@firmachain/firma-js 0.2.5 → 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/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 +10 -6
- package/dist/sdk/FirmaDistributionService.js +159 -75
- package/dist/sdk/FirmaFeeGrantService.d.ts +8 -5
- package/dist/sdk/FirmaFeeGrantService.js +125 -50
- package/dist/sdk/FirmaGovService.d.ts +16 -10
- package/dist/sdk/FirmaGovService.js +296 -127
- 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 +7 -6
- package/dist/sdk/FirmaStakingService.js +141 -103
- 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 +30 -15
- 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 +1 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.js +8 -8
- 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 +1 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +20 -20
- 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,18 +106,18 @@ 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 };
|
|
@@ -139,7 +139,7 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
139
139
|
switch (_a.label) {
|
|
140
140
|
case 0:
|
|
141
141
|
path = "/cosmos/distribution/v1beta1/community_pool";
|
|
142
|
-
return [4 /*yield*/, this.
|
|
142
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
143
143
|
case 1:
|
|
144
144
|
result = _a.sent();
|
|
145
145
|
return [2 /*return*/, result.data.pool[0].amount];
|
|
@@ -147,6 +147,21 @@ var DistributionQueryClient = /** @class */ (function () {
|
|
|
147
147
|
});
|
|
148
148
|
});
|
|
149
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
|
+
};
|
|
150
165
|
return DistributionQueryClient;
|
|
151
166
|
}());
|
|
152
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 };
|
|
@@ -45,7 +45,7 @@ export interface ProposalInfo {
|
|
|
45
45
|
voting_end_time: string;
|
|
46
46
|
}
|
|
47
47
|
export declare class GovQueryClient {
|
|
48
|
-
private
|
|
48
|
+
private readonly axios;
|
|
49
49
|
constructor(baseUrl: string);
|
|
50
50
|
queryGetParam(): Promise<ProposalParam>;
|
|
51
51
|
queryGetProposal(id: string): Promise<ProposalInfo>;
|
|
@@ -52,10 +52,10 @@ var ProposalStatus;
|
|
|
52
52
|
})(ProposalStatus = exports.ProposalStatus || (exports.ProposalStatus = {}));
|
|
53
53
|
var GovQueryClient = /** @class */ (function () {
|
|
54
54
|
function GovQueryClient(baseUrl) {
|
|
55
|
-
this.
|
|
55
|
+
this.axios = axios_1.default.create({
|
|
56
56
|
baseURL: baseUrl,
|
|
57
57
|
headers: {
|
|
58
|
-
Accept:
|
|
58
|
+
Accept: "application/json",
|
|
59
59
|
},
|
|
60
60
|
timeout: 15000,
|
|
61
61
|
});
|
|
@@ -67,15 +67,15 @@ var GovQueryClient = /** @class */ (function () {
|
|
|
67
67
|
switch (_a.label) {
|
|
68
68
|
case 0:
|
|
69
69
|
path = "/cosmos/gov/v1beta1/params/voting";
|
|
70
|
-
return [4 /*yield*/, this.
|
|
70
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
71
71
|
case 1:
|
|
72
72
|
votingResult = _a.sent();
|
|
73
73
|
path = "/cosmos/gov/v1beta1/params/deposit";
|
|
74
|
-
return [4 /*yield*/, this.
|
|
74
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
75
75
|
case 2:
|
|
76
76
|
depositResult = _a.sent();
|
|
77
77
|
path = "/cosmos/gov/v1beta1/params/tallying";
|
|
78
|
-
return [4 /*yield*/, this.
|
|
78
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
79
79
|
case 3:
|
|
80
80
|
tallyingResult = _a.sent();
|
|
81
81
|
return [2 /*return*/, {
|
|
@@ -94,7 +94,7 @@ var GovQueryClient = /** @class */ (function () {
|
|
|
94
94
|
switch (_a.label) {
|
|
95
95
|
case 0:
|
|
96
96
|
path = "/cosmos/gov/v1beta1/proposals/" + id;
|
|
97
|
-
return [4 /*yield*/, this.
|
|
97
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
98
98
|
case 1:
|
|
99
99
|
result = _a.sent();
|
|
100
100
|
return [2 /*return*/, result.data.proposal];
|
|
@@ -109,7 +109,7 @@ var GovQueryClient = /** @class */ (function () {
|
|
|
109
109
|
switch (_a.label) {
|
|
110
110
|
case 0:
|
|
111
111
|
path = "/cosmos/gov/v1beta1/proposals";
|
|
112
|
-
return [4 /*yield*/, this.
|
|
112
|
+
return [4 /*yield*/, this.axios.get(path, { params: { proposalStatus: status } })];
|
|
113
113
|
case 1:
|
|
114
114
|
result = _a.sent();
|
|
115
115
|
return [2 /*return*/, result.data.proposals];
|
|
@@ -124,7 +124,7 @@ var GovQueryClient = /** @class */ (function () {
|
|
|
124
124
|
switch (_a.label) {
|
|
125
125
|
case 0:
|
|
126
126
|
path = "/cosmos/gov/v1beta1/proposals";
|
|
127
|
-
return [4 /*yield*/, this.
|
|
127
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
128
128
|
case 1:
|
|
129
129
|
result = _a.sent();
|
|
130
130
|
return [2 /*return*/, result.data.proposals];
|
|
@@ -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,7 +77,7 @@ 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
82
|
queryGetUndelegationInfoFromValidator(address: string, validatorAddress: string): Promise<UndelegationInfo>;
|
|
83
83
|
queryGetDelegationInfoFromValidator(address: string, validatorAddress: string): Promise<DelegationInfo>;
|
|
@@ -43,10 +43,10 @@ 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
|
});
|
|
@@ -57,8 +57,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
57
57
|
return __generator(this, function (_a) {
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
60
|
-
path = "/cosmos/staking/v1beta1/validators
|
|
61
|
-
return [4 /*yield*/, this.
|
|
60
|
+
path = "/cosmos/staking/v1beta1/validators/" + validatorAddress + "/delegations/" + address + "/unbonding_delegation";
|
|
61
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
62
62
|
case 1:
|
|
63
63
|
result = _a.sent();
|
|
64
64
|
// If there is no data in the list, throw 404 exception.
|
|
@@ -74,8 +74,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
74
74
|
return __generator(this, function (_a) {
|
|
75
75
|
switch (_a.label) {
|
|
76
76
|
case 0:
|
|
77
|
-
path = "/cosmos/staking/v1beta1/validators
|
|
78
|
-
return [4 /*yield*/, this.
|
|
77
|
+
path = "/cosmos/staking/v1beta1/validators/" + validatorAddress + "/delegations/" + address;
|
|
78
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
79
79
|
case 1:
|
|
80
80
|
result = _a.sent();
|
|
81
81
|
return [2 /*return*/, result.data.delegation_response];
|
|
@@ -89,8 +89,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
89
89
|
return __generator(this, function (_a) {
|
|
90
90
|
switch (_a.label) {
|
|
91
91
|
case 0:
|
|
92
|
-
path = "/cosmos/staking/v1beta1/delegators
|
|
93
|
-
return [4 /*yield*/, this.
|
|
92
|
+
path = "/cosmos/staking/v1beta1/delegators/" + address + "/unbonding_delegations";
|
|
93
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
94
94
|
case 1:
|
|
95
95
|
result = _a.sent();
|
|
96
96
|
return [2 /*return*/, result.data.unbonding_responses];
|
|
@@ -104,8 +104,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
104
104
|
return __generator(this, function (_a) {
|
|
105
105
|
switch (_a.label) {
|
|
106
106
|
case 0:
|
|
107
|
-
path = "/cosmos/staking/v1beta1/delegators
|
|
108
|
-
return [4 /*yield*/, this.
|
|
107
|
+
path = "/cosmos/staking/v1beta1/delegators/" + address + "/redelegations";
|
|
108
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
109
109
|
case 1:
|
|
110
110
|
result = _a.sent();
|
|
111
111
|
return [2 /*return*/, result.data.redelegation_responses];
|
|
@@ -119,8 +119,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
119
119
|
return __generator(this, function (_a) {
|
|
120
120
|
switch (_a.label) {
|
|
121
121
|
case 0:
|
|
122
|
-
path = "/cosmos/staking/v1beta1/validators
|
|
123
|
-
return [4 /*yield*/, this.
|
|
122
|
+
path = "/cosmos/staking/v1beta1/validators/" + address + "/unbonding_delegations";
|
|
123
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
124
124
|
case 1:
|
|
125
125
|
result = _a.sent();
|
|
126
126
|
return [2 /*return*/, result.data.unbonding_responses];
|
|
@@ -134,8 +134,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
134
134
|
return __generator(this, function (_a) {
|
|
135
135
|
switch (_a.label) {
|
|
136
136
|
case 0:
|
|
137
|
-
path = "/cosmos/staking/v1beta1/validators
|
|
138
|
-
return [4 /*yield*/, this.
|
|
137
|
+
path = "/cosmos/staking/v1beta1/validators/" + address + "/delegations";
|
|
138
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
139
139
|
case 1:
|
|
140
140
|
result = _a.sent();
|
|
141
141
|
return [2 /*return*/, result.data.delegation_responses];
|
|
@@ -149,8 +149,8 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
149
149
|
return __generator(this, function (_a) {
|
|
150
150
|
switch (_a.label) {
|
|
151
151
|
case 0:
|
|
152
|
-
path = "/cosmos/staking/v1beta1/delegations
|
|
153
|
-
return [4 /*yield*/, this.
|
|
152
|
+
path = "/cosmos/staking/v1beta1/delegations/" + address;
|
|
153
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
154
154
|
case 1:
|
|
155
155
|
result = _a.sent();
|
|
156
156
|
return [2 /*return*/, result.data.delegation_responses];
|
|
@@ -165,7 +165,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
165
165
|
switch (_a.label) {
|
|
166
166
|
case 0:
|
|
167
167
|
path = "/cosmos/staking/v1beta1/params";
|
|
168
|
-
return [4 /*yield*/, this.
|
|
168
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
169
169
|
case 1:
|
|
170
170
|
result = _a.sent();
|
|
171
171
|
return [2 /*return*/, result.data.params];
|
|
@@ -180,7 +180,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
180
180
|
switch (_a.label) {
|
|
181
181
|
case 0:
|
|
182
182
|
path = "/cosmos/staking/v1beta1/pool";
|
|
183
|
-
return [4 /*yield*/, this.
|
|
183
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
184
184
|
case 1:
|
|
185
185
|
result = _a.sent();
|
|
186
186
|
return [2 /*return*/, result.data.pool];
|
|
@@ -195,7 +195,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
195
195
|
switch (_a.label) {
|
|
196
196
|
case 0:
|
|
197
197
|
path = "/cosmos/staking/v1beta1/validators/" + valoperAddress;
|
|
198
|
-
return [4 /*yield*/, this.
|
|
198
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
199
199
|
case 1:
|
|
200
200
|
result = _a.sent();
|
|
201
201
|
return [2 /*return*/, result.data.validator];
|
|
@@ -210,7 +210,7 @@ var StakingQueryClient = /** @class */ (function () {
|
|
|
210
210
|
switch (_a.label) {
|
|
211
211
|
case 0:
|
|
212
212
|
path = "/cosmos/staking/v1beta1/validators";
|
|
213
|
-
return [4 /*yield*/, this.
|
|
213
|
+
return [4 /*yield*/, this.axios.get(path)];
|
|
214
214
|
case 1:
|
|
215
215
|
result = _a.sent();
|
|
216
216
|
return [2 /*return*/, result.data.validators];
|