@airgap/cosmos 0.13.45-beta.3 → 0.13.45-beta.4
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/package.json +6 -6
- package/v0/index.js +8 -8
- package/v0/index.js.map +1 -1
- package/v0/protocol/CosmosAddress.js +16 -15
- package/v0/protocol/CosmosAddress.js.map +1 -1
- package/v0/protocol/CosmosCoin.js +24 -23
- package/v0/protocol/CosmosCoin.js.map +1 -1
- package/v0/protocol/CosmosCryptoClient.js +82 -19
- package/v0/protocol/CosmosCryptoClient.js.map +1 -1
- package/v0/protocol/CosmosFee.js +17 -16
- package/v0/protocol/CosmosFee.js.map +1 -1
- package/v0/protocol/CosmosNodeClient.js +365 -173
- package/v0/protocol/CosmosNodeClient.js.map +1 -1
- package/v0/protocol/CosmosProtocol.d.ts +1 -0
- package/v0/protocol/CosmosProtocol.js +1094 -577
- package/v0/protocol/CosmosProtocol.js.map +1 -1
- package/v0/protocol/CosmosProtocolOptions.js +98 -25
- package/v0/protocol/CosmosProtocolOptions.js.map +1 -1
- package/v0/protocol/CosmosTransaction.js +39 -37
- package/v0/protocol/CosmosTransaction.js.map +1 -1
- package/v0/protocol/CosmosTypes.js +1 -1
- package/v0/protocol/CosmosTypes.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js +27 -24
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosMessage.js +12 -11
- package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosSendMessage.js +41 -31
- package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +21 -20
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +77 -25
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v1/block-explorer/MintscanBlockExplorer.js +61 -12
- package/v1/block-explorer/MintscanBlockExplorer.js.map +1 -1
- package/v1/index.js +3 -3
- package/v1/index.js.map +1 -1
- package/v1/module/CosmosModule.d.ts +1 -1
- package/v1/module/CosmosModule.js +95 -37
- package/v1/module/CosmosModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/protocol/CosmosProtocol.d.ts +1 -1
- package/v1/protocol/CosmosProtocol.js +113 -35
- package/v1/protocol/CosmosProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +124 -57
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
|
@@ -1,190 +1,382 @@
|
|
|
1
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
|
+
};
|
|
2
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
40
|
};
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
42
|
exports.CosmosNodeClient = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
43
|
+
var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
|
|
44
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
45
|
+
var CosmosCoin_1 = require("./CosmosCoin");
|
|
46
|
+
var CosmosNodeClient = /** @class */ (function () {
|
|
47
|
+
function CosmosNodeClient(baseURL, useCORSProxy) {
|
|
48
|
+
if (useCORSProxy === void 0) { useCORSProxy = false; }
|
|
12
49
|
this.baseURL = baseURL;
|
|
13
50
|
this.useCORSProxy = useCORSProxy;
|
|
14
51
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const response = await index_1.default.get(this.url(`/node_info`));
|
|
42
|
-
const nodeInfo = response.data.node_info;
|
|
43
|
-
return nodeInfo;
|
|
44
|
-
}
|
|
45
|
-
async broadcastSignedTransaction(tx_bytes) {
|
|
46
|
-
const response = await index_1.default.post(this.url(`/cosmos/tx/v1beta1/txs`), {
|
|
47
|
-
tx_bytes,
|
|
48
|
-
mode: 'BROADCAST_MODE_ASYNC'
|
|
49
|
-
}, {
|
|
50
|
-
headers: {
|
|
51
|
-
'Content-type': 'application/json'
|
|
52
|
-
}
|
|
52
|
+
CosmosNodeClient.prototype.fetchBalance = function (address, totalBalance) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var response, data, availableBalance, totalBalance_1;
|
|
55
|
+
return __generator(this, function (_a) {
|
|
56
|
+
switch (_a.label) {
|
|
57
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/bank/balances/".concat(address)))];
|
|
58
|
+
case 1:
|
|
59
|
+
response = _a.sent();
|
|
60
|
+
data = response.data.result;
|
|
61
|
+
if (!(data.length > 0)) return [3 /*break*/, 5];
|
|
62
|
+
availableBalance = CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(data));
|
|
63
|
+
if (!totalBalance) return [3 /*break*/, 3];
|
|
64
|
+
return [4 /*yield*/, Promise.all([
|
|
65
|
+
this.fetchTotalReward(address),
|
|
66
|
+
this.fetchTotalUnbondingAmount(address),
|
|
67
|
+
this.fetchTotalDelegatedAmount(address)
|
|
68
|
+
])];
|
|
69
|
+
case 2:
|
|
70
|
+
totalBalance_1 = (_a.sent()).reduce(function (current, next) { return current.plus(next); }, new bignumber_1.default(availableBalance));
|
|
71
|
+
return [2 /*return*/, totalBalance_1.decimalPlaces(0, bignumber_1.default.ROUND_FLOOR)];
|
|
72
|
+
case 3: return [2 /*return*/, new bignumber_1.default(availableBalance).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR)];
|
|
73
|
+
case 4: return [3 /*break*/, 6];
|
|
74
|
+
case 5: return [2 /*return*/, new bignumber_1.default(0)];
|
|
75
|
+
case 6: return [2 /*return*/];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
53
78
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return filterEmpty ? delegations.filter((delegation) => new bignumber_1.default(delegation.balance.amount).gt(0)) : delegations;
|
|
68
|
-
}
|
|
69
|
-
async fetchTotalDelegatedAmount(address) {
|
|
70
|
-
const delegations = await this.fetchDelegations(address);
|
|
71
|
-
const balances = delegations.map((delegation) => delegation.balance);
|
|
72
|
-
return CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(balances)).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
|
|
73
|
-
}
|
|
74
|
-
async fetchValidator(address) {
|
|
75
|
-
const response = await index_1.default.get(this.url(`/staking/validators/${address}`));
|
|
76
|
-
const validator = response.data.result;
|
|
77
|
-
return validator;
|
|
78
|
-
}
|
|
79
|
-
async fetchValidators() {
|
|
80
|
-
const response = await index_1.default.get(this.url('/staking/validators'));
|
|
81
|
-
const validators = response.data.result;
|
|
82
|
-
return validators;
|
|
83
|
-
}
|
|
84
|
-
async fetchSelfDelegation(validatorAddress) {
|
|
85
|
-
const validatorInfo = await index_1.default.get(this.url(`/distribution/validators/${validatorAddress}`));
|
|
86
|
-
const operatorAddress = validatorInfo.data.result.operator_address;
|
|
87
|
-
const response = await index_1.default.get(this.url(`/staking/delegators/${operatorAddress}/delegations/${validatorAddress}`));
|
|
88
|
-
const delegation = response.data.result;
|
|
89
|
-
return delegation;
|
|
90
|
-
}
|
|
91
|
-
async fetchUnbondingDelegations(delegatorAddress) {
|
|
92
|
-
const response = await index_1.default.get(this.url(`/staking/delegators/${delegatorAddress}/unbonding_delegations`));
|
|
93
|
-
const unbondingDelegations = response.data.result;
|
|
94
|
-
return unbondingDelegations;
|
|
95
|
-
}
|
|
96
|
-
async fetchTotalUnbondingAmount(address) {
|
|
97
|
-
const unbondingDelegations = await this.fetchUnbondingDelegations(address);
|
|
98
|
-
if (unbondingDelegations) {
|
|
99
|
-
const unbondings = unbondingDelegations.map((delegation) => delegation.entries).reduce((current, next) => current.concat(next), []);
|
|
100
|
-
return unbondings
|
|
101
|
-
.reduce((current, next) => current.plus(new bignumber_1.default(next.balance)), new bignumber_1.default(0))
|
|
102
|
-
.decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
|
|
103
|
-
}
|
|
104
|
-
return new bignumber_1.default(0);
|
|
105
|
-
}
|
|
106
|
-
async fetchRewardDetails(delegatorAddress) {
|
|
107
|
-
return index_1.default.get(this.url(`/distribution/delegators/${delegatorAddress}/rewards`))
|
|
108
|
-
.then((response) => (response.data.result.rewards ?? []))
|
|
109
|
-
.catch(() => []);
|
|
110
|
-
}
|
|
111
|
-
async fetchTotalReward(delegatorAddress) {
|
|
112
|
-
const totalRewards = await index_1.default.get(this.url(`/distribution/delegators/${delegatorAddress}/rewards`))
|
|
113
|
-
.then((response) => response.data.result.total)
|
|
114
|
-
.catch(() => []);
|
|
115
|
-
if (totalRewards?.length > 0) {
|
|
116
|
-
return CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(totalRewards)).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
|
|
117
|
-
}
|
|
118
|
-
return new bignumber_1.default(0);
|
|
119
|
-
}
|
|
120
|
-
async fetchRewardForDelegation(delegatorAddress, validatorAddress) {
|
|
121
|
-
const totalRewards = await index_1.default.get(this.url(`/distribution/delegators/${delegatorAddress}/rewards/${validatorAddress}`))
|
|
122
|
-
.then((response) => response.data.result)
|
|
123
|
-
.catch(() => []);
|
|
124
|
-
if (totalRewards?.length > 0) {
|
|
125
|
-
return CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(totalRewards)).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
|
|
126
|
-
}
|
|
127
|
-
return new bignumber_1.default(0);
|
|
128
|
-
}
|
|
129
|
-
async withdrawAllDelegationRewards(delegatorAddress, chainID, accountNumber, sequence, gas, fee, memo, simulate = false) {
|
|
130
|
-
const body = {
|
|
131
|
-
base_req: {
|
|
132
|
-
from: delegatorAddress,
|
|
133
|
-
memo,
|
|
134
|
-
chain_id: chainID,
|
|
135
|
-
account_number: accountNumber,
|
|
136
|
-
sequence,
|
|
137
|
-
gas: gas.toFixed(),
|
|
138
|
-
gas_adjustment: '1.2',
|
|
139
|
-
fees: [
|
|
140
|
-
{
|
|
141
|
-
denom: 'uatom',
|
|
142
|
-
amount: fee.toFixed()
|
|
143
|
-
}
|
|
144
|
-
],
|
|
145
|
-
simulate
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
const response = await index_1.default.post(this.url(`/distribution/delegators/${delegatorAddress}/rewards`), JSON.stringify(body), {
|
|
149
|
-
headers: {
|
|
150
|
-
'Content-type': 'application/json'
|
|
151
|
-
}
|
|
79
|
+
};
|
|
80
|
+
CosmosNodeClient.prototype.fetchSendTransactionsFor = function (address, limit, offset, isSender) {
|
|
81
|
+
if (isSender === void 0) { isSender = true; }
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var response;
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
switch (_a.label) {
|
|
86
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/cosmos/tx/v1beta1/txs?events=".concat(isSender ? 'transfer.sender' : 'transfer.recipient', "='").concat(address, "'&pagination.limit=").concat(limit, "&pagination.offset=").concat(offset, "&orderBy=ORDER_BY_DESC")))];
|
|
87
|
+
case 1:
|
|
88
|
+
response = _a.sent();
|
|
89
|
+
return [2 /*return*/, response.data];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
152
92
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
denom: 'uatom',
|
|
168
|
-
amount: fee.toFixed()
|
|
169
|
-
}
|
|
170
|
-
],
|
|
171
|
-
simulate
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
const response = await index_1.default.post(this.url(`/distribution/delegators/${delegatorAddress}/rewards/${validatorAdress}`), JSON.stringify(body), {
|
|
175
|
-
headers: {
|
|
176
|
-
'Content-type': 'application/json'
|
|
177
|
-
}
|
|
93
|
+
};
|
|
94
|
+
CosmosNodeClient.prototype.fetchNodeInfo = function () {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var response, nodeInfo;
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/node_info"))];
|
|
100
|
+
case 1:
|
|
101
|
+
response = _a.sent();
|
|
102
|
+
nodeInfo = response.data.node_info;
|
|
103
|
+
return [2 /*return*/, nodeInfo];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
178
106
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
107
|
+
};
|
|
108
|
+
CosmosNodeClient.prototype.broadcastSignedTransaction = function (tx_bytes) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var response;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4 /*yield*/, index_1.default.post(this.url("/cosmos/tx/v1beta1/txs"), {
|
|
114
|
+
tx_bytes: tx_bytes,
|
|
115
|
+
mode: 'BROADCAST_MODE_ASYNC'
|
|
116
|
+
}, {
|
|
117
|
+
headers: {
|
|
118
|
+
'Content-type': 'application/json'
|
|
119
|
+
}
|
|
120
|
+
})];
|
|
121
|
+
case 1:
|
|
122
|
+
response = _a.sent();
|
|
123
|
+
return [2 /*return*/, response.data.tx_response.txhash];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
CosmosNodeClient.prototype.fetchAccount = function (address) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var response, account;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/auth/accounts/".concat(address)))];
|
|
134
|
+
case 1:
|
|
135
|
+
response = _a.sent();
|
|
136
|
+
account = response.data.result;
|
|
137
|
+
return [2 /*return*/, account];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
CosmosNodeClient.prototype.fetchDelegations = function (address, filterEmpty) {
|
|
143
|
+
if (filterEmpty === void 0) { filterEmpty = true; }
|
|
144
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
+
var response, delegations;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
switch (_a.label) {
|
|
148
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/staking/delegators/".concat(address, "/delegations")))];
|
|
149
|
+
case 1:
|
|
150
|
+
response = _a.sent();
|
|
151
|
+
if (response.data === null) {
|
|
152
|
+
return [2 /*return*/, []];
|
|
153
|
+
}
|
|
154
|
+
delegations = response.data.result;
|
|
155
|
+
return [2 /*return*/, filterEmpty ? delegations.filter(function (delegation) { return new bignumber_1.default(delegation.balance.amount).gt(0); }) : delegations];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
CosmosNodeClient.prototype.fetchTotalDelegatedAmount = function (address) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
var delegations, balances;
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
switch (_a.label) {
|
|
165
|
+
case 0: return [4 /*yield*/, this.fetchDelegations(address)];
|
|
166
|
+
case 1:
|
|
167
|
+
delegations = _a.sent();
|
|
168
|
+
balances = delegations.map(function (delegation) { return delegation.balance; });
|
|
169
|
+
return [2 /*return*/, CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(balances)).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR)];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
CosmosNodeClient.prototype.fetchValidator = function (address) {
|
|
175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
+
var response, validator;
|
|
177
|
+
return __generator(this, function (_a) {
|
|
178
|
+
switch (_a.label) {
|
|
179
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/staking/validators/".concat(address)))];
|
|
180
|
+
case 1:
|
|
181
|
+
response = _a.sent();
|
|
182
|
+
validator = response.data.result;
|
|
183
|
+
return [2 /*return*/, validator];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
CosmosNodeClient.prototype.fetchValidators = function () {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
+
var response, validators;
|
|
191
|
+
return __generator(this, function (_a) {
|
|
192
|
+
switch (_a.label) {
|
|
193
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url('/staking/validators'))];
|
|
194
|
+
case 1:
|
|
195
|
+
response = _a.sent();
|
|
196
|
+
validators = response.data.result;
|
|
197
|
+
return [2 /*return*/, validators];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
CosmosNodeClient.prototype.fetchSelfDelegation = function (validatorAddress) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
+
var validatorInfo, operatorAddress, response, delegation;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
switch (_a.label) {
|
|
207
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/distribution/validators/".concat(validatorAddress)))];
|
|
208
|
+
case 1:
|
|
209
|
+
validatorInfo = _a.sent();
|
|
210
|
+
operatorAddress = validatorInfo.data.result.operator_address;
|
|
211
|
+
return [4 /*yield*/, index_1.default.get(this.url("/staking/delegators/".concat(operatorAddress, "/delegations/").concat(validatorAddress)))];
|
|
212
|
+
case 2:
|
|
213
|
+
response = _a.sent();
|
|
214
|
+
delegation = response.data.result;
|
|
215
|
+
return [2 /*return*/, delegation];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
CosmosNodeClient.prototype.fetchUnbondingDelegations = function (delegatorAddress) {
|
|
221
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
222
|
+
var response, unbondingDelegations;
|
|
223
|
+
return __generator(this, function (_a) {
|
|
224
|
+
switch (_a.label) {
|
|
225
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/staking/delegators/".concat(delegatorAddress, "/unbonding_delegations")))];
|
|
226
|
+
case 1:
|
|
227
|
+
response = _a.sent();
|
|
228
|
+
unbondingDelegations = response.data.result;
|
|
229
|
+
return [2 /*return*/, unbondingDelegations];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
CosmosNodeClient.prototype.fetchTotalUnbondingAmount = function (address) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
236
|
+
var unbondingDelegations, unbondings;
|
|
237
|
+
return __generator(this, function (_a) {
|
|
238
|
+
switch (_a.label) {
|
|
239
|
+
case 0: return [4 /*yield*/, this.fetchUnbondingDelegations(address)];
|
|
240
|
+
case 1:
|
|
241
|
+
unbondingDelegations = _a.sent();
|
|
242
|
+
if (unbondingDelegations) {
|
|
243
|
+
unbondings = unbondingDelegations.map(function (delegation) { return delegation.entries; }).reduce(function (current, next) { return current.concat(next); }, []);
|
|
244
|
+
return [2 /*return*/, unbondings
|
|
245
|
+
.reduce(function (current, next) { return current.plus(new bignumber_1.default(next.balance)); }, new bignumber_1.default(0))
|
|
246
|
+
.decimalPlaces(0, bignumber_1.default.ROUND_FLOOR)];
|
|
247
|
+
}
|
|
248
|
+
return [2 /*return*/, new bignumber_1.default(0)];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
CosmosNodeClient.prototype.fetchRewardDetails = function (delegatorAddress) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
+
return __generator(this, function (_a) {
|
|
256
|
+
return [2 /*return*/, index_1.default.get(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards")))
|
|
257
|
+
.then(function (response) { var _a; return ((_a = response.data.result.rewards) !== null && _a !== void 0 ? _a : []); })
|
|
258
|
+
.catch(function () { return []; })];
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
CosmosNodeClient.prototype.fetchTotalReward = function (delegatorAddress) {
|
|
263
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
264
|
+
var totalRewards;
|
|
265
|
+
return __generator(this, function (_a) {
|
|
266
|
+
switch (_a.label) {
|
|
267
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards")))
|
|
268
|
+
.then(function (response) { return response.data.result.total; })
|
|
269
|
+
.catch(function () { return []; })];
|
|
270
|
+
case 1:
|
|
271
|
+
totalRewards = _a.sent();
|
|
272
|
+
if ((totalRewards === null || totalRewards === void 0 ? void 0 : totalRewards.length) > 0) {
|
|
273
|
+
return [2 /*return*/, CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(totalRewards)).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR)];
|
|
274
|
+
}
|
|
275
|
+
return [2 /*return*/, new bignumber_1.default(0)];
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
CosmosNodeClient.prototype.fetchRewardForDelegation = function (delegatorAddress, validatorAddress) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
+
var totalRewards;
|
|
283
|
+
return __generator(this, function (_a) {
|
|
284
|
+
switch (_a.label) {
|
|
285
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards/").concat(validatorAddress)))
|
|
286
|
+
.then(function (response) { return response.data.result; })
|
|
287
|
+
.catch(function () { return []; })];
|
|
288
|
+
case 1:
|
|
289
|
+
totalRewards = _a.sent();
|
|
290
|
+
if ((totalRewards === null || totalRewards === void 0 ? void 0 : totalRewards.length) > 0) {
|
|
291
|
+
return [2 /*return*/, CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(totalRewards)).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR)];
|
|
292
|
+
}
|
|
293
|
+
return [2 /*return*/, new bignumber_1.default(0)];
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
CosmosNodeClient.prototype.withdrawAllDelegationRewards = function (delegatorAddress, chainID, accountNumber, sequence, gas, fee, memo, simulate) {
|
|
299
|
+
if (simulate === void 0) { simulate = false; }
|
|
300
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
301
|
+
var body, response;
|
|
302
|
+
return __generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
304
|
+
case 0:
|
|
305
|
+
body = {
|
|
306
|
+
base_req: {
|
|
307
|
+
from: delegatorAddress,
|
|
308
|
+
memo: memo,
|
|
309
|
+
chain_id: chainID,
|
|
310
|
+
account_number: accountNumber,
|
|
311
|
+
sequence: sequence,
|
|
312
|
+
gas: gas.toFixed(),
|
|
313
|
+
gas_adjustment: '1.2',
|
|
314
|
+
fees: [
|
|
315
|
+
{
|
|
316
|
+
denom: 'uatom',
|
|
317
|
+
amount: fee.toFixed()
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
simulate: simulate
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
return [4 /*yield*/, index_1.default.post(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards")), JSON.stringify(body), {
|
|
324
|
+
headers: {
|
|
325
|
+
'Content-type': 'application/json'
|
|
326
|
+
}
|
|
327
|
+
})];
|
|
328
|
+
case 1:
|
|
329
|
+
response = _a.sent();
|
|
330
|
+
return [2 /*return*/, response.data.hash];
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
CosmosNodeClient.prototype.withdrawDelegationRewards = function (delegatorAddress, validatorAdress, chainID, accountNumber, sequence, gas, fee, memo, simulate) {
|
|
336
|
+
if (simulate === void 0) { simulate = false; }
|
|
337
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
338
|
+
var body, response;
|
|
339
|
+
return __generator(this, function (_a) {
|
|
340
|
+
switch (_a.label) {
|
|
341
|
+
case 0:
|
|
342
|
+
body = {
|
|
343
|
+
base_req: {
|
|
344
|
+
from: delegatorAddress,
|
|
345
|
+
memo: memo,
|
|
346
|
+
chain_id: chainID,
|
|
347
|
+
account_number: accountNumber,
|
|
348
|
+
sequence: sequence,
|
|
349
|
+
gas: gas.toFixed(),
|
|
350
|
+
gas_adjustment: '1.2',
|
|
351
|
+
fees: [
|
|
352
|
+
{
|
|
353
|
+
denom: 'uatom',
|
|
354
|
+
amount: fee.toFixed()
|
|
355
|
+
}
|
|
356
|
+
],
|
|
357
|
+
simulate: simulate
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
return [4 /*yield*/, index_1.default.post(this.url("/distribution/delegators/".concat(delegatorAddress, "/rewards/").concat(validatorAdress)), JSON.stringify(body), {
|
|
361
|
+
headers: {
|
|
362
|
+
'Content-type': 'application/json'
|
|
363
|
+
}
|
|
364
|
+
})];
|
|
365
|
+
case 1:
|
|
366
|
+
response = _a.sent();
|
|
367
|
+
return [2 /*return*/, response.data.hash];
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
CosmosNodeClient.prototype.url = function (path) {
|
|
373
|
+
var result = "".concat(this.baseURL).concat(path);
|
|
183
374
|
if (this.useCORSProxy) {
|
|
184
|
-
result =
|
|
375
|
+
result = "https://cors-proxy.airgap.prod.gke.papers.tech/proxy?url=".concat(encodeURI(result));
|
|
185
376
|
}
|
|
186
377
|
return result;
|
|
187
|
-
}
|
|
188
|
-
|
|
378
|
+
};
|
|
379
|
+
return CosmosNodeClient;
|
|
380
|
+
}());
|
|
189
381
|
exports.CosmosNodeClient = CosmosNodeClient;
|
|
190
382
|
//# sourceMappingURL=CosmosNodeClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosNodeClient.js","sourceRoot":"","sources":["../../../src/v0/protocol/CosmosNodeClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CosmosNodeClient.js","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AC,GAAG,CAAC,mCAA4B,gBAAgB,sBAAY,eAAe,CAAE,CAAC,EACnF,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EACpB;gCACE,OAAO,EAAE;oCACP,cAAc,EAAE,kBAAkB;iCACnC;6BACF,CACF,EAAA;;wBARK,QAAQ,GAAG,SAQhB;wBAED,sBAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAA;;;;KAC1B;IAEO,8BAAG,GAAX,UAAY,IAAY;QACtB,IAAI,MAAM,GAAG,UAAG,IAAI,CAAC,OAAO,SAAG,IAAI,CAAE,CAAA;QACrC,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,MAAM,GAAG,mEAA4D,SAAS,CAAC,MAAM,CAAC,CAAE,CAAA;SACzF;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IACH,uBAAC;AAAD,CAAC,AAxPD,IAwPC;AAxPY,4CAAgB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { KeyPair } from '@airgap/coinlib-core/data/KeyPair';
|
|
2
3
|
import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
3
4
|
import { AirGapTransactionStatus, IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|