@airgap/polkadot 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 +4 -4
- package/v0/index.js +6 -6
- package/v0/index.js.map +1 -1
- package/v0/protocol/kusama/KusamaProtocol.js +22 -41
- package/v0/protocol/kusama/KusamaProtocol.js.map +1 -1
- package/v0/protocol/kusama/KusamaProtocolOptions.js +33 -70
- package/v0/protocol/kusama/KusamaProtocolOptions.js.map +1 -1
- package/v0/protocol/polkadot/PolkadotProtocol.js +23 -42
- package/v0/protocol/polkadot/PolkadotProtocol.js.map +1 -1
- package/v0/protocol/polkadot/PolkadotProtocolOptions.js +33 -70
- package/v0/protocol/polkadot/PolkadotProtocolOptions.js.map +1 -1
- package/v1/controller/PolkadotAccountController.js +373 -648
- package/v1/controller/PolkadotAccountController.js.map +1 -1
- package/v1/controller/PolkadotTransactionController.js +3 -23
- package/v1/controller/PolkadotTransactionController.js.map +1 -1
- package/v1/data/staking/PolkadotActiveEraInfo.js +10 -11
- package/v1/data/staking/PolkadotActiveEraInfo.js.map +1 -1
- package/v1/data/staking/PolkadotEraRewardPoints.js +10 -13
- package/v1/data/staking/PolkadotEraRewardPoints.js.map +1 -1
- package/v1/data/staking/PolkadotExposure.js +11 -14
- package/v1/data/staking/PolkadotExposure.js.map +1 -1
- package/v1/data/staking/PolkadotNominationStatus.js +1 -1
- package/v1/data/staking/PolkadotNominationStatus.js.map +1 -1
- package/v1/data/staking/PolkadotNominations.js +11 -12
- package/v1/data/staking/PolkadotNominations.js.map +1 -1
- package/v1/data/staking/PolkadotNominatorDetails.d.ts +1 -1
- package/v1/data/staking/PolkadotPayee.js +1 -1
- package/v1/data/staking/PolkadotPayee.js.map +1 -1
- package/v1/data/staking/PolkadotSlashingSpans.js +12 -13
- package/v1/data/staking/PolkadotSlashingSpans.js.map +1 -1
- package/v1/data/staking/PolkadotStakingActionType.js +1 -1
- package/v1/data/staking/PolkadotStakingActionType.js.map +1 -1
- package/v1/data/staking/PolkadotStakingLedger.js +13 -16
- package/v1/data/staking/PolkadotStakingLedger.js.map +1 -1
- package/v1/data/staking/PolkadotValidatorDetails.d.ts +1 -1
- package/v1/data/staking/PolkadotValidatorPrefs.js +9 -10
- package/v1/data/staking/PolkadotValidatorPrefs.js.map +1 -1
- package/v1/data/transaction/method/args.js +146 -271
- package/v1/data/transaction/method/args.js.map +1 -1
- package/v1/data/transaction/transaction.js +11 -22
- package/v1/data/transaction/transaction.js.map +1 -1
- package/v1/index.js +6 -6
- package/v1/index.js.map +1 -1
- package/v1/module/PolkadotModule.d.ts +1 -1
- package/v1/module/PolkadotModule.js +40 -98
- package/v1/module/PolkadotModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/node/PolkadotNodeClient.js +101 -284
- package/v1/node/PolkadotNodeClient.js.map +1 -1
- package/v1/protocol/KusamaProtocol.js +28 -54
- package/v1/protocol/KusamaProtocol.js.map +1 -1
- package/v1/protocol/PolkadotBaseProtocol.js +409 -701
- package/v1/protocol/PolkadotBaseProtocol.js.map +1 -1
- package/v1/protocol/PolkadotProtocol.js +20 -51
- package/v1/protocol/PolkadotProtocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +5 -6
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +75 -154
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +3 -23
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +1 -1
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/configuration.d.ts +1 -1
- package/v1/types/crypto.d.ts +1 -1
- package/v1/types/protocol.d.ts +2 -2
|
@@ -1,292 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.CONSTANTS = exports.CALLS = exports.STORAGE_ENTRIES = exports.PolkadotNodeClient = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_this.createCallEndpointEntry('rebond', 'Staking', 'rebond')
|
|
4
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
|
+
const PolkadotActiveEraInfo_1 = require("../data/staking/PolkadotActiveEraInfo");
|
|
6
|
+
const PolkadotEraRewardPoints_1 = require("../data/staking/PolkadotEraRewardPoints");
|
|
7
|
+
const PolkadotExposure_1 = require("../data/staking/PolkadotExposure");
|
|
8
|
+
const PolkadotNominations_1 = require("../data/staking/PolkadotNominations");
|
|
9
|
+
const PolkadotPayee_1 = require("../data/staking/PolkadotPayee");
|
|
10
|
+
const PolkadotSlashingSpans_1 = require("../data/staking/PolkadotSlashingSpans");
|
|
11
|
+
const PolkadotStakingLedger_1 = require("../data/staking/PolkadotStakingLedger");
|
|
12
|
+
const PolkadotValidatorPrefs_1 = require("../data/staking/PolkadotValidatorPrefs");
|
|
13
|
+
class PolkadotNodeClient extends v1_1.SubstrateCommonNodeClient {
|
|
14
|
+
constructor(configuration, url) {
|
|
15
|
+
super(configuration, url);
|
|
16
|
+
this.registerCallEntrypointEntries([
|
|
17
|
+
this.createCallEndpointEntry('bond', 'Staking', 'bond'),
|
|
18
|
+
this.createCallEndpointEntry('unbond', 'Staking', 'unbond'),
|
|
19
|
+
this.createCallEndpointEntry('bond_extra', 'Staking', 'bond_extra'),
|
|
20
|
+
this.createCallEndpointEntry('withdraw_unbonded', 'Staking', 'withdraw_unbonded'),
|
|
21
|
+
this.createCallEndpointEntry('nominate', 'Staking', 'nominate'),
|
|
22
|
+
this.createCallEndpointEntry('cancel_nomination', 'Staking', 'chill'),
|
|
23
|
+
this.createCallEndpointEntry('collect_payout', 'Staking', 'payout_stakers'),
|
|
24
|
+
this.createCallEndpointEntry('set_payee', 'Staking', 'set_payee'),
|
|
25
|
+
this.createCallEndpointEntry('set_controller', 'Staking', 'set_controller'),
|
|
26
|
+
this.createCallEndpointEntry('rebond', 'Staking', 'rebond')
|
|
79
27
|
]);
|
|
80
|
-
return _this;
|
|
81
28
|
}
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
PolkadotNodeClient.prototype.getStakingLedger = function (address) {
|
|
163
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
-
var _this = this;
|
|
165
|
-
return __generator(this, function (_a) {
|
|
166
|
-
return [2 /*return*/, this.fromStorage('Staking', 'Ledger', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
167
|
-
return item ? PolkadotStakingLedger_1.PolkadotStakingLedger.decode(_this.configuration, _this.runtimeVersion, item) : undefined;
|
|
168
|
-
})];
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
PolkadotNodeClient.prototype.getValidators = function () {
|
|
173
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
-
var _this = this;
|
|
175
|
-
return __generator(this, function (_a) {
|
|
176
|
-
return [2 /*return*/, this.fromStorage('Session', 'Validators').then(function (items) {
|
|
177
|
-
return items
|
|
178
|
-
? v1_1.SCALEArray.decode(_this.configuration, _this.runtimeVersion, items, function (network, _, hex) {
|
|
179
|
-
return v1_1.SCALEAccountId.decode(network, hex);
|
|
180
|
-
}).decoded.elements.map(function (encoded) { return encoded.address; })
|
|
181
|
-
: undefined;
|
|
182
|
-
})];
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
PolkadotNodeClient.prototype.getValidatorExposure = function (eraIndex, address) {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
188
|
-
var _this = this;
|
|
189
|
-
return __generator(this, function (_a) {
|
|
190
|
-
return [2 /*return*/, this.fromStorage('Staking', 'ErasStakers', v1_1.SCALEInt.from(eraIndex, 32), v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) { return (item ? PolkadotExposure_1.PolkadotExposure.decode(_this.configuration, _this.runtimeVersion, item) : undefined); })];
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
PolkadotNodeClient.prototype.getIdentityOf = function (address) {
|
|
195
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
196
|
-
var _this = this;
|
|
197
|
-
return __generator(this, function (_a) {
|
|
198
|
-
return [2 /*return*/, this.fromStorage('Identity', 'IdentityOf', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
199
|
-
return item ? v1_1.SubstrateRegistration.decode(_this.configuration, _this.runtimeVersion, item) : undefined;
|
|
200
|
-
})];
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
PolkadotNodeClient.prototype.getSuperOf = function (address) {
|
|
205
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
206
|
-
var _this = this;
|
|
207
|
-
return __generator(this, function (_a) {
|
|
208
|
-
return [2 /*return*/, this.fromStorage('Identity', 'SuperOf', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
209
|
-
return item
|
|
210
|
-
? v1_1.SCALETuple.decode(_this.configuration, _this.runtimeVersion, item, function (network, _, hex) { return v1_1.SCALEAccountId.decode(network, hex); }, function (_network, _runtimeVersion, hex) { return v1_1.SCALEData.decode(hex); }).decoded
|
|
211
|
-
: undefined;
|
|
212
|
-
})];
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
PolkadotNodeClient.prototype.getSubsOf = function (address) {
|
|
217
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
-
var _this = this;
|
|
219
|
-
return __generator(this, function (_a) {
|
|
220
|
-
return [2 /*return*/, this.fromStorage('Identity', 'SubsOf', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
221
|
-
return item
|
|
222
|
-
? v1_1.SCALETuple.decode(_this.configuration, _this.runtimeVersion, item, function (_network, _runtimeVersion, hex) { return v1_1.SCALECompactInt.decode(hex); }, function (network, _, hex) {
|
|
223
|
-
return v1_1.SCALEArray.decode(network, _, hex, function (innerNetwork, _, innerHex) { return v1_1.SCALEAccountId.decode(innerNetwork, innerHex); });
|
|
224
|
-
}).decoded
|
|
225
|
-
: undefined;
|
|
226
|
-
})];
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
PolkadotNodeClient.prototype.getValidatorPrefs = function (eraIndex, address) {
|
|
231
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
232
|
-
var _this = this;
|
|
233
|
-
return __generator(this, function (_a) {
|
|
234
|
-
return [2 /*return*/, this.fromStorage('Staking', 'ErasValidatorPrefs', v1_1.SCALEInt.from(eraIndex, 32), v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) { return (item ? PolkadotValidatorPrefs_1.PolkadotValidatorPrefs.decode(_this.configuration, _this.runtimeVersion, item) : undefined); })];
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
};
|
|
238
|
-
PolkadotNodeClient.prototype.getExpectedEraDuration = function () {
|
|
239
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
240
|
-
var constants, expectedBlockTime, epochDuration, sessionsPerEra;
|
|
241
|
-
return __generator(this, function (_a) {
|
|
242
|
-
switch (_a.label) {
|
|
243
|
-
case 0: return [4 /*yield*/, Promise.all([
|
|
244
|
-
this.getBlockTimeP(),
|
|
245
|
-
this.getEpochDuration(),
|
|
246
|
-
this.getConstant('Staking', 'SessionsPerEra')
|
|
247
|
-
]).then(function (constants) { return constants.map(function (constant) { return (constant ? v1_1.SCALEInt.decode(constant).decoded.value : undefined); }); })];
|
|
248
|
-
case 1:
|
|
249
|
-
constants = _a.sent();
|
|
250
|
-
if (constants.some(function (constant) { return constant === undefined; })) {
|
|
251
|
-
return [2 /*return*/, undefined];
|
|
252
|
-
}
|
|
253
|
-
expectedBlockTime = constants[0];
|
|
254
|
-
epochDuration = constants[1];
|
|
255
|
-
sessionsPerEra = constants[2];
|
|
256
|
-
return [2 /*return*/, expectedBlockTime.multipliedBy(epochDuration).multipliedBy(sessionsPerEra)];
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
PolkadotNodeClient.prototype.getActiveEraInfo = function () {
|
|
262
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
263
|
-
var _this = this;
|
|
264
|
-
return __generator(this, function (_a) {
|
|
265
|
-
return [2 /*return*/, this.fromStorage('Staking', 'ActiveEra').then(function (item) {
|
|
266
|
-
return item ? PolkadotActiveEraInfo_1.PolkadotActiveEraInfo.decode(_this.configuration, _this.runtimeVersion, item) : undefined;
|
|
267
|
-
})];
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
PolkadotNodeClient.prototype.getSlashingSpan = function (address) {
|
|
272
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
273
|
-
var _this = this;
|
|
274
|
-
return __generator(this, function (_a) {
|
|
275
|
-
return [2 /*return*/, this.fromStorage('Staking', 'SlashingSpans', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
276
|
-
return item ? PolkadotSlashingSpans_1.PolkadotSlashingSpans.decode(_this.configuration, _this.runtimeVersion, item) : undefined;
|
|
277
|
-
})];
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
PolkadotNodeClient.prototype.getMinNominatorBond = function () {
|
|
282
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
283
|
-
return __generator(this, function (_a) {
|
|
284
|
-
return [2 /*return*/, this.fromStorage('Staking', 'MinNominatorBond').then(function (value) { return (value ? v1_1.SCALEInt.decode(value).decoded.value : undefined); })];
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
return PolkadotNodeClient;
|
|
289
|
-
}(v1_1.SubstrateCommonNodeClient));
|
|
29
|
+
async getBlockTimeP() {
|
|
30
|
+
return (await super.getBlockTime()).toString();
|
|
31
|
+
}
|
|
32
|
+
async getEpochDuration() {
|
|
33
|
+
return this.configuration.epochDuration;
|
|
34
|
+
}
|
|
35
|
+
async getCurrentEraIndex() {
|
|
36
|
+
return this.fromStorage('Staking', 'CurrentEra').then((item) => (item ? v1_1.SCALEInt.decode(item).decoded.value : undefined));
|
|
37
|
+
}
|
|
38
|
+
async getBonded(address) {
|
|
39
|
+
return this.fromStorage('Staking', 'Bonded', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item ? v1_1.SCALEAccountId.decode(this.configuration, item).decoded.address : undefined);
|
|
40
|
+
}
|
|
41
|
+
async getNominations(address) {
|
|
42
|
+
return this.fromStorage('Staking', 'Nominators', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item ? PolkadotNominations_1.PolkadotNominations.decode(this.configuration, this.runtimeVersion, item) : undefined);
|
|
43
|
+
}
|
|
44
|
+
async getRewardPoints(eraIndex) {
|
|
45
|
+
return this.fromStorage('Staking', 'ErasRewardPoints', v1_1.SCALEInt.from(eraIndex, 32)).then((item) => item ? PolkadotEraRewardPoints_1.PolkadotEraRewardPoints.decode(this.configuration, this.runtimeVersion, item) : undefined);
|
|
46
|
+
}
|
|
47
|
+
async getValidatorReward(eraIndex) {
|
|
48
|
+
return this.fromStorage('Staking', 'ErasValidatorReward', v1_1.SCALEInt.from(eraIndex, 32)).then((item) => item ? v1_1.SCALEInt.decode(item).decoded.value : undefined);
|
|
49
|
+
}
|
|
50
|
+
async getStakersClipped(eraIndex, validator) {
|
|
51
|
+
return this.fromStorage('Staking', 'ErasStakersClipped', v1_1.SCALEInt.from(eraIndex, 32), v1_1.SCALEAccountId.from(validator, this.configuration)).then((item) => (item ? PolkadotExposure_1.PolkadotExposure.decode(this.configuration, this.runtimeVersion, item) : undefined));
|
|
52
|
+
}
|
|
53
|
+
async getRewardDestination(address) {
|
|
54
|
+
return this.fromStorage('Staking', 'Payee', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item ? v1_1.SCALEEnum.decode(item, (hex) => PolkadotPayee_1.PolkadotPayee[PolkadotPayee_1.PolkadotPayee[hex]]).decoded.value : undefined);
|
|
55
|
+
}
|
|
56
|
+
async getStakingLedger(address) {
|
|
57
|
+
return this.fromStorage('Staking', 'Ledger', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item ? PolkadotStakingLedger_1.PolkadotStakingLedger.decode(this.configuration, this.runtimeVersion, item) : undefined);
|
|
58
|
+
}
|
|
59
|
+
async getValidators() {
|
|
60
|
+
return this.fromStorage('Session', 'Validators').then((items) => items
|
|
61
|
+
? v1_1.SCALEArray.decode(this.configuration, this.runtimeVersion, items, (network, _, hex) => v1_1.SCALEAccountId.decode(network, hex)).decoded.elements.map((encoded) => encoded.address)
|
|
62
|
+
: undefined);
|
|
63
|
+
}
|
|
64
|
+
async getValidatorExposure(eraIndex, address) {
|
|
65
|
+
return this.fromStorage('Staking', 'ErasStakers', v1_1.SCALEInt.from(eraIndex, 32), v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => (item ? PolkadotExposure_1.PolkadotExposure.decode(this.configuration, this.runtimeVersion, item) : undefined));
|
|
66
|
+
}
|
|
67
|
+
async getIdentityOf(address) {
|
|
68
|
+
return this.fromStorage('Identity', 'IdentityOf', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item ? v1_1.SubstrateRegistration.decode(this.configuration, this.runtimeVersion, item) : undefined);
|
|
69
|
+
}
|
|
70
|
+
async getSuperOf(address) {
|
|
71
|
+
return this.fromStorage('Identity', 'SuperOf', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item
|
|
72
|
+
? v1_1.SCALETuple.decode(this.configuration, this.runtimeVersion, item, (network, _, hex) => v1_1.SCALEAccountId.decode(network, hex), (_network, _runtimeVersion, hex) => v1_1.SCALEData.decode(hex)).decoded
|
|
73
|
+
: undefined);
|
|
74
|
+
}
|
|
75
|
+
async getSubsOf(address) {
|
|
76
|
+
return this.fromStorage('Identity', 'SubsOf', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item
|
|
77
|
+
? v1_1.SCALETuple.decode(this.configuration, this.runtimeVersion, item, (_network, _runtimeVersion, hex) => v1_1.SCALECompactInt.decode(hex), (network, _, hex) => v1_1.SCALEArray.decode(network, _, hex, (innerNetwork, _, innerHex) => v1_1.SCALEAccountId.decode(innerNetwork, innerHex))).decoded
|
|
78
|
+
: undefined);
|
|
79
|
+
}
|
|
80
|
+
async getValidatorPrefs(eraIndex, address) {
|
|
81
|
+
return this.fromStorage('Staking', 'ErasValidatorPrefs', v1_1.SCALEInt.from(eraIndex, 32), v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => (item ? PolkadotValidatorPrefs_1.PolkadotValidatorPrefs.decode(this.configuration, this.runtimeVersion, item) : undefined));
|
|
82
|
+
}
|
|
83
|
+
async getExpectedEraDuration() {
|
|
84
|
+
const constants = await Promise.all([
|
|
85
|
+
this.getBlockTimeP(),
|
|
86
|
+
this.getEpochDuration(),
|
|
87
|
+
this.getConstant('Staking', 'SessionsPerEra')
|
|
88
|
+
]).then((constants) => constants.map((constant) => (constant ? v1_1.SCALEInt.decode(constant).decoded.value : undefined)));
|
|
89
|
+
if (constants.some((constant) => constant === undefined)) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const expectedBlockTime = constants[0];
|
|
93
|
+
const epochDuration = constants[1];
|
|
94
|
+
const sessionsPerEra = constants[2];
|
|
95
|
+
return expectedBlockTime.multipliedBy(epochDuration).multipliedBy(sessionsPerEra);
|
|
96
|
+
}
|
|
97
|
+
async getActiveEraInfo() {
|
|
98
|
+
return this.fromStorage('Staking', 'ActiveEra').then((item) => item ? PolkadotActiveEraInfo_1.PolkadotActiveEraInfo.decode(this.configuration, this.runtimeVersion, item) : undefined);
|
|
99
|
+
}
|
|
100
|
+
async getSlashingSpan(address) {
|
|
101
|
+
return this.fromStorage('Staking', 'SlashingSpans', v1_1.SCALEAccountId.from(address, this.configuration)).then((item) => item ? PolkadotSlashingSpans_1.PolkadotSlashingSpans.decode(this.configuration, this.runtimeVersion, item) : undefined);
|
|
102
|
+
}
|
|
103
|
+
async getMinNominatorBond() {
|
|
104
|
+
return this.fromStorage('Staking', 'MinNominatorBond').then((value) => (value ? v1_1.SCALEInt.decode(value).decoded.value : undefined));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
290
107
|
exports.PolkadotNodeClient = PolkadotNodeClient;
|
|
291
108
|
// Supported Calls
|
|
292
109
|
exports.STORAGE_ENTRIES = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolkadotNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/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CACrC,CAAA"}
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = exports.KusamaProtocolImpl = exports.KUSAMA_CONFIGURATION = exports.KUSAMA_METADATA = void 0;
|
|
4
|
+
exports.createKusamaProtocol = createKusamaProtocol;
|
|
5
|
+
exports.createKusamaProtocolOptions = createKusamaProtocolOptions;
|
|
6
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
7
|
+
const PolkadotBaseProtocol_1 = require("./PolkadotBaseProtocol");
|
|
8
|
+
const PolkadotProtocol_1 = require("./PolkadotProtocol");
|
|
9
|
+
const transaction_1 = require("../data/transaction/transaction");
|
|
34
10
|
// Implementation
|
|
35
11
|
exports.KUSAMA_METADATA = {
|
|
36
12
|
identifier: coinlib_core_1.MainProtocolSymbols.KUSAMA,
|
|
@@ -59,39 +35,39 @@ exports.KUSAMA_METADATA = {
|
|
|
59
35
|
},
|
|
60
36
|
mainUnit: 'KSM',
|
|
61
37
|
account: {
|
|
62
|
-
standardDerivationPath:
|
|
38
|
+
standardDerivationPath: `m/44'/434'/0'/0/0`,
|
|
63
39
|
address: {
|
|
64
40
|
isCaseSensitive: true,
|
|
65
|
-
placeholder:
|
|
41
|
+
placeholder: `C/D/E/F/G/H/J...`,
|
|
66
42
|
regex: '^[C-HJ][a-km-zA-HJ-NP-Z1-9]+$'
|
|
67
43
|
}
|
|
68
44
|
}
|
|
69
45
|
};
|
|
70
|
-
exports.KUSAMA_CONFIGURATION =
|
|
46
|
+
exports.KUSAMA_CONFIGURATION = {
|
|
47
|
+
...PolkadotProtocol_1.POLKADOT_CONFIGURATION,
|
|
48
|
+
epochDuration: '60',
|
|
49
|
+
transaction: {
|
|
71
50
|
version: 5,
|
|
72
51
|
types: transaction_1.TRANSACTION_TYPES
|
|
73
|
-
},
|
|
52
|
+
},
|
|
53
|
+
account: {
|
|
74
54
|
type: 'ss58',
|
|
75
55
|
format: 2
|
|
76
|
-
} });
|
|
77
|
-
var KusamaProtocolImpl = /** @class */ (function (_super) {
|
|
78
|
-
__extends(KusamaProtocolImpl, _super);
|
|
79
|
-
function KusamaProtocolImpl(options) {
|
|
80
|
-
if (options === void 0) { options = {}; }
|
|
81
|
-
var completeOptions = createKusamaProtocolOptions(options.network);
|
|
82
|
-
var metadata = exports.KUSAMA_METADATA;
|
|
83
|
-
var configuration = exports.KUSAMA_CONFIGURATION;
|
|
84
|
-
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
85
56
|
}
|
|
86
|
-
|
|
87
|
-
|
|
57
|
+
};
|
|
58
|
+
class KusamaProtocolImpl extends PolkadotBaseProtocol_1.PolkadotBaseProtocolImpl {
|
|
59
|
+
constructor(options = {}) {
|
|
60
|
+
const completeOptions = createKusamaProtocolOptions(options.network);
|
|
61
|
+
const metadata = exports.KUSAMA_METADATA;
|
|
62
|
+
const configuration = exports.KUSAMA_CONFIGURATION;
|
|
63
|
+
super({ metadata, configuration, network: completeOptions.network });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
88
66
|
exports.KusamaProtocolImpl = KusamaProtocolImpl;
|
|
89
67
|
// Factory
|
|
90
|
-
function createKusamaProtocol(options) {
|
|
91
|
-
if (options === void 0) { options = {}; }
|
|
68
|
+
function createKusamaProtocol(options = {}) {
|
|
92
69
|
return new KusamaProtocolImpl(options);
|
|
93
70
|
}
|
|
94
|
-
exports.createKusamaProtocol = createKusamaProtocol;
|
|
95
71
|
exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = {
|
|
96
72
|
name: 'Mainnet',
|
|
97
73
|
type: 'mainnet',
|
|
@@ -99,12 +75,10 @@ exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = {
|
|
|
99
75
|
blockExplorerUrl: 'https://assethub-kusama.subscan.io',
|
|
100
76
|
blockExplorerApi: 'https://kusama.subscan.prod.gke.papers.tech/api/v2/scan'
|
|
101
77
|
};
|
|
102
|
-
|
|
103
|
-
function createKusamaProtocolOptions(network) {
|
|
104
|
-
if (network === void 0) { network = {}; }
|
|
78
|
+
const DEFAULT_KUSAMA_PROTOCOL_NETWORK = exports.KUSAMA_MAINNET_PROTOCOL_NETWORK;
|
|
79
|
+
function createKusamaProtocolOptions(network = {}) {
|
|
105
80
|
return {
|
|
106
|
-
network:
|
|
81
|
+
network: { ...DEFAULT_KUSAMA_PROTOCOL_NETWORK, ...network }
|
|
107
82
|
};
|
|
108
83
|
}
|
|
109
|
-
exports.createKusamaProtocolOptions = createKusamaProtocolOptions;
|
|
110
84
|
//# sourceMappingURL=KusamaProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KusamaProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/KusamaProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KusamaProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/KusamaProtocol.ts"],"names":[],"mappings":";;;AAgFA,oDAEC;AAYD,kEAIC;AAlGD,uDAA0D;AAM1D,iEAAuF;AACvF,yDAA2D;AAC3D,iEAAmE;AAMnE,iBAAiB;AAEJ,QAAA,eAAe,GAAkC;IAC5D,UAAU,EAAE,kCAAmB,CAAC,MAAM;IACtC,IAAI,EAAE,QAAQ;IAEd,KAAK,EAAE;QACL,GAAG,EAAE;YACH,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;YACxB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1B,QAAQ,EAAE,CAAC;SACZ;QACD,MAAM,EAAE;YACN,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;YAC3B,QAAQ,EAAE,CAAC;SACZ;KACF;IACD,QAAQ,EAAE,KAAK;IAEf,OAAO,EAAE;QACP,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE;YACP,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,kBAAkB;YAC/B,KAAK,EAAE,+BAA+B;SACvC;KACF;CACF,CAAA;AAEY,QAAA,oBAAoB,GAAkC;IACjE,GAAG,yCAAsB;IACzB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