@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,10 +43,10 @@ exports.DistributionQueryClient = void 0;
|
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
44
|
var DistributionQueryClient = /** @class */ (function () {
|
|
45
45
|
function DistributionQueryClient(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
|
});
|
|
@@ -57,14 +57,14 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
57
57
|
return __generator(this, function (_a) {
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
60
|
-
path = "/cosmos/distribution/v1beta1/delegators
|
|
61
|
-
return [4 /*yield*/, this.
|
|
60
|
+
path = "/cosmos/distribution/v1beta1/delegators/" + address + "/rewards/" + validatorAddress;
|
|
61
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
62
62
|
case 1:
|
|
63
63
|
result = _a.sent();
|
|
64
|
-
if (result.data.rewards.length
|
|
64
|
+
if (result.data.rewards.length === 0) {
|
|
65
65
|
return [2 /*return*/, "0"];
|
|
66
66
|
}
|
|
67
|
-
// reward array is very important for
|
|
67
|
+
// reward array is very important for refactoring and other functions.
|
|
68
68
|
return [2 /*return*/, result.data.rewards[0].amount];
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -76,8 +76,8 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
76
76
|
return __generator(this, function (_a) {
|
|
77
77
|
switch (_a.label) {
|
|
78
78
|
case 0:
|
|
79
|
-
path = "/cosmos/distribution/v1beta1/validators
|
|
80
|
-
return [4 /*yield*/, this.
|
|
79
|
+
path = "/cosmos/distribution/v1beta1/validators/" + address + "/outstanding_rewards";
|
|
80
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
81
81
|
case 1:
|
|
82
82
|
result = _a.sent();
|
|
83
83
|
return [2 /*return*/, result.data.rewards.rewards];
|
|
@@ -91,8 +91,8 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
91
91
|
return __generator(this, function (_a) {
|
|
92
92
|
switch (_a.label) {
|
|
93
93
|
case 0:
|
|
94
|
-
path = "/cosmos/distribution/v1beta1/validators
|
|
95
|
-
return [4 /*yield*/, this.
|
|
94
|
+
path = "/cosmos/distribution/v1beta1/validators/" + address + "/commission";
|
|
95
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
96
96
|
case 1:
|
|
97
97
|
result = _a.sent();
|
|
98
98
|
return [2 /*return*/, result.data.commission.commission];
|
|
@@ -106,25 +106,27 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
106
106
|
return __generator(this, function (_a) {
|
|
107
107
|
switch (_a.label) {
|
|
108
108
|
case 0:
|
|
109
|
-
path = "/cosmos/distribution/v1beta1/delegators
|
|
110
|
-
return [4 /*yield*/, this.
|
|
109
|
+
path = "/cosmos/distribution/v1beta1/delegators/" + address + "/rewards";
|
|
110
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
111
111
|
case 1:
|
|
112
112
|
result = _a.sent();
|
|
113
113
|
data = result.data;
|
|
114
114
|
finalData = {
|
|
115
115
|
rewards: [],
|
|
116
|
-
total:
|
|
116
|
+
total: ""
|
|
117
117
|
};
|
|
118
118
|
for (i = 0; i < data.rewards.length; i++) {
|
|
119
119
|
amount = "0";
|
|
120
|
-
if (data.rewards[i].reward.length
|
|
120
|
+
if (data.rewards[i].reward.length !== 0) {
|
|
121
121
|
amount = data.rewards[i].reward[0].amount;
|
|
122
122
|
}
|
|
123
123
|
tempData = { validator_address: data.rewards[i].validator_address, amount: amount };
|
|
124
124
|
finalData.rewards.push(tempData);
|
|
125
125
|
}
|
|
126
126
|
;
|
|
127
|
-
|
|
127
|
+
if (data.total.length > 0) {
|
|
128
|
+
finalData.total = data.total[0].amount;
|
|
129
|
+
}
|
|
128
130
|
return [2 /*return*/, finalData];
|
|
129
131
|
}
|
|
130
132
|
});
|
|
@@ -137,7 +139,7 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
137
139
|
switch (_a.label) {
|
|
138
140
|
case 0:
|
|
139
141
|
path = "/cosmos/distribution/v1beta1/community_pool";
|
|
140
|
-
return [4 /*yield*/, this.
|
|
142
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
141
143
|
case 1:
|
|
142
144
|
result = _a.sent();
|
|
143
145
|
return [2 /*return*/, result.data.pool[0].amount];
|
|
@@ -145,6 +147,21 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
145
147
|
});
|
|
146
148
|
});
|
|
147
149
|
};
|
|
150
|
+
DistributionQueryClient.prototype.queryGetWithdrawAddress = function (address) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
+
var path, result;
|
|
153
|
+
return __generator(this, function (_a) {
|
|
154
|
+
switch (_a.label) {
|
|
155
|
+
case 0:
|
|
156
|
+
path = "/cosmos/distribution/v1beta1/delegators/" + address + "/withdraw_address";
|
|
157
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
158
|
+
case 1:
|
|
159
|
+
result = _a.sent();
|
|
160
|
+
return [2 /*return*/, result.data.withdraw_address];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
148
165
|
return DistributionQueryClient;
|
|
149
166
|
}());
|
|
150
167
|
exports.DistributionQueryClient = DistributionQueryClient;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { EncodeObject, OfflineDirectSigner } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgFundCommunityPool, MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
-
interface MsgFundCommunityPoolEncodeObject extends EncodeObject {
|
|
4
|
+
export interface MsgFundCommunityPoolEncodeObject extends EncodeObject {
|
|
5
5
|
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool";
|
|
6
6
|
readonly value: Partial<MsgFundCommunityPool>;
|
|
7
7
|
}
|
|
8
|
-
interface MsgSetWithdrawAddressEncodeObject extends EncodeObject {
|
|
8
|
+
export interface MsgSetWithdrawAddressEncodeObject extends EncodeObject {
|
|
9
9
|
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress";
|
|
10
10
|
readonly value: Partial<MsgSetWithdrawAddress>;
|
|
11
11
|
}
|
|
12
|
-
interface MsgWithdrawDelegatorRewardEncodeObject extends EncodeObject {
|
|
12
|
+
export interface MsgWithdrawDelegatorRewardEncodeObject extends EncodeObject {
|
|
13
13
|
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward";
|
|
14
14
|
readonly value: Partial<MsgWithdrawDelegatorReward>;
|
|
15
15
|
}
|
|
16
|
-
interface MsgWithdrawValidatorCommissionEncodeObject extends EncodeObject {
|
|
16
|
+
export interface MsgWithdrawValidatorCommissionEncodeObject extends EncodeObject {
|
|
17
17
|
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission";
|
|
18
18
|
readonly value: Partial<MsgWithdrawValidatorCommission>;
|
|
19
19
|
}
|
|
20
20
|
export declare class DistributionTxClient extends ITxClient {
|
|
21
|
-
constructor(
|
|
21
|
+
constructor(wallet: OfflineDirectSigner, serverUrl: string);
|
|
22
22
|
msgFundCommunityPool(data: MsgFundCommunityPool): MsgFundCommunityPoolEncodeObject;
|
|
23
23
|
msgSetWithdrawAddress(data: MsgSetWithdrawAddress): MsgSetWithdrawAddressEncodeObject;
|
|
24
24
|
msgWithdrawDelegatorReward(data: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardEncodeObject;
|
|
25
25
|
msgWithdrawValidatorCommission(data: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionEncodeObject;
|
|
26
26
|
}
|
|
27
|
-
export {};
|
|
@@ -23,13 +23,13 @@ var types = [
|
|
|
23
23
|
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", tx_1.MsgFundCommunityPool],
|
|
24
24
|
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", tx_1.MsgSetWithdrawAddress],
|
|
25
25
|
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", tx_1.MsgWithdrawDelegatorReward],
|
|
26
|
-
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_1.MsgWithdrawValidatorCommission]
|
|
26
|
+
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_1.MsgWithdrawValidatorCommission]
|
|
27
27
|
];
|
|
28
28
|
var registry = new proto_signing_1.Registry(types);
|
|
29
29
|
var DistributionTxClient = /** @class */ (function (_super) {
|
|
30
30
|
__extends(DistributionTxClient, _super);
|
|
31
|
-
function DistributionTxClient(
|
|
32
|
-
return _super.call(this,
|
|
31
|
+
function DistributionTxClient(wallet, serverUrl) {
|
|
32
|
+
return _super.call(this, wallet, serverUrl, registry) || this;
|
|
33
33
|
}
|
|
34
34
|
DistributionTxClient.prototype.msgFundCommunityPool = function (data) {
|
|
35
35
|
return { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: data };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coin } from
|
|
1
|
+
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
|
|
2
2
|
export interface FeeAllowanceType {
|
|
3
3
|
granter: string;
|
|
4
4
|
grantee: string;
|
|
@@ -10,7 +10,7 @@ export interface FeeAllowanceType1 {
|
|
|
10
10
|
expiration: Date | undefined;
|
|
11
11
|
}
|
|
12
12
|
export declare class FeeGrantQueryClient {
|
|
13
|
-
private
|
|
13
|
+
private readonly axios;
|
|
14
14
|
constructor(baseUrl: string);
|
|
15
15
|
getGranteeAllowance(granterAddress: string, granteeAddress: string): Promise<FeeAllowanceType1>;
|
|
16
16
|
getGranteeAllowanceAll(granteeAddress: string): Promise<FeeAllowanceType[]>;
|
|
@@ -43,10 +43,10 @@ exports.FeeGrantQueryClient = void 0;
|
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
44
|
var FeeGrantQueryClient = /** @class */ (function () {
|
|
45
45
|
function FeeGrantQueryClient(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
|
});
|
|
@@ -58,7 +58,7 @@ var FeeGrantQueryClient = /** @class */ (function () {
|
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
60
60
|
path = "/cosmos/feegrant/v1beta1/allowance/" + granterAddress + "/" + granteeAddress;
|
|
61
|
-
return [4 /*yield*/, this.
|
|
61
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
62
62
|
case 1:
|
|
63
63
|
result = _a.sent();
|
|
64
64
|
return [2 /*return*/, result.data.allowance.allowance];
|
|
@@ -73,7 +73,7 @@ var FeeGrantQueryClient = /** @class */ (function () {
|
|
|
73
73
|
switch (_a.label) {
|
|
74
74
|
case 0:
|
|
75
75
|
path = "/cosmos/feegrant/v1beta1/allowances/" + granteeAddress;
|
|
76
|
-
return [4 /*yield*/, this.
|
|
76
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
77
77
|
case 1:
|
|
78
78
|
result = _a.sent();
|
|
79
79
|
return [2 /*return*/, result.data.allowances];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { OfflineDirectSigner, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgGrantAllowance, MsgRevokeAllowance } from "./FeeGrantTxTypes";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
-
interface MsgGrantAllowanceEncodeObject extends EncodeObject {
|
|
4
|
+
export interface MsgGrantAllowanceEncodeObject extends EncodeObject {
|
|
5
5
|
readonly typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance";
|
|
6
6
|
readonly value: Partial<MsgGrantAllowance>;
|
|
7
7
|
}
|
|
8
|
-
interface MsgRevokeAllowanceEncodeObject extends EncodeObject {
|
|
8
|
+
export interface MsgRevokeAllowanceEncodeObject extends EncodeObject {
|
|
9
9
|
readonly typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance";
|
|
10
10
|
readonly value: Partial<MsgRevokeAllowance>;
|
|
11
11
|
}
|
|
12
12
|
export declare class FeeGrantTxClient extends ITxClient {
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(wallet: OfflineDirectSigner, serverUrl: string);
|
|
14
14
|
msgGrantAllowance(data: MsgGrantAllowance): MsgGrantAllowanceEncodeObject;
|
|
15
15
|
msgRevokeAllowance(data: MsgRevokeAllowance): MsgRevokeAllowanceEncodeObject;
|
|
16
16
|
}
|
|
17
|
-
export {};
|
|
@@ -26,8 +26,8 @@ var types = [
|
|
|
26
26
|
var registry = new proto_signing_1.Registry(types);
|
|
27
27
|
var FeeGrantTxClient = /** @class */ (function (_super) {
|
|
28
28
|
__extends(FeeGrantTxClient, _super);
|
|
29
|
-
function FeeGrantTxClient(
|
|
30
|
-
return _super.call(this,
|
|
29
|
+
function FeeGrantTxClient(wallet, serverUrl) {
|
|
30
|
+
return _super.call(this, wallet, serverUrl, registry) || this;
|
|
31
31
|
}
|
|
32
32
|
FeeGrantTxClient.prototype.msgGrantAllowance = function (data) {
|
|
33
33
|
return { typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", value: data };
|
|
@@ -1,6 +1,54 @@
|
|
|
1
|
+
export declare enum ProposalStatus {
|
|
2
|
+
PROPOSAL_STATUS_UNSPECIFIED = 0,
|
|
3
|
+
PROPOSAL_STATUS_DEPOSIT_PERIOD = 1,
|
|
4
|
+
PROPOSAL_STATUS_VOTING_PERIOD = 2,
|
|
5
|
+
PROPOSAL_STATUS_PASSED = 3,
|
|
6
|
+
PROPOSAL_STATUS_REJECTED = 4,
|
|
7
|
+
PROPOSAL_STATUS_FAILED = 5
|
|
8
|
+
}
|
|
9
|
+
export interface ProposalParam {
|
|
10
|
+
voting_period: string;
|
|
11
|
+
deposit_params: {
|
|
12
|
+
min_deposit: {
|
|
13
|
+
denom: string;
|
|
14
|
+
amount: string;
|
|
15
|
+
}[];
|
|
16
|
+
max_deposit_period: string;
|
|
17
|
+
};
|
|
18
|
+
tally_params: {
|
|
19
|
+
quorum: string;
|
|
20
|
+
threshold: string;
|
|
21
|
+
veto_threshold: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface ProposalInfo {
|
|
25
|
+
proposal_id: string;
|
|
26
|
+
content: {
|
|
27
|
+
"@type": string;
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
status: string;
|
|
32
|
+
final_tally_result: {
|
|
33
|
+
yes: string;
|
|
34
|
+
abstain: string;
|
|
35
|
+
no: string;
|
|
36
|
+
no_with_veto: string;
|
|
37
|
+
};
|
|
38
|
+
submit_time: string;
|
|
39
|
+
deposit_end_time: string;
|
|
40
|
+
total_deposit: {
|
|
41
|
+
denom: string;
|
|
42
|
+
amount: string;
|
|
43
|
+
}[];
|
|
44
|
+
voting_start_time: string;
|
|
45
|
+
voting_end_time: string;
|
|
46
|
+
}
|
|
1
47
|
export declare class GovQueryClient {
|
|
2
|
-
private
|
|
48
|
+
private readonly axios;
|
|
3
49
|
constructor(baseUrl: string);
|
|
4
|
-
|
|
5
|
-
|
|
50
|
+
queryGetParam(): Promise<ProposalParam>;
|
|
51
|
+
queryGetProposal(id: string): Promise<ProposalInfo>;
|
|
52
|
+
queryGetProposalListByStatus(status: ProposalStatus): Promise<ProposalInfo[]>;
|
|
53
|
+
queryGetProposalList(): Promise<ProposalInfo[]>;
|
|
6
54
|
}
|
|
@@ -39,44 +39,95 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.GovQueryClient = void 0;
|
|
42
|
+
exports.GovQueryClient = exports.ProposalStatus = void 0;
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
|
+
var ProposalStatus;
|
|
45
|
+
(function (ProposalStatus) {
|
|
46
|
+
ProposalStatus[ProposalStatus["PROPOSAL_STATUS_UNSPECIFIED"] = 0] = "PROPOSAL_STATUS_UNSPECIFIED";
|
|
47
|
+
ProposalStatus[ProposalStatus["PROPOSAL_STATUS_DEPOSIT_PERIOD"] = 1] = "PROPOSAL_STATUS_DEPOSIT_PERIOD";
|
|
48
|
+
ProposalStatus[ProposalStatus["PROPOSAL_STATUS_VOTING_PERIOD"] = 2] = "PROPOSAL_STATUS_VOTING_PERIOD";
|
|
49
|
+
ProposalStatus[ProposalStatus["PROPOSAL_STATUS_PASSED"] = 3] = "PROPOSAL_STATUS_PASSED";
|
|
50
|
+
ProposalStatus[ProposalStatus["PROPOSAL_STATUS_REJECTED"] = 4] = "PROPOSAL_STATUS_REJECTED";
|
|
51
|
+
ProposalStatus[ProposalStatus["PROPOSAL_STATUS_FAILED"] = 5] = "PROPOSAL_STATUS_FAILED";
|
|
52
|
+
})(ProposalStatus = exports.ProposalStatus || (exports.ProposalStatus = {}));
|
|
44
53
|
var GovQueryClient = /** @class */ (function () {
|
|
45
54
|
function GovQueryClient(baseUrl) {
|
|
46
|
-
this.
|
|
55
|
+
this.axios = axios_1.default.create({
|
|
47
56
|
baseURL: baseUrl,
|
|
48
57
|
headers: {
|
|
49
|
-
Accept:
|
|
58
|
+
Accept: "application/json",
|
|
50
59
|
},
|
|
51
60
|
timeout: 15000,
|
|
52
61
|
});
|
|
53
62
|
}
|
|
54
|
-
GovQueryClient.prototype.
|
|
63
|
+
GovQueryClient.prototype.queryGetParam = function () {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var path, votingResult, depositResult, tallyingResult;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
path = "/cosmos/gov/v1beta1/params/voting";
|
|
70
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
71
|
+
case 1:
|
|
72
|
+
votingResult = _a.sent();
|
|
73
|
+
path = "/cosmos/gov/v1beta1/params/deposit";
|
|
74
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
75
|
+
case 2:
|
|
76
|
+
depositResult = _a.sent();
|
|
77
|
+
path = "/cosmos/gov/v1beta1/params/tallying";
|
|
78
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
79
|
+
case 3:
|
|
80
|
+
tallyingResult = _a.sent();
|
|
81
|
+
return [2 /*return*/, {
|
|
82
|
+
voting_period: votingResult.data.voting_params.voting_period,
|
|
83
|
+
deposit_params: depositResult.data.deposit_params,
|
|
84
|
+
tally_params: tallyingResult.data.tally_params
|
|
85
|
+
}];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
GovQueryClient.prototype.queryGetProposal = function (id) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var path, result;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
path = "/cosmos/gov/v1beta1/proposals/" + id;
|
|
97
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
98
|
+
case 1:
|
|
99
|
+
result = _a.sent();
|
|
100
|
+
return [2 /*return*/, result.data.proposal];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
GovQueryClient.prototype.queryGetProposalListByStatus = function (status) {
|
|
55
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
107
|
var path, result;
|
|
57
108
|
return __generator(this, function (_a) {
|
|
58
109
|
switch (_a.label) {
|
|
59
110
|
case 0:
|
|
60
|
-
path = "/cosmos/
|
|
61
|
-
return [4 /*yield*/, this.
|
|
111
|
+
path = "/cosmos/gov/v1beta1/proposals";
|
|
112
|
+
return [4 /*yield*/, this.axios.get(path, { params: { proposalStatus: status } })];
|
|
62
113
|
case 1:
|
|
63
114
|
result = _a.sent();
|
|
64
|
-
return [2 /*return*/, result.data.
|
|
115
|
+
return [2 /*return*/, result.data.proposals];
|
|
65
116
|
}
|
|
66
117
|
});
|
|
67
118
|
});
|
|
68
119
|
};
|
|
69
|
-
GovQueryClient.prototype.
|
|
120
|
+
GovQueryClient.prototype.queryGetProposalList = function () {
|
|
70
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
122
|
var path, result;
|
|
72
123
|
return __generator(this, function (_a) {
|
|
73
124
|
switch (_a.label) {
|
|
74
125
|
case 0:
|
|
75
|
-
path = "/cosmos/
|
|
76
|
-
return [4 /*yield*/, this.
|
|
126
|
+
path = "/cosmos/gov/v1beta1/proposals";
|
|
127
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
77
128
|
case 1:
|
|
78
129
|
result = _a.sent();
|
|
79
|
-
return [2 /*return*/, result.data.
|
|
130
|
+
return [2 /*return*/, result.data.proposals];
|
|
80
131
|
}
|
|
81
132
|
});
|
|
82
133
|
});
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { EncodeObject, OfflineDirectSigner } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgDeposit, MsgSubmitProposal, MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
-
interface MsgDepositEncodeObject extends EncodeObject {
|
|
4
|
+
export interface MsgDepositEncodeObject extends EncodeObject {
|
|
5
5
|
readonly typeUrl: "/cosmos.gov.v1beta1.MsgDeposit";
|
|
6
6
|
readonly value: Partial<MsgDeposit>;
|
|
7
7
|
}
|
|
8
|
-
interface MsgSubmitProposalEncodeObject extends EncodeObject {
|
|
8
|
+
export interface MsgSubmitProposalEncodeObject extends EncodeObject {
|
|
9
9
|
readonly typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal";
|
|
10
10
|
readonly value: Partial<MsgSubmitProposal>;
|
|
11
11
|
}
|
|
12
|
-
interface MsgVoteEncodeObject extends EncodeObject {
|
|
12
|
+
export interface MsgVoteEncodeObject extends EncodeObject {
|
|
13
13
|
readonly typeUrl: "/cosmos.gov.v1beta1.MsgVote";
|
|
14
14
|
readonly value: Partial<MsgVote>;
|
|
15
15
|
}
|
|
16
16
|
export declare class GovTxClient extends ITxClient {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(wallet: OfflineDirectSigner, serverUrl: string);
|
|
18
18
|
msgDeposit(data: MsgDeposit): MsgDepositEncodeObject;
|
|
19
19
|
msgSubmitProposal(data: MsgSubmitProposal): MsgSubmitProposalEncodeObject;
|
|
20
20
|
msgVote(data: MsgVote): MsgVoteEncodeObject;
|
|
21
21
|
}
|
|
22
|
-
export {};
|
|
@@ -22,13 +22,13 @@ var ITxClient_1 = require("../common/ITxClient");
|
|
|
22
22
|
var types = [
|
|
23
23
|
["/cosmos.gov.v1beta1.MsgDeposit", tx_1.MsgDeposit],
|
|
24
24
|
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_1.MsgSubmitProposal],
|
|
25
|
-
["/cosmos.gov.v1beta1.MsgVote", tx_1.MsgVote]
|
|
25
|
+
["/cosmos.gov.v1beta1.MsgVote", tx_1.MsgVote]
|
|
26
26
|
];
|
|
27
27
|
var registry = new proto_signing_1.Registry(types);
|
|
28
28
|
var GovTxClient = /** @class */ (function (_super) {
|
|
29
29
|
__extends(GovTxClient, _super);
|
|
30
|
-
function GovTxClient(
|
|
31
|
-
return _super.call(this,
|
|
30
|
+
function GovTxClient(wallet, serverUrl) {
|
|
31
|
+
return _super.call(this, wallet, serverUrl, registry) || this;
|
|
32
32
|
}
|
|
33
33
|
GovTxClient.prototype.msgDeposit = function (data) {
|
|
34
34
|
return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: data };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Pagination } from
|
|
1
|
+
import { Pagination } from "../common";
|
|
2
2
|
export interface NftItemType {
|
|
3
3
|
id: string;
|
|
4
4
|
owner: string;
|
|
5
5
|
tokenURI: string;
|
|
6
6
|
}
|
|
7
7
|
export declare class NftQueryClient {
|
|
8
|
-
private
|
|
8
|
+
private readonly axios;
|
|
9
9
|
constructor(baseUrl: string);
|
|
10
10
|
queryBalanceOf(ownerAddress: string): Promise<string>;
|
|
11
11
|
queryTokenOfOwnerByIndex(ownerAddress: string, index: string): Promise<string>;
|
|
@@ -43,10 +43,10 @@ exports.NftQueryClient = void 0;
|
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
44
|
var NftQueryClient = /** @class */ (function () {
|
|
45
45
|
function NftQueryClient(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
|
});
|
|
@@ -58,7 +58,7 @@ var NftQueryClient = /** @class */ (function () {
|
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
60
60
|
path = "/firmachain/firmachain/nft/balanceOf";
|
|
61
|
-
return [4 /*yield*/, this.
|
|
61
|
+
return [4 /*yield*/, this.axios.get(path, { params: { ownerAddress: ownerAddress } })];
|
|
62
62
|
case 1:
|
|
63
63
|
result = _a.sent();
|
|
64
64
|
return [2 /*return*/, result.data.total];
|
|
@@ -73,7 +73,7 @@ var NftQueryClient = /** @class */ (function () {
|
|
|
73
73
|
switch (_a.label) {
|
|
74
74
|
case 0:
|
|
75
75
|
path = "/firmachain/firmachain/nft/tokenOfOwnerByIndex";
|
|
76
|
-
return [4 /*yield*/, this.
|
|
76
|
+
return [4 /*yield*/, this.axios.get(path, { params: { ownerAddress: ownerAddress, index: index } })];
|
|
77
77
|
case 1:
|
|
78
78
|
result = _a.sent();
|
|
79
79
|
return [2 /*return*/, result.data.tokenId];
|
|
@@ -87,8 +87,8 @@ var NftQueryClient = /** @class */ (function () {
|
|
|
87
87
|
return __generator(this, function (_a) {
|
|
88
88
|
switch (_a.label) {
|
|
89
89
|
case 0:
|
|
90
|
-
path = "/firmachain/firmachain/nft/nftItem
|
|
91
|
-
return [4 /*yield*/, this.
|
|
90
|
+
path = "/firmachain/firmachain/nft/nftItem/" + nftId;
|
|
91
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
92
92
|
case 1:
|
|
93
93
|
result = _a.sent();
|
|
94
94
|
return [2 /*return*/, result.data.NftItem];
|
|
@@ -104,10 +104,13 @@ var NftQueryClient = /** @class */ (function () {
|
|
|
104
104
|
switch (_a.label) {
|
|
105
105
|
case 0:
|
|
106
106
|
path = "/firmachain/firmachain/nft/nftItem";
|
|
107
|
-
return [4 /*yield*/, this.
|
|
107
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
108
108
|
case 1:
|
|
109
109
|
result = _a.sent();
|
|
110
|
-
convertPagination = {
|
|
110
|
+
convertPagination = {
|
|
111
|
+
next_key: result.data.pagination.next_key,
|
|
112
|
+
total: Number.parseInt(result.data.pagination.total)
|
|
113
|
+
};
|
|
111
114
|
return [2 /*return*/, { dataList: result.data.NftItem, pagination: convertPagination }];
|
|
112
115
|
}
|
|
113
116
|
});
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { OfflineDirectSigner, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgTransfer, MsgMint, MsgBurn } from "./NftTxTypes";
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
|
-
interface MsgTransferEncodeObject extends EncodeObject {
|
|
4
|
+
export interface MsgTransferEncodeObject extends EncodeObject {
|
|
5
5
|
readonly typeUrl: "/firmachain.firmachain.nft.MsgTransfer";
|
|
6
6
|
readonly value: Partial<MsgTransfer>;
|
|
7
7
|
}
|
|
8
|
-
interface MsgMintEncodeObject extends EncodeObject {
|
|
8
|
+
export interface MsgMintEncodeObject extends EncodeObject {
|
|
9
9
|
readonly typeUrl: "/firmachain.firmachain.nft.MsgMint";
|
|
10
10
|
readonly value: Partial<MsgMint>;
|
|
11
11
|
}
|
|
12
|
-
interface MsgBurnEncodeObject extends EncodeObject {
|
|
12
|
+
export interface MsgBurnEncodeObject extends EncodeObject {
|
|
13
13
|
readonly typeUrl: "/firmachain.firmachain.nft.MsgBurn";
|
|
14
14
|
readonly value: Partial<MsgBurn>;
|
|
15
15
|
}
|
|
16
16
|
export declare class NftTxClient extends ITxClient {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(wallet: OfflineDirectSigner, serverUrl: string);
|
|
18
18
|
msgTransfer(data: MsgTransfer): MsgTransferEncodeObject;
|
|
19
19
|
msgMint(data: MsgMint): MsgMintEncodeObject;
|
|
20
20
|
msgBurn(data: MsgBurn): MsgBurnEncodeObject;
|
|
21
21
|
}
|
|
22
|
-
export {};
|
|
@@ -22,13 +22,13 @@ var ITxClient_1 = require("../common/ITxClient");
|
|
|
22
22
|
var types = [
|
|
23
23
|
["/firmachain.firmachain.nft.MsgTransfer", NftTxTypes_1.MsgTransfer],
|
|
24
24
|
["/firmachain.firmachain.nft.MsgMint", NftTxTypes_1.MsgMint],
|
|
25
|
-
["/firmachain.firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn]
|
|
25
|
+
["/firmachain.firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn]
|
|
26
26
|
];
|
|
27
27
|
var registry = new proto_signing_1.Registry(types);
|
|
28
28
|
var NftTxClient = /** @class */ (function (_super) {
|
|
29
29
|
__extends(NftTxClient, _super);
|
|
30
|
-
function NftTxClient(
|
|
31
|
-
return _super.call(this,
|
|
30
|
+
function NftTxClient(wallet, serverUrl) {
|
|
31
|
+
return _super.call(this, wallet, serverUrl, registry) || this;
|
|
32
32
|
}
|
|
33
33
|
NftTxClient.prototype.msgTransfer = function (data) {
|
|
34
34
|
return { typeUrl: "/firmachain.firmachain.nft.MsgTransfer", value: data };
|
|
@@ -77,8 +77,10 @@ export interface ValidatorDataType {
|
|
|
77
77
|
min_self_delegation: string;
|
|
78
78
|
}
|
|
79
79
|
export declare class StakingQueryClient {
|
|
80
|
-
private
|
|
80
|
+
private readonly axios;
|
|
81
81
|
constructor(baseUrl: string);
|
|
82
|
+
queryGetUndelegationInfoFromValidator(address: string, validatorAddress: string): Promise<UndelegationInfo>;
|
|
83
|
+
queryGetDelegationInfoFromValidator(address: string, validatorAddress: string): Promise<DelegationInfo>;
|
|
82
84
|
queryGetTotalUndelegateInfo(address: string): Promise<UndelegationInfo[]>;
|
|
83
85
|
querygetTotalRedelegationInfo(address: string): Promise<RedelegationInfo[]>;
|
|
84
86
|
queryGetUndelegationListFromValidator(address: string): Promise<UndelegationInfo[]>;
|