@airgap/acurast 0.13.45-beta.2 → 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 +5 -5
- package/v1/controller/AcurastAccountController.js +3 -23
- package/v1/controller/AcurastAccountController.js.map +1 -1
- package/v1/controller/AcurastTransactionController.js +3 -23
- 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 +40 -98
- package/v1/module/AcurastModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/node/AcurastNodeClient.js +3 -23
- package/v1/node/AcurastNodeClient.js.map +1 -1
- package/v1/protocol/AcurastBaseProtocol.js +26 -88
- package/v1/protocol/AcurastBaseProtocol.js.map +1 -1
- package/v1/protocol/AcurastCanaryProtocol.js +19 -50
- package/v1/protocol/AcurastCanaryProtocol.js.map +1 -1
- package/v1/protocol/AcurastProtocol.js +18 -49
- package/v1/protocol/AcurastProtocol.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 +73 -150
- 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
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.3",
|
|
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.3",
|
|
35
|
+
"@airgap/module-kit": "^0.13.45-beta.3",
|
|
36
|
+
"@airgap/serializer": "^0.13.45-beta.3",
|
|
37
|
+
"@airgap/substrate": "^0.13.45-beta.3",
|
|
38
38
|
"@polkadot/util": "2.0.1",
|
|
39
39
|
"@polkadot/wasm-crypto": "0.20.1"
|
|
40
40
|
},
|
|
@@ -1,28 +1,8 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.AcurastAccountController = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function AcurastAccountController() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
return AcurastAccountController;
|
|
26
|
-
}(v1_1.SubstrateCommonAccountController));
|
|
4
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
|
+
class AcurastAccountController extends v1_1.SubstrateCommonAccountController {
|
|
6
|
+
}
|
|
27
7
|
exports.AcurastAccountController = AcurastAccountController;
|
|
28
8
|
//# 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,6CAAuE;AAKvE,MAAa,wBAAyB,SAAQ,qCAAiF;CAAG;AAAlI,4DAAkI"}
|
|
@@ -1,28 +1,8 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.AcurastTransactionController = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function AcurastTransactionController() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
return AcurastTransactionController;
|
|
26
|
-
}(v1_1.SubstrateCommonTransactionController));
|
|
4
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
|
+
class AcurastTransactionController extends v1_1.SubstrateCommonTransactionController {
|
|
6
|
+
}
|
|
27
7
|
exports.AcurastTransactionController = AcurastTransactionController;
|
|
28
8
|
//# 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,6CAA2E;AAK3E,MAAa,4BAA6B,SAAQ,yCAAqF;CAAG;AAA1I,oEAA0I"}
|
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
|
+
const AcurastCanaryProtocol_1 = require("./protocol/AcurastCanaryProtocol");
|
|
5
5
|
Object.defineProperty(exports, "createAcurastCanaryProtocol", { enumerable: true, get: function () { return AcurastCanaryProtocol_1.createAcurastCanaryProtocol; } });
|
|
6
|
-
|
|
6
|
+
const AcurastModule_1 = require("./module/AcurastModule");
|
|
7
7
|
Object.defineProperty(exports, "AcurastModule", { enumerable: true, get: function () { return AcurastModule_1.AcurastModule; } });
|
|
8
|
-
|
|
8
|
+
const 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,4EAAqG;AAa7B,4GAbxC,mDAA2B,OAawC;AAZnG,0DAAsD;AAQ7C,8FARA,6BAAa,OAQA;AAPtB,gEAAmF;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
|
-
|
|
6
|
+
type SupportedProtocols = MainProtocolSymbols.ACURAST | MainProtocolSymbols.ACURAST_CANARY;
|
|
7
7
|
export declare class AcurastModule implements AirGapModule<{
|
|
8
8
|
Protocols: SupportedProtocols;
|
|
9
9
|
ProtocolNetwork: AcurastProtocolNetwork;
|
|
@@ -1,114 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.AcurastModule = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_a[coinlib_core_1.MainProtocolSymbols.ACURAST] = new module_kit_1.ModuleNetworkRegistry({
|
|
4
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
5
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
6
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
7
|
+
const substrate_1 = require("@airgap/substrate");
|
|
8
|
+
const AcurastProtocol_1 = require("../protocol/AcurastProtocol");
|
|
9
|
+
const serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
10
|
+
const AcurastCanaryProtocol_1 = require("../protocol/AcurastCanaryProtocol");
|
|
11
|
+
class AcurastModule {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.networkRegistries = {
|
|
14
|
+
[coinlib_core_1.MainProtocolSymbols.ACURAST]: new module_kit_1.ModuleNetworkRegistry({
|
|
52
15
|
supportedNetworks: [AcurastProtocol_1.ACURAST_MAINNET_PROTOCOL_NETWORK]
|
|
53
16
|
}),
|
|
54
|
-
|
|
17
|
+
[coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY]: new module_kit_1.ModuleNetworkRegistry({
|
|
55
18
|
supportedNetworks: [AcurastCanaryProtocol_1.ACURAST_CANARY_PROTOCOL_NETWORK]
|
|
56
|
-
})
|
|
57
|
-
|
|
19
|
+
})
|
|
20
|
+
};
|
|
58
21
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
59
22
|
}
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
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) {
|
|
23
|
+
async createOfflineProtocol(identifier) {
|
|
24
|
+
return this.createProtocol(identifier);
|
|
25
|
+
}
|
|
26
|
+
async createOnlineProtocol(identifier, networkOrId) {
|
|
27
|
+
const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
|
|
28
|
+
if (network === undefined) {
|
|
29
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, `Protocol network type not supported. (Acurast)`);
|
|
30
|
+
}
|
|
31
|
+
return this.createProtocol(identifier, network);
|
|
32
|
+
}
|
|
33
|
+
async createBlockExplorer(identifier, networkOrId) {
|
|
34
|
+
const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
|
|
35
|
+
if (network === undefined) {
|
|
36
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, `Block Explorer network type not supported. (Acurast)`);
|
|
37
|
+
}
|
|
38
|
+
return new substrate_1.SubscanBlockExplorer(network.blockExplorerUrl);
|
|
39
|
+
}
|
|
40
|
+
async createV3SerializerCompanion() {
|
|
41
|
+
return new serializer_companion_1.AcurastV3SerializerCompanion();
|
|
42
|
+
}
|
|
43
|
+
createProtocol(identifier, network) {
|
|
101
44
|
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST) {
|
|
102
|
-
return (0, AcurastProtocol_1.createAcurastProtocol)({ network
|
|
45
|
+
return (0, AcurastProtocol_1.createAcurastProtocol)({ network });
|
|
103
46
|
}
|
|
104
47
|
else if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
105
|
-
return (0, AcurastCanaryProtocol_1.createAcurastCanaryProtocol)({ network
|
|
48
|
+
return (0, AcurastCanaryProtocol_1.createAcurastCanaryProtocol)({ network });
|
|
106
49
|
}
|
|
107
50
|
else {
|
|
108
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE,
|
|
51
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported. (Acurast)`);
|
|
109
52
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
}());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
113
55
|
exports.AcurastModule = AcurastModule;
|
|
114
56
|
//# 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,uDAAkE;AAClE,wDAAqE;AACrE,mDAO2B;AAG3B,iDAAwD;AAExD,iEAAqG;AACrG,gFAAoF;AAEpF,6EAAgH;AAIhH,MAAa,aAAa;IAA1B;QACmB,sBAAiB,GAAsD;YACtF,CAAC,kCAAmB,CAAC,OAAO,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBACvD,iBAAiB,EAAE,CAAC,kDAAgC,CAAC;aACtD,CAAC;YACF,CAAC,kCAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBAC9D,iBAAiB,EAAE,CAAC,uDAA+B,CAAC;aACrD,CAAC;SACH,CAAA;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IA+C1I,CAAC;IA7CQ,KAAK,CAAC,qBAAqB,CAAC,UAA8B;QAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC/B,UAA8B,EAC9B,WAA6C;QAE7C,MAAM,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;QAE9G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,gDAAgD,CAAC,CAAA;QACvG,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,UAA8B,EAC9B,WAA6C;QAE7C,MAAM,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;QAE9G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,sDAAsD,CAAC,CAAA;QAC7G,CAAC;QAED,OAAO,IAAI,gCAAoB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAC,2BAA2B;QACtC,OAAO,IAAI,mDAA4B,EAAE,CAAA;IAC3C,CAAC;IAEO,cAAc,CAAC,UAA8B,EAAE,OAAyB;QAC9E,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,EAAE,CAAC;YAC/C,OAAO,IAAA,uCAAqB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QAC3C,CAAC;aAAM,IAAI,UAAU,KAAK,kCAAmB,CAAC,cAAc,EAAE,CAAC;YAC7D,OAAO,IAAA,mDAA2B,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QACjD,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,YAAY,UAAU,2BAA2B,CAAC,CAAA;QACxG,CAAC;IACH,CAAC;CACF;AAxDD,sCAwDC"}
|
package/v1/module.js
CHANGED
|
@@ -14,11 +14,10 @@ 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 = create;
|
|
18
|
+
const 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;
|
|
24
23
|
//# 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":";;;;;;;;;;;;;;;;AAKA,wBAEC;AAND,0DAAsD;AAEtD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,6BAAa,EAAE,CAAA;AAC5B,CAAC"}
|
|
@@ -1,28 +1,8 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.AcurastNodeClient = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function AcurastNodeClient() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
return AcurastNodeClient;
|
|
26
|
-
}(v1_1.SubstrateCommonNodeClient));
|
|
4
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
|
+
class AcurastNodeClient extends v1_1.SubstrateCommonNodeClient {
|
|
6
|
+
}
|
|
27
7
|
exports.AcurastNodeClient = AcurastNodeClient;
|
|
28
8
|
//# 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,6CAAgE;AAIhE,MAAa,iBAAkB,SAAQ,8BAAuD;CAAG;AAAjG,8CAAiG"}
|
|
@@ -1,96 +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 __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.AcurastBaseProtocolImpl = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
4
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
|
+
const AcurastAccountController_1 = require("../controller/AcurastAccountController");
|
|
6
|
+
const AcurastTransactionController_1 = require("../controller/AcurastTransactionController");
|
|
7
|
+
const AcurastNodeClient_1 = require("../node/AcurastNodeClient");
|
|
59
8
|
// Implemenation
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return _super.call(this, options, nodeClient, accountController, transactionController, blockExplorer) || this;
|
|
9
|
+
class AcurastBaseProtocolImpl extends v1_1.SubstrateProtocolImpl {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
const nodeClient = new AcurastNodeClient_1.AcurastNodeClient(options.configuration, options.network.rpcUrl);
|
|
12
|
+
const accountController = new AcurastAccountController_1.AcurastAccountController(options.configuration, nodeClient);
|
|
13
|
+
const transactionController = new AcurastTransactionController_1.AcurastTransactionController(options.configuration, nodeClient);
|
|
14
|
+
const blockExplorer = new v1_1.SubscanBlockExplorerClient(options.network.blockExplorerApi);
|
|
15
|
+
super(options, nodeClient, accountController, transactionController, blockExplorer);
|
|
68
16
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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];
|
|
17
|
+
async getFutureRequiredTransactions(accountId, intention) {
|
|
18
|
+
const balance = await this.accountController.getBalance(accountId);
|
|
19
|
+
const transferableBalance = balance.transferable.minus(balance.existentialDeposit);
|
|
20
|
+
const requiredTransactions = [];
|
|
21
|
+
if (intention === 'transfer') {
|
|
22
|
+
requiredTransactions.push([
|
|
23
|
+
'transfer',
|
|
24
|
+
{
|
|
25
|
+
to: v1_1.SubstrateSS58Address.createPlaceholder(),
|
|
26
|
+
value: transferableBalance
|
|
89
27
|
}
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
return requiredTransactions;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
95
33
|
exports.AcurastBaseProtocolImpl = AcurastBaseProtocolImpl;
|
|
96
34
|
//# 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,6CAO6B;AAE7B,qFAAiF;AACjF,6FAAyF;AACzF,iEAA6D;AAU7D,gBAAgB;AAEhB,MAAsB,uBACpB,SAAQ,0BAOP;IAGD,YAAmB,OAA2C;QAC5D,MAAM,UAAU,GAAsB,IAAI,qCAAiB,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE1G,MAAM,iBAAiB,GAA6B,IAAI,mDAAwB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QACnH,MAAM,qBAAqB,GAAiC,IAAI,2DAA4B,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAE/H,MAAM,aAAa,GAA+B,IAAI,+BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;QAElH,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,CAAC,CAAA;IACrF,CAAC;IAES,KAAK,CAAC,6BAA6B,CAC3C,SAAmD,EACnD,SAA+B;QAE/B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;QAElE,MAAM,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;QAElF,MAAM,oBAAoB,GAAoE,EAAE,CAAA;QAEhG,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;YAC7B,oBAAoB,CAAC,IAAI,CAAC;gBACxB,UAAU;gBACV;oBACE,EAAE,EAAE,yBAAoB,CAAC,iBAAiB,EAAE;oBAC5C,KAAK,EAAE,mBAAmB;iBAC3B;aACF,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,oBAAoB,CAAA;IAC7B,CAAC;CACF;AA5CD,0DA4CC"}
|
|
@@ -1,35 +1,11 @@
|
|
|
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
|
-
|
|
3
|
+
exports.ACURAST_CANARY_PROTOCOL_NETWORK = exports.AcurastCanaryProtocolImpl = exports.ACURAST_CANARY_METADATA = void 0;
|
|
4
|
+
exports.createAcurastCanaryProtocol = createAcurastCanaryProtocol;
|
|
5
|
+
exports.createAcurastCanaryProtocolOptions = createAcurastCanaryProtocolOptions;
|
|
6
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
7
|
+
const AcurastBaseProtocol_1 = require("./AcurastBaseProtocol");
|
|
8
|
+
const AcurastProtocol_1 = require("./AcurastProtocol");
|
|
33
9
|
// Implementation
|
|
34
10
|
exports.ACURAST_CANARY_METADATA = {
|
|
35
11
|
identifier: coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY,
|
|
@@ -42,32 +18,27 @@ exports.ACURAST_CANARY_METADATA = {
|
|
|
42
18
|
},
|
|
43
19
|
mainUnit: 'cACU',
|
|
44
20
|
account: {
|
|
45
|
-
standardDerivationPath:
|
|
21
|
+
standardDerivationPath: `m/44'/434'/0'/0/0`,
|
|
46
22
|
address: {
|
|
47
23
|
isCaseSensitive: true,
|
|
48
|
-
placeholder:
|
|
24
|
+
placeholder: `5ABC...`,
|
|
49
25
|
regex: '^5[a-km-zA-HJ-NP-Z1-9]+$'
|
|
50
26
|
}
|
|
51
27
|
}
|
|
52
28
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var configuration = AcurastProtocol_1.ACURAST_CONFIGURATION;
|
|
60
|
-
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
29
|
+
class AcurastCanaryProtocolImpl extends AcurastBaseProtocol_1.AcurastBaseProtocolImpl {
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
const completeOptions = createAcurastCanaryProtocolOptions(options.network);
|
|
32
|
+
const metadata = exports.ACURAST_CANARY_METADATA;
|
|
33
|
+
const configuration = AcurastProtocol_1.ACURAST_CONFIGURATION;
|
|
34
|
+
super({ metadata, configuration, network: completeOptions.network });
|
|
61
35
|
}
|
|
62
|
-
|
|
63
|
-
}(AcurastBaseProtocol_1.AcurastBaseProtocolImpl));
|
|
36
|
+
}
|
|
64
37
|
exports.AcurastCanaryProtocolImpl = AcurastCanaryProtocolImpl;
|
|
65
38
|
// Factory
|
|
66
|
-
function createAcurastCanaryProtocol(options) {
|
|
67
|
-
if (options === void 0) { options = {}; }
|
|
39
|
+
function createAcurastCanaryProtocol(options = {}) {
|
|
68
40
|
return new AcurastCanaryProtocolImpl(options);
|
|
69
41
|
}
|
|
70
|
-
exports.createAcurastCanaryProtocol = createAcurastCanaryProtocol;
|
|
71
42
|
exports.ACURAST_CANARY_PROTOCOL_NETWORK = {
|
|
72
43
|
name: 'Mainnet',
|
|
73
44
|
type: 'mainnet',
|
|
@@ -76,12 +47,10 @@ exports.ACURAST_CANARY_PROTOCOL_NETWORK = {
|
|
|
76
47
|
// blockExplorerUrl: 'https://polkadot.js.org/apps/?rpc=wss.collator-1.acurast.papers.tech#/explorer',
|
|
77
48
|
blockExplorerApi: ''
|
|
78
49
|
};
|
|
79
|
-
|
|
80
|
-
function createAcurastCanaryProtocolOptions(network) {
|
|
81
|
-
if (network === void 0) { network = {}; }
|
|
50
|
+
const DEFAULT_ACURAST_PROTOCOL_NETWORK = exports.ACURAST_CANARY_PROTOCOL_NETWORK;
|
|
51
|
+
function createAcurastCanaryProtocolOptions(network = {}) {
|
|
82
52
|
return {
|
|
83
|
-
network:
|
|
53
|
+
network: { ...DEFAULT_ACURAST_PROTOCOL_NETWORK, ...network }
|
|
84
54
|
};
|
|
85
55
|
}
|
|
86
|
-
exports.createAcurastCanaryProtocolOptions = createAcurastCanaryProtocolOptions;
|
|
87
56
|
//# 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":";;;AA+CA,kEAEC;AAaD,gFAIC;AAlED,uDAA0D;AAK1D,+DAAoF;AACpF,uDAAyD;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,MAAa,yBAA0B,SAAQ,6CAA2C;IACxF,YAAmB,UAAoD,EAAE;QACvE,MAAM,eAAe,GAA2B,kCAAkC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEnG,MAAM,QAAQ,GAAyC,+BAAuB,CAAA;QAC9E,MAAM,aAAa,GAAiC,uCAAqB,CAAA;QAEzE,KAAK,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,CAAA;IACtE,CAAC;CACF;AATD,8DASC;AAED,UAAU;AAEV,SAAgB,2BAA2B,CAAC,UAAoD,EAAE;IAChG,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAA;AAC/C,CAAC;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,MAAM,gCAAgC,GAA2B,uCAA+B,CAAA;AAEhG,SAAgB,kCAAkC,CAAC,UAA2C,EAAE;IAC9F,OAAO;QACL,OAAO,EAAE,EAAE,GAAG,gCAAgC,EAAE,GAAG,OAAO,EAAE;KAC7D,CAAA;AACH,CAAC"}
|
|
@@ -1,34 +1,10 @@
|
|
|
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
|
-
|
|
3
|
+
exports.ACURAST_MAINNET_PROTOCOL_NETWORK = exports.AcurastProtocolImpl = exports.ACURAST_CONFIGURATION = exports.ACURAST_METADATA = void 0;
|
|
4
|
+
exports.createAcurastProtocol = createAcurastProtocol;
|
|
5
|
+
exports.createAcurastProtocolOptions = createAcurastProtocolOptions;
|
|
6
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
7
|
+
const AcurastBaseProtocol_1 = require("./AcurastBaseProtocol");
|
|
32
8
|
// Implementation
|
|
33
9
|
exports.ACURAST_METADATA = {
|
|
34
10
|
identifier: coinlib_core_1.MainProtocolSymbols.ACURAST,
|
|
@@ -41,10 +17,10 @@ exports.ACURAST_METADATA = {
|
|
|
41
17
|
},
|
|
42
18
|
mainUnit: 'ACU',
|
|
43
19
|
account: {
|
|
44
|
-
standardDerivationPath:
|
|
20
|
+
standardDerivationPath: `m/44'/434'/0'/0/0`,
|
|
45
21
|
address: {
|
|
46
22
|
isCaseSensitive: true,
|
|
47
|
-
placeholder:
|
|
23
|
+
placeholder: `5ABC...`,
|
|
48
24
|
regex: '^5[a-km-zA-HJ-NP-Z1-9]+$'
|
|
49
25
|
}
|
|
50
26
|
}
|
|
@@ -59,24 +35,19 @@ exports.ACURAST_CONFIGURATION = {
|
|
|
59
35
|
types: {}
|
|
60
36
|
}
|
|
61
37
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var configuration = exports.ACURAST_CONFIGURATION;
|
|
69
|
-
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
38
|
+
class AcurastProtocolImpl extends AcurastBaseProtocol_1.AcurastBaseProtocolImpl {
|
|
39
|
+
constructor(options = {}) {
|
|
40
|
+
const completeOptions = createAcurastProtocolOptions(options.network);
|
|
41
|
+
const metadata = exports.ACURAST_METADATA;
|
|
42
|
+
const configuration = exports.ACURAST_CONFIGURATION;
|
|
43
|
+
super({ metadata, configuration, network: completeOptions.network });
|
|
70
44
|
}
|
|
71
|
-
|
|
72
|
-
}(AcurastBaseProtocol_1.AcurastBaseProtocolImpl));
|
|
45
|
+
}
|
|
73
46
|
exports.AcurastProtocolImpl = AcurastProtocolImpl;
|
|
74
47
|
// Factory
|
|
75
|
-
function createAcurastProtocol(options) {
|
|
76
|
-
if (options === void 0) { options = {}; }
|
|
48
|
+
function createAcurastProtocol(options = {}) {
|
|
77
49
|
return new AcurastProtocolImpl(options);
|
|
78
50
|
}
|
|
79
|
-
exports.createAcurastProtocol = createAcurastProtocol;
|
|
80
51
|
exports.ACURAST_MAINNET_PROTOCOL_NETWORK = {
|
|
81
52
|
name: 'Mainnet',
|
|
82
53
|
type: 'mainnet',
|
|
@@ -84,12 +55,10 @@ exports.ACURAST_MAINNET_PROTOCOL_NETWORK = {
|
|
|
84
55
|
blockExplorerUrl: 'https://polkadot.js.org/apps/?rpc=wss://acurast-canarynet-ws.prod.gke.papers.tech#/explorer',
|
|
85
56
|
blockExplorerApi: ''
|
|
86
57
|
};
|
|
87
|
-
|
|
88
|
-
function createAcurastProtocolOptions(network) {
|
|
89
|
-
if (network === void 0) { network = {}; }
|
|
58
|
+
const DEFAULT_ACURAST_PROTOCOL_NETWORK = exports.ACURAST_MAINNET_PROTOCOL_NETWORK;
|
|
59
|
+
function createAcurastProtocolOptions(network = {}) {
|
|
90
60
|
return {
|
|
91
|
-
network:
|
|
61
|
+
network: { ...DEFAULT_ACURAST_PROTOCOL_NETWORK, ...network }
|
|
92
62
|
};
|
|
93
63
|
}
|
|
94
|
-
exports.createAcurastProtocolOptions = createAcurastProtocolOptions;
|
|
95
64
|
//# 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":";;;AA0DA,sDAEC;AAYD,oEAIC;AA5ED,uDAA0D;AAK1D,+DAAoF;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,MAAa,mBAAoB,SAAQ,6CAAqC;IAC5E,YAAmB,UAAoD,EAAE;QACvE,MAAM,eAAe,GAA2B,4BAA4B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAE7F,MAAM,QAAQ,GAAmC,wBAAgB,CAAA;QACjE,MAAM,aAAa,GAAiC,6BAAqB,CAAA;QAEzE,KAAK,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,CAAA;IACtE,CAAC;CACF;AATD,kDASC;AAED,UAAU;AAEV,SAAgB,qBAAqB,CAAC,UAAoD,EAAE;IAC1F,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC;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,MAAM,gCAAgC,GAA2B,wCAAgC,CAAA;AAEjG,SAAgB,4BAA4B,CAAC,UAA2C,EAAE;IACxF,OAAO;QACL,OAAO,EAAE,EAAE,GAAG,gCAAgC,EAAE,GAAG,OAAO,EAAE;KAC7D,CAAA;AACH,CAAC"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.acurastUnsignedTransactionToRequest = acurastUnsignedTransactionToRequest;
|
|
4
|
+
exports.acurastSignedTransactionToResponse = acurastSignedTransactionToResponse;
|
|
5
|
+
exports.acurastTransactionSignRequestToUnsigned = acurastTransactionSignRequestToUnsigned;
|
|
6
|
+
exports.acurastTransactionSignResponseToSigned = acurastTransactionSignResponseToSigned;
|
|
7
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
8
|
function acurastUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
6
9
|
return (0, v1_1.substrateUnsignedTransactionToRequest)(unsigned, publicKey, callbackUrl);
|
|
7
10
|
}
|
|
8
|
-
exports.acurastUnsignedTransactionToRequest = acurastUnsignedTransactionToRequest;
|
|
9
11
|
function acurastSignedTransactionToResponse(signed, accountIdentifier) {
|
|
10
12
|
return (0, v1_1.substrateSignedTransactionToResponse)(signed, accountIdentifier);
|
|
11
13
|
}
|
|
12
|
-
exports.acurastSignedTransactionToResponse = acurastSignedTransactionToResponse;
|
|
13
14
|
function acurastTransactionSignRequestToUnsigned(request) {
|
|
14
15
|
return (0, v1_1.substrateTransactionSignRequestToUnsigned)(request);
|
|
15
16
|
}
|
|
16
|
-
exports.acurastTransactionSignRequestToUnsigned = acurastTransactionSignRequestToUnsigned;
|
|
17
17
|
function acurastTransactionSignResponseToSigned(response) {
|
|
18
18
|
return (0, v1_1.substrateTransactionSignResponseToSigned)(response);
|
|
19
19
|
}
|
|
20
|
-
exports.acurastTransactionSignResponseToSigned = acurastTransactionSignResponseToSigned;
|
|
21
20
|
//# 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":";;AAYA,kFAMC;AAED,gFAKC;AAED,0FAEC;AAED,wFAEC;AAjCD,6CAO6B;AAK7B,SAAgB,mCAAmC,CACjD,QAAsC,EACtC,SAAiB,EACjB,WAAoB;IAEpB,OAAO,IAAA,0CAAqC,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;AAChF,CAAC;AAED,SAAgB,kCAAkC,CAChD,MAAkC,EAClC,iBAAyB;IAEzB,OAAO,IAAA,yCAAoC,EAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AACxE,CAAC;AAED,SAAgB,uCAAuC,CAAC,OAAsC;IAC5F,OAAO,IAAA,8CAAyC,EAAC,OAAO,CAAC,CAAA;AAC3D,CAAC;AAED,SAAgB,sCAAsC,CAAC,QAAwC;IAC7F,OAAO,IAAA,6CAAwC,EAAC,QAAQ,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -1,53 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.AcurastV3SerializerCompanion = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
4
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
5
|
+
const validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
6
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
7
|
+
const serializer_1 = require("@airgap/serializer");
|
|
8
|
+
const transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
9
|
+
const transaction_validator_1 = require("./validators/transaction-validator");
|
|
10
|
+
const validators_1 = require("./validators/validators");
|
|
11
|
+
const acurastTransactionSignRequest = require('./schemas/generated/transaction-sign-request-acurast.json');
|
|
12
|
+
const acurastTransactionSignResponse = require('./schemas/generated/transaction-sign-response-acurast.json');
|
|
13
|
+
class AcurastV3SerializerCompanion {
|
|
14
|
+
constructor() {
|
|
51
15
|
this.schemas = [
|
|
52
16
|
{
|
|
53
17
|
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
@@ -71,111 +35,70 @@ var AcurastV3SerializerCompanion = /** @class */ (function () {
|
|
|
71
35
|
}
|
|
72
36
|
];
|
|
73
37
|
this.acurastTransactionValidator = new transaction_validator_1.AcurastTransactionValidator();
|
|
74
|
-
Object.keys(validators_1.acurastValidators).forEach(
|
|
38
|
+
Object.keys(validators_1.acurastValidators).forEach((key) => {
|
|
75
39
|
validate_1.validators[key] = validators_1.acurastValidators[key];
|
|
76
40
|
});
|
|
77
41
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
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
|
-
}());
|
|
42
|
+
async toTransactionSignRequest(identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
43
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
44
|
+
return (0, transaction_converter_1.acurastUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async fromTransactionSignRequest(identifier, transactionSignRequest) {
|
|
51
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
52
|
+
return (0, transaction_converter_1.acurastTransactionSignRequestToUnsigned)(transactionSignRequest);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async validateTransactionSignRequest(identifier, transactionSignRequest) {
|
|
59
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
60
|
+
try {
|
|
61
|
+
await this.acurastTransactionValidator.validateUnsignedTransaction(transactionSignRequest);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async toTransactionSignResponse(identifier, signedTransaction, accountIdentifier) {
|
|
73
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
74
|
+
return (0, transaction_converter_1.acurastSignedTransactionToResponse)(signedTransaction, accountIdentifier);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async fromTransactionSignResponse(identifier, transactionSignResponse) {
|
|
81
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
82
|
+
return (0, transaction_converter_1.acurastTransactionSignResponseToSigned)(transactionSignResponse);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async validateTransactionSignResponse(identifier, transactionSignResponse) {
|
|
89
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.ACURAST || identifier === coinlib_core_1.MainProtocolSymbols.ACURAST_CANARY) {
|
|
90
|
+
try {
|
|
91
|
+
await this.acurastTransactionValidator.validateSignedTransaction(transactionSignResponse);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, `Protocol ${identifier} not supported`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
180
103
|
exports.AcurastV3SerializerCompanion = AcurastV3SerializerCompanion;
|
|
181
104
|
//# 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,28 +1,8 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.AcurastTransactionValidator = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function AcurastTransactionValidator() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
return AcurastTransactionValidator;
|
|
26
|
-
}(v1_1.SubstrateTransactionValidator));
|
|
4
|
+
const v1_1 = require("@airgap/substrate/v1");
|
|
5
|
+
class AcurastTransactionValidator extends v1_1.SubstrateTransactionValidator {
|
|
6
|
+
}
|
|
27
7
|
exports.AcurastTransactionValidator = AcurastTransactionValidator;
|
|
28
8
|
//# 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,6CAAoE;AAEpE,MAAa,2BAA4B,SAAQ,kCAA6B;CAAmC;AAAjH,kEAAiH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.acurastValidators = void 0;
|
|
4
|
-
|
|
4
|
+
const 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,6CAA0D;AAE7C,QAAA,iBAAiB,GAAG,wBAAmB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SubstrateProtocolConfiguration, SubstrateSS58AccountConfiguration } from '@airgap/substrate/v1';
|
|
2
|
-
export
|
|
2
|
+
export 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
|
|
2
|
+
export 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
|
|
4
|
-
export
|
|
3
|
+
export type AcurastUnits = 'ACU';
|
|
4
|
+
export type AcurastCanaryUnits = 'cACU';
|
|
5
5
|
export interface AcurastProtocolNetwork extends SubstrateProtocolNetwork {
|
|
6
6
|
blockExplorerApi: string;
|
|
7
7
|
}
|