@airgap/acurast 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 +5 -5
- package/v1/controller/AcurastAccountController.js +23 -3
- package/v1/controller/AcurastAccountController.js.map +1 -1
- package/v1/controller/AcurastTransactionController.js +23 -3
- package/v1/controller/AcurastTransactionController.js.map +1 -1
- package/v1/index.js +3 -3
- package/v1/index.js.map +1 -1
- package/v1/module/AcurastModule.d.ts +1 -1
- package/v1/module/AcurastModule.js +98 -40
- package/v1/module/AcurastModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/node/AcurastNodeClient.js +23 -3
- package/v1/node/AcurastNodeClient.js.map +1 -1
- package/v1/protocol/AcurastBaseProtocol.js +88 -26
- package/v1/protocol/AcurastBaseProtocol.js.map +1 -1
- package/v1/protocol/AcurastCanaryProtocol.js +50 -19
- package/v1/protocol/AcurastCanaryProtocol.js.map +1 -1
- package/v1/protocol/AcurastProtocol.js +49 -18
- package/v1/protocol/AcurastProtocol.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 +150 -73
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/acurast",
|
|
3
|
-
"version": "0.13.45-beta.
|
|
3
|
+
"version": "0.13.45-beta.4",
|
|
4
4
|
"description": "The @airgap/acurast is an Acurast implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@airgap/coinlib-core": "^0.13.45-beta.
|
|
35
|
-
"@airgap/module-kit": "^0.13.45-beta.
|
|
36
|
-
"@airgap/serializer": "^0.13.45-beta.
|
|
37
|
-
"@airgap/substrate": "^0.13.45-beta.
|
|
34
|
+
"@airgap/coinlib-core": "^0.13.45-beta.4",
|
|
35
|
+
"@airgap/module-kit": "^0.13.45-beta.4",
|
|
36
|
+
"@airgap/serializer": "^0.13.45-beta.4",
|
|
37
|
+
"@airgap/substrate": "^0.13.45-beta.4",
|
|
38
38
|
"@polkadot/util": "2.0.1",
|
|
39
39
|
"@polkadot/wasm-crypto": "0.20.1"
|
|
40
40
|
},
|
|
@@ -1,8 +1,28 @@
|
|
|
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
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.AcurastAccountController = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
19
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
20
|
+
var AcurastAccountController = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AcurastAccountController, _super);
|
|
22
|
+
function AcurastAccountController() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AcurastAccountController;
|
|
26
|
+
}(v1_1.SubstrateCommonAccountController));
|
|
7
27
|
exports.AcurastAccountController = AcurastAccountController;
|
|
8
28
|
//# sourceMappingURL=AcurastAccountController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastAccountController.js","sourceRoot":"","sources":["../../../src/v1/controller/AcurastAccountController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastAccountController.js","sourceRoot":"","sources":["../../../src/v1/controller/AcurastAccountController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAuE;AAKvE;IAA8C,4CAAiF;IAA/H;;IAAiI,CAAC;IAAD,+BAAC;AAAD,CAAC,AAAlI,CAA8C,qCAAgC,GAAoD;AAArH,4DAAwB"}
|
|
@@ -1,8 +1,28 @@
|
|
|
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
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.AcurastTransactionController = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
19
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
20
|
+
var AcurastTransactionController = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AcurastTransactionController, _super);
|
|
22
|
+
function AcurastTransactionController() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AcurastTransactionController;
|
|
26
|
+
}(v1_1.SubstrateCommonTransactionController));
|
|
7
27
|
exports.AcurastTransactionController = AcurastTransactionController;
|
|
8
28
|
//# sourceMappingURL=AcurastTransactionController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastTransactionController.js","sourceRoot":"","sources":["../../../src/v1/controller/AcurastTransactionController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastTransactionController.js","sourceRoot":"","sources":["../../../src/v1/controller/AcurastTransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA2E;AAK3E;IAAkD,gDAAqF;IAAvI;;IAAyI,CAAC;IAAD,mCAAC;AAAD,CAAC,AAA1I,CAAkD,yCAAoC,GAAoD;AAA7H,oEAA4B"}
|
package/v1/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAcurastCanaryProtocol = exports.createAcurastProtocol = exports.AcurastModule = void 0;
|
|
4
|
-
|
|
4
|
+
var AcurastCanaryProtocol_1 = require("./protocol/AcurastCanaryProtocol");
|
|
5
5
|
Object.defineProperty(exports, "createAcurastCanaryProtocol", { enumerable: true, get: function () { return AcurastCanaryProtocol_1.createAcurastCanaryProtocol; } });
|
|
6
|
-
|
|
6
|
+
var AcurastModule_1 = require("./module/AcurastModule");
|
|
7
7
|
Object.defineProperty(exports, "AcurastModule", { enumerable: true, get: function () { return AcurastModule_1.AcurastModule; } });
|
|
8
|
-
|
|
8
|
+
var AcurastProtocol_1 = require("./protocol/AcurastProtocol");
|
|
9
9
|
Object.defineProperty(exports, "createAcurastProtocol", { enumerable: true, get: function () { return AcurastProtocol_1.createAcurastProtocol; } });
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,0EAAqG;AAa7B,4GAbxC,mDAA2B,OAawC;AAZnG,wDAAsD;AAQ7C,8FARA,6BAAa,OAQA;AAPtB,8DAAmF;AAWzD,sGAXA,uCAAqB,OAWA"}
|
|
@@ -3,7 +3,7 @@ import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from
|
|
|
3
3
|
import { BlockExplorer } from '@airgap/module-kit/block-explorer/block-explorer';
|
|
4
4
|
import { OfflineProtocol, OnlineProtocol } from '@airgap/module-kit/protocol/protocol';
|
|
5
5
|
import { AcurastProtocolNetwork } from '../types/protocol';
|
|
6
|
-
type SupportedProtocols = MainProtocolSymbols.ACURAST | MainProtocolSymbols.ACURAST_CANARY;
|
|
6
|
+
declare type SupportedProtocols = MainProtocolSymbols.ACURAST | MainProtocolSymbols.ACURAST_CANARY;
|
|
7
7
|
export declare class AcurastModule implements AirGapModule<{
|
|
8
8
|
Protocols: SupportedProtocols;
|
|
9
9
|
ProtocolNetwork: AcurastProtocolNetwork;
|
|
@@ -1,56 +1,114 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.AcurastModule = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
42
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
43
|
+
var substrate_1 = require("@airgap/substrate");
|
|
44
|
+
var AcurastProtocol_1 = require("../protocol/AcurastProtocol");
|
|
45
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
46
|
+
var AcurastCanaryProtocol_1 = require("../protocol/AcurastCanaryProtocol");
|
|
47
|
+
var AcurastModule = /** @class */ (function () {
|
|
48
|
+
function AcurastModule() {
|
|
49
|
+
var _a;
|
|
50
|
+
this.networkRegistries = (_a = {},
|
|
51
|
+
_a[coinlib_core_1.MainProtocolSymbols.ACURAST] = new module_kit_1.ModuleNetworkRegistry({
|
|
15
52
|
supportedNetworks: [AcurastProtocol_1.ACURAST_MAINNET_PROTOCOL_NETWORK]
|
|
16
53
|
}),
|
|
17
|
-
[coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY]
|
|
54
|
+
_a[coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY] = new module_kit_1.ModuleNetworkRegistry({
|
|
18
55
|
supportedNetworks: [AcurastCanaryProtocol_1.ACURAST_CANARY_PROTOCOL_NETWORK]
|
|
19
|
-
})
|
|
20
|
-
|
|
56
|
+
}),
|
|
57
|
+
_a);
|
|
21
58
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
22
59
|
}
|
|
23
|
-
|
|
24
|
-
return this
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
60
|
+
AcurastModule.prototype.createOfflineProtocol = function (identifier) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
return [2 /*return*/, this.createProtocol(identifier)];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
AcurastModule.prototype.createOnlineProtocol = function (identifier, networkOrId) {
|
|
68
|
+
var _a;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var network;
|
|
71
|
+
return __generator(this, function (_b) {
|
|
72
|
+
network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
|
|
73
|
+
if (network === undefined) {
|
|
74
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol network type not supported. (Acurast)");
|
|
75
|
+
}
|
|
76
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
AcurastModule.prototype.createBlockExplorer = function (identifier, networkOrId) {
|
|
81
|
+
var _a;
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var network;
|
|
84
|
+
return __generator(this, function (_b) {
|
|
85
|
+
network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
|
|
86
|
+
if (network === undefined) {
|
|
87
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Block Explorer network type not supported. (Acurast)");
|
|
88
|
+
}
|
|
89
|
+
return [2 /*return*/, new substrate_1.SubscanBlockExplorer(network.blockExplorerUrl)];
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
AcurastModule.prototype.createV3SerializerCompanion = function () {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
return [2 /*return*/, new serializer_companion_1.AcurastV3SerializerCompanion()];
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
AcurastModule.prototype.createProtocol = function (identifier, network) {
|
|
44
101
|
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST) {
|
|
45
|
-
return (0, AcurastProtocol_1.createAcurastProtocol)({ network });
|
|
102
|
+
return (0, AcurastProtocol_1.createAcurastProtocol)({ network: network });
|
|
46
103
|
}
|
|
47
104
|
else if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
48
|
-
return (0, AcurastCanaryProtocol_1.createAcurastCanaryProtocol)({ network });
|
|
105
|
+
return (0, AcurastCanaryProtocol_1.createAcurastCanaryProtocol)({ network: network });
|
|
49
106
|
}
|
|
50
107
|
else {
|
|
51
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE,
|
|
108
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Acurast)"));
|
|
52
109
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
110
|
+
};
|
|
111
|
+
return AcurastModule;
|
|
112
|
+
}());
|
|
55
113
|
exports.AcurastModule = AcurastModule;
|
|
56
114
|
//# sourceMappingURL=AcurastModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastModule.js","sourceRoot":"","sources":["../../../src/v1/module/AcurastModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastModule.js","sourceRoot":"","sources":["../../../src/v1/module/AcurastModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAO2B;AAG3B,+CAAwD;AAExD,+DAAqG;AACrG,8EAAoF;AAEpF,2EAAgH;AAIhH;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,OAAO,IAAG,IAAI,kCAAqB,CAAC;gBACvD,iBAAiB,EAAE,CAAC,kDAAgC,CAAC;aACtD,CAAC;YACF,GAAC,kCAAmB,CAAC,cAAc,IAAG,IAAI,kCAAqB,CAAC;gBAC9D,iBAAiB,EAAE,CAAC,uDAA+B,CAAC;aACrD,CAAC;gBACH;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IA+C1I,CAAC;IA7Cc,6CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,4CAAoB,GAAjC,UACE,UAA8B,EAC9B,WAA6C;;;;;gBAEvC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,gDAAgD,CAAC,CAAA;iBACtG;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,2CAAmB,GAAhC,UACE,UAA8B,EAC9B,WAA6C;;;;;gBAEvC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,sDAAsD,CAAC,CAAA;iBAC5G;gBAED,sBAAO,IAAI,gCAAoB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAA;;;KAC1D;IAEY,mDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,mDAA4B,EAAE,EAAA;;;KAC1C;IAEO,sCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,EAAE;YAC9C,OAAO,IAAA,uCAAqB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;SAC1C;aAAM,IAAI,UAAU,KAAK,kCAAmB,CAAC,cAAc,EAAE;YAC5D,OAAO,IAAA,mDAA2B,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;SAChD;aAAM;YACL,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,8BAA2B,CAAC,CAAA;SACvG;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAxDD,IAwDC;AAxDY,sCAAa"}
|
package/v1/module.js
CHANGED
|
@@ -14,10 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.create =
|
|
18
|
-
|
|
17
|
+
exports.create = void 0;
|
|
18
|
+
var AcurastModule_1 = require("./module/AcurastModule");
|
|
19
19
|
__exportStar(require("./index"), exports);
|
|
20
20
|
function create() {
|
|
21
21
|
return new AcurastModule_1.AcurastModule();
|
|
22
22
|
}
|
|
23
|
+
exports.create = create;
|
|
23
24
|
//# sourceMappingURL=module.js.map
|
package/v1/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,wDAAsD;AAEtD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,6BAAa,EAAE,CAAA;AAC5B,CAAC;AAFD,wBAEC"}
|
|
@@ -1,8 +1,28 @@
|
|
|
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
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.AcurastNodeClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
19
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
20
|
+
var AcurastNodeClient = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AcurastNodeClient, _super);
|
|
22
|
+
function AcurastNodeClient() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AcurastNodeClient;
|
|
26
|
+
}(v1_1.SubstrateCommonNodeClient));
|
|
7
27
|
exports.AcurastNodeClient = AcurastNodeClient;
|
|
8
28
|
//# sourceMappingURL=AcurastNodeClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/AcurastNodeClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/AcurastNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAgE;AAIhE;IAAuC,qCAAuD;IAA9F;;IAAgG,CAAC;IAAD,wBAAC;AAAD,CAAC,AAAjG,CAAuC,8BAAyB,GAAiC;AAApF,8CAAiB"}
|
|
@@ -1,34 +1,96 @@
|
|
|
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.AcurastBaseProtocolImpl = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
55
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
56
|
+
var AcurastAccountController_1 = require("../controller/AcurastAccountController");
|
|
57
|
+
var AcurastTransactionController_1 = require("../controller/AcurastTransactionController");
|
|
58
|
+
var AcurastNodeClient_1 = require("../node/AcurastNodeClient");
|
|
8
59
|
// Implemenation
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
60
|
+
var AcurastBaseProtocolImpl = /** @class */ (function (_super) {
|
|
61
|
+
__extends(AcurastBaseProtocolImpl, _super);
|
|
62
|
+
function AcurastBaseProtocolImpl(options) {
|
|
63
|
+
var nodeClient = new AcurastNodeClient_1.AcurastNodeClient(options.configuration, options.network.rpcUrl);
|
|
64
|
+
var accountController = new AcurastAccountController_1.AcurastAccountController(options.configuration, nodeClient);
|
|
65
|
+
var transactionController = new AcurastTransactionController_1.AcurastTransactionController(options.configuration, nodeClient);
|
|
66
|
+
var blockExplorer = new v1_1.SubscanBlockExplorerClient(options.network.blockExplorerApi);
|
|
67
|
+
return _super.call(this, options, nodeClient, accountController, transactionController, blockExplorer) || this;
|
|
16
68
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
69
|
+
AcurastBaseProtocolImpl.prototype.getFutureRequiredTransactions = function (accountId, intention) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var balance, transferableBalance, requiredTransactions;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, this.accountController.getBalance(accountId)];
|
|
75
|
+
case 1:
|
|
76
|
+
balance = _a.sent();
|
|
77
|
+
transferableBalance = balance.transferable.minus(balance.existentialDeposit);
|
|
78
|
+
requiredTransactions = [];
|
|
79
|
+
if (intention === 'transfer') {
|
|
80
|
+
requiredTransactions.push([
|
|
81
|
+
'transfer',
|
|
82
|
+
{
|
|
83
|
+
to: v1_1.SubstrateSS58Address.createPlaceholder(),
|
|
84
|
+
value: transferableBalance
|
|
85
|
+
}
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
return [2 /*return*/, requiredTransactions];
|
|
27
89
|
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
return AcurastBaseProtocolImpl;
|
|
94
|
+
}(v1_1.SubstrateProtocolImpl));
|
|
33
95
|
exports.AcurastBaseProtocolImpl = AcurastBaseProtocolImpl;
|
|
34
96
|
//# sourceMappingURL=AcurastBaseProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AcurastBaseProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AcurastBaseProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAO6B;AAE7B,mFAAiF;AACjF,2FAAyF;AACzF,+DAA6D;AAU7D,gBAAgB;AAEhB;IACU,2CAOP;IAGD,iCAAmB,OAA2C;QAC5D,IAAM,UAAU,GAAsB,IAAI,qCAAiB,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE1G,IAAM,iBAAiB,GAA6B,IAAI,mDAAwB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QACnH,IAAM,qBAAqB,GAAiC,IAAI,2DAA4B,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAE/H,IAAM,aAAa,GAA+B,IAAI,+BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;eAElH,kBAAM,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,CAAC;IACrF,CAAC;IAEe,+DAA6B,GAA7C,UACE,SAAmD,EACnD,SAA+B;;;;;4BAEf,qBAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAA;;wBAA5D,OAAO,GAAG,SAAkD;wBAE5D,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;wBAE5E,oBAAoB,GAAoE,EAAE,CAAA;wBAEhG,IAAI,SAAS,KAAK,UAAU,EAAE;4BAC5B,oBAAoB,CAAC,IAAI,CAAC;gCACxB,UAAU;gCACV;oCACE,EAAE,EAAE,yBAAoB,CAAC,iBAAiB,EAAE;oCAC5C,KAAK,EAAE,mBAAmB;iCAC3B;6BACF,CAAC,CAAA;yBACH;wBAED,sBAAO,oBAAoB,EAAA;;;;KAC5B;IACH,8BAAC;AAAD,CAAC,AA5CD,CACU,0BAAqB,GA2C9B;AA5CqB,0DAAuB"}
|
|
@@ -1,11 +1,35 @@
|
|
|
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.ACURAST_CANARY_PROTOCOL_NETWORK = exports.AcurastCanaryProtocolImpl = exports.ACURAST_CANARY_METADATA = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const AcurastBaseProtocol_1 = require("./AcurastBaseProtocol");
|
|
8
|
-
const AcurastProtocol_1 = require("./AcurastProtocol");
|
|
29
|
+
exports.createAcurastCanaryProtocolOptions = exports.ACURAST_CANARY_PROTOCOL_NETWORK = exports.createAcurastCanaryProtocol = exports.AcurastCanaryProtocolImpl = exports.ACURAST_CANARY_METADATA = void 0;
|
|
30
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
31
|
+
var AcurastBaseProtocol_1 = require("./AcurastBaseProtocol");
|
|
32
|
+
var AcurastProtocol_1 = require("./AcurastProtocol");
|
|
9
33
|
// Implementation
|
|
10
34
|
exports.ACURAST_CANARY_METADATA = {
|
|
11
35
|
identifier: coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY,
|
|
@@ -18,27 +42,32 @@ exports.ACURAST_CANARY_METADATA = {
|
|
|
18
42
|
},
|
|
19
43
|
mainUnit: 'cACU',
|
|
20
44
|
account: {
|
|
21
|
-
standardDerivationPath:
|
|
45
|
+
standardDerivationPath: "m/44'/434'/0'/0/0",
|
|
22
46
|
address: {
|
|
23
47
|
isCaseSensitive: true,
|
|
24
|
-
placeholder:
|
|
48
|
+
placeholder: "5ABC...",
|
|
25
49
|
regex: '^5[a-km-zA-HJ-NP-Z1-9]+$'
|
|
26
50
|
}
|
|
27
51
|
}
|
|
28
52
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
var AcurastCanaryProtocolImpl = /** @class */ (function (_super) {
|
|
54
|
+
__extends(AcurastCanaryProtocolImpl, _super);
|
|
55
|
+
function AcurastCanaryProtocolImpl(options) {
|
|
56
|
+
if (options === void 0) { options = {}; }
|
|
57
|
+
var completeOptions = createAcurastCanaryProtocolOptions(options.network);
|
|
58
|
+
var metadata = exports.ACURAST_CANARY_METADATA;
|
|
59
|
+
var configuration = AcurastProtocol_1.ACURAST_CONFIGURATION;
|
|
60
|
+
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
35
61
|
}
|
|
36
|
-
|
|
62
|
+
return AcurastCanaryProtocolImpl;
|
|
63
|
+
}(AcurastBaseProtocol_1.AcurastBaseProtocolImpl));
|
|
37
64
|
exports.AcurastCanaryProtocolImpl = AcurastCanaryProtocolImpl;
|
|
38
65
|
// Factory
|
|
39
|
-
function createAcurastCanaryProtocol(options
|
|
66
|
+
function createAcurastCanaryProtocol(options) {
|
|
67
|
+
if (options === void 0) { options = {}; }
|
|
40
68
|
return new AcurastCanaryProtocolImpl(options);
|
|
41
69
|
}
|
|
70
|
+
exports.createAcurastCanaryProtocol = createAcurastCanaryProtocol;
|
|
42
71
|
exports.ACURAST_CANARY_PROTOCOL_NETWORK = {
|
|
43
72
|
name: 'Mainnet',
|
|
44
73
|
type: 'mainnet',
|
|
@@ -47,10 +76,12 @@ exports.ACURAST_CANARY_PROTOCOL_NETWORK = {
|
|
|
47
76
|
// blockExplorerUrl: 'https://polkadot.js.org/apps/?rpc=wss.collator-1.acurast.papers.tech#/explorer',
|
|
48
77
|
blockExplorerApi: ''
|
|
49
78
|
};
|
|
50
|
-
|
|
51
|
-
function createAcurastCanaryProtocolOptions(network
|
|
79
|
+
var DEFAULT_ACURAST_PROTOCOL_NETWORK = exports.ACURAST_CANARY_PROTOCOL_NETWORK;
|
|
80
|
+
function createAcurastCanaryProtocolOptions(network) {
|
|
81
|
+
if (network === void 0) { network = {}; }
|
|
52
82
|
return {
|
|
53
|
-
network: {
|
|
83
|
+
network: __assign(__assign({}, DEFAULT_ACURAST_PROTOCOL_NETWORK), network)
|
|
54
84
|
};
|
|
55
85
|
}
|
|
86
|
+
exports.createAcurastCanaryProtocolOptions = createAcurastCanaryProtocolOptions;
|
|
56
87
|
//# sourceMappingURL=AcurastCanaryProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastCanaryProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AcurastCanaryProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastCanaryProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AcurastCanaryProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAK1D,6DAAoF;AACpF,qDAAyD;AAKzD,iBAAiB;AAEJ,QAAA,uBAAuB,GAAyC;IAC3E,UAAU,EAAE,kCAAmB,CAAC,cAAc;IAC9C,IAAI,EAAE,gBAAgB;IAEtB,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,EAAE;SACb;KACF;IACD,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE;QACP,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE;YACP,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,0BAA0B;SAClC;KACF;CACF,CAAA;AAED;IAA+C,6CAA2C;IACxF,mCAAmB,OAAsD;QAAtD,wBAAA,EAAA,YAAsD;QACvE,IAAM,eAAe,GAA2B,kCAAkC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEnG,IAAM,QAAQ,GAAyC,+BAAuB,CAAA;QAC9E,IAAM,aAAa,GAAiC,uCAAqB,CAAA;eAEzE,kBAAM,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC;IACtE,CAAC;IACH,gCAAC;AAAD,CAAC,AATD,CAA+C,6CAAuB,GASrE;AATY,8DAAyB;AAWtC,UAAU;AAEV,SAAgB,2BAA2B,CAAC,OAAsD;IAAtD,wBAAA,EAAA,YAAsD;IAChG,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAA;AAC/C,CAAC;AAFD,kEAEC;AAEY,QAAA,+BAA+B,GAA2B;IACrE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,uCAAuC;IAC/C,gBAAgB,EAAE,6FAA6F;IAC/G,sGAAsG;IACtG,gBAAgB,EAAE,EAAE;CACrB,CAAA;AAED,IAAM,gCAAgC,GAA2B,uCAA+B,CAAA;AAEhG,SAAgB,kCAAkC,CAAC,OAA6C;IAA7C,wBAAA,EAAA,YAA6C;IAC9F,OAAO;QACL,OAAO,wBAAO,gCAAgC,GAAK,OAAO,CAAE;KAC7D,CAAA;AACH,CAAC;AAJD,gFAIC"}
|
|
@@ -1,10 +1,34 @@
|
|
|
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.ACURAST_MAINNET_PROTOCOL_NETWORK = exports.AcurastProtocolImpl = exports.ACURAST_CONFIGURATION = exports.ACURAST_METADATA = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
7
|
-
const AcurastBaseProtocol_1 = require("./AcurastBaseProtocol");
|
|
29
|
+
exports.createAcurastProtocolOptions = exports.ACURAST_MAINNET_PROTOCOL_NETWORK = exports.createAcurastProtocol = exports.AcurastProtocolImpl = exports.ACURAST_CONFIGURATION = exports.ACURAST_METADATA = void 0;
|
|
30
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
31
|
+
var AcurastBaseProtocol_1 = require("./AcurastBaseProtocol");
|
|
8
32
|
// Implementation
|
|
9
33
|
exports.ACURAST_METADATA = {
|
|
10
34
|
identifier: coinlib_core_1.MainProtocolSymbols.ACURAST,
|
|
@@ -17,10 +41,10 @@ exports.ACURAST_METADATA = {
|
|
|
17
41
|
},
|
|
18
42
|
mainUnit: 'ACU',
|
|
19
43
|
account: {
|
|
20
|
-
standardDerivationPath:
|
|
44
|
+
standardDerivationPath: "m/44'/434'/0'/0/0",
|
|
21
45
|
address: {
|
|
22
46
|
isCaseSensitive: true,
|
|
23
|
-
placeholder:
|
|
47
|
+
placeholder: "5ABC...",
|
|
24
48
|
regex: '^5[a-km-zA-HJ-NP-Z1-9]+$'
|
|
25
49
|
}
|
|
26
50
|
}
|
|
@@ -35,19 +59,24 @@ exports.ACURAST_CONFIGURATION = {
|
|
|
35
59
|
types: {}
|
|
36
60
|
}
|
|
37
61
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
var AcurastProtocolImpl = /** @class */ (function (_super) {
|
|
63
|
+
__extends(AcurastProtocolImpl, _super);
|
|
64
|
+
function AcurastProtocolImpl(options) {
|
|
65
|
+
if (options === void 0) { options = {}; }
|
|
66
|
+
var completeOptions = createAcurastProtocolOptions(options.network);
|
|
67
|
+
var metadata = exports.ACURAST_METADATA;
|
|
68
|
+
var configuration = exports.ACURAST_CONFIGURATION;
|
|
69
|
+
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
44
70
|
}
|
|
45
|
-
|
|
71
|
+
return AcurastProtocolImpl;
|
|
72
|
+
}(AcurastBaseProtocol_1.AcurastBaseProtocolImpl));
|
|
46
73
|
exports.AcurastProtocolImpl = AcurastProtocolImpl;
|
|
47
74
|
// Factory
|
|
48
|
-
function createAcurastProtocol(options
|
|
75
|
+
function createAcurastProtocol(options) {
|
|
76
|
+
if (options === void 0) { options = {}; }
|
|
49
77
|
return new AcurastProtocolImpl(options);
|
|
50
78
|
}
|
|
79
|
+
exports.createAcurastProtocol = createAcurastProtocol;
|
|
51
80
|
exports.ACURAST_MAINNET_PROTOCOL_NETWORK = {
|
|
52
81
|
name: 'Mainnet',
|
|
53
82
|
type: 'mainnet',
|
|
@@ -55,10 +84,12 @@ exports.ACURAST_MAINNET_PROTOCOL_NETWORK = {
|
|
|
55
84
|
blockExplorerUrl: 'https://polkadot.js.org/apps/?rpc=wss://acurast-canarynet-ws.prod.gke.papers.tech#/explorer',
|
|
56
85
|
blockExplorerApi: ''
|
|
57
86
|
};
|
|
58
|
-
|
|
59
|
-
function createAcurastProtocolOptions(network
|
|
87
|
+
var DEFAULT_ACURAST_PROTOCOL_NETWORK = exports.ACURAST_MAINNET_PROTOCOL_NETWORK;
|
|
88
|
+
function createAcurastProtocolOptions(network) {
|
|
89
|
+
if (network === void 0) { network = {}; }
|
|
60
90
|
return {
|
|
61
|
-
network: {
|
|
91
|
+
network: __assign(__assign({}, DEFAULT_ACURAST_PROTOCOL_NETWORK), network)
|
|
62
92
|
};
|
|
63
93
|
}
|
|
94
|
+
exports.createAcurastProtocolOptions = createAcurastProtocolOptions;
|
|
64
95
|
//# sourceMappingURL=AcurastProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcurastProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AcurastProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AcurastProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AcurastProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAK1D,6DAAoF;AAKpF,iBAAiB;AAEJ,QAAA,gBAAgB,GAAmC;IAC9D,UAAU,EAAE,kCAAmB,CAAC,OAAO;IACvC,IAAI,EAAE,SAAS;IAEf,KAAK,EAAE;QACL,GAAG,EAAE;YACH,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;YACxB,QAAQ,EAAE,EAAE;SACb;KACF;IACD,QAAQ,EAAE,KAAK;IAEf,OAAO,EAAE;QACP,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE;YACP,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,0BAA0B;SAClC;KACF;CACF,CAAA;AAEY,QAAA,qBAAqB,GAAiC;IACjE,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,EAAE;KACX;IACD,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,EAAE;KACV;CACF,CAAA;AAED;IAAyC,uCAAqC;IAC5E,6BAAmB,OAAsD;QAAtD,wBAAA,EAAA,YAAsD;QACvE,IAAM,eAAe,GAA2B,4BAA4B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAE7F,IAAM,QAAQ,GAAmC,wBAAgB,CAAA;QACjE,IAAM,aAAa,GAAiC,6BAAqB,CAAA;eAEzE,kBAAM,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC;IACtE,CAAC;IACH,0BAAC;AAAD,CAAC,AATD,CAAyC,6CAAuB,GAS/D;AATY,kDAAmB;AAWhC,UAAU;AAEV,SAAgB,qBAAqB,CAAC,OAAsD;IAAtD,wBAAA,EAAA,YAAsD;IAC1F,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC;AAFD,sDAEC;AAEY,QAAA,gCAAgC,GAA2B;IACtE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,wCAAwC;IAChD,gBAAgB,EAAE,6FAA6F;IAC/G,gBAAgB,EAAE,EAAE;CACrB,CAAA;AAED,IAAM,gCAAgC,GAA2B,wCAAgC,CAAA;AAEjG,SAAgB,4BAA4B,CAAC,OAA6C;IAA7C,wBAAA,EAAA,YAA6C;IACxF,OAAO;QACL,OAAO,wBAAO,gCAAgC,GAAK,OAAO,CAAE;KAC7D,CAAA;AACH,CAAC;AAJD,oEAIC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.acurastUnsignedTransactionToRequest =
|
|
4
|
-
|
|
5
|
-
exports.acurastTransactionSignRequestToUnsigned = acurastTransactionSignRequestToUnsigned;
|
|
6
|
-
exports.acurastTransactionSignResponseToSigned = acurastTransactionSignResponseToSigned;
|
|
7
|
-
const v1_1 = require("@airgap/substrate/v1");
|
|
3
|
+
exports.acurastTransactionSignResponseToSigned = exports.acurastTransactionSignRequestToUnsigned = exports.acurastSignedTransactionToResponse = exports.acurastUnsignedTransactionToRequest = void 0;
|
|
4
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
8
5
|
function acurastUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
9
6
|
return (0, v1_1.substrateUnsignedTransactionToRequest)(unsigned, publicKey, callbackUrl);
|
|
10
7
|
}
|
|
8
|
+
exports.acurastUnsignedTransactionToRequest = acurastUnsignedTransactionToRequest;
|
|
11
9
|
function acurastSignedTransactionToResponse(signed, accountIdentifier) {
|
|
12
10
|
return (0, v1_1.substrateSignedTransactionToResponse)(signed, accountIdentifier);
|
|
13
11
|
}
|
|
12
|
+
exports.acurastSignedTransactionToResponse = acurastSignedTransactionToResponse;
|
|
14
13
|
function acurastTransactionSignRequestToUnsigned(request) {
|
|
15
14
|
return (0, v1_1.substrateTransactionSignRequestToUnsigned)(request);
|
|
16
15
|
}
|
|
16
|
+
exports.acurastTransactionSignRequestToUnsigned = acurastTransactionSignRequestToUnsigned;
|
|
17
17
|
function acurastTransactionSignResponseToSigned(response) {
|
|
18
18
|
return (0, v1_1.substrateTransactionSignResponseToSigned)(response);
|
|
19
19
|
}
|
|
20
|
+
exports.acurastTransactionSignResponseToSigned = acurastTransactionSignResponseToSigned;
|
|
20
21
|
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;AAAA,2CAO6B;AAK7B,SAAgB,mCAAmC,CACjD,QAAsC,EACtC,SAAiB,EACjB,WAAoB;IAEpB,OAAO,IAAA,0CAAqC,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;AAChF,CAAC;AAND,kFAMC;AAED,SAAgB,kCAAkC,CAChD,MAAkC,EAClC,iBAAyB;IAEzB,OAAO,IAAA,yCAAoC,EAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AACxE,CAAC;AALD,gFAKC;AAED,SAAgB,uCAAuC,CAAC,OAAsC;IAC5F,OAAO,IAAA,8CAAyC,EAAC,OAAO,CAAC,CAAA;AAC3D,CAAC;AAFD,0FAEC;AAED,SAAgB,sCAAsC,CAAC,QAAwC;IAC7F,OAAO,IAAA,6CAAwC,EAAC,QAAQ,CAAC,CAAA;AAC3D,CAAC;AAFD,wFAEC"}
|
|
@@ -1,17 +1,53 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.AcurastV3SerializerCompanion = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
42
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
43
|
+
var serializer_1 = require("@airgap/serializer");
|
|
44
|
+
var transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
45
|
+
var transaction_validator_1 = require("./validators/transaction-validator");
|
|
46
|
+
var validators_1 = require("./validators/validators");
|
|
47
|
+
var acurastTransactionSignRequest = require('./schemas/generated/transaction-sign-request-acurast.json');
|
|
48
|
+
var acurastTransactionSignResponse = require('./schemas/generated/transaction-sign-response-acurast.json');
|
|
49
|
+
var AcurastV3SerializerCompanion = /** @class */ (function () {
|
|
50
|
+
function AcurastV3SerializerCompanion() {
|
|
15
51
|
this.schemas = [
|
|
16
52
|
{
|
|
17
53
|
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
@@ -35,70 +71,111 @@ class AcurastV3SerializerCompanion {
|
|
|
35
71
|
}
|
|
36
72
|
];
|
|
37
73
|
this.acurastTransactionValidator = new transaction_validator_1.AcurastTransactionValidator();
|
|
38
|
-
Object.keys(validators_1.acurastValidators).forEach((key)
|
|
74
|
+
Object.keys(validators_1.acurastValidators).forEach(function (key) {
|
|
39
75
|
validate_1.validators[key] = validators_1.acurastValidators[key];
|
|
40
76
|
});
|
|
41
77
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
78
|
+
AcurastV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
82
|
+
return [2 /*return*/, (0, transaction_converter_1.acurastUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
86
|
+
}
|
|
87
|
+
return [2 /*return*/];
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
AcurastV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
95
|
+
return [2 /*return*/, (0, transaction_converter_1.acurastTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
99
|
+
}
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
AcurastV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
+
var _a;
|
|
107
|
+
return __generator(this, function (_b) {
|
|
108
|
+
switch (_b.label) {
|
|
109
|
+
case 0:
|
|
110
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY)) return [3 /*break*/, 5];
|
|
111
|
+
_b.label = 1;
|
|
112
|
+
case 1:
|
|
113
|
+
_b.trys.push([1, 3, , 4]);
|
|
114
|
+
return [4 /*yield*/, this.acurastTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
115
|
+
case 2:
|
|
116
|
+
_b.sent();
|
|
117
|
+
return [2 /*return*/, true];
|
|
118
|
+
case 3:
|
|
119
|
+
_a = _b.sent();
|
|
120
|
+
return [2 /*return*/, false];
|
|
121
|
+
case 4: return [3 /*break*/, 6];
|
|
122
|
+
case 5: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
123
|
+
case 6: return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
AcurastV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
return __generator(this, function (_a) {
|
|
131
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
132
|
+
return [2 /*return*/, (0, transaction_converter_1.acurastSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
136
|
+
}
|
|
137
|
+
return [2 /*return*/];
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
AcurastV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
145
|
+
return [2 /*return*/, (0, transaction_converter_1.acurastTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
149
|
+
}
|
|
150
|
+
return [2 /*return*/];
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
AcurastV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
+
var _a;
|
|
157
|
+
return __generator(this, function (_b) {
|
|
158
|
+
switch (_b.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY)) return [3 /*break*/, 5];
|
|
161
|
+
_b.label = 1;
|
|
162
|
+
case 1:
|
|
163
|
+
_b.trys.push([1, 3, , 4]);
|
|
164
|
+
return [4 /*yield*/, this.acurastTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
165
|
+
case 2:
|
|
166
|
+
_b.sent();
|
|
167
|
+
return [2 /*return*/, true];
|
|
168
|
+
case 3:
|
|
169
|
+
_a = _b.sent();
|
|
170
|
+
return [2 /*return*/, false];
|
|
171
|
+
case 4: return [3 /*break*/, 6];
|
|
172
|
+
case 5: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
173
|
+
case 6: return [2 /*return*/];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
return AcurastV3SerializerCompanion;
|
|
179
|
+
}());
|
|
103
180
|
exports.AcurastV3SerializerCompanion = AcurastV3SerializerCompanion;
|
|
104
181
|
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,28 @@
|
|
|
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
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.AcurastTransactionValidator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
19
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
20
|
+
var AcurastTransactionValidator = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AcurastTransactionValidator, _super);
|
|
22
|
+
function AcurastTransactionValidator() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AcurastTransactionValidator;
|
|
26
|
+
}(v1_1.SubstrateTransactionValidator));
|
|
7
27
|
exports.AcurastTransactionValidator = AcurastTransactionValidator;
|
|
8
28
|
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,2CAAoE;AAEpE;IAAiD,+CAA6B;IAA9E;;IAAgH,CAAC;IAAD,kCAAC;AAAD,CAAC,AAAjH,CAAiD,kCAA6B,GAAmC;AAApG,kEAA2B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.acurastValidators = void 0;
|
|
4
|
-
|
|
4
|
+
var v1_1 = require("@airgap/substrate/v1");
|
|
5
5
|
exports.acurastValidators = v1_1.substrateValidators;
|
|
6
6
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;AAAA,2CAA0D;AAE7C,QAAA,iBAAiB,GAAG,wBAAmB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SubstrateProtocolConfiguration, SubstrateSS58AccountConfiguration } from '@airgap/substrate/v1';
|
|
2
|
-
export type AcurastTransactionType = never;
|
|
2
|
+
export declare type AcurastTransactionType = never;
|
|
3
3
|
export interface AcurastProtocolConfiguration extends SubstrateProtocolConfiguration<SubstrateSS58AccountConfiguration, AcurastTransactionType> {
|
|
4
4
|
}
|
package/v1/types/crypto.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Sr25519CryptoConfiguration } from '@airgap/module-kit';
|
|
2
|
-
export type AcurastCryptoConfiguration = Sr25519CryptoConfiguration;
|
|
2
|
+
export declare type AcurastCryptoConfiguration = Sr25519CryptoConfiguration;
|
package/v1/types/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SubstrateProtocolNetwork, SubstrateProtocolOptions } from '@airgap/substrate/v1';
|
|
2
2
|
import { AcurastProtocolConfiguration } from './configuration';
|
|
3
|
-
export type AcurastUnits = 'ACU';
|
|
4
|
-
export type AcurastCanaryUnits = 'cACU';
|
|
3
|
+
export declare type AcurastUnits = 'ACU';
|
|
4
|
+
export declare type AcurastCanaryUnits = 'cACU';
|
|
5
5
|
export interface AcurastProtocolNetwork extends SubstrateProtocolNetwork {
|
|
6
6
|
blockExplorerApi: string;
|
|
7
7
|
}
|