@airgap/cosmos 0.13.45-beta.1 → 0.13.45-beta.3
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 +15 -16
- package/v0/protocol/CosmosAddress.js.map +1 -1
- package/v0/protocol/CosmosCoin.js +23 -24
- package/v0/protocol/CosmosCoin.js.map +1 -1
- package/v0/protocol/CosmosCryptoClient.js +19 -82
- package/v0/protocol/CosmosCryptoClient.js.map +1 -1
- package/v0/protocol/CosmosFee.js +16 -17
- package/v0/protocol/CosmosFee.js.map +1 -1
- package/v0/protocol/CosmosNodeClient.js +173 -365
- package/v0/protocol/CosmosNodeClient.js.map +1 -1
- package/v0/protocol/CosmosProtocol.d.ts +0 -1
- package/v0/protocol/CosmosProtocol.js +577 -1094
- package/v0/protocol/CosmosProtocol.js.map +1 -1
- package/v0/protocol/CosmosProtocolOptions.js +25 -98
- package/v0/protocol/CosmosProtocolOptions.js.map +1 -1
- package/v0/protocol/CosmosTransaction.js +37 -39
- 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 +24 -27
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosMessage.js +11 -12
- package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosSendMessage.js +31 -41
- package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +20 -21
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +25 -77
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v1/block-explorer/MintscanBlockExplorer.js +12 -61
- 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 +37 -95
- package/v1/module/CosmosModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/protocol/CosmosProtocol.d.ts +1 -1
- package/v1/protocol/CosmosProtocol.js +35 -113
- package/v1/protocol/CosmosProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +57 -124
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
|
@@ -1,382 +1,190 @@
|
|
|
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
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
41
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.CosmosNodeClient = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (useCORSProxy === void 0) { useCORSProxy = false; }
|
|
7
|
+
const index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
|
|
8
|
+
const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
9
|
+
const CosmosCoin_1 = require("./CosmosCoin");
|
|
10
|
+
class CosmosNodeClient {
|
|
11
|
+
constructor(baseURL, useCORSProxy = false) {
|
|
49
12
|
this.baseURL = baseURL;
|
|
50
13
|
this.useCORSProxy = useCORSProxy;
|
|
51
14
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
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
|
-
});
|
|
106
|
-
});
|
|
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
|
-
});
|
|
15
|
+
async fetchBalance(address, totalBalance) {
|
|
16
|
+
const response = await index_1.default.get(this.url(`/bank/balances/${address}`));
|
|
17
|
+
const data = response.data.result;
|
|
18
|
+
if (data.length > 0) {
|
|
19
|
+
const availableBalance = CosmosCoin_1.CosmosCoin.sum(CosmosCoin_1.CosmosCoin.fromCoins(data));
|
|
20
|
+
if (totalBalance) {
|
|
21
|
+
const totalBalance = (await Promise.all([
|
|
22
|
+
this.fetchTotalReward(address),
|
|
23
|
+
this.fetchTotalUnbondingAmount(address),
|
|
24
|
+
this.fetchTotalDelegatedAmount(address)
|
|
25
|
+
])).reduce((current, next) => current.plus(next), new bignumber_1.default(availableBalance));
|
|
26
|
+
return totalBalance.decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return new bignumber_1.default(availableBalance).decimalPlaces(0, bignumber_1.default.ROUND_FLOOR);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return new bignumber_1.default(0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async fetchSendTransactionsFor(address, limit, offset, isSender = true) {
|
|
37
|
+
const response = await index_1.default.get(this.url(`/cosmos/tx/v1beta1/txs?events=${isSender ? 'transfer.sender' : 'transfer.recipient'}='${address}'&pagination.limit=${limit}&pagination.offset=${offset}&orderBy=ORDER_BY_DESC`));
|
|
38
|
+
return response.data;
|
|
39
|
+
}
|
|
40
|
+
async fetchNodeInfo() {
|
|
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
|
+
}
|
|
296
53
|
});
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
54
|
+
return response.data.tx_response.txhash;
|
|
55
|
+
}
|
|
56
|
+
async fetchAccount(address) {
|
|
57
|
+
const response = await index_1.default.get(this.url(`/auth/accounts/${address}`));
|
|
58
|
+
const account = response.data.result;
|
|
59
|
+
return account;
|
|
60
|
+
}
|
|
61
|
+
async fetchDelegations(address, filterEmpty = true) {
|
|
62
|
+
const response = await index_1.default.get(this.url(`/staking/delegators/${address}/delegations`));
|
|
63
|
+
if (response.data === null) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
const delegations = response.data.result;
|
|
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
|
+
}
|
|
333
152
|
});
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
});
|
|
153
|
+
return response.data.hash;
|
|
154
|
+
}
|
|
155
|
+
async withdrawDelegationRewards(delegatorAddress, validatorAdress, chainID, accountNumber, sequence, gas, fee, memo, simulate = false) {
|
|
156
|
+
const body = {
|
|
157
|
+
base_req: {
|
|
158
|
+
from: delegatorAddress,
|
|
159
|
+
memo,
|
|
160
|
+
chain_id: chainID,
|
|
161
|
+
account_number: accountNumber,
|
|
162
|
+
sequence,
|
|
163
|
+
gas: gas.toFixed(),
|
|
164
|
+
gas_adjustment: '1.2',
|
|
165
|
+
fees: [
|
|
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
|
+
}
|
|
370
178
|
});
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
179
|
+
return response.data.hash;
|
|
180
|
+
}
|
|
181
|
+
url(path) {
|
|
182
|
+
let result = `${this.baseURL}${path}`;
|
|
374
183
|
if (this.useCORSProxy) {
|
|
375
|
-
result =
|
|
184
|
+
result = `https://cors-proxy.airgap.prod.gke.papers.tech/proxy?url=${encodeURI(result)}`;
|
|
376
185
|
}
|
|
377
186
|
return result;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
}());
|
|
187
|
+
}
|
|
188
|
+
}
|
|
381
189
|
exports.CosmosNodeClient = CosmosNodeClient;
|
|
382
190
|
//# 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","sourceRoot":"","sources":["../../../src/v0/protocol/CosmosNodeClient.ts"],"names":[],"mappings":";;;;;;AAAA,qGAA+F;AAC/F,mHAA0F;AAC1F,6CAAyC;AAazC,MAAa,gBAAgB;IAC3B,YAA4B,OAAe,EAAS,eAAwB,KAAK;QAArD,YAAO,GAAP,OAAO,CAAQ;QAAS,iBAAY,GAAZ,YAAY,CAAiB;IAAG,CAAC;IAE9E,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,YAAsB;QAC/D,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC,CAAA;QACvE,MAAM,IAAI,GAAwB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAA;QACtD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,gBAAgB,GAAG,uBAAU,CAAC,GAAG,CAAC,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;YACnE,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,YAAY,GAAG,CACnB,MAAM,OAAO,CAAC,GAAG,CAAC;oBAChB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;oBAC9B,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC;oBACvC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC;iBACxC,CAAC,CACH,C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,CAAC,IAAI,CAAC,EACpB;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAA;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAA;IAC3B,CAAC;IAEO,GAAG,CAAC,IAAY;QACtB,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAA;QACrC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,MAAM,GAAG,4DAA4D,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;QAC1F,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAxPD,4CAwPC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { KeyPair } from '@airgap/coinlib-core/data/KeyPair';
|
|
3
2
|
import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
4
3
|
import { AirGapTransactionStatus, IAirGapTransaction } from '@airgap/coinlib-core/interfaces/IAirGapTransaction';
|