@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,119 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.createAstarProtocolOptions = exports.ASTAR_MAINNET_PROTOCOL_NETWORK = exports.createAstarProtocol = exports.AstarProtocolImpl = exports.ASTAR_CONFIGURATION = exports.ASTAR_METADATA = void 0;
|
|
30
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
31
|
+
var AstarBaseProtocol_1 = require("./AstarBaseProtocol");
|
|
32
|
+
// Implementation
|
|
33
|
+
exports.ASTAR_METADATA = {
|
|
34
|
+
identifier: coinlib_core_1.MainProtocolSymbols.ASTAR,
|
|
35
|
+
name: 'Astar',
|
|
36
|
+
units: {
|
|
37
|
+
ASTR: {
|
|
38
|
+
symbol: { value: 'ASTR' },
|
|
39
|
+
decimals: 18
|
|
40
|
+
},
|
|
41
|
+
mASTR: {
|
|
42
|
+
symbol: { value: 'mASTR' },
|
|
43
|
+
decimals: 15
|
|
44
|
+
},
|
|
45
|
+
uASTR: {
|
|
46
|
+
symbol: { value: 'uASTR' },
|
|
47
|
+
decimals: 12
|
|
48
|
+
},
|
|
49
|
+
nASTR: {
|
|
50
|
+
symbol: { value: 'nASTR' },
|
|
51
|
+
decimals: 9
|
|
52
|
+
},
|
|
53
|
+
pASTR: {
|
|
54
|
+
symbol: { value: 'pASTR' },
|
|
55
|
+
decimals: 6
|
|
56
|
+
},
|
|
57
|
+
fASTR: {
|
|
58
|
+
symbol: { value: 'fASTR' },
|
|
59
|
+
decimals: 3
|
|
60
|
+
},
|
|
61
|
+
aASTR: {
|
|
62
|
+
symbol: { value: 'aASTR' },
|
|
63
|
+
decimals: 0
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
mainUnit: 'ASTR',
|
|
67
|
+
account: {
|
|
68
|
+
standardDerivationPath: "m/44'/810'/0'/0/0",
|
|
69
|
+
address: {
|
|
70
|
+
isCaseSensitive: true,
|
|
71
|
+
placeholder: "ABC...",
|
|
72
|
+
regex: '^[a-km-zA-HJ-NP-Z1-9]+$'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.ASTAR_CONFIGURATION = {
|
|
77
|
+
account: {
|
|
78
|
+
type: 'ss58',
|
|
79
|
+
format: 5
|
|
80
|
+
},
|
|
81
|
+
transaction: {
|
|
82
|
+
version: 4,
|
|
83
|
+
types: {}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var AstarProtocolImpl = /** @class */ (function (_super) {
|
|
87
|
+
__extends(AstarProtocolImpl, _super);
|
|
88
|
+
function AstarProtocolImpl(options) {
|
|
89
|
+
if (options === void 0) { options = {}; }
|
|
90
|
+
var completeOptions = createAstarProtocolOptions(options.network);
|
|
91
|
+
var metadata = exports.ASTAR_METADATA;
|
|
92
|
+
var configuration = exports.ASTAR_CONFIGURATION;
|
|
93
|
+
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
94
|
+
}
|
|
95
|
+
return AstarProtocolImpl;
|
|
96
|
+
}(AstarBaseProtocol_1.AstarBaseProtocolImpl));
|
|
97
|
+
exports.AstarProtocolImpl = AstarProtocolImpl;
|
|
98
|
+
// Factory
|
|
99
|
+
function createAstarProtocol(options) {
|
|
100
|
+
if (options === void 0) { options = {}; }
|
|
101
|
+
return new AstarProtocolImpl(options);
|
|
102
|
+
}
|
|
103
|
+
exports.createAstarProtocol = createAstarProtocol;
|
|
104
|
+
exports.ASTAR_MAINNET_PROTOCOL_NETWORK = {
|
|
105
|
+
name: 'Mainnet',
|
|
106
|
+
type: 'mainnet',
|
|
107
|
+
rpcUrl: 'https://evm.astar.network',
|
|
108
|
+
blockExplorerUrl: 'https://astar.subscan.io',
|
|
109
|
+
blockExplorerApi: 'https://astar.subscan.prod.gke.papers.tech/api/v2/scan'
|
|
110
|
+
};
|
|
111
|
+
var DEFAULT_ASTAR_PROTOCOL_NETWORK = exports.ASTAR_MAINNET_PROTOCOL_NETWORK;
|
|
112
|
+
function createAstarProtocolOptions(network) {
|
|
113
|
+
if (network === void 0) { network = {}; }
|
|
114
|
+
return {
|
|
115
|
+
network: __assign(__assign({}, DEFAULT_ASTAR_PROTOCOL_NETWORK), network)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
exports.createAstarProtocolOptions = createAstarProtocolOptions;
|
|
119
|
+
//# sourceMappingURL=AstarProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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V;IACD,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,EAAE;KACV;CACF,CAAA;AAED;IAAuC,qCAAiC;IACtE,2BAAmB,OAAoD;QAApD,wBAAA,EAAA,YAAoD;QACrE,IAAM,eAAe,GAAyB,0BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEzF,IAAM,QAAQ,GAAiC,sBAAc,CAAA;QAC7D,IAAM,aAAa,GAA+B,2BAAmB,CAAA;eAErE,kBAAM,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC;IACtE,CAAC;IACH,wBAAC;AAAD,CAAC,AATD,CAAuC,yCAAqB,GAS3D;AATY,8CAAiB;AAW9B,UAAU;AAEV,SAAgB,mBAAmB,CAAC,OAAoD;IAApD,wBAAA,EAAA,YAAoD;IACtF,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAA;AACvC,CAAC;AAFD,kDAEC;AAEY,QAAA,8BAA8B,GAAyB;IAClE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,2BAA2B;IACnC,gBAAgB,EAAE,0BAA0B;IAC5C,gBAAgB,EAAE,wDAAwD;CAC3E,CAAA;AAED,IAAM,8BAA8B,GAAyB,sCAA8B,CAAA;AAE3F,SAAgB,0BAA0B,CAAC,OAA2C;IAA3C,wBAAA,EAAA,YAA2C;IACpF,OAAO;QACL,OAAO,wBAAO,8BAA8B,GAAK,OAAO,CAAE;KAC3D,CAAA;AACH,CAAC;AAJD,gEAIC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ProtocolMetadata, RecursivePartial } from '@wallfree-dev/module-kit';
|
|
2
|
+
import { AstarProtocolConfiguration } from '../types/configuration';
|
|
3
|
+
import { AstarProtocolNetwork, AstarProtocolOptions, ShidenUnits } from '../types/protocol';
|
|
4
|
+
import { AstarBaseProtocol, AstarBaseProtocolImpl } from './AstarBaseProtocol';
|
|
5
|
+
export interface ShidenProtocol extends AstarBaseProtocol<ShidenUnits> {
|
|
6
|
+
}
|
|
7
|
+
export declare const SHIDEN_METADATA: ProtocolMetadata<ShidenUnits>;
|
|
8
|
+
export declare const SHIDEN_CONFIGURATION: AstarProtocolConfiguration;
|
|
9
|
+
export declare class ShidenProtocolImpl extends AstarBaseProtocolImpl<ShidenUnits> implements ShidenProtocol {
|
|
10
|
+
constructor(options?: RecursivePartial<AstarProtocolOptions>);
|
|
11
|
+
}
|
|
12
|
+
export declare function createShidenProtocol(options?: RecursivePartial<AstarProtocolOptions>): ShidenProtocol;
|
|
13
|
+
export declare const SHIDEN_MAINNET_PROTOCOL_NETWORK: AstarProtocolNetwork;
|
|
14
|
+
export declare function createShidenProtocolOptions(network?: Partial<AstarProtocolNetwork>): AstarProtocolOptions;
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.createShidenProtocolOptions = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = exports.createShidenProtocol = exports.ShidenProtocolImpl = exports.SHIDEN_CONFIGURATION = exports.SHIDEN_METADATA = void 0;
|
|
30
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
31
|
+
var AstarBaseProtocol_1 = require("./AstarBaseProtocol");
|
|
32
|
+
var AstarProtocol_1 = require("./AstarProtocol");
|
|
33
|
+
// Implementation
|
|
34
|
+
exports.SHIDEN_METADATA = {
|
|
35
|
+
identifier: coinlib_core_1.MainProtocolSymbols.SHIDEN,
|
|
36
|
+
name: 'Shiden',
|
|
37
|
+
units: {
|
|
38
|
+
SDN: {
|
|
39
|
+
symbol: { value: 'SDN' },
|
|
40
|
+
decimals: 18
|
|
41
|
+
},
|
|
42
|
+
mSDN: {
|
|
43
|
+
symbol: { value: 'mSDN' },
|
|
44
|
+
decimals: 15
|
|
45
|
+
},
|
|
46
|
+
uSDN: {
|
|
47
|
+
symbol: { value: 'uSDN' },
|
|
48
|
+
decimals: 12
|
|
49
|
+
},
|
|
50
|
+
nSDN: {
|
|
51
|
+
symbol: { value: 'nSDN' },
|
|
52
|
+
decimals: 9
|
|
53
|
+
},
|
|
54
|
+
pSDN: {
|
|
55
|
+
symbol: { value: 'pSDN' },
|
|
56
|
+
decimals: 6
|
|
57
|
+
},
|
|
58
|
+
fSDN: {
|
|
59
|
+
symbol: { value: 'fSDN' },
|
|
60
|
+
decimals: 3
|
|
61
|
+
},
|
|
62
|
+
aSDN: {
|
|
63
|
+
symbol: { value: 'aSDN' },
|
|
64
|
+
decimals: 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
mainUnit: 'SDN',
|
|
68
|
+
account: {
|
|
69
|
+
standardDerivationPath: "m/44'/810'/0'/0/0",
|
|
70
|
+
address: {
|
|
71
|
+
isCaseSensitive: true,
|
|
72
|
+
placeholder: "ABC...",
|
|
73
|
+
regex: '^[a-km-zA-HJ-NP-Z1-9]+$'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
exports.SHIDEN_CONFIGURATION = AstarProtocol_1.ASTAR_CONFIGURATION;
|
|
78
|
+
var ShidenProtocolImpl = /** @class */ (function (_super) {
|
|
79
|
+
__extends(ShidenProtocolImpl, _super);
|
|
80
|
+
function ShidenProtocolImpl(options) {
|
|
81
|
+
if (options === void 0) { options = {}; }
|
|
82
|
+
var completeOptions = createShidenProtocolOptions(options.network);
|
|
83
|
+
var metadata = exports.SHIDEN_METADATA;
|
|
84
|
+
var configuration = exports.SHIDEN_CONFIGURATION;
|
|
85
|
+
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
|
|
86
|
+
}
|
|
87
|
+
return ShidenProtocolImpl;
|
|
88
|
+
}(AstarBaseProtocol_1.AstarBaseProtocolImpl));
|
|
89
|
+
exports.ShidenProtocolImpl = ShidenProtocolImpl;
|
|
90
|
+
// Factory
|
|
91
|
+
function createShidenProtocol(options) {
|
|
92
|
+
if (options === void 0) { options = {}; }
|
|
93
|
+
return new ShidenProtocolImpl(options);
|
|
94
|
+
}
|
|
95
|
+
exports.createShidenProtocol = createShidenProtocol;
|
|
96
|
+
exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = {
|
|
97
|
+
name: 'Mainnet',
|
|
98
|
+
type: 'mainnet',
|
|
99
|
+
rpcUrl: 'https://shiden.public.curie.radiumblock.co/ws',
|
|
100
|
+
blockExplorerUrl: 'https://shiden.subscan.io',
|
|
101
|
+
blockExplorerApi: 'https://shiden.subscan.prod.gke.papers.tech/api/v2/scan'
|
|
102
|
+
};
|
|
103
|
+
var DEFAULT_SHIDEN_PROTOCOL_NETWORK = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK;
|
|
104
|
+
function createShidenProtocolOptions(network) {
|
|
105
|
+
if (network === void 0) { network = {}; }
|
|
106
|
+
return {
|
|
107
|
+
network: __assign(__assign({}, DEFAULT_SHIDEN_PROTOCOL_NETWORK), network)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
exports.createShidenProtocolOptions = createShidenProtocolOptions;
|
|
111
|
+
//# sourceMappingURL=ShidenProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShidenProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/ShidenProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAgE;AAMhE,yDAA8E;AAC9E,iDAAqD;AAMrD,iBAAiB;AAEJ,QAAA,eAAe,GAAkC;IAC5D,UAAU,EAAE,kCAAmB,CAAC,MAAM;IACtC,IAAI,EAAE,QAAQ;IAEd,KAAK,EAAE;QACL,GAAG,EAAE;YACH,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;YACxB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,EAAE;SACb;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACzB,QAAQ,EAAE,CAAC;SACZ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CAAC;AAJD,kEAIC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SubstrateSignedTransaction, SubstrateUnsignedTransaction } from '@wallfree-dev/substrate/v1';
|
|
2
|
+
import { AstarTransactionSignRequest } from '../definitions/transaction-sign-request-astar';
|
|
3
|
+
import { AstarTransactionSignResponse } from '../definitions/transaction-sign-response-astar';
|
|
4
|
+
export declare function astarUnsignedTransactionToRequest(unsigned: SubstrateUnsignedTransaction, publicKey: string, callbackUrl?: string): AstarTransactionSignRequest;
|
|
5
|
+
export declare function astarSignedTransactionToResponse(signed: SubstrateSignedTransaction, accountIdentifier: string): AstarTransactionSignResponse;
|
|
6
|
+
export declare function astarTransactionSignRequestToUnsigned(request: AstarTransactionSignRequest): SubstrateUnsignedTransaction;
|
|
7
|
+
export declare function astarTransactionSignResponseToSigned(response: AstarTransactionSignResponse): SubstrateSignedTransaction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.astarTransactionSignResponseToSigned = exports.astarTransactionSignRequestToUnsigned = exports.astarSignedTransactionToResponse = exports.astarUnsignedTransactionToRequest = void 0;
|
|
4
|
+
var v1_1 = require("@wallfree-dev/substrate/v1");
|
|
5
|
+
function astarUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
6
|
+
return (0, v1_1.substrateUnsignedTransactionToRequest)(unsigned, publicKey, callbackUrl);
|
|
7
|
+
}
|
|
8
|
+
exports.astarUnsignedTransactionToRequest = astarUnsignedTransactionToRequest;
|
|
9
|
+
function astarSignedTransactionToResponse(signed, accountIdentifier) {
|
|
10
|
+
return (0, v1_1.substrateSignedTransactionToResponse)(signed, accountIdentifier);
|
|
11
|
+
}
|
|
12
|
+
exports.astarSignedTransactionToResponse = astarSignedTransactionToResponse;
|
|
13
|
+
function astarTransactionSignRequestToUnsigned(request) {
|
|
14
|
+
return (0, v1_1.substrateTransactionSignRequestToUnsigned)(request);
|
|
15
|
+
}
|
|
16
|
+
exports.astarTransactionSignRequestToUnsigned = astarTransactionSignRequestToUnsigned;
|
|
17
|
+
function astarTransactionSignResponseToSigned(response) {
|
|
18
|
+
return (0, v1_1.substrateTransactionSignResponseToSigned)(response);
|
|
19
|
+
}
|
|
20
|
+
exports.astarTransactionSignResponseToSigned = astarTransactionSignResponseToSigned;
|
|
21
|
+
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;AAAA,iDAOmC;AAKnC,SAAgB,iCAAiC,CAC/C,QAAsC,EACtC,SAAiB,EACjB,WAAoB;IAEpB,OAAO,IAAA,0CAAqC,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;AAChF,CAAC;AAND,8EAMC;AAED,SAAgB,gCAAgC,CAC9C,MAAkC,EAClC,iBAAyB;IAEzB,OAAO,IAAA,yCAAoC,EAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AACxE,CAAC;AALD,4EAKC;AAED,SAAgB,qCAAqC,CAAC,OAAoC;IACxF,OAAO,IAAA,8CAAyC,EAAC,OAAO,CAAC,CAAA;AAC3D,CAAC;AAFD,sFAEC;AAED,SAAgB,oCAAoC,CAAC,QAAsC;IACzF,OAAO,IAAA,6CAAwC,EAAC,QAAQ,CAAC,CAAA;AAC3D,CAAC;AAFD,oFAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-request-astar.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-sign-response-astar.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/AstarTransactionSignRequest",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"AstarTransactionSignRequest": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"callbackURL": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"publicKey": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"transaction": {
|
|
15
|
+
"$ref": "#/definitions/SubstrateUnsignedTransaction"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": ["publicKey", "transaction"],
|
|
19
|
+
"type": "object"
|
|
20
|
+
},
|
|
21
|
+
"SubstrateUnsignedTransaction": {
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"properties": {
|
|
24
|
+
"encoded": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"type": {
|
|
28
|
+
"enum": ["unsigned"],
|
|
29
|
+
"type": "string"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["encoded", "type"],
|
|
33
|
+
"type": "object"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/AstarTransactionSignResponse",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"AstarTransactionSignResponse": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"accountIdentifier": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"transaction": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": ["accountIdentifier", "transaction"],
|
|
16
|
+
"type": "object"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@wallfree-dev/module-kit';
|
|
2
|
+
import { V3SchemaConfiguration } from '@wallfree-dev/module-kit/types/serializer';
|
|
3
|
+
import { TransactionSignRequest, TransactionSignResponse } from '@wallfree-dev/serializer';
|
|
4
|
+
export declare class AstarV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
+
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
+
private readonly astarTransactionValidator;
|
|
7
|
+
constructor();
|
|
8
|
+
toTransactionSignRequest(identifier: string, unsignedTransaction: UnsignedTransaction, publicKey: string, callbackUrl?: string): Promise<TransactionSignRequest>;
|
|
9
|
+
fromTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<UnsignedTransaction>;
|
|
10
|
+
validateTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<boolean>;
|
|
11
|
+
toTransactionSignResponse(identifier: string, signedTransaction: SignedTransaction, accountIdentifier: string): Promise<TransactionSignResponse>;
|
|
12
|
+
fromTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<SignedTransaction>;
|
|
13
|
+
validateTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<boolean>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
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.AstarV3SerializerCompanion = void 0;
|
|
40
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
41
|
+
var validate_1 = require("@wallfree-dev/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
42
|
+
var errors_1 = require("@wallfree-dev/coinlib-core/errors");
|
|
43
|
+
var serializer_1 = require("@wallfree-dev/serializer");
|
|
44
|
+
var transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
45
|
+
var transaction_validator_1 = require("./validators/transaction-validator");
|
|
46
|
+
var validators_1 = require("./validators/validators");
|
|
47
|
+
var astarTransactionSignRequest = require('./schemas/generated/transaction-sign-request-astar.json');
|
|
48
|
+
var astarTransactionSignResponse = require('./schemas/generated/transaction-sign-response-astar.json');
|
|
49
|
+
var AstarV3SerializerCompanion = /** @class */ (function () {
|
|
50
|
+
function AstarV3SerializerCompanion() {
|
|
51
|
+
this.schemas = [
|
|
52
|
+
{
|
|
53
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
54
|
+
schema: { schema: astarTransactionSignRequest },
|
|
55
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.ASTAR
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
59
|
+
schema: { schema: astarTransactionSignResponse },
|
|
60
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.ASTAR
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
64
|
+
schema: { schema: astarTransactionSignRequest },
|
|
65
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.SHIDEN
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
69
|
+
schema: { schema: astarTransactionSignResponse },
|
|
70
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.SHIDEN
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
this.astarTransactionValidator = new transaction_validator_1.AstarTransactionValidator();
|
|
74
|
+
Object.keys(validators_1.astarValidators).forEach(function (key) {
|
|
75
|
+
validate_1.validators[key] = validators_1.astarValidators[key];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
AstarV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (identifier) {
|
|
82
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
83
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
84
|
+
return [2 /*return*/, (0, transaction_converter_1.astarUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
85
|
+
default:
|
|
86
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
87
|
+
}
|
|
88
|
+
return [2 /*return*/];
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
AstarV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (identifier) {
|
|
96
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
97
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
98
|
+
return [2 /*return*/, (0, transaction_converter_1.astarTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
99
|
+
default:
|
|
100
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
101
|
+
}
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
AstarV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
return __generator(this, function (_c) {
|
|
110
|
+
switch (_c.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
_a = identifier;
|
|
113
|
+
switch (_a) {
|
|
114
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR: return [3 /*break*/, 1];
|
|
115
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN: return [3 /*break*/, 1];
|
|
116
|
+
}
|
|
117
|
+
return [3 /*break*/, 4];
|
|
118
|
+
case 1:
|
|
119
|
+
_c.trys.push([1, 3, , 4]);
|
|
120
|
+
return [4 /*yield*/, this.astarTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
121
|
+
case 2:
|
|
122
|
+
_c.sent();
|
|
123
|
+
return [2 /*return*/, true];
|
|
124
|
+
case 3:
|
|
125
|
+
_b = _c.sent();
|
|
126
|
+
return [2 /*return*/, false];
|
|
127
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
AstarV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (identifier) {
|
|
136
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
137
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
138
|
+
return [2 /*return*/, (0, transaction_converter_1.astarSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
139
|
+
default:
|
|
140
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
141
|
+
}
|
|
142
|
+
return [2 /*return*/];
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
AstarV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (identifier) {
|
|
150
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR:
|
|
151
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN:
|
|
152
|
+
return [2 /*return*/, (0, transaction_converter_1.astarTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
153
|
+
default:
|
|
154
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
155
|
+
}
|
|
156
|
+
return [2 /*return*/];
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
AstarV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
return __generator(this, function (_c) {
|
|
164
|
+
switch (_c.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
_a = identifier;
|
|
167
|
+
switch (_a) {
|
|
168
|
+
case coinlib_core_1.MainProtocolSymbols.ASTAR: return [3 /*break*/, 1];
|
|
169
|
+
case coinlib_core_1.MainProtocolSymbols.SHIDEN: return [3 /*break*/, 1];
|
|
170
|
+
}
|
|
171
|
+
return [3 /*break*/, 4];
|
|
172
|
+
case 1:
|
|
173
|
+
_c.trys.push([1, 3, , 4]);
|
|
174
|
+
return [4 /*yield*/, this.astarTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
175
|
+
case 2:
|
|
176
|
+
_c.sent();
|
|
177
|
+
return [2 /*return*/, true];
|
|
178
|
+
case 3:
|
|
179
|
+
_b = _c.sent();
|
|
180
|
+
return [2 /*return*/, false];
|
|
181
|
+
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.SUBSTRATE, "Protocol ".concat(identifier, " not supported"));
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
return AstarV3SerializerCompanion;
|
|
187
|
+
}());
|
|
188
|
+
exports.AstarV3SerializerCompanion = AstarV3SerializerCompanion;
|
|
189
|
+
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAwE;AACxE,oGAAoG;AACpG,4DAAoE;AAGpE,uDAAsH;AAGtH,mFAKkD;AAClD,4EAA8E;AAC9E,sDAAyD;AAEzD,IAAM,2BAA2B,GAAe,OAAO,CAAC,yDAAyD,CAAC,CAAA;AAClH,IAAM,4BAA4B,GAAe,OAAO,CAAC,0DAA0D,CAAC,CAAA;AAEpH;IA0BE;QAzBgB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,2BAA2B,EAAE;gBAC/C,kBAAkB,EAAE,kCAAmB,CAAC,KAAK;aAC9C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,4BAA4B,EAAE;gBAChD,kBAAkB,EAAE,kCAAmB,CAAC,KAAK;aAC9C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAA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;wBAE3B,qBAAM,IAAI,CAAC,yBAAyB,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,EAAA;;wBAAvF,SAAuF,CAAA;wBAEvF,sBAAO,IAAI,EAAA;;;wBAEX,sBAAO,KAAK,EAAA;4BAGd,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;;KAEzF;IACH,iCAAC;AAAD,CAAC,AAtHD,IAsHC;AAtHY,gEAA0B"}
|
|
@@ -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.AstarTransactionValidator = void 0;
|
|
19
|
+
var v1_1 = require("@wallfree-dev/substrate/v1");
|
|
20
|
+
var AstarTransactionValidator = /** @class */ (function (_super) {
|
|
21
|
+
__extends(AstarTransactionValidator, _super);
|
|
22
|
+
function AstarTransactionValidator() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return AstarTransactionValidator;
|
|
26
|
+
}(v1_1.SubstrateTransactionValidator));
|
|
27
|
+
exports.AstarTransactionValidator = AstarTransactionValidator;
|
|
28
|
+
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,iDAA0E;AAE1E;IAA+C,6CAA6B;IAA5E;;IAA8G,CAAC;IAAD,gCAAC;AAAD,CAAC,AAA/G,CAA+C,kCAA6B,GAAmC;AAAlG,8DAAyB"}
|