@firmachain/firma-js 0.2.29 → 0.2.32

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 (52) hide show
  1. package/dist/sdk/FirmaAuthzService.d.ts +41 -0
  2. package/dist/sdk/FirmaAuthzService.js +633 -0
  3. package/dist/sdk/FirmaBankService.d.ts +2 -1
  4. package/dist/sdk/FirmaBankService.js +3 -0
  5. package/dist/sdk/FirmaCosmWasmService.d.ts +38 -0
  6. package/dist/sdk/FirmaCosmWasmService.js +667 -0
  7. package/dist/sdk/FirmaDistributionService.d.ts +2 -1
  8. package/dist/sdk/FirmaDistributionService.js +3 -0
  9. package/dist/sdk/FirmaIbcService.d.ts +15 -0
  10. package/dist/sdk/FirmaIbcService.js +144 -0
  11. package/dist/sdk/FirmaMobileSDK.d.ts +3 -1
  12. package/dist/sdk/FirmaMobileSDK.js +4 -1
  13. package/dist/sdk/FirmaSDK.d.ts +7 -1
  14. package/dist/sdk/FirmaSDK.js +10 -1
  15. package/dist/sdk/FirmaStakingService.d.ts +18 -5
  16. package/dist/sdk/FirmaStakingService.js +15 -8
  17. package/dist/sdk/FirmaUtil.d.ts +7 -0
  18. package/dist/sdk/FirmaUtil.js +69 -1
  19. package/dist/sdk/FirmaWalletService.d.ts +3 -0
  20. package/dist/sdk/FirmaWalletService.js +18 -10
  21. package/dist/sdk/firmachain/amino/signer.d.ts +1 -2
  22. package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +48 -0
  23. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +142 -0
  24. package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +22 -0
  25. package/dist/sdk/firmachain/authz/AuthzTxClient.js +44 -0
  26. package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +147 -0
  27. package/dist/sdk/firmachain/authz/AuthzTxTypes.js +358 -0
  28. package/dist/sdk/firmachain/authz/index.d.ts +3 -0
  29. package/dist/sdk/firmachain/authz/index.js +15 -0
  30. package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -0
  31. package/dist/sdk/firmachain/common/ITxClient.js +9 -0
  32. package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +50 -0
  33. package/dist/sdk/firmachain/common/signingaminostargateclient.js +267 -0
  34. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.d.ts +52 -0
  35. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +193 -0
  36. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +37 -0
  37. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +56 -0
  38. package/dist/sdk/firmachain/cosmwasm/index.d.ts +3 -0
  39. package/dist/sdk/firmachain/cosmwasm/index.js +15 -0
  40. package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +34 -0
  41. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +71 -0
  42. package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +12 -0
  43. package/dist/sdk/firmachain/ibc/IbcTxClient.js +36 -0
  44. package/dist/sdk/firmachain/ibc/index.d.ts +3 -0
  45. package/dist/sdk/firmachain/ibc/index.js +15 -0
  46. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +17 -4
  47. package/dist/sdk/firmachain/staking/StakingQueryClient.js +38 -18
  48. package/package.json +4 -2
  49. package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +0 -94
  50. package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +0 -437
  51. package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +0 -23
  52. package/dist/sdk/firmachain/amino/secp256k1wallet.js +0 -141
@@ -43,6 +43,9 @@ var FirmaDistributionService = /** @class */ (function () {
43
43
  function FirmaDistributionService(config) {
44
44
  this.config = config;
45
45
  }
46
+ FirmaDistributionService.prototype.getTxClient = function (wallet) {
47
+ return new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
48
+ };
46
49
  FirmaDistributionService.prototype.getGasEstimationSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
47
50
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
48
51
  return __awaiter(this, void 0, void 0, function () {
@@ -0,0 +1,15 @@
1
+ import { FirmaWalletService } from "./FirmaWalletService";
2
+ import { FirmaConfig } from "./FirmaConfig";
3
+ import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
4
+ import { ClientState, IbcTxClient, TxMisc } from "./firmachain/ibc";
5
+ import Long from "long";
6
+ import { Height } from "cosmjs-types/ibc/core/client/v1/client";
7
+ export declare class FirmaIbcService {
8
+ private readonly config;
9
+ constructor(config: FirmaConfig);
10
+ getTxClient(wallet: FirmaWalletService): IbcTxClient;
11
+ getGasEstimationTransfer(wallet: FirmaWalletService, sourcePort: string, sourceChannel: string, denom: string, amount: string, receiver: string, timeoutHeight: Height, timeoutTimestamp: Long, txMisc?: TxMisc): Promise<number>;
12
+ transfer(wallet: FirmaWalletService, sourcePort: string, sourceChannel: string, denom: string, amount: string, receiver: string, timeoutHeight: Height, timeoutTimestamp: Long, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
13
+ private getSignedTxTransfer;
14
+ getClientState(sourceChannel: string, sourcePort: string): Promise<ClientState>;
15
+ }
@@ -0,0 +1,144 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.FirmaIbcService = void 0;
40
+ var FirmaUtil_1 = require("./FirmaUtil");
41
+ var ibc_1 = require("./firmachain/ibc");
42
+ var FirmaIbcService = /** @class */ (function () {
43
+ function FirmaIbcService(config) {
44
+ this.config = config;
45
+ }
46
+ FirmaIbcService.prototype.getTxClient = function (wallet) {
47
+ return new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
48
+ };
49
+ FirmaIbcService.prototype.getGasEstimationTransfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
50
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var txRaw, error_1;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0:
56
+ _a.trys.push([0, 3, , 4]);
57
+ return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc)];
58
+ case 1:
59
+ txRaw = _a.sent();
60
+ return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
61
+ case 2: return [2 /*return*/, _a.sent()];
62
+ case 3:
63
+ error_1 = _a.sent();
64
+ FirmaUtil_1.FirmaUtil.printLog(error_1);
65
+ throw error_1;
66
+ case 4: return [2 /*return*/];
67
+ }
68
+ });
69
+ });
70
+ };
71
+ FirmaIbcService.prototype.transfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
72
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
73
+ return __awaiter(this, void 0, void 0, function () {
74
+ var txRaw, bankTxClient, error_2;
75
+ return __generator(this, function (_a) {
76
+ switch (_a.label) {
77
+ case 0:
78
+ _a.trys.push([0, 3, , 4]);
79
+ return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc)];
80
+ case 1:
81
+ txRaw = _a.sent();
82
+ bankTxClient = new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
83
+ return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
84
+ case 2: return [2 /*return*/, _a.sent()];
85
+ case 3:
86
+ error_2 = _a.sent();
87
+ FirmaUtil_1.FirmaUtil.printLog(error_2);
88
+ throw error_2;
89
+ case 4: return [2 /*return*/];
90
+ }
91
+ });
92
+ });
93
+ };
94
+ FirmaIbcService.prototype.getSignedTxTransfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
95
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var ibcTxClient, address, message, error_3;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ _a.trys.push([0, 3, , 4]);
102
+ ibcTxClient = new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
103
+ return [4 /*yield*/, wallet.getAddress()];
104
+ case 1:
105
+ address = _a.sent();
106
+ message = ibcTxClient.msgTransfer({ sourcePort: sourcePort, sourceChannel: sourceChannel, sender: address, receiver: receiver,
107
+ token: { denom: denom, amount: amount },
108
+ timeoutHeight: timeoutHeight, timeoutTimestamp: timeoutTimestamp });
109
+ return [4 /*yield*/, ibcTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
110
+ case 2: return [2 /*return*/, _a.sent()];
111
+ case 3:
112
+ error_3 = _a.sent();
113
+ FirmaUtil_1.FirmaUtil.printLog(error_3);
114
+ throw error_3;
115
+ case 4: return [2 /*return*/];
116
+ }
117
+ });
118
+ });
119
+ };
120
+ // query
121
+ FirmaIbcService.prototype.getClientState = function (sourceChannel, sourcePort) {
122
+ return __awaiter(this, void 0, void 0, function () {
123
+ var queryClient, result, error_4;
124
+ return __generator(this, function (_a) {
125
+ switch (_a.label) {
126
+ case 0:
127
+ _a.trys.push([0, 2, , 3]);
128
+ queryClient = new ibc_1.IbcQueryClient(this.config.restApiAddress);
129
+ return [4 /*yield*/, queryClient.getClientState(sourceChannel, sourcePort)];
130
+ case 1:
131
+ result = _a.sent();
132
+ return [2 /*return*/, result];
133
+ case 2:
134
+ error_4 = _a.sent();
135
+ FirmaUtil_1.FirmaUtil.printLog(error_4);
136
+ throw error_4;
137
+ case 3: return [2 /*return*/];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ return FirmaIbcService;
143
+ }());
144
+ exports.FirmaIbcService = FirmaIbcService;
@@ -10,6 +10,7 @@ import { FirmaWalletService } from "./FirmaWalletService";
10
10
  import { FirmaGovService } from "./FirmaGovService";
11
11
  import { ChainService } from "./FirmaChainService";
12
12
  import { SlashingService } from "./FirmaSlashingService";
13
+ import { FirmaAuthzService } from "./FirmaAuthzService";
13
14
  export declare class FirmaMobileSDK {
14
15
  Config: FirmaConfig;
15
16
  Wallet: FirmaWalletService;
@@ -23,5 +24,6 @@ export declare class FirmaMobileSDK {
23
24
  Contract: ContractService;
24
25
  BlockChain: ChainService;
25
26
  Slashing: SlashingService;
26
- constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, BlockChain?: ChainService, Slashing?: SlashingService);
27
+ Authz: FirmaAuthzService;
28
+ constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService);
27
29
  }
@@ -13,8 +13,9 @@ var FirmaUtil_1 = require("./FirmaUtil");
13
13
  var FirmaGovService_1 = require("./FirmaGovService");
14
14
  var FirmaChainService_1 = require("./FirmaChainService");
15
15
  var FirmaSlashingService_1 = require("./FirmaSlashingService");
16
+ var FirmaAuthzService_1 = require("./FirmaAuthzService");
16
17
  var FirmaMobileSDK = /** @class */ (function () {
17
- function FirmaMobileSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, BlockChain, Slashing) {
18
+ function FirmaMobileSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, BlockChain, Slashing, Authz) {
18
19
  if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
19
20
  if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
20
21
  if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
@@ -26,6 +27,7 @@ var FirmaMobileSDK = /** @class */ (function () {
26
27
  if (Contract === void 0) { Contract = new FirmaContractService_1.ContractService(Config); }
27
28
  if (BlockChain === void 0) { BlockChain = new FirmaChainService_1.ChainService(Config); }
28
29
  if (Slashing === void 0) { Slashing = new FirmaSlashingService_1.SlashingService(Config); }
30
+ if (Authz === void 0) { Authz = new FirmaAuthzService_1.FirmaAuthzService(Config); }
29
31
  this.Config = Config;
30
32
  this.Wallet = Wallet;
31
33
  this.Bank = Bank;
@@ -38,6 +40,7 @@ var FirmaMobileSDK = /** @class */ (function () {
38
40
  this.Contract = Contract;
39
41
  this.BlockChain = BlockChain;
40
42
  this.Slashing = Slashing;
43
+ this.Authz = Authz;
41
44
  FirmaUtil_1.FirmaUtil.config = Config;
42
45
  }
43
46
  return FirmaMobileSDK;
@@ -11,6 +11,9 @@ import { FirmaWalletService } from "./FirmaWalletService";
11
11
  import { FirmaGovService } from "./FirmaGovService";
12
12
  import { ChainService } from "./FirmaChainService";
13
13
  import { SlashingService } from "./FirmaSlashingService";
14
+ import { FirmaAuthzService } from "./FirmaAuthzService";
15
+ import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
16
+ import { FirmaIbcService } from "./FirmaIbcService";
14
17
  export declare class FirmaSDK {
15
18
  Config: FirmaConfig;
16
19
  Wallet: FirmaWalletService;
@@ -25,5 +28,8 @@ export declare class FirmaSDK {
25
28
  Ipfs: IpfsService;
26
29
  BlockChain: ChainService;
27
30
  Slashing: SlashingService;
28
- constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService);
31
+ Authz: FirmaAuthzService;
32
+ CosmWasm: FirmaCosmWasmService;
33
+ Ibc: FirmaIbcService;
34
+ constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService, CosmWasm?: FirmaCosmWasmService, Ibc?: FirmaIbcService);
29
35
  }
@@ -14,8 +14,11 @@ var FirmaUtil_1 = require("./FirmaUtil");
14
14
  var FirmaGovService_1 = require("./FirmaGovService");
15
15
  var FirmaChainService_1 = require("./FirmaChainService");
16
16
  var FirmaSlashingService_1 = require("./FirmaSlashingService");
17
+ var FirmaAuthzService_1 = require("./FirmaAuthzService");
18
+ var FirmaCosmWasmService_1 = require("./FirmaCosmWasmService");
19
+ var FirmaIbcService_1 = require("./FirmaIbcService");
17
20
  var FirmaSDK = /** @class */ (function () {
18
- function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing) {
21
+ function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc) {
19
22
  if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
20
23
  if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
21
24
  if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
@@ -28,6 +31,9 @@ var FirmaSDK = /** @class */ (function () {
28
31
  if (Ipfs === void 0) { Ipfs = new FirmaIpfsService_1.IpfsService(Config); }
29
32
  if (BlockChain === void 0) { BlockChain = new FirmaChainService_1.ChainService(Config); }
30
33
  if (Slashing === void 0) { Slashing = new FirmaSlashingService_1.SlashingService(Config); }
34
+ if (Authz === void 0) { Authz = new FirmaAuthzService_1.FirmaAuthzService(Config); }
35
+ if (CosmWasm === void 0) { CosmWasm = new FirmaCosmWasmService_1.FirmaCosmWasmService(Config); }
36
+ if (Ibc === void 0) { Ibc = new FirmaIbcService_1.FirmaIbcService(Config); }
31
37
  this.Config = Config;
32
38
  this.Wallet = Wallet;
33
39
  this.Bank = Bank;
@@ -41,6 +47,9 @@ var FirmaSDK = /** @class */ (function () {
41
47
  this.Ipfs = Ipfs;
42
48
  this.BlockChain = BlockChain;
43
49
  this.Slashing = Slashing;
50
+ this.Authz = Authz;
51
+ this.CosmWasm = CosmWasm;
52
+ this.Ibc = Ibc;
44
53
  FirmaUtil_1.FirmaUtil.config = Config;
45
54
  }
46
55
  return FirmaSDK;
@@ -1,4 +1,4 @@
1
- import { TxMisc, ValidatorDataType, PoolDataType, ParamsDataType, DelegationInfo, RedelegationInfo, UndelegationInfo } from "./firmachain/staking";
1
+ import { StakingTxClient, TxMisc, ValidatorDataType, PoolDataType, ParamsDataType, DelegationInfo, RedelegationInfo, UndelegationInfo, Pagination } from "./firmachain/staking";
2
2
  import { FirmaWalletService } from "./FirmaWalletService";
3
3
  import { FirmaConfig } from "./FirmaConfig";
4
4
  import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
@@ -7,6 +7,7 @@ import { MsgCreateValidator } from "cosmjs-types/cosmos/staking/v1beta1/tx";
7
7
  export declare class FirmaStakingService {
8
8
  private readonly config;
9
9
  constructor(config: FirmaConfig);
10
+ getTxClient(wallet: FirmaWalletService): StakingTxClient;
10
11
  getGasEstimationDelegate(wallet: FirmaWalletService, validatorAddres: string, amount: number, txMisc?: TxMisc): Promise<number>;
11
12
  getGasEstimationUndelegate(wallet: FirmaWalletService, validatorAddres: string, amount: number, txMisc?: TxMisc): Promise<number>;
12
13
  getGasEstimationRedelegate(wallet: FirmaWalletService, validatorSrcAddress: string, validatorDstAddress: string, amount: number, txMisc?: TxMisc): Promise<number>;
@@ -24,11 +25,23 @@ export declare class FirmaStakingService {
24
25
  getDelegationInfoFromValidator(address: string, validatorAddress: string): Promise<DelegationInfo>;
25
26
  getTotalUndelegateInfo(address: string): Promise<UndelegationInfo[]>;
26
27
  getTotalRedelegationInfo(address: string): Promise<RedelegationInfo[]>;
27
- getUndelegationListFromValidator(valoperAddress: string): Promise<UndelegationInfo[]>;
28
- getDelegationListFromValidator(valoperAddress: string): Promise<DelegationInfo[]>;
29
- getTotalDelegationInfo(address: string): Promise<DelegationInfo[]>;
28
+ getUndelegationListFromValidator(valoperAddress: string, paginationKey?: string): Promise<{
29
+ dataList: UndelegationInfo[];
30
+ pagination: Pagination;
31
+ }>;
32
+ getDelegationListFromValidator(valoperAddress: string, paginationKey?: string): Promise<{
33
+ dataList: DelegationInfo[];
34
+ pagination: Pagination;
35
+ }>;
36
+ getTotalDelegationInfo(address: string, paginationKey?: string): Promise<{
37
+ dataList: DelegationInfo[];
38
+ pagination: Pagination;
39
+ }>;
30
40
  getParams(): Promise<ParamsDataType>;
31
41
  getPool(): Promise<PoolDataType>;
32
42
  getValidator(valoperAddress: string): Promise<ValidatorDataType>;
33
- getValidatorList(): Promise<ValidatorDataType[]>;
43
+ getValidatorList(paginationKey?: string): Promise<{
44
+ dataList: ValidatorDataType[];
45
+ pagination: Pagination;
46
+ }>;
34
47
  }
@@ -43,6 +43,9 @@ var FirmaStakingService = /** @class */ (function () {
43
43
  function FirmaStakingService(config) {
44
44
  this.config = config;
45
45
  }
46
+ FirmaStakingService.prototype.getTxClient = function (wallet) {
47
+ return new staking_1.StakingTxClient(wallet, this.config.rpcAddress);
48
+ };
46
49
  FirmaStakingService.prototype.getGasEstimationDelegate = function (wallet, validatorAddres, amount, txMisc) {
47
50
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
48
51
  return __awaiter(this, void 0, void 0, function () {
@@ -452,7 +455,8 @@ var FirmaStakingService = /** @class */ (function () {
452
455
  });
453
456
  });
454
457
  };
455
- FirmaStakingService.prototype.getUndelegationListFromValidator = function (valoperAddress) {
458
+ FirmaStakingService.prototype.getUndelegationListFromValidator = function (valoperAddress, paginationKey) {
459
+ if (paginationKey === void 0) { paginationKey = ""; }
456
460
  return __awaiter(this, void 0, void 0, function () {
457
461
  var queryClient, result, error_18;
458
462
  return __generator(this, function (_a) {
@@ -460,7 +464,7 @@ var FirmaStakingService = /** @class */ (function () {
460
464
  case 0:
461
465
  _a.trys.push([0, 2, , 3]);
462
466
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
463
- return [4 /*yield*/, queryClient.queryGetUndelegationListFromValidator(valoperAddress)];
467
+ return [4 /*yield*/, queryClient.queryGetUndelegationListFromValidator(valoperAddress, paginationKey)];
464
468
  case 1:
465
469
  result = _a.sent();
466
470
  return [2 /*return*/, result];
@@ -473,7 +477,8 @@ var FirmaStakingService = /** @class */ (function () {
473
477
  });
474
478
  });
475
479
  };
476
- FirmaStakingService.prototype.getDelegationListFromValidator = function (valoperAddress) {
480
+ FirmaStakingService.prototype.getDelegationListFromValidator = function (valoperAddress, paginationKey) {
481
+ if (paginationKey === void 0) { paginationKey = ""; }
477
482
  return __awaiter(this, void 0, void 0, function () {
478
483
  var queryClient, result, error_19;
479
484
  return __generator(this, function (_a) {
@@ -481,7 +486,7 @@ var FirmaStakingService = /** @class */ (function () {
481
486
  case 0:
482
487
  _a.trys.push([0, 2, , 3]);
483
488
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
484
- return [4 /*yield*/, queryClient.queryGetDelegateListFromValidator(valoperAddress)];
489
+ return [4 /*yield*/, queryClient.queryGetDelegateListFromValidator(valoperAddress, paginationKey)];
485
490
  case 1:
486
491
  result = _a.sent();
487
492
  return [2 /*return*/, result];
@@ -494,7 +499,8 @@ var FirmaStakingService = /** @class */ (function () {
494
499
  });
495
500
  });
496
501
  };
497
- FirmaStakingService.prototype.getTotalDelegationInfo = function (address) {
502
+ FirmaStakingService.prototype.getTotalDelegationInfo = function (address, paginationKey) {
503
+ if (paginationKey === void 0) { paginationKey = ""; }
498
504
  return __awaiter(this, void 0, void 0, function () {
499
505
  var queryClient, result, error_20;
500
506
  return __generator(this, function (_a) {
@@ -502,7 +508,7 @@ var FirmaStakingService = /** @class */ (function () {
502
508
  case 0:
503
509
  _a.trys.push([0, 2, , 3]);
504
510
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
505
- return [4 /*yield*/, queryClient.queryGetTotalDelegationInfo(address)];
511
+ return [4 /*yield*/, queryClient.queryGetTotalDelegationInfo(address, paginationKey)];
506
512
  case 1:
507
513
  result = _a.sent();
508
514
  return [2 /*return*/, result];
@@ -578,7 +584,8 @@ var FirmaStakingService = /** @class */ (function () {
578
584
  });
579
585
  });
580
586
  };
581
- FirmaStakingService.prototype.getValidatorList = function () {
587
+ FirmaStakingService.prototype.getValidatorList = function (paginationKey) {
588
+ if (paginationKey === void 0) { paginationKey = ""; }
582
589
  return __awaiter(this, void 0, void 0, function () {
583
590
  var queryClient, result, error_24;
584
591
  return __generator(this, function (_a) {
@@ -586,7 +593,7 @@ var FirmaStakingService = /** @class */ (function () {
586
593
  case 0:
587
594
  _a.trys.push([0, 2, , 3]);
588
595
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
589
- return [4 /*yield*/, queryClient.queryValidators()];
596
+ return [4 /*yield*/, queryClient.queryValidators(paginationKey)];
590
597
  case 1:
591
598
  result = _a.sent();
592
599
  return [2 /*return*/, result];
@@ -2,6 +2,8 @@ import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
2
2
  import { FirmaConfig } from "./FirmaConfig";
3
3
  import { SignerData } from "./firmachain/common/LedgerSigningStargateClient";
4
4
  import { SignAndBroadcastOptions, TxMisc } from "./firmachain/common";
5
+ import { ArbitraryVerifyData } from "./firmachain/common/signingaminostargateclient";
6
+ import { FirmaWalletService } from "./FirmaWalletService";
5
7
  export declare class FirmaUtil {
6
8
  static config: FirmaConfig;
7
9
  static readonly FctDecimal: number;
@@ -11,8 +13,11 @@ export declare class FirmaUtil {
11
13
  static getTokenStringFromUTokenStr(uTokenAmount: string, decimal: number): string;
12
14
  static getUTokenStringFromToken(tokenAmount: number, decimal: number): string;
13
15
  static getUTokenFromToken(tokenAmount: number, decimal: number): number;
16
+ static arrayBufferToBase64(buffer: Uint8Array): string;
17
+ static base64ToArrayBuffer(base64: string): Uint8Array;
14
18
  static getTokenStringFromUToken(uTokenAmount: number, decimal: number): string;
15
19
  static getUFCTStringFromFCTStr(fctAmount: string): string;
20
+ static getUFCTFromFCT(fctAmount: number): number;
16
21
  static getFCTStringFromUFCTStr(uFctAmount: string): string;
17
22
  static getUFCTStringFromFCT(fctAmount: number): string;
18
23
  static getFCTStringFromUFCT(uFctAmount: number): string;
@@ -27,6 +32,8 @@ export declare class FirmaUtil {
27
32
  static estimateGas(txRaw: TxRaw): Promise<number>;
28
33
  static estimateGasRaw(txRaw: Uint8Array): Promise<number>;
29
34
  static printLog(log: any): void;
35
+ static experimentalAdr36Sign(wallet: FirmaWalletService, data: string): Promise<ArbitraryVerifyData>;
36
+ static experimentalAdr36Verify(data: ArbitraryVerifyData, checkMsg: string): Promise<boolean>;
30
37
  }
31
38
  export declare const DefaultTxMisc: {
32
39
  memo: string;
@@ -46,6 +46,8 @@ var CryptoJS = require("crypto-js");
46
46
  var sha1 = require("crypto-js/sha1");
47
47
  var sha256 = require("crypto-js/sha256");
48
48
  var encHex = require("crypto-js/enc-hex");
49
+ var signingaminostargateclient_1 = require("./firmachain/common/signingaminostargateclient");
50
+ var proto_signing_1 = require("@cosmjs/proto-signing");
49
51
  var FirmaUtil = /** @class */ (function () {
50
52
  function FirmaUtil(firmaConfig) {
51
53
  FirmaUtil.config = firmaConfig;
@@ -86,13 +88,35 @@ var FirmaUtil = /** @class */ (function () {
86
88
  var newBig = big.toFixed(0);
87
89
  return Number.parseInt(newBig);
88
90
  };
91
+ FirmaUtil.arrayBufferToBase64 = function (buffer) {
92
+ var binary = '';
93
+ var bytes = new Uint8Array(buffer);
94
+ var len = bytes.byteLength;
95
+ for (var i = 0; i < len; i++) {
96
+ binary += String.fromCharCode(bytes[i]);
97
+ }
98
+ return btoa(binary);
99
+ };
100
+ FirmaUtil.base64ToArrayBuffer = function (base64) {
101
+ var binary_string = atob(base64);
102
+ var len = binary_string.length;
103
+ var bytes = new Uint8Array(len);
104
+ for (var i = 0; i < len; i++) {
105
+ bytes[i] = binary_string.charCodeAt(i);
106
+ }
107
+ return bytes;
108
+ };
89
109
  FirmaUtil.getTokenStringFromUToken = function (uTokenAmount, decimal) {
110
+ var fixedUTokenAmount = Math.floor(uTokenAmount);
90
111
  var decimalMutiplyer = Math.pow(10, decimal);
91
- return (uTokenAmount / decimalMutiplyer).toString();
112
+ return (fixedUTokenAmount / decimalMutiplyer).toString();
92
113
  };
93
114
  FirmaUtil.getUFCTStringFromFCTStr = function (fctAmount) {
94
115
  return this.getUTokenStringFromTokenStr(fctAmount, this.FctDecimal);
95
116
  };
117
+ FirmaUtil.getUFCTFromFCT = function (fctAmount) {
118
+ return this.getUTokenFromToken(fctAmount, this.FctDecimal);
119
+ };
96
120
  FirmaUtil.getFCTStringFromUFCTStr = function (uFctAmount) {
97
121
  return this.getTokenStringFromUTokenStr(uFctAmount, this.FctDecimal);
98
122
  };
@@ -223,6 +247,50 @@ var FirmaUtil = /** @class */ (function () {
223
247
  return;
224
248
  console.log("[FirmaSDK] " + log);
225
249
  };
250
+ FirmaUtil.experimentalAdr36Sign = function (wallet, data) {
251
+ return __awaiter(this, void 0, void 0, function () {
252
+ var registry, aliceClient, address, userData, error_4;
253
+ return __generator(this, function (_a) {
254
+ switch (_a.label) {
255
+ case 0:
256
+ _a.trys.push([0, 4, , 5]);
257
+ registry = new proto_signing_1.Registry();
258
+ return [4 /*yield*/, signingaminostargateclient_1.SigningAminoStargateClient.connectWithSigner(FirmaUtil.config.rpcAddress, wallet.getRawAminoWallet(), registry)];
259
+ case 1:
260
+ aliceClient = _a.sent();
261
+ return [4 /*yield*/, wallet.getAddress()];
262
+ case 2:
263
+ address = _a.sent();
264
+ userData = Buffer.from(data);
265
+ return [4 /*yield*/, aliceClient.experimentalAdr36Sign(address, userData)];
266
+ case 3: return [2 /*return*/, _a.sent()];
267
+ case 4:
268
+ error_4 = _a.sent();
269
+ FirmaUtil.printLog(error_4);
270
+ throw error_4;
271
+ case 5: return [2 /*return*/];
272
+ }
273
+ });
274
+ });
275
+ };
276
+ FirmaUtil.experimentalAdr36Verify = function (data, checkMsg) {
277
+ return __awaiter(this, void 0, void 0, function () {
278
+ var error_5;
279
+ return __generator(this, function (_a) {
280
+ switch (_a.label) {
281
+ case 0:
282
+ _a.trys.push([0, 2, , 3]);
283
+ return [4 /*yield*/, signingaminostargateclient_1.SigningAminoStargateClient.experimentalAdr36Verify(data, checkMsg)];
284
+ case 1: return [2 /*return*/, _a.sent()];
285
+ case 2:
286
+ error_5 = _a.sent();
287
+ FirmaUtil.printLog(error_5);
288
+ throw error_5;
289
+ case 3: return [2 /*return*/];
290
+ }
291
+ });
292
+ });
293
+ };
226
294
  FirmaUtil.FctDecimal = 6;
227
295
  return FirmaUtil;
228
296
  }());
@@ -4,16 +4,19 @@ import { FirmaConfig } from "./FirmaConfig";
4
4
  import { SignAndBroadcastOptions } from "./firmachain/common";
5
5
  import { LedgerWalletInterface } from "./firmachain/common/LedgerWallet";
6
6
  import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
7
+ import { Secp256k1Wallet } from "@cosmjs/amino";
7
8
  export declare class FirmaWalletService {
8
9
  private readonly config;
9
10
  private mnemonic;
10
11
  private privateKey;
11
12
  private accountIndex;
13
+ private aminoWallet;
12
14
  private wallet;
13
15
  private ledger;
14
16
  getHdPath(): string;
15
17
  getPrefix(): string;
16
18
  getRawWallet(): DirectSecp256k1Wallet;
19
+ getRawAminoWallet(): Secp256k1Wallet;
17
20
  getPrivateKey(): string;
18
21
  getMnemonic(): string;
19
22
  isLedger(): boolean;
@@ -41,6 +41,7 @@ var proto_signing_1 = require("@cosmjs/proto-signing");
41
41
  var crypto_1 = require("@cosmjs/crypto");
42
42
  var FirmaUtil_1 = require("./FirmaUtil");
43
43
  var LedgerWallet_1 = require("./firmachain/common/LedgerWallet");
44
+ var amino_1 = require("@cosmjs/amino");
44
45
  var CryptoJS = require("crypto-js");
45
46
  var FirmaWalletService = /** @class */ (function () {
46
47
  function FirmaWalletService(config) {
@@ -58,6 +59,9 @@ var FirmaWalletService = /** @class */ (function () {
58
59
  FirmaWalletService.prototype.getRawWallet = function () {
59
60
  return this.wallet;
60
61
  };
62
+ FirmaWalletService.prototype.getRawAminoWallet = function () {
63
+ return this.aminoWallet;
64
+ };
61
65
  FirmaWalletService.prototype.getPrivateKey = function () {
62
66
  return this.privateKey;
63
67
  };
@@ -163,7 +167,7 @@ var FirmaWalletService = /** @class */ (function () {
163
167
  return [4 /*yield*/, crypto_1.Bip39.mnemonicToSeed(mnemonicChecked)];
164
168
  case 1:
165
169
  seed = _a.sent();
166
- hdpath = FirmaWalletService.getHdPath(this.getHdPath(), this.accountIndex);
170
+ hdpath = FirmaWalletService.getHdPath(this.getHdPath(), accountIndex);
167
171
  privkey = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, seed, hdpath[0]).privkey;
168
172
  privateKey = "0x" + Buffer.from(privkey).toString("hex");
169
173
  return [2 /*return*/, privateKey];
@@ -178,23 +182,27 @@ var FirmaWalletService = /** @class */ (function () {
178
182
  };
179
183
  FirmaWalletService.prototype.initFromPrivateKey = function (privateKey) {
180
184
  return __awaiter(this, void 0, void 0, function () {
181
- var tempPrivateKey, _a, error_4;
182
- return __generator(this, function (_b) {
183
- switch (_b.label) {
185
+ var tempPrivateKey, _a, _b, error_4;
186
+ return __generator(this, function (_c) {
187
+ switch (_c.label) {
184
188
  case 0:
185
- _b.trys.push([0, 2, , 3]);
189
+ _c.trys.push([0, 3, , 4]);
186
190
  tempPrivateKey = Buffer.from(privateKey.replace("0x", ""), "hex");
187
191
  _a = this;
188
192
  return [4 /*yield*/, proto_signing_1.DirectSecp256k1Wallet.fromKey(tempPrivateKey, this.getPrefix())];
189
193
  case 1:
190
- _a.wallet = _b.sent();
191
- this.privateKey = privateKey;
192
- return [3 /*break*/, 3];
194
+ _a.wallet = _c.sent();
195
+ _b = this;
196
+ return [4 /*yield*/, amino_1.Secp256k1Wallet.fromKey(tempPrivateKey, this.getPrefix())];
193
197
  case 2:
194
- error_4 = _b.sent();
198
+ _b.aminoWallet = _c.sent();
199
+ this.privateKey = privateKey;
200
+ return [3 /*break*/, 4];
201
+ case 3:
202
+ error_4 = _c.sent();
195
203
  FirmaUtil_1.FirmaUtil.printLog(error_4);
196
204
  throw error_4;
197
- case 3: return [2 /*return*/];
205
+ case 4: return [2 /*return*/];
198
206
  }
199
207
  });
200
208
  });
@@ -1,5 +1,4 @@
1
- import { StdSignature } from "./signature";
2
- import { StdSignDoc } from "./signdoc";
1
+ import { StdSignature, StdSignDoc } from "@cosmjs/amino";
3
2
  export declare type Algo = "secp256k1" | "ed25519" | "sr25519";
4
3
  export interface AccountData {
5
4
  /** A printable address (typically bech32 encoded) */