@airgap/polkadot 0.13.45-beta.3 → 0.13.45-beta.5
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 +41 -22
- package/v0/protocol/kusama/KusamaProtocol.js.map +1 -1
- package/v0/protocol/kusama/KusamaProtocolOptions.js +70 -33
- package/v0/protocol/kusama/KusamaProtocolOptions.js.map +1 -1
- package/v0/protocol/polkadot/PolkadotProtocol.js +42 -23
- package/v0/protocol/polkadot/PolkadotProtocol.js.map +1 -1
- package/v0/protocol/polkadot/PolkadotProtocolOptions.js +70 -33
- package/v0/protocol/polkadot/PolkadotProtocolOptions.js.map +1 -1
- package/v1/controller/PolkadotAccountController.js +648 -373
- package/v1/controller/PolkadotAccountController.js.map +1 -1
- package/v1/controller/PolkadotTransactionController.js +23 -3
- package/v1/controller/PolkadotTransactionController.js.map +1 -1
- package/v1/data/staking/PolkadotActiveEraInfo.js +11 -10
- package/v1/data/staking/PolkadotActiveEraInfo.js.map +1 -1
- package/v1/data/staking/PolkadotEraRewardPoints.js +13 -10
- package/v1/data/staking/PolkadotEraRewardPoints.js.map +1 -1
- package/v1/data/staking/PolkadotExposure.js +14 -11
- 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 +12 -11
- 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 +13 -12
- 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 +16 -13
- package/v1/data/staking/PolkadotStakingLedger.js.map +1 -1
- package/v1/data/staking/PolkadotValidatorDetails.d.ts +1 -1
- package/v1/data/staking/PolkadotValidatorPrefs.js +10 -9
- package/v1/data/staking/PolkadotValidatorPrefs.js.map +1 -1
- package/v1/data/transaction/method/args.js +271 -146
- package/v1/data/transaction/method/args.js.map +1 -1
- package/v1/data/transaction/transaction.js +22 -11
- 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 +98 -40
- package/v1/module/PolkadotModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/node/PolkadotNodeClient.js +284 -101
- package/v1/node/PolkadotNodeClient.js.map +1 -1
- package/v1/protocol/KusamaProtocol.js +54 -28
- package/v1/protocol/KusamaProtocol.js.map +1 -1
- package/v1/protocol/PolkadotBaseProtocol.js +701 -409
- package/v1/protocol/PolkadotBaseProtocol.js.map +1 -1
- package/v1/protocol/PolkadotProtocol.js +51 -20
- package/v1/protocol/PolkadotProtocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +6 -5
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +154 -75
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +23 -3
- 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,109 +1,292 @@
|
|
|
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
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.CONSTANTS = exports.CALLS = exports.STORAGE_ENTRIES = exports.PolkadotNodeClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
55
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
56
|
+
var PolkadotActiveEraInfo_1 = require("../data/staking/PolkadotActiveEraInfo");
|
|
57
|
+
var PolkadotEraRewardPoints_1 = require("../data/staking/PolkadotEraRewardPoints");
|
|
58
|
+
var PolkadotExposure_1 = require("../data/staking/PolkadotExposure");
|
|
59
|
+
var PolkadotNominations_1 = require("../data/staking/PolkadotNominations");
|
|
60
|
+
var PolkadotPayee_1 = require("../data/staking/PolkadotPayee");
|
|
61
|
+
var PolkadotSlashingSpans_1 = require("../data/staking/PolkadotSlashingSpans");
|
|
62
|
+
var PolkadotStakingLedger_1 = require("../data/staking/PolkadotStakingLedger");
|
|
63
|
+
var PolkadotValidatorPrefs_1 = require("../data/staking/PolkadotValidatorPrefs");
|
|
64
|
+
var PolkadotNodeClient = /** @class */ (function (_super) {
|
|
65
|
+
__extends(PolkadotNodeClient, _super);
|
|
66
|
+
function PolkadotNodeClient(configuration, url) {
|
|
67
|
+
var _this = _super.call(this, configuration, url) || this;
|
|
68
|
+
_this.registerCallEntrypointEntries([
|
|
69
|
+
_this.createCallEndpointEntry('bond', 'Staking', 'bond'),
|
|
70
|
+
_this.createCallEndpointEntry('unbond', 'Staking', 'unbond'),
|
|
71
|
+
_this.createCallEndpointEntry('bond_extra', 'Staking', 'bond_extra'),
|
|
72
|
+
_this.createCallEndpointEntry('withdraw_unbonded', 'Staking', 'withdraw_unbonded'),
|
|
73
|
+
_this.createCallEndpointEntry('nominate', 'Staking', 'nominate'),
|
|
74
|
+
_this.createCallEndpointEntry('cancel_nomination', 'Staking', 'chill'),
|
|
75
|
+
_this.createCallEndpointEntry('collect_payout', 'Staking', 'payout_stakers'),
|
|
76
|
+
_this.createCallEndpointEntry('set_payee', 'Staking', 'set_payee'),
|
|
77
|
+
_this.createCallEndpointEntry('set_controller', 'Staking', 'set_controller'),
|
|
78
|
+
_this.createCallEndpointEntry('rebond', 'Staking', 'rebond')
|
|
27
79
|
]);
|
|
80
|
+
return _this;
|
|
28
81
|
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return this
|
|
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
|
-
this
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return this
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
82
|
+
PolkadotNodeClient.prototype.getBlockTimeP = function () {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
switch (_a.label) {
|
|
86
|
+
case 0: return [4 /*yield*/, _super.prototype.getBlockTime.call(this)];
|
|
87
|
+
case 1: return [2 /*return*/, (_a.sent()).toString()];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
PolkadotNodeClient.prototype.getEpochDuration = function () {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
return [2 /*return*/, this.configuration.epochDuration];
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
PolkadotNodeClient.prototype.getCurrentEraIndex = function () {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
return [2 /*return*/, this.fromStorage('Staking', 'CurrentEra').then(function (item) { return (item ? v1_1.SCALEInt.decode(item).decoded.value : undefined); })];
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
PolkadotNodeClient.prototype.getBonded = function (address) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
var _this = this;
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
return [2 /*return*/, this.fromStorage('Staking', 'Bonded', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
111
|
+
return item ? v1_1.SCALEAccountId.decode(_this.configuration, item).decoded.address : undefined;
|
|
112
|
+
})];
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
PolkadotNodeClient.prototype.getNominations = function (address) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var _this = this;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
return [2 /*return*/, this.fromStorage('Staking', 'Nominators', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
121
|
+
return item ? PolkadotNominations_1.PolkadotNominations.decode(_this.configuration, _this.runtimeVersion, item) : undefined;
|
|
122
|
+
})];
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
PolkadotNodeClient.prototype.getRewardPoints = function (eraIndex) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
var _this = this;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
return [2 /*return*/, this.fromStorage('Staking', 'ErasRewardPoints', v1_1.SCALEInt.from(eraIndex, 32)).then(function (item) {
|
|
131
|
+
return item ? PolkadotEraRewardPoints_1.PolkadotEraRewardPoints.decode(_this.configuration, _this.runtimeVersion, item) : undefined;
|
|
132
|
+
})];
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
PolkadotNodeClient.prototype.getValidatorReward = function (eraIndex) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
return [2 /*return*/, this.fromStorage('Staking', 'ErasValidatorReward', v1_1.SCALEInt.from(eraIndex, 32)).then(function (item) {
|
|
140
|
+
return item ? v1_1.SCALEInt.decode(item).decoded.value : undefined;
|
|
141
|
+
})];
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
PolkadotNodeClient.prototype.getStakersClipped = function (eraIndex, validator) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
147
|
+
var _this = this;
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
return [2 /*return*/, this.fromStorage('Staking', 'ErasStakersClipped', v1_1.SCALEInt.from(eraIndex, 32), v1_1.SCALEAccountId.from(validator, this.configuration)).then(function (item) { return (item ? PolkadotExposure_1.PolkadotExposure.decode(_this.configuration, _this.runtimeVersion, item) : undefined); })];
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
PolkadotNodeClient.prototype.getRewardDestination = function (address) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
return [2 /*return*/, this.fromStorage('Staking', 'Payee', v1_1.SCALEAccountId.from(address, this.configuration)).then(function (item) {
|
|
157
|
+
return item ? v1_1.SCALEEnum.decode(item, function (hex) { return PolkadotPayee_1.PolkadotPayee[PolkadotPayee_1.PolkadotPayee[hex]]; }).decoded.value : undefined;
|
|
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));
|
|
107
290
|
exports.PolkadotNodeClient = PolkadotNodeClient;
|
|
108
291
|
// Supported Calls
|
|
109
292
|
exports.STORAGE_ENTRIES = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolkadotNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/PolkadotNodeClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PolkadotNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/PolkadotNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAW6B;AAE7B,+EAA6E;AAC7E,mFAAiF;AACjF,qEAAmE;AACnE,2EAAyE;AACzE,+DAA6D;AAC7D,+EAA6E;AAC7E,+EAA6E;AAC7E,iFAA+E;AAG/E;IAAwC,sCAAwD;IAC9F,4BAAmB,aAA4C,EAAE,GAAW;QAA5E,YACE,kBAAM,aAAa,EAAE,GAAG,CAAC,SAa1B;QAZC,KAAI,CAAC,6BAA6B,CAAC;YACjC,KAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC;YACvD,KAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;YAC3D,KAAI,CAAC,uBAAuB,CAAC,YAAY,EAAE,SAAS,EAAE,YAAY,CAAC;YACnE,KAAI,CAAC,uBAAuB,CAAC,mBAAmB,EAAE,SAAS,EAAE,mBAAmB,CAAC;YACjF,KAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC;YAC/D,KAAI,CAAC,uBAAuB,CAAC,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC;YACrE,KAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,CAAC;YAC3E,KAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC;YACjE,KAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,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QAAQ,CAAU;IACtD,OAAO,EAAE;QACP,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,aAAa;QACb,oBAAoB;QACpB,oBAAoB;QACpB,qBAAqB;QACrB,kBAAkB;QAClB,eAAe;QACf,kBAAkB;KACV;IACV,OAAO,EAAE,CAAC,YAAY,CAAU;CACjC,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,OAAO,EAAE;QACP,MAAM;QACN,YAAY;QACZ,QAAQ;QACR,mBAAmB;QACnB,UAAU;QACV,OAAO;QACP,WAAW;QACX,gBAAgB;QAChB,gBAAgB;QAChB,QAAQ;KACA;CACX,CAAA;AAEY,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,CAAC,gBAAgB,CAAU;CACrC,CAAA"}
|
|
@@ -1,12 +1,36 @@
|
|
|
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
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = exports.KusamaProtocolImpl = exports.KUSAMA_CONFIGURATION = exports.KUSAMA_METADATA = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const PolkadotProtocol_1 = require("./PolkadotProtocol");
|
|
9
|
-
const transaction_1 = require("../data/transaction/transaction");
|
|
29
|
+
exports.createKusamaProtocolOptions = exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = exports.createKusamaProtocol = exports.KusamaProtocolImpl = exports.KUSAMA_CONFIGURATION = exports.KUSAMA_METADATA = void 0;
|
|
30
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
31
|
+
var PolkadotBaseProtocol_1 = require("./PolkadotBaseProtocol");
|
|
32
|
+
var PolkadotProtocol_1 = require("./PolkadotProtocol");
|
|
33
|
+
var transaction_1 = require("../data/transaction/transaction");
|
|
10
34
|
// Implementation
|
|
11
35
|
exports.KUSAMA_METADATA = {
|
|
12
36
|
identifier: coinlib_core_1.MainProtocolSymbols.KUSAMA,
|
|
@@ -35,39 +59,39 @@ exports.KUSAMA_METADATA = {
|
|
|
35
59
|
},
|
|
36
60
|
mainUnit: 'KSM',
|
|
37
61
|
account: {
|
|
38
|
-
standardDerivationPath:
|
|
62
|
+
standardDerivationPath: "m/44'/434'/0'/0/0",
|
|
39
63
|
address: {
|
|
40
64
|
isCaseSensitive: true,
|
|
41
|
-
placeholder:
|
|
65
|
+
placeholder: "C/D/E/F/G/H/J...",
|
|
42
66
|
regex: '^[C-HJ][a-km-zA-HJ-NP-Z1-9]+$'
|
|
43
67
|
}
|
|
44
68
|
}
|
|
45
69
|
};
|
|
46
|
-
exports.KUSAMA_CONFIGURATION = {
|
|
47
|
-
...PolkadotProtocol_1.POLKADOT_CONFIGURATION,
|
|
48
|
-
epochDuration: '60',
|
|
49
|
-
transaction: {
|
|
70
|
+
exports.KUSAMA_CONFIGURATION = __assign(__assign({}, PolkadotProtocol_1.POLKADOT_CONFIGURATION), { epochDuration: '60', transaction: {
|
|
50
71
|
version: 5,
|
|
51
72
|
types: transaction_1.TRANSACTION_TYPES
|
|
52
|
-
},
|
|
53
|
-
account: {
|
|
73
|
+
}, account: {
|
|
54
74
|
type: 'ss58',
|
|
55
75
|
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;
|
|
56
85
|
}
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
}
|
|
86
|
+
return KusamaProtocolImpl;
|
|
87
|
+
}(PolkadotBaseProtocol_1.PolkadotBaseProtocolImpl));
|
|
66
88
|
exports.KusamaProtocolImpl = KusamaProtocolImpl;
|
|
67
89
|
// Factory
|
|
68
|
-
function createKusamaProtocol(options
|
|
90
|
+
function createKusamaProtocol(options) {
|
|
91
|
+
if (options === void 0) { options = {}; }
|
|
69
92
|
return new KusamaProtocolImpl(options);
|
|
70
93
|
}
|
|
94
|
+
exports.createKusamaProtocol = createKusamaProtocol;
|
|
71
95
|
exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = {
|
|
72
96
|
name: 'Mainnet',
|
|
73
97
|
type: 'mainnet',
|
|
@@ -75,10 +99,12 @@ exports.KUSAMA_MAINNET_PROTOCOL_NETWORK = {
|
|
|
75
99
|
blockExplorerUrl: 'https://assethub-kusama.subscan.io',
|
|
76
100
|
blockExplorerApi: 'https://kusama.subscan.prod.gke.papers.tech/api/v2/scan'
|
|
77
101
|
};
|
|
78
|
-
|
|
79
|
-
function createKusamaProtocolOptions(network
|
|
102
|
+
var DEFAULT_KUSAMA_PROTOCOL_NETWORK = exports.KUSAMA_MAINNET_PROTOCOL_NETWORK;
|
|
103
|
+
function createKusamaProtocolOptions(network) {
|
|
104
|
+
if (network === void 0) { network = {}; }
|
|
80
105
|
return {
|
|
81
|
-
network: {
|
|
106
|
+
network: __assign(__assign({}, DEFAULT_KUSAMA_PROTOCOL_NETWORK), network)
|
|
82
107
|
};
|
|
83
108
|
}
|
|
109
|
+
exports.createKusamaProtocolOptions = createKusamaProtocolOptions;
|
|
84
110
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAM1D,+DAAuF;AACvF,uDAA2D;AAC3D,+DAAmE;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,E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