@wallfree-dev/astar 0.13.42
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/LICENSE.md +7 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +65 -0
- package/readme.md +121 -0
- package/v0/index.d.ts +5 -0
- package/v0/index.js +31 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/astar/AstarProtocol.d.ts +22 -0
- package/v0/protocol/astar/AstarProtocol.js +79 -0
- package/v0/protocol/astar/AstarProtocol.js.map +1 -0
- package/v0/protocol/astar/AstarProtocolOptions.d.ts +28 -0
- package/v0/protocol/astar/AstarProtocolOptions.js +96 -0
- package/v0/protocol/astar/AstarProtocolOptions.js.map +1 -0
- package/v0/protocol/shiden/ShidenProtocol.d.ts +19 -0
- package/v0/protocol/shiden/ShidenProtocol.js +72 -0
- package/v0/protocol/shiden/ShidenProtocol.js.map +1 -0
- package/v0/protocol/shiden/ShidenProtocolOptions.d.ts +22 -0
- package/v0/protocol/shiden/ShidenProtocolOptions.js +80 -0
- package/v0/protocol/shiden/ShidenProtocolOptions.js.map +1 -0
- package/v1/controller/AstarAccountController.d.ts +5 -0
- package/v1/controller/AstarAccountController.js +28 -0
- package/v1/controller/AstarAccountController.js.map +1 -0
- package/v1/controller/AstarTransactionController.d.ts +5 -0
- package/v1/controller/AstarTransactionController.js +28 -0
- package/v1/controller/AstarTransactionController.js.map +1 -0
- package/v1/index.d.ts +9 -0
- package/v1/index.js +10 -0
- package/v1/index.js.map +1 -0
- package/v1/module/AstarModule.d.ts +19 -0
- package/v1/module/AstarModule.js +113 -0
- package/v1/module/AstarModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/node/AstarNodeClient.d.ts +4 -0
- package/v1/node/AstarNodeClient.js +28 -0
- package/v1/node/AstarNodeClient.js.map +1 -0
- package/v1/protocol/AstarBaseProtocol.d.ts +13 -0
- package/v1/protocol/AstarBaseProtocol.js +96 -0
- package/v1/protocol/AstarBaseProtocol.js.map +1 -0
- package/v1/protocol/AstarProtocol.d.ts +14 -0
- package/v1/protocol/AstarProtocol.js +119 -0
- package/v1/protocol/AstarProtocol.js.map +1 -0
- package/v1/protocol/ShidenProtocol.d.ts +14 -0
- package/v1/protocol/ShidenProtocol.js +111 -0
- package/v1/protocol/ShidenProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +21 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-astar.json +36 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-astar.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +14 -0
- package/v1/serializer/v3/serializer-companion.js +189 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +4 -0
- package/v1/serializer/v3/validators/transaction-validator.js +28 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +4 -0
- package/v1/serializer/v3/validators/validators.js +6 -0
- package/v1/serializer/v3/validators/validators.js.map +1 -0
- package/v1/types/configuration.d.ts +4 -0
- package/v1/types/configuration.js +3 -0
- package/v1/types/configuration.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +12 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ShidenProtocolOptions = exports.ShidenProtocolNetwork = exports.ShidenProtocolNetworkExtras = exports.ShidenSubscanBlockExplorer = exports.ShidenProtocolConfig = void 0;
|
|
19
|
+
var ProtocolNetwork_1 = require("@wallfree-dev/coinlib-core/utils/ProtocolNetwork");
|
|
20
|
+
var SubstrateProtocolOptions_1 = require("@wallfree-dev/substrate/v0/protocol/SubstrateProtocolOptions");
|
|
21
|
+
var AstarProtocolOptions_1 = require("../astar/AstarProtocolOptions");
|
|
22
|
+
var MAINNET_NAME = 'Mainnet';
|
|
23
|
+
var NODE_URL = 'https://shiden.public.curie.radiumblock.co/ws';
|
|
24
|
+
var BLOCK_EXPLORER_URL = 'https://shiden.subscan.io';
|
|
25
|
+
var BLOCK_EXPLORER_API = 'https://shiden.subscan.prod.gke.papers.tech/api/scan';
|
|
26
|
+
var ShidenProtocolConfig = /** @class */ (function (_super) {
|
|
27
|
+
__extends(ShidenProtocolConfig, _super);
|
|
28
|
+
function ShidenProtocolConfig() {
|
|
29
|
+
return _super.call(this) || this;
|
|
30
|
+
}
|
|
31
|
+
return ShidenProtocolConfig;
|
|
32
|
+
}(AstarProtocolOptions_1.AstarProtocolConfig));
|
|
33
|
+
exports.ShidenProtocolConfig = ShidenProtocolConfig;
|
|
34
|
+
var ShidenSubscanBlockExplorer = /** @class */ (function (_super) {
|
|
35
|
+
__extends(ShidenSubscanBlockExplorer, _super);
|
|
36
|
+
function ShidenSubscanBlockExplorer(blockExplorer) {
|
|
37
|
+
if (blockExplorer === void 0) { blockExplorer = BLOCK_EXPLORER_URL; }
|
|
38
|
+
return _super.call(this, blockExplorer) || this;
|
|
39
|
+
}
|
|
40
|
+
return ShidenSubscanBlockExplorer;
|
|
41
|
+
}(SubstrateProtocolOptions_1.SubscanBlockExplorer));
|
|
42
|
+
exports.ShidenSubscanBlockExplorer = ShidenSubscanBlockExplorer;
|
|
43
|
+
var ShidenProtocolNetworkExtras = /** @class */ (function (_super) {
|
|
44
|
+
__extends(ShidenProtocolNetworkExtras, _super);
|
|
45
|
+
function ShidenProtocolNetworkExtras(apiUrl) {
|
|
46
|
+
if (apiUrl === void 0) { apiUrl = BLOCK_EXPLORER_API; }
|
|
47
|
+
var _this = _super.call(this, apiUrl) || this;
|
|
48
|
+
_this.apiUrl = apiUrl;
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
return ShidenProtocolNetworkExtras;
|
|
52
|
+
}(AstarProtocolOptions_1.AstarProtocolNetworkExtras));
|
|
53
|
+
exports.ShidenProtocolNetworkExtras = ShidenProtocolNetworkExtras;
|
|
54
|
+
var ShidenProtocolNetwork = /** @class */ (function (_super) {
|
|
55
|
+
__extends(ShidenProtocolNetwork, _super);
|
|
56
|
+
function ShidenProtocolNetwork(name, type, rpcUrl, blockExplorer, extras) {
|
|
57
|
+
if (name === void 0) { name = MAINNET_NAME; }
|
|
58
|
+
if (type === void 0) { type = ProtocolNetwork_1.NetworkType.MAINNET; }
|
|
59
|
+
if (rpcUrl === void 0) { rpcUrl = NODE_URL; }
|
|
60
|
+
if (blockExplorer === void 0) { blockExplorer = new ShidenSubscanBlockExplorer(); }
|
|
61
|
+
if (extras === void 0) { extras = new ShidenProtocolNetworkExtras(); }
|
|
62
|
+
return _super.call(this, name, type, rpcUrl, blockExplorer, extras) || this;
|
|
63
|
+
}
|
|
64
|
+
return ShidenProtocolNetwork;
|
|
65
|
+
}(AstarProtocolOptions_1.AstarProtocolNetwork));
|
|
66
|
+
exports.ShidenProtocolNetwork = ShidenProtocolNetwork;
|
|
67
|
+
var ShidenProtocolOptions = /** @class */ (function (_super) {
|
|
68
|
+
__extends(ShidenProtocolOptions, _super);
|
|
69
|
+
function ShidenProtocolOptions(network, config) {
|
|
70
|
+
if (network === void 0) { network = new ShidenProtocolNetwork(); }
|
|
71
|
+
if (config === void 0) { config = new ShidenProtocolConfig(); }
|
|
72
|
+
var _this = _super.call(this, network, config) || this;
|
|
73
|
+
_this.network = network;
|
|
74
|
+
_this.config = config;
|
|
75
|
+
return _this;
|
|
76
|
+
}
|
|
77
|
+
return ShidenProtocolOptions;
|
|
78
|
+
}(AstarProtocolOptions_1.BaseAstarProtocolOptions));
|
|
79
|
+
exports.ShidenProtocolOptions = ShidenProtocolOptions;
|
|
80
|
+
//# sourceMappingURL=ShidenProtocolOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShidenProtocolOptions.js","sourceRoot":"","sources":["../../../../src/v0/protocol/shiden/ShidenProtocolOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,oFAA8E;AAC9E,yGAAmG;AAEnG,sEAKsC;AAEtC,IAAM,YAAY,GAAW,SAAS,CAAA;AAEtC,IAAM,QAAQ,GAAW,+CAA+C,CAAA;AAExE,IAAM,kBAAkB,GAAW,2BAA2B,CAAA;AAC9D,IAAM,kBAAkB,GAAW,sDAAsD,CAAA;AAEzF;IAA0C,wCAAmB;IAC3D;eACE,iBAAO;IACT,CAAC;IACH,2BAAC;AAAD,CAAC,AAJD,CAA0C,0CAAmB,GAI5D;AAJY,oDAAoB;AAMjC;IAAgD,8CAAoB;IAClE,oCAAY,aAA0C;QAA1C,8BAAA,EAAA,kCAA0C;eACpD,kBAAM,aAAa,CAAC;IACtB,CAAC;IACH,iCAAC;AAAD,CAAC,AAJD,CAAgD,+CAAoB,GAInE;AAJY,gEAA0B;AAMvC;IAAiD,+CAA0B;IACzE,qCAA4B,MAAmC;QAAnC,uBAAA,EAAA,2BAAmC;QAA/D,YACE,kBAAM,MAAM,CAAC,SACd;QAF2B,YAAM,GAAN,MAAM,CAA6B;;IAE/D,CAAC;IACH,kCAAC;AAAD,CAAC,AAJD,CAAiD,iDAA0B,GAI1E;AAJY,kEAA2B;AAMxC;IAA2C,yCAAoB;IAC7D,+BACE,IAA2B,EAC3B,IAAuC,EACvC,MAAyB,EACzB,aAAuE,EACvE,MAAuE;QAJvE,qBAAA,EAAA,mBAA2B;QAC3B,qBAAA,EAAA,OAAoB,6BAAW,CAAC,OAAO;QACvC,uBAAA,EAAA,iBAAyB;QACzB,8BAAA,EAAA,oBAA2C,0BAA0B,EAAE;QACvE,uBAAA,EAAA,aAA0C,2BAA2B,EAAE;eAEvE,kBAAM,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC;IAClD,CAAC;IACH,4BAAC;AAAD,CAAC,AAVD,CAA2C,2CAAoB,GAU9D;AAVY,sDAAqB;AAYlC;IAA2C,yCAA8C;IACvF,+BACkB,OAA4D,EAC5D,MAAyD;QADzD,wBAAA,EAAA,cAAqC,qBAAqB,EAAE;QAC5D,uBAAA,EAAA,aAAmC,oBAAoB,EAAE;QAF3E,YAIE,kBAAM,OAAO,EAAE,MAAM,CAAC,SACvB;QAJiB,aAAO,GAAP,OAAO,CAAqD;QAC5D,YAAM,GAAN,MAAM,CAAmD;;IAG3E,CAAC;IACH,4BAAC;AAAD,CAAC,AAPD,CAA2C,+CAAwB,GAOlE;AAPY,sDAAqB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SubstrateCommonAccountController } from '@wallfree-dev/substrate/v1';
|
|
2
|
+
import { AstarNodeClient } from '../node/AstarNodeClient';
|
|
3
|
+
import { AstarProtocolConfiguration } from '../types/configuration';
|
|
4
|
+
export declare class AstarAccountController extends SubstrateCommonAccountController<AstarProtocolConfiguration, AstarNodeClient> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AstarAccountController = void 0;
|
|
19
|
+
var v1_1 = require("@wallfree-dev/substrate/v1");
|
|
20
|
+
var AstarAccountController = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AstarAccountController, _super);
|
|
22
|
+
function AstarAccountController() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AstarAccountController;
|
|
26
|
+
}(v1_1.SubstrateCommonAccountController));
|
|
27
|
+
exports.AstarAccountController = AstarAccountController;
|
|
28
|
+
//# sourceMappingURL=AstarAccountController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarAccountController.js","sourceRoot":"","sources":["../../../src/v1/controller/AstarAccountController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iDAA6E;AAK7E;IAA4C,0CAA6E;IAAzH;;IAA2H,CAAC;IAAD,6BAAC;AAAD,CAAC,AAA5H,CAA4C,qCAAgC,GAAgD;AAA/G,wDAAsB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SubstrateCommonTransactionController } from '@wallfree-dev/substrate/v1';
|
|
2
|
+
import { AstarNodeClient } from '../node/AstarNodeClient';
|
|
3
|
+
import { AstarProtocolConfiguration } from '../types/configuration';
|
|
4
|
+
export declare class AstarTransactionController extends SubstrateCommonTransactionController<AstarProtocolConfiguration, AstarNodeClient> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AstarTransactionController = void 0;
|
|
19
|
+
var v1_1 = require("@wallfree-dev/substrate/v1");
|
|
20
|
+
var AstarTransactionController = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AstarTransactionController, _super);
|
|
22
|
+
function AstarTransactionController() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AstarTransactionController;
|
|
26
|
+
}(v1_1.SubstrateCommonTransactionController));
|
|
27
|
+
exports.AstarTransactionController = AstarTransactionController;
|
|
28
|
+
//# sourceMappingURL=AstarTransactionController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarTransactionController.js","sourceRoot":"","sources":["../../../src/v1/controller/AstarTransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iDAAiF;AAKjF;IAAgD,8CAAiF;IAAjI;;IAAmI,CAAC;IAAD,iCAAC;AAAD,CAAC,AAApI,CAAgD,yCAAoC,GAAgD;AAAvH,gEAA0B"}
|
package/v1/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AstarModule } from './module/AstarModule';
|
|
2
|
+
import { AstarProtocol, createAstarProtocol } from './protocol/AstarProtocol';
|
|
3
|
+
import { createShidenProtocol, ShidenProtocol } from './protocol/ShidenProtocol';
|
|
4
|
+
import { AstarProtocolConfiguration } from './types/configuration';
|
|
5
|
+
import { AstarCryptoConfiguration } from './types/crypto';
|
|
6
|
+
import { AstarProtocolNetwork, AstarProtocolOptions, AstarUnits, ShidenUnits } from './types/protocol';
|
|
7
|
+
export { AstarModule };
|
|
8
|
+
export { AstarProtocol, createAstarProtocol, ShidenProtocol, createShidenProtocol };
|
|
9
|
+
export { AstarCryptoConfiguration, AstarUnits, ShidenUnits, AstarProtocolNetwork, AstarProtocolOptions, AstarProtocolConfiguration };
|
package/v1/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createShidenProtocol = exports.createAstarProtocol = exports.AstarModule = void 0;
|
|
4
|
+
var AstarModule_1 = require("./module/AstarModule");
|
|
5
|
+
Object.defineProperty(exports, "AstarModule", { enumerable: true, get: function () { return AstarModule_1.AstarModule; } });
|
|
6
|
+
var AstarProtocol_1 = require("./protocol/AstarProtocol");
|
|
7
|
+
Object.defineProperty(exports, "createAstarProtocol", { enumerable: true, get: function () { return AstarProtocol_1.createAstarProtocol; } });
|
|
8
|
+
var ShidenProtocol_1 = require("./protocol/ShidenProtocol");
|
|
9
|
+
Object.defineProperty(exports, "createShidenProtocol", { enumerable: true, get: function () { return ShidenProtocol_1.createShidenProtocol; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,oDAAkD;AASzC,4FATA,yBAAW,OASA;AARpB,0DAA6E;AAYrD,oGAZA,mCAAmB,OAYA;AAX3C,4DAAgF;AAWnB,qGAXpD,qCAAoB,OAWoD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MainProtocolSymbols } from '@wallfree-dev/coinlib-core';
|
|
2
|
+
import { AirGapModule, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@wallfree-dev/module-kit';
|
|
3
|
+
import { BlockExplorer } from '@wallfree-dev/module-kit/block-explorer/block-explorer';
|
|
4
|
+
import { OfflineProtocol, OnlineProtocol } from '@wallfree-dev/module-kit/protocol/protocol';
|
|
5
|
+
import { AstarProtocolNetwork } from '../types/protocol';
|
|
6
|
+
declare type SupportedProtocols = MainProtocolSymbols.ASTAR | MainProtocolSymbols.SHIDEN;
|
|
7
|
+
export declare class AstarModule implements AirGapModule<{
|
|
8
|
+
Protocols: SupportedProtocols;
|
|
9
|
+
ProtocolNetwork: AstarProtocolNetwork;
|
|
10
|
+
}> {
|
|
11
|
+
private readonly networkRegistries;
|
|
12
|
+
readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
|
|
13
|
+
createOfflineProtocol(identifier: SupportedProtocols): Promise<OfflineProtocol | undefined>;
|
|
14
|
+
createOnlineProtocol(identifier: SupportedProtocols, networkOrId?: AstarProtocolNetwork | string): Promise<OnlineProtocol | undefined>;
|
|
15
|
+
createBlockExplorer(identifier: SupportedProtocols, networkOrId?: AstarProtocolNetwork | string): Promise<BlockExplorer | undefined>;
|
|
16
|
+
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
17
|
+
private createProtocol;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.AstarModule = void 0;
|
|
40
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
41
|
+
var errors_1 = require("@wallfree-dev/coinlib-core/errors");
|
|
42
|
+
var module_kit_1 = require("@wallfree-dev/module-kit");
|
|
43
|
+
var substrate_1 = require("@wallfree-dev/substrate");
|
|
44
|
+
var AstarProtocol_1 = require("../protocol/AstarProtocol");
|
|
45
|
+
var ShidenProtocol_1 = require("../protocol/ShidenProtocol");
|
|
46
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
47
|
+
var AstarModule = /** @class */ (function () {
|
|
48
|
+
function AstarModule() {
|
|
49
|
+
var _a;
|
|
50
|
+
this.networkRegistries = (_a = {},
|
|
51
|
+
_a[coinlib_core_1.MainProtocolSymbols.ASTAR] = new module_kit_1.ModuleNetworkRegistry({
|
|
52
|
+
supportedNetworks: [AstarProtocol_1.ASTAR_MAINNET_PROTOCOL_NETWORK]
|
|
53
|
+
}),
|
|
54
|
+
_a[coinlib_core_1.MainProtocolSymbols.SHIDEN] = new module_kit_1.ModuleNetworkRegistry({
|
|
55
|
+
supportedNetworks: [ShidenProtocol_1.SHIDEN_MAINNET_PROTOCOL_NETWORK]
|
|
56
|
+
}),
|
|
57
|
+
_a);
|
|
58
|
+
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
59
|
+
}
|
|
60
|
+
AstarModule.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
|
+
AstarModule.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. (Astar)");
|
|
75
|
+
}
|
|
76
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
AstarModule.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. (Astar)");
|
|
88
|
+
}
|
|
89
|
+
return [2 /*return*/, new substrate_1.SubscanBlockExplorer(network.blockExplorerUrl)];
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
AstarModule.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.AstarV3SerializerCompanion()];
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
AstarModule.prototype.createProtocol = function (identifier, network) {
|
|
101
|
+
switch (identifier) {
|
|
102
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
103
|
+
return (0, AstarProtocol_1.createAstarProtocol)({ network: network });
|
|
104
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
105
|
+
return (0, ShidenProtocol_1.createShidenProtocol)({ network: network });
|
|
106
|
+
default:
|
|
107
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported. (Astar)"));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return AstarModule;
|
|
111
|
+
}());
|
|
112
|
+
exports.AstarModule = AstarModule;
|
|
113
|
+
//# sourceMappingURL=AstarModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarModule.js","sourceRoot":"","sources":["../../../src/v1/module/AstarModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAwE;AACxE,4DAA2E;AAC3E,uDAOiC;AAGjC,qDAA8D;AAE9D,2DAA+F;AAC/F,6DAAkG;AAClG,8EAAkF;AAKlF;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,KAAK,IAAG,IAAI,kCAAqB,CAAC;gBACrD,iBAAiB,EAAE,CAAC,8CAA8B,CAAC;aACpD,CAAC;YACF,GAAC,kCAAmB,CAAC,MAAM,IAAG,IAAI,kCAAqB,CAAC;gBACtD,iBAAiB,EAAE,CAAC,gDAA+B,CAAC;aACrD,CAAC;gBACH;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAgD1I,CAAC;IA9Cc,2CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,0CAAoB,GAAjC,UACE,UAA8B,EAC9B,WAA2C;;;;;gBAErC,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,8CAA8C,CAAC,CAAA;iBACpG;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,yCAAmB,GAAhC,UACE,UAA8B,EAC9B,WAA2C;;;;;gBAErC,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,oDAAoD,CAAC,CAAA;iBAC1G;gBAED,sBAAO,IAAI,gCAAoB,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAA;;;KAC1D;IAEY,iDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,iDAA0B,EAAE,EAAA;;;KACxC;IAEO,oCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE;YAClB,KAAK,kCAAmB,CAAC,KAAK;gBAC5B,OAAO,IAAA,mCAAmB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YACzC,KAAK,kCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC1C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,4BAAyB,CAAC,CAAA;SACvG;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,kCAAW"}
|
package/v1/module.d.ts
ADDED
package/v1/module.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.create = void 0;
|
|
18
|
+
var AstarModule_1 = require("./module/AstarModule");
|
|
19
|
+
__exportStar(require("./index"), exports);
|
|
20
|
+
function create() {
|
|
21
|
+
return new AstarModule_1.AstarModule();
|
|
22
|
+
}
|
|
23
|
+
exports.create = create;
|
|
24
|
+
//# sourceMappingURL=module.js.map
|
package/v1/module.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,oDAAkD;AAElD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,yBAAW,EAAE,CAAA;AAC1B,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AstarNodeClient = void 0;
|
|
19
|
+
var v1_1 = require("@wallfree-dev/substrate/v1");
|
|
20
|
+
var AstarNodeClient = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AstarNodeClient, _super);
|
|
22
|
+
function AstarNodeClient() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AstarNodeClient;
|
|
26
|
+
}(v1_1.SubstrateCommonNodeClient));
|
|
27
|
+
exports.AstarNodeClient = AstarNodeClient;
|
|
28
|
+
//# sourceMappingURL=AstarNodeClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarNodeClient.js","sourceRoot":"","sources":["../../../src/v1/node/AstarNodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iDAAsE;AAItE;IAAqC,mCAAqD;IAA1F;;IAA4F,CAAC;IAAD,sBAAC;AAAD,CAAC,AAA7F,CAAqC,8BAAyB,GAA+B;AAAhF,0CAAe"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SubstrateAccountId, SubstrateProtocol, SubstrateProtocolImpl, SubstrateSS58Address, SubstrateTransactionType } from '@wallfree-dev/substrate/v1';
|
|
2
|
+
import { AstarAccountController } from '../controller/AstarAccountController';
|
|
3
|
+
import { AstarTransactionController } from '../controller/AstarTransactionController';
|
|
4
|
+
import { AstarNodeClient } from '../node/AstarNodeClient';
|
|
5
|
+
import { AstarProtocolConfiguration } from '../types/configuration';
|
|
6
|
+
import { AstarCryptoConfiguration } from '../types/crypto';
|
|
7
|
+
import { AstarBaseProtocolOptions, AstarProtocolNetwork } from '../types/protocol';
|
|
8
|
+
export interface AstarBaseProtocol<_Units extends string = string> extends SubstrateProtocol<AstarProtocolConfiguration, _Units, AstarProtocolNetwork, AstarCryptoConfiguration> {
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class AstarBaseProtocolImpl<_Units extends string> extends SubstrateProtocolImpl<_Units, AstarProtocolConfiguration, AstarProtocolNetwork, AstarNodeClient, AstarAccountController, AstarTransactionController> implements AstarBaseProtocol<_Units> {
|
|
11
|
+
constructor(options: AstarBaseProtocolOptions<_Units>);
|
|
12
|
+
protected getFutureRequiredTransactions(accountId: SubstrateAccountId<SubstrateSS58Address>, intention: 'transfer' | 'check'): Promise<[SubstrateTransactionType<AstarProtocolConfiguration>, any][]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.AstarBaseProtocolImpl = void 0;
|
|
55
|
+
var v1_1 = require("@wallfree-dev/substrate/v1");
|
|
56
|
+
var AstarAccountController_1 = require("../controller/AstarAccountController");
|
|
57
|
+
var AstarTransactionController_1 = require("../controller/AstarTransactionController");
|
|
58
|
+
var AstarNodeClient_1 = require("../node/AstarNodeClient");
|
|
59
|
+
// Implemenation
|
|
60
|
+
var AstarBaseProtocolImpl = /** @class */ (function (_super) {
|
|
61
|
+
__extends(AstarBaseProtocolImpl, _super);
|
|
62
|
+
function AstarBaseProtocolImpl(options) {
|
|
63
|
+
var nodeClient = new AstarNodeClient_1.AstarNodeClient(options.configuration, options.network.rpcUrl);
|
|
64
|
+
var accountController = new AstarAccountController_1.AstarAccountController(options.configuration, nodeClient);
|
|
65
|
+
var transactionController = new AstarTransactionController_1.AstarTransactionController(options.configuration, nodeClient);
|
|
66
|
+
var blockExplorer = new v1_1.SubscanBlockExplorerClient(options.network.blockExplorerApi);
|
|
67
|
+
return _super.call(this, options, nodeClient, accountController, transactionController, blockExplorer) || this;
|
|
68
|
+
}
|
|
69
|
+
AstarBaseProtocolImpl.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];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
return AstarBaseProtocolImpl;
|
|
94
|
+
}(v1_1.SubstrateProtocolImpl));
|
|
95
|
+
exports.AstarBaseProtocolImpl = AstarBaseProtocolImpl;
|
|
96
|
+
//# sourceMappingURL=AstarBaseProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarBaseProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/AstarBaseProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAOmC;AAEnC,+EAA6E;AAC7E,uFAAqF;AACrF,2DAAyD;AAUzD,gBAAgB;AAEhB;IACU,yCAOP;IAGD,+BAAmB,OAAyC;QAC1D,IAAM,UAAU,GAAoB,IAAI,iCAAe,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAEtG,IAAM,iBAAiB,GAA2B,IAAI,+CAAsB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAC/G,IAAM,qBAAqB,GAA+B,IAAI,uDAA0B,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;QAE3H,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,6DAA6B,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,GAAkE,EAAE,CAAA;wBAE9F,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,4BAAC;AAAD,CAAC,AA5CD,CACU,0BAAqB,GA2C9B;AA5CqB,sDAAqB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ProtocolMetadata, RecursivePartial } from '@wallfree-dev/module-kit';
|
|
2
|
+
import { AstarProtocolConfiguration } from '../types/configuration';
|
|
3
|
+
import { AstarProtocolNetwork, AstarProtocolOptions, AstarUnits } from '../types/protocol';
|
|
4
|
+
import { AstarBaseProtocol, AstarBaseProtocolImpl } from './AstarBaseProtocol';
|
|
5
|
+
export interface AstarProtocol extends AstarBaseProtocol<AstarUnits> {
|
|
6
|
+
}
|
|
7
|
+
export declare const ASTAR_METADATA: ProtocolMetadata<AstarUnits>;
|
|
8
|
+
export declare const ASTAR_CONFIGURATION: AstarProtocolConfiguration;
|
|
9
|
+
export declare class AstarProtocolImpl extends AstarBaseProtocolImpl<AstarUnits> implements AstarProtocol {
|
|
10
|
+
constructor(options?: RecursivePartial<AstarProtocolOptions>);
|
|
11
|
+
}
|
|
12
|
+
export declare function createAstarProtocol(options?: RecursivePartial<AstarProtocolOptions>): AstarProtocol;
|
|
13
|
+
export declare const ASTAR_MAINNET_PROTOCOL_NETWORK: AstarProtocolNetwork;
|
|
14
|
+
export declare function createAstarProtocolOptions(network?: Partial<AstarProtocolNetwork>): AstarProtocolOptions;
|