@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.
- package/LICENSE +21 -0
- package/README.md +153 -154
- package/dist/sdk/FirmaBankService.d.ts +5 -5
- package/dist/sdk/FirmaBankService.js +30 -30
- package/dist/sdk/FirmaConfig.d.ts +3 -3
- package/dist/sdk/FirmaContractService.d.ts +5 -5
- package/dist/sdk/FirmaContractService.js +19 -19
- package/dist/sdk/FirmaDistributionService.d.ts +13 -9
- package/dist/sdk/FirmaDistributionService.js +162 -78
- package/dist/sdk/FirmaFeeGrantService.d.ts +11 -8
- package/dist/sdk/FirmaFeeGrantService.js +128 -53
- package/dist/sdk/FirmaGovService.d.ts +28 -16
- package/dist/sdk/FirmaGovService.js +447 -119
- package/dist/sdk/FirmaIpfsService.d.ts +4 -4
- package/dist/sdk/FirmaIpfsService.js +14 -14
- package/dist/sdk/FirmaNftService.d.ts +4 -4
- package/dist/sdk/FirmaNftService.js +18 -20
- package/dist/sdk/FirmaSDK.js +2 -1
- package/dist/sdk/FirmaStakingService.d.ts +9 -6
- package/dist/sdk/FirmaStakingService.js +177 -97
- package/dist/sdk/FirmaUtil.d.ts +3 -2
- package/dist/sdk/FirmaUtil.js +16 -11
- package/dist/sdk/FirmaWalletService.d.ts +6 -6
- package/dist/sdk/FirmaWalletService.js +22 -22
- package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
- package/dist/sdk/firmachain/bank/BankTxClient.d.ts +3 -4
- package/dist/sdk/firmachain/bank/BankTxClient.js +2 -2
- package/dist/sdk/firmachain/common/ITxClient.d.ts +5 -5
- package/dist/sdk/firmachain/common/ITxClient.js +7 -7
- package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/common/TendermintQueryClient.js +5 -4
- package/dist/sdk/firmachain/common/accounts.js +25 -20
- package/dist/sdk/firmachain/common/signingstargateclient.js +3 -3
- package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +17 -11
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +3 -4
- package/dist/sdk/firmachain/contract/ContractTxClient.js +3 -3
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +2 -1
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +33 -16
- package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +5 -6
- package/dist/sdk/firmachain/distribution/DistributionTxClient.js +3 -3
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +4 -4
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +3 -4
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +2 -2
- package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +51 -3
- package/dist/sdk/firmachain/gov/GovQueryClient.js +62 -11
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +4 -5
- package/dist/sdk/firmachain/gov/GovTxClient.js +3 -3
- package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/nft/NftQueryClient.js +11 -8
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +4 -5
- package/dist/sdk/firmachain/nft/NftTxClient.js +3 -3
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +3 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +48 -16
- package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +6 -7
- package/dist/sdk/firmachain/staking/StakingTxClient.js +2 -2
- package/package.json +1 -1
|
@@ -43,22 +43,54 @@ exports.StakingQueryClient = void 0;
|
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
44
|
var StakingQueryClient = /** @class */ (function () {
|
|
45
45
|
function StakingQueryClient(baseUrl) {
|
|
46
|
-
this.
|
|
46
|
+
this.axios = axios_1.default.create({
|
|
47
47
|
baseURL: baseUrl,
|
|
48
48
|
headers: {
|
|
49
|
-
Accept:
|
|
49
|
+
Accept: "application/json",
|
|
50
50
|
},
|
|
51
51
|
timeout: 15000,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
StakingQueryClient.prototype.queryGetUndelegationInfoFromValidator = function (address, validatorAddress) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var path, result;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
path = "/cosmos/staking/v1beta1/validators/" + validatorAddress + "/delegations/" + address + "/unbonding_delegation";
|
|
61
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
62
|
+
case 1:
|
|
63
|
+
result = _a.sent();
|
|
64
|
+
// If there is no data in the list, throw 404 exception.
|
|
65
|
+
//console.log(result);
|
|
66
|
+
return [2 /*return*/, result.data.unbond];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
StakingQueryClient.prototype.queryGetDelegationInfoFromValidator = function (address, validatorAddress) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var path, result;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
path = "/cosmos/staking/v1beta1/validators/" + validatorAddress + "/delegations/" + address;
|
|
78
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
79
|
+
case 1:
|
|
80
|
+
result = _a.sent();
|
|
81
|
+
return [2 /*return*/, result.data.delegation_response];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
54
86
|
StakingQueryClient.prototype.queryGetTotalUndelegateInfo = function (address) {
|
|
55
87
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
88
|
var path, result;
|
|
57
89
|
return __generator(this, function (_a) {
|
|
58
90
|
switch (_a.label) {
|
|
59
91
|
case 0:
|
|
60
|
-
path = "/cosmos/staking/v1beta1/delegators
|
|
61
|
-
return [4 /*yield*/, this.
|
|
92
|
+
path = "/cosmos/staking/v1beta1/delegators/" + address + "/unbonding_delegations";
|
|
93
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
62
94
|
case 1:
|
|
63
95
|
result = _a.sent();
|
|
64
96
|
return [2 /*return*/, result.data.unbonding_responses];
|
|
@@ -72,8 +104,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
72
104
|
return __generator(this, function (_a) {
|
|
73
105
|
switch (_a.label) {
|
|
74
106
|
case 0:
|
|
75
|
-
path = "/cosmos/staking/v1beta1/delegators
|
|
76
|
-
return [4 /*yield*/, this.
|
|
107
|
+
path = "/cosmos/staking/v1beta1/delegators/" + address + "/redelegations";
|
|
108
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
77
109
|
case 1:
|
|
78
110
|
result = _a.sent();
|
|
79
111
|
return [2 /*return*/, result.data.redelegation_responses];
|
|
@@ -87,8 +119,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
87
119
|
return __generator(this, function (_a) {
|
|
88
120
|
switch (_a.label) {
|
|
89
121
|
case 0:
|
|
90
|
-
path = "/cosmos/staking/v1beta1/validators
|
|
91
|
-
return [4 /*yield*/, this.
|
|
122
|
+
path = "/cosmos/staking/v1beta1/validators/" + address + "/unbonding_delegations";
|
|
123
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
92
124
|
case 1:
|
|
93
125
|
result = _a.sent();
|
|
94
126
|
return [2 /*return*/, result.data.unbonding_responses];
|
|
@@ -102,8 +134,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
102
134
|
return __generator(this, function (_a) {
|
|
103
135
|
switch (_a.label) {
|
|
104
136
|
case 0:
|
|
105
|
-
path = "/cosmos/staking/v1beta1/validators
|
|
106
|
-
return [4 /*yield*/, this.
|
|
137
|
+
path = "/cosmos/staking/v1beta1/validators/" + address + "/delegations";
|
|
138
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
107
139
|
case 1:
|
|
108
140
|
result = _a.sent();
|
|
109
141
|
return [2 /*return*/, result.data.delegation_responses];
|
|
@@ -117,8 +149,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
117
149
|
return __generator(this, function (_a) {
|
|
118
150
|
switch (_a.label) {
|
|
119
151
|
case 0:
|
|
120
|
-
path = "/cosmos/staking/v1beta1/delegations
|
|
121
|
-
return [4 /*yield*/, this.
|
|
152
|
+
path = "/cosmos/staking/v1beta1/delegations/" + address;
|
|
153
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
122
154
|
case 1:
|
|
123
155
|
result = _a.sent();
|
|
124
156
|
return [2 /*return*/, result.data.delegation_responses];
|
|
@@ -133,7 +165,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
133
165
|
switch (_a.label) {
|
|
134
166
|
case 0:
|
|
135
167
|
path = "/cosmos/staking/v1beta1/params";
|
|
136
|
-
return [4 /*yield*/, this.
|
|
168
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
137
169
|
case 1:
|
|
138
170
|
result = _a.sent();
|
|
139
171
|
return [2 /*return*/, result.data.params];
|
|
@@ -148,7 +180,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
148
180
|
switch (_a.label) {
|
|
149
181
|
case 0:
|
|
150
182
|
path = "/cosmos/staking/v1beta1/pool";
|
|
151
|
-
return [4 /*yield*/, this.
|
|
183
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
152
184
|
case 1:
|
|
153
185
|
result = _a.sent();
|
|
154
186
|
return [2 /*return*/, result.data.pool];
|
|
@@ -163,7 +195,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
163
195
|
switch (_a.label) {
|
|
164
196
|
case 0:
|
|
165
197
|
path = "/cosmos/staking/v1beta1/validators/" + valoperAddress;
|
|
166
|
-
return [4 /*yield*/, this.
|
|
198
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
167
199
|
case 1:
|
|
168
200
|
result = _a.sent();
|
|
169
201
|
return [2 /*return*/, result.data.validator];
|
|
@@ -178,7 +210,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
178
210
|
switch (_a.label) {
|
|
179
211
|
case 0:
|
|
180
212
|
path = "/cosmos/staking/v1beta1/validators";
|
|
181
|
-
return [4 /*yield*/, this.
|
|
213
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
182
214
|
case 1:
|
|
183
215
|
result = _a.sent();
|
|
184
216
|
return [2 /*return*/, result.data.validators];
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { EncodeObject, OfflineDirectSigner } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgBeginRedelegate, MsgCreateValidator, MsgDelegate, MsgEditValidator, MsgUndelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
-
interface MsgDelegateEncodeObject extends EncodeObject {
|
|
4
|
+
export interface MsgDelegateEncodeObject extends EncodeObject {
|
|
5
5
|
readonly typeUrl: "/cosmos.staking.v1beta1.MsgDelegate";
|
|
6
6
|
readonly value: Partial<MsgDelegate>;
|
|
7
7
|
}
|
|
8
|
-
interface MsgUndelegateEncodeObject extends EncodeObject {
|
|
8
|
+
export interface MsgUndelegateEncodeObject extends EncodeObject {
|
|
9
9
|
readonly typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate";
|
|
10
10
|
readonly value: Partial<MsgUndelegate>;
|
|
11
11
|
}
|
|
12
|
-
interface MsgRedelegateEncodeObject extends EncodeObject {
|
|
12
|
+
export interface MsgRedelegateEncodeObject extends EncodeObject {
|
|
13
13
|
readonly typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate";
|
|
14
14
|
readonly value: Partial<MsgBeginRedelegate>;
|
|
15
15
|
}
|
|
16
|
-
interface MsgEditValidatorEncodeObject extends EncodeObject {
|
|
16
|
+
export interface MsgEditValidatorEncodeObject extends EncodeObject {
|
|
17
17
|
readonly typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator";
|
|
18
18
|
readonly value: Partial<MsgEditValidator>;
|
|
19
19
|
}
|
|
20
|
-
interface MsgCreateValidatorEncodeObject extends EncodeObject {
|
|
20
|
+
export interface MsgCreateValidatorEncodeObject extends EncodeObject {
|
|
21
21
|
readonly typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator";
|
|
22
22
|
readonly value: Partial<MsgCreateValidator>;
|
|
23
23
|
}
|
|
24
24
|
export declare class StakingTxClient extends ITxClient {
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(wallet: OfflineDirectSigner, serverUrl: string);
|
|
26
26
|
msgDelegate(data: MsgDelegate): MsgDelegateEncodeObject;
|
|
27
27
|
msgUndelegate(data: MsgUndelegate): MsgUndelegateEncodeObject;
|
|
28
28
|
msgRedelegate(data: MsgBeginRedelegate): MsgRedelegateEncodeObject;
|
|
29
29
|
msgEditValidator(data: MsgEditValidator): MsgEditValidatorEncodeObject;
|
|
30
30
|
msgCreateValidator(data: MsgCreateValidator): MsgCreateValidatorEncodeObject;
|
|
31
31
|
}
|
|
32
|
-
export {};
|
|
@@ -29,8 +29,8 @@ var types = [
|
|
|
29
29
|
var registry = new proto_signing_1.Registry(types);
|
|
30
30
|
var StakingTxClient = /** @class */ (function (_super) {
|
|
31
31
|
__extends(StakingTxClient, _super);
|
|
32
|
-
function StakingTxClient(
|
|
33
|
-
return _super.call(this,
|
|
32
|
+
function StakingTxClient(wallet, serverUrl) {
|
|
33
|
+
return _super.call(this, wallet, serverUrl, registry) || this;
|
|
34
34
|
}
|
|
35
35
|
StakingTxClient.prototype.msgDelegate = function (data) {
|
|
36
36
|
return { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: data };
|