@substrate/api-sidecar 11.3.6 → 11.3.7
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/build/package.json +6 -8
- package/build/src/chains-config/astarControllers.d.ts +5 -0
- package/build/src/chains-config/astarControllers.js +37 -0
- package/build/src/chains-config/astarControllers.js.map +1 -0
- package/build/src/chains-config/crustControllers.d.ts +5 -0
- package/build/src/chains-config/crustControllers.js +34 -0
- package/build/src/chains-config/crustControllers.js.map +1 -0
- package/build/src/chains-config/index.js +4 -0
- package/build/src/chains-config/index.js.map +1 -1
- package/build/src/chains-config/metadata-consts/astarConsts.d.ts +2 -0
- package/build/src/chains-config/metadata-consts/astarConsts.js +20 -0
- package/build/src/chains-config/metadata-consts/astarConsts.js.map +1 -0
- package/build/src/chains-config/metadata-consts/crustConsts.d.ts +2 -0
- package/build/src/chains-config/metadata-consts/crustConsts.js +11 -0
- package/build/src/chains-config/metadata-consts/crustConsts.js.map +1 -0
- package/build/src/chains-config/metadata-consts/index.js +6 -0
- package/build/src/chains-config/metadata-consts/index.js.map +1 -1
- package/build/src/chains-config/metadata-consts/kusamaConsts.js +1 -1
- package/build/src/chains-config/metadata-consts/kusamaConsts.js.map +1 -1
- package/build/src/services/accounts/AccountsAssetsService.js +45 -3
- package/build/src/services/accounts/AccountsAssetsService.js.map +1 -1
- package/build/src/services/accounts/AccountsAssetsService.spec.js +5 -99
- package/build/src/services/accounts/AccountsAssetsService.spec.js.map +1 -1
- package/build/src/services/accounts/AccountsBalanceInfoService.d.ts +7 -0
- package/build/src/services/accounts/AccountsBalanceInfoService.js +21 -3
- package/build/src/services/accounts/AccountsBalanceInfoService.js.map +1 -1
- package/build/src/services/pallets/PalletsAssetsService.spec.js +5 -105
- package/build/src/services/pallets/PalletsAssetsService.spec.js.map +1 -1
- package/build/src/types/responses/AccountAssets.d.ts +1 -1
- package/package.json +6 -8
package/build/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "11.3.
|
|
2
|
+
"version": "11.3.7",
|
|
3
3
|
"name": "@substrate/api-sidecar",
|
|
4
4
|
"description": "REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.",
|
|
5
5
|
"homepage": "https://github.com/paritytech/substrate-api-sidecar#readme",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"test:test-release": "yarn start:test-release"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@polkadot/api": "^7.
|
|
53
|
+
"@polkadot/api": "^7.2.1",
|
|
54
54
|
"@polkadot/apps-config": "0.98.2-164",
|
|
55
55
|
"@polkadot/util-crypto": "^8.2.2",
|
|
56
56
|
"@polkadot/x-rxjs": "^6.11.1",
|
|
57
|
-
"@substrate/calc": "^0.2.
|
|
57
|
+
"@substrate/calc": "^0.2.7",
|
|
58
58
|
"argparse": "^2.0.1",
|
|
59
59
|
"confmgr": "1.0.7",
|
|
60
60
|
"express": "^4.17.1",
|
|
@@ -72,20 +72,18 @@
|
|
|
72
72
|
"@types/lru-cache": "^5.1.1",
|
|
73
73
|
"@types/morgan": "1.9.3",
|
|
74
74
|
"@types/triple-beam": "^1.3.2",
|
|
75
|
-
"standard-version": "9.3.2",
|
|
76
75
|
"tsc-watch": "^4.4.0"
|
|
77
76
|
},
|
|
78
77
|
"resolutions": {
|
|
79
|
-
"@polkadot/api": "7.
|
|
78
|
+
"@polkadot/api": "7.2.1",
|
|
80
79
|
"@polkadot/keyring": "8.2.2",
|
|
81
80
|
"@polkadot/networks": "8.2.2",
|
|
82
|
-
"@polkadot/types": "7.
|
|
83
|
-
"@polkadot/types-known": "7.
|
|
81
|
+
"@polkadot/types": "7.2.1",
|
|
82
|
+
"@polkadot/types-known": "7.2.1",
|
|
84
83
|
"@polkadot/util": "8.2.2",
|
|
85
84
|
"@polkadot/util-crypto": "8.2.2",
|
|
86
85
|
"@polkadot/wasm-crypto": "4.5.1",
|
|
87
86
|
"bn.js": "4.12.0",
|
|
88
|
-
"node-forge": ">=0.10.0",
|
|
89
87
|
"node-fetch": ">=2.6.1",
|
|
90
88
|
"prismjs": ">=1.23.0",
|
|
91
89
|
"typescript": "4.4.3"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.astarControllers = void 0;
|
|
4
|
+
const lruCache_1 = require("./cache/lruCache");
|
|
5
|
+
const metadata_consts_1 = require("./metadata-consts");
|
|
6
|
+
/**
|
|
7
|
+
* Controllers for Astar collator
|
|
8
|
+
*/
|
|
9
|
+
exports.astarControllers = {
|
|
10
|
+
controllers: [
|
|
11
|
+
'AccountsBalanceInfo',
|
|
12
|
+
'AccountsVestingInfo',
|
|
13
|
+
'AccountsValidate',
|
|
14
|
+
'Blocks',
|
|
15
|
+
'BlocksExtrinsics',
|
|
16
|
+
'BlocksTrace',
|
|
17
|
+
'NodeNetwork',
|
|
18
|
+
'NodeTransactionPool',
|
|
19
|
+
'NodeVersion',
|
|
20
|
+
'PalletsAssets',
|
|
21
|
+
'PalletsStorage',
|
|
22
|
+
'Paras',
|
|
23
|
+
'RuntimeCode',
|
|
24
|
+
'RuntimeMetadata',
|
|
25
|
+
'RuntimeSpec',
|
|
26
|
+
'TransactionFeeEstimate',
|
|
27
|
+
'TransactionMaterial',
|
|
28
|
+
'TransactionSubmit',
|
|
29
|
+
],
|
|
30
|
+
options: {
|
|
31
|
+
finalizes: true,
|
|
32
|
+
minCalcFeeRuntime: 1,
|
|
33
|
+
blockWeightStore: (0, metadata_consts_1.getBlockWeight)('astar'),
|
|
34
|
+
blockStore: (0, lruCache_1.initLRUCache)(),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=astarControllers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astarControllers.js","sourceRoot":"","sources":["../../../src/chains-config/astarControllers.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAChD,uDAAmD;AAEnD;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IACjD,WAAW,EAAE;QACZ,qBAAqB;QACrB,qBAAqB;QACrB,kBAAkB;QAClB,QAAQ;QACR,kBAAkB;QAClB,aAAa;QACb,aAAa;QACb,qBAAqB;QACrB,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,OAAO;QACP,aAAa;QACb,iBAAiB;QACjB,aAAa;QACb,wBAAwB;QACxB,qBAAqB;QACrB,mBAAmB;KACnB;IACD,OAAO,EAAE;QACR,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,IAAA,gCAAc,EAAC,OAAO,CAAC;QACzC,UAAU,EAAE,IAAA,uBAAY,GAAE;KAC1B;CACD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.crustControllers = void 0;
|
|
4
|
+
const lruCache_1 = require("./cache/lruCache");
|
|
5
|
+
const metadata_consts_1 = require("./metadata-consts");
|
|
6
|
+
/**
|
|
7
|
+
* Controllers for crust collator
|
|
8
|
+
*/
|
|
9
|
+
exports.crustControllers = {
|
|
10
|
+
controllers: [
|
|
11
|
+
'AccountsBalanceInfo',
|
|
12
|
+
'AccountsValidate',
|
|
13
|
+
'Blocks',
|
|
14
|
+
'BlocksExtrinsics',
|
|
15
|
+
'NodeNetwork',
|
|
16
|
+
'NodeTransactionPool',
|
|
17
|
+
'NodeVersion',
|
|
18
|
+
'PalletsStorage',
|
|
19
|
+
'RuntimeCode',
|
|
20
|
+
'RuntimeMetadata',
|
|
21
|
+
'RuntimeSpec',
|
|
22
|
+
'TransactionDryRun',
|
|
23
|
+
'TransactionFeeEstimate',
|
|
24
|
+
'TransactionMaterial',
|
|
25
|
+
'TransactionSubmit',
|
|
26
|
+
],
|
|
27
|
+
options: {
|
|
28
|
+
finalizes: true,
|
|
29
|
+
minCalcFeeRuntime: 1,
|
|
30
|
+
blockWeightStore: (0, metadata_consts_1.getBlockWeight)('crust'),
|
|
31
|
+
blockStore: (0, lruCache_1.initLRUCache)(),
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=crustControllers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crustControllers.js","sourceRoot":"","sources":["../../../src/chains-config/crustControllers.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAChD,uDAAmD;AAEnD;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IACjD,WAAW,EAAE;QACZ,qBAAqB;QACrB,kBAAkB;QAClB,QAAQ;QACR,kBAAkB;QAClB,aAAa;QACb,qBAAqB;QACrB,aAAa;QACb,gBAAgB;QAChB,aAAa;QACb,iBAAiB;QACjB,aAAa;QACb,mBAAmB;QACnB,wBAAwB;QACxB,qBAAqB;QACrB,mBAAmB;KACnB;IACD,OAAO,EAAE;QACR,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,IAAA,gCAAc,EAAC,OAAO,CAAC;QACzC,UAAU,EAAE,IAAA,uBAAY,GAAE;KAC1B;CACD,CAAC"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getControllersForSpec = void 0;
|
|
4
4
|
const controllers_1 = require("../controllers");
|
|
5
5
|
const acalaControllers_1 = require("./acalaControllers");
|
|
6
|
+
const astarControllers_1 = require("./astarControllers");
|
|
6
7
|
const calamariControllers_1 = require("./calamariControllers");
|
|
8
|
+
const crustControllers_1 = require("./crustControllers");
|
|
7
9
|
const defaultControllers_1 = require("./defaultControllers");
|
|
8
10
|
const dockMainnetControllers_1 = require("./dockMainnetControllers");
|
|
9
11
|
const dockPoSMainnetControllers_1 = require("./dockPoSMainnetControllers");
|
|
@@ -37,11 +39,13 @@ const specToControllerMap = {
|
|
|
37
39
|
westmine: statemineControllers_1.statemineControllers,
|
|
38
40
|
westmint: statemintControllers_1.statemintControllers,
|
|
39
41
|
shiden: shidenControllers_1.shidenControllers,
|
|
42
|
+
astar: astarControllers_1.astarControllers,
|
|
40
43
|
sora: soraControllers_1.soraControllers,
|
|
41
44
|
calamari: calamariControllers_1.calamariControllers,
|
|
42
45
|
karura: karuraControllers_1.karuraControllers,
|
|
43
46
|
acala: acalaControllers_1.acalaControllers,
|
|
44
47
|
manta: mantaControllers_1.mantaControllers,
|
|
48
|
+
crust: crustControllers_1.crustControllers,
|
|
45
49
|
};
|
|
46
50
|
/**
|
|
47
51
|
* Return an array of instantiated controller instances based off of a `specName`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chains-config/index.ts"],"names":[],"mappings":";;;AAIA,gDAA6C;AAE7C,yDAAsD;AACtD,+DAA4D;AAC5D,6DAA0D;AAC1D,qEAAkE;AAClE,2EAAwE;AACxE,2EAAqE;AACrE,2DAAwD;AACxD,uDAAoD;AACpD,2DAAwD;AACxD,2DAAwD;AACxD,6DAA0D;AAC1D,yDAAsD;AACtD,+DAA4D;AAC5D,+DAA4D;AAC5D,2DAAwD;AACxD,uDAAoD;AACpD,iEAA8D;AAC9D,iEAA8D;AAC9D,6DAA0D;AAE1D,MAAM,mBAAmB,GAAG;IAC3B,OAAO,EAAE,uCAAkB;IAC3B,QAAQ,EAAE,yCAAmB;IAC7B,QAAQ,EAAE,yCAAmB;IAC7B,MAAM,EAAE,qCAAiB;IACzB,MAAM,EAAE,qCAAiB;IACzB,IAAI,EAAE,iCAAe;IACrB,OAAO,EAAE,uCAAkB;IAC3B,mBAAmB,EAAE,+CAAsB;IAC3C,uBAAuB,EAAE,qDAAyB;IAClD,uBAAuB,EAAE,kDAAsB;IAC/C,SAAS,EAAE,2CAAoB;IAC/B,SAAS,EAAE,2CAAoB;IAC/B,QAAQ,EAAE,2CAAoB;IAC9B,QAAQ,EAAE,2CAAoB;IA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CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QAE3D,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAA2C,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.astarDefinitions = void 0;
|
|
4
|
+
exports.astarDefinitions = [
|
|
5
|
+
{
|
|
6
|
+
runtimeVersions: [1, 2, 3, 6, 7, 8, 10, 14, 15],
|
|
7
|
+
perClass: {
|
|
8
|
+
normal: {
|
|
9
|
+
baseExtrinsic: BigInt(125000000),
|
|
10
|
+
},
|
|
11
|
+
operational: {
|
|
12
|
+
baseExtrinsic: BigInt(1),
|
|
13
|
+
},
|
|
14
|
+
mandatory: {
|
|
15
|
+
baseExtrinsic: BigInt(128000000000001),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=astarConsts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astarConsts.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/astarConsts.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAqB;IACjD;QACC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QAC/C,QAAQ,EAAE;YACT,MAAM,EAAE;gBACP,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC;aAChC;YACD,WAAW,EAAE;gBACZ,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;aACxB;YACD,SAAS,EAAE;gBACV,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC;aACtC;SACD;KACD;CACD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.crustDefinitions = void 0;
|
|
4
|
+
const substrateConsts_1 = require("./substrateConsts");
|
|
5
|
+
exports.crustDefinitions = [
|
|
6
|
+
{
|
|
7
|
+
runtimeVersions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
|
8
|
+
extrinsicBaseWeight: substrateConsts_1.extrinsicBaseWeight,
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=crustConsts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crustConsts.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/crustConsts.ts"],"names":[],"mappings":";;;AACA,uDAAwD;AAE3C,QAAA,gBAAgB,GAAqB;IACjD;QACC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QAC5D,mBAAmB,EAAnB,qCAAmB;KACnB;CACD,CAAC"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getBlockWeight = exports.generateBlockWeightStore = void 0;
|
|
4
4
|
const chains_config_1 = require("../../types/chains-config");
|
|
5
5
|
const acalaConsts_1 = require("./acalaConsts");
|
|
6
|
+
const astarConsts_1 = require("./astarConsts");
|
|
6
7
|
const calamariConsts_1 = require("./calamariConsts");
|
|
8
|
+
const crustConsts_1 = require("./crustConsts");
|
|
7
9
|
const dockConsts_1 = require("./dockConsts");
|
|
8
10
|
const karuraConsts_1 = require("./karuraConsts");
|
|
9
11
|
const kusamaConsts_1 = require("./kusamaConsts");
|
|
@@ -84,6 +86,8 @@ function getBlockWeight(specName) {
|
|
|
84
86
|
return generateBlockWeightStore(dockConsts_1.dockPoSTestnetDefinitions);
|
|
85
87
|
case 'shiden':
|
|
86
88
|
return generateBlockWeightStore(shidenConsts_1.shidenDefinitions);
|
|
89
|
+
case 'astar':
|
|
90
|
+
return generateBlockWeightStore(astarConsts_1.astarDefinitions);
|
|
87
91
|
case 'calamari':
|
|
88
92
|
return generateBlockWeightStore(calamariConsts_1.calamariDefinitions);
|
|
89
93
|
case 'karura':
|
|
@@ -92,6 +96,8 @@ function getBlockWeight(specName) {
|
|
|
92
96
|
return generateBlockWeightStore(acalaConsts_1.acalaDefinitions);
|
|
93
97
|
case 'manta':
|
|
94
98
|
return generateBlockWeightStore(mantaConsts_1.mantaDefinitions);
|
|
99
|
+
case 'crust':
|
|
100
|
+
return generateBlockWeightStore(crustConsts_1.crustDefinitions);
|
|
95
101
|
default:
|
|
96
102
|
return {};
|
|
97
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/index.ts"],"names":[],"mappings":";;;AAAA,6DAOmC;AACnC,+CAAiD;AACjD,qDAAuD;AACvD,6CAIsB;AACtB,iDAAmD;AACnD,iDAAmD;AACnD,+CAAiD;AACjD,qDAAuD;AACvD,qDAAuD;AACvD,iDAAmD;AACnD,uDAAyD;AACzD,uDAAyD;AACzD,mDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,wBAAwB,CACvC,gBAAkC;IAElC,MAAM,gBAAgB,GAAqB,EAAE,CAAC;IAE9C,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE;QACnC,MAAM,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC;QAC5C,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE;YACtC,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YAE/B,IAAI,IAAA,oCAAoB,EAAC,GAAG,CAAC,EAAE;gBAC7B,gBAAgB,CAAC,OAAO,CAAwB,CAAC,mBAAmB;oBACpE,GAAG,C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ACX,OAAO,wBAAwB,CAAC,8BAAgB,CAAC,CAAC;QACnD;YACC,OAAO,EAAE,CAAC;KACX;AACF,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/index.ts"],"names":[],"mappings":";;;AAAA,6DAOmC;AACnC,+CAAiD;AACjD,+CAAiD;AACjD,qDAAuD;AACvD,+CAAiD;AACjD,6CAIsB;AACtB,iDAAmD;AACnD,iDAAmD;AACnD,+CAAiD;AACjD,qDAAuD;AACvD,qDAAuD;AACvD,iDAAmD;AACnD,uDAAyD;AACzD,uDAAyD;AACzD,mDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,wBAAwB,CACvC,gBAAkC;IAElC,MAAM,gBAAgB,GAAqB,EAAE,CAAC;IAE9C,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE;QACnC,MAAM,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC;QAC5C,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE;YACtC,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YAE/B,IAAI,IAAA,oCAAoB,EAAC,GAAG,CAAC,EAAE;gBAC7B,gBAAgB,CAAC,OAAO,CAAwB,CAAC,mBAAmB;oBACpE,GAAG,CAAC,mBAAmB,CAAC;aACzB;iBAAM,IAAI,IAAA,+BAAe,EAAC,GAAG,CAAC,EAAE;gBAC/B,gBAAgB,CAAC,OAAO,CAAmB,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;aACrE;iBAAM;gBACN,MAAM,IAAI,KAAK,CACd,gEAAgE,CAChE,CAAC;aACF;SACD;KACD;IAED,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAxBD,4DAwBC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,QAAgB;IAC9C,QAAQ,QAAQ,EAAE;QACjB,KAAK,UAAU;YACd,OAAO,wBAAwB,CAAC,oCAAmB,CAAC,CA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 9140,
|
|
16
|
+
9100, 9110, 9111, 9122, 9130, 9140, 9150, 9151,
|
|
17
17
|
],
|
|
18
18
|
perClass: substrateConsts_1.perClass,
|
|
19
19
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kusamaConsts.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/kusamaConsts.ts"],"names":[],"mappings":";;;AACA,uDAAkE;AAErD,QAAA,iBAAiB,GAAqB;IAClD;QACC,eAAe,EAAE;YAChB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YACtE,IAAI,EAAE,IAAI;SACV;QACD,mBAAmB,EAAnB,qCAAmB;KACnB;IACD;QACC,eAAe,EAAE;YAChB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YACtE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"kusamaConsts.js","sourceRoot":"","sources":["../../../../src/chains-config/metadata-consts/kusamaConsts.ts"],"names":[],"mappings":";;;AACA,uDAAkE;AAErD,QAAA,iBAAiB,GAAqB;IAClD;QACC,eAAe,EAAE;YAChB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YACtE,IAAI,EAAE,IAAI;SACV;QACD,mBAAmB,EAAnB,qCAAmB;KACnB;IACD;QACC,eAAe,EAAE;YAChB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YACtE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;SAC9C;QACD,QAAQ,EAAR,0BAAQ;KACR;CACD,CAAC"}
|
|
@@ -87,11 +87,53 @@ class AccountsAssetsService extends AbstractService_1.AbstractService {
|
|
|
87
87
|
async queryAssets(historicApi, assets, address) {
|
|
88
88
|
return Promise.all(assets.map(async (assetId) => {
|
|
89
89
|
const assetBalance = await historicApi.query.assets.account(assetId, address);
|
|
90
|
+
/**
|
|
91
|
+
* The following checks for three different cases:
|
|
92
|
+
*/
|
|
93
|
+
// 1. Via runtime v9160 the updated storage introduces a `reason` field,
|
|
94
|
+
// and polkadot-js wraps the newly returned `PalletAssetsAssetAccount` in an `Option`.
|
|
95
|
+
if (assetBalance.isSome) {
|
|
96
|
+
const balanceProps = assetBalance.unwrap();
|
|
97
|
+
return {
|
|
98
|
+
assetId,
|
|
99
|
+
balance: balanceProps.balance,
|
|
100
|
+
isFrozen: balanceProps.isFrozen,
|
|
101
|
+
isSufficient: balanceProps.reason.isSufficient,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// 2. `query.assets.account()` return `PalletAssetsAssetBalance` which exludes `reasons` but has
|
|
105
|
+
// `sufficient` as a key.
|
|
106
|
+
if (assetBalance.sufficient) {
|
|
107
|
+
const balanceProps = assetBalance;
|
|
108
|
+
return {
|
|
109
|
+
assetId,
|
|
110
|
+
balance: balanceProps.balance,
|
|
111
|
+
isFrozen: balanceProps.isFrozen,
|
|
112
|
+
isSufficient: balanceProps.sufficient,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// 3. The older legacy type of `PalletAssetsAssetBalance` has a key of `isSufficient` instead
|
|
116
|
+
// of `sufficient`.
|
|
117
|
+
if (assetBalance['isSufficient']) {
|
|
118
|
+
const balanceProps = assetBalance;
|
|
119
|
+
return {
|
|
120
|
+
assetId,
|
|
121
|
+
balance: balanceProps.balance,
|
|
122
|
+
isFrozen: balanceProps.isFrozen,
|
|
123
|
+
isSufficient: balanceProps.isSufficient,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* This return value wont ever be reached as polkadot-js defaults the
|
|
128
|
+
* `balance` value to `0`, `isFrozen` to false, and `isSufficient` to false.
|
|
129
|
+
* This ensures that the typescript compiler is happy, but we also follow along
|
|
130
|
+
* with polkadot-js/substrate convention.
|
|
131
|
+
*/
|
|
90
132
|
return {
|
|
91
133
|
assetId,
|
|
92
|
-
balance:
|
|
93
|
-
isFrozen:
|
|
94
|
-
isSufficient:
|
|
134
|
+
balance: historicApi.registry.createType('u128', 0),
|
|
135
|
+
isFrozen: historicApi.registry.createType('bool', false),
|
|
136
|
+
isSufficient: historicApi.registry.createType('bool', false),
|
|
95
137
|
};
|
|
96
138
|
}));
|
|
97
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsAssetsService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsAssetsService.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AccountsAssetsService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsAssetsService.ts"],"names":[],"mappings":";;;AAIA,6CAAyC;AAOzC,wDAAqD;AA6BrD,MAAa,qBAAsB,SAAQ,iCAAe;IACzD;;;;;;;;;OASG;IACH,KAAK,CAAC,kBAAkB,CACvB,IAAe,EACf,OAAe,EACf,MAAgB;QAEhB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrB,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEvC,8CAA8C;QAC9C,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAEnC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,GAAG,CA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aACF;YAED,6FAA6F;YAC7F,mBAAmB;YACnB,IAAI,YAAY,CAAC,cAAc,CAAS,EAAE;gBACzC,MAAM,YAAY,GACjB,YAAyD,CAAC;gBAE3D,OAAO;oBACN,OAAO;oBACP,OAAO,EAAE,YAAY,CAAC,OAAO;oBAC7B,QAAQ,EAAE,YAAY,CAAC,QAAQ;oBAC/B,YAAY,EAAE,YAAY,CAAC,YAAY;iBACvC,CAAC;aACF;YAED;;;;;eAKG;YACH,OAAO;gBACN,OAAO;gBACP,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;gBACnD,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;gBACxD,YAAY,EAAE,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;aAC5D,CAAC;QACH,CAAC,CAAC,CACF,CAAC;IACH,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,IAA6B;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACK,gBAAgB,CAAC,WAAqC;QAC7D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;YAC9B,MAAM,IAAI,wBAAU,CACnB,+DAA+D,CAC/D,CAAC;SACF;IACF,CAAC;CACD;AApMD,sDAoMC"}
|
|
@@ -1,110 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const sanitizeNumbers_1 = require("../../sanitize/sanitizeNumbers");
|
|
4
|
-
const statemintMetadata_1 = require("../../test-helpers/metadata/statemintMetadata");
|
|
5
|
-
const registries_1 = require("../../test-helpers/registries");
|
|
6
|
-
const typeFactory_1 = require("../../test-helpers/typeFactory");
|
|
7
|
-
const typeFactory_2 = require("../../test-helpers/typeFactory");
|
|
8
4
|
const mock_1 = require("../test-helpers/mock");
|
|
5
|
+
const mockAssetData_1 = require("../test-helpers/mock/assets/mockAssetData");
|
|
9
6
|
const AccountsAssetsService_1 = require("./AccountsAssetsService");
|
|
10
|
-
const statemintApiV1 = (0, typeFactory_1.createApiWithAugmentations)(statemintMetadata_1.statemintV1);
|
|
11
|
-
const statemintTypeFactory = new typeFactory_2.TypeFactory(statemintApiV1);
|
|
12
|
-
const falseBool = registries_1.rococoRegistry.createType('bool', false);
|
|
13
|
-
const trueBool = registries_1.rococoRegistry.createType('bool', true);
|
|
14
|
-
const assetTBalanceOne = registries_1.rococoRegistry.createType('u64', 10000000);
|
|
15
|
-
const assetTBalanceTwo = registries_1.rococoRegistry.createType('u64', 20000000);
|
|
16
|
-
const accountIdOne = registries_1.rococoRegistry.createType('AccountId', '1TYrFCWxwHA5bhiXf6uLvPfG6eEvrzzL7uiPK3Yc6yHLUqc');
|
|
17
|
-
const accountIdTwo = registries_1.rococoRegistry.createType('AccountId', '13NXiLYYzVEjXxU3eaZNcrjEX9vPyVDNNpURCzK8Bj9BiCWH');
|
|
18
|
-
const balanceOfTwo = registries_1.rococoRegistry.createType('BalanceOf', 2000000);
|
|
19
|
-
const assetsInfo = () => Promise.resolve().then(() => {
|
|
20
|
-
const responseObj = {
|
|
21
|
-
owner: accountIdOne,
|
|
22
|
-
issue: accountIdTwo,
|
|
23
|
-
admin: accountIdTwo,
|
|
24
|
-
freezer: accountIdTwo,
|
|
25
|
-
supply: assetTBalanceOne,
|
|
26
|
-
deposit: balanceOfTwo,
|
|
27
|
-
minBalance: registries_1.rococoRegistry.createType('u64', 10000),
|
|
28
|
-
isSufficient: trueBool,
|
|
29
|
-
accounts: registries_1.rococoRegistry.createType('u32', 10),
|
|
30
|
-
sufficients: registries_1.rococoRegistry.createType('u32', 15),
|
|
31
|
-
approvals: registries_1.rococoRegistry.createType('u32', 20),
|
|
32
|
-
isFrozen: falseBool,
|
|
33
|
-
};
|
|
34
|
-
return registries_1.rococoRegistry.createType('AssetDetails', responseObj);
|
|
35
|
-
});
|
|
36
|
-
const assetsMetadata = () => Promise.resolve().then(() => {
|
|
37
|
-
const responseObj = {
|
|
38
|
-
deposit: balanceOfTwo,
|
|
39
|
-
name: registries_1.rococoRegistry.createType('Bytes', 'statemint'),
|
|
40
|
-
symbol: registries_1.rococoRegistry.createType('Bytes', 'DOT'),
|
|
41
|
-
decimals: registries_1.rococoRegistry.createType('u8', 10),
|
|
42
|
-
isFrozen: falseBool,
|
|
43
|
-
};
|
|
44
|
-
return registries_1.rococoRegistry.createType('AssetMetadata', responseObj);
|
|
45
|
-
});
|
|
46
|
-
const assetBalanceObjOne = {
|
|
47
|
-
balance: assetTBalanceOne,
|
|
48
|
-
isFrozen: falseBool,
|
|
49
|
-
sufficient: trueBool,
|
|
50
|
-
};
|
|
51
|
-
const assetBalanceObjTwo = {
|
|
52
|
-
balance: assetTBalanceTwo,
|
|
53
|
-
isFrozen: trueBool,
|
|
54
|
-
sufficient: trueBool,
|
|
55
|
-
};
|
|
56
|
-
const assetBalanceObjThree = {
|
|
57
|
-
balance: assetTBalanceTwo,
|
|
58
|
-
isFrozen: falseBool,
|
|
59
|
-
sufficient: falseBool,
|
|
60
|
-
};
|
|
61
|
-
const assetBalanceFactory = {
|
|
62
|
-
'10': assetBalanceObjOne,
|
|
63
|
-
'20': assetBalanceObjTwo,
|
|
64
|
-
'30': assetBalanceObjThree,
|
|
65
|
-
};
|
|
66
|
-
const assetStorageKeyOne = statemintTypeFactory.storageKey(10, 'AssetId', statemintApiV1.query.assets.asset);
|
|
67
|
-
const assetStorageKeyTwo = statemintTypeFactory.storageKey(20, 'AssetId', statemintApiV1.query.assets.asset);
|
|
68
|
-
const assetStorageKeyThree = statemintTypeFactory.storageKey(30, 'AssetId', statemintApiV1.query.assets.asset);
|
|
69
|
-
const assetsAccountKeysAt = () => Promise.resolve().then(() => {
|
|
70
|
-
return [assetStorageKeyOne, assetStorageKeyTwo, assetStorageKeyThree];
|
|
71
|
-
});
|
|
72
|
-
/**
|
|
73
|
-
* Attach `keys` to mockApi.query.assets.asset
|
|
74
|
-
*/
|
|
75
|
-
Object.assign(assetsInfo, {
|
|
76
|
-
keys: assetsAccountKeysAt,
|
|
77
|
-
});
|
|
78
|
-
/**
|
|
79
|
-
* @param assetId options are 10, 20, 30
|
|
80
|
-
*/
|
|
81
|
-
const assetsAccount = (assetId, _address) => {
|
|
82
|
-
const id = typeof assetId === 'number' ? assetId : parseInt(assetId.toString());
|
|
83
|
-
switch (id) {
|
|
84
|
-
case 10:
|
|
85
|
-
return assetBalanceFactory[10];
|
|
86
|
-
case 20:
|
|
87
|
-
return assetBalanceFactory[20];
|
|
88
|
-
case 30:
|
|
89
|
-
return assetBalanceFactory[30];
|
|
90
|
-
default:
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const assetApprovals = () => Promise.resolve().then(() => {
|
|
95
|
-
const assetObj = {
|
|
96
|
-
amount: assetTBalanceOne,
|
|
97
|
-
deposit: balanceOfTwo,
|
|
98
|
-
};
|
|
99
|
-
return registries_1.rococoRegistry.createType('Option<AssetApproval>', assetObj);
|
|
100
|
-
});
|
|
101
7
|
const historicApi = {
|
|
102
8
|
query: {
|
|
103
9
|
assets: {
|
|
104
|
-
account: assetsAccount,
|
|
105
|
-
approvals: assetApprovals,
|
|
106
|
-
asset:
|
|
107
|
-
metadata: assetsMetadata,
|
|
10
|
+
account: mockAssetData_1.assetsAccount,
|
|
11
|
+
approvals: mockAssetData_1.assetApprovals,
|
|
12
|
+
asset: (0, mockAssetData_1.assetsInfoKeysInjected)(),
|
|
13
|
+
metadata: mockAssetData_1.assetsMetadata,
|
|
108
14
|
},
|
|
109
15
|
},
|
|
110
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsAssetsService.spec.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsAssetsService.spec.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"AccountsAssetsService.spec.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsAssetsService.spec.ts"],"names":[],"mappings":";;AAIA,oEAAiE;AACjE,+CAAuE;AACvE,6EAKmD;AACnD,mEAAgE;AAEhE,MAAM,WAAW,GAAG;IACnB,KAAK,EAAE;QACN,MAAM,EAAE;YACP,OAAO,EAAE,6BAAa;YACtB,SAAS,EAAE,8BAAc;YACzB,KAAK,EAAE,IAAA,sCAAsB,GAAE;YAC/B,QAAQ,EAAE,8BAAc;SACxB;KACD;CACsC,CAAC;AAEzC,MAAM,OAAO,GAAG;IACf,GAAG,qBAAc;IACjB,EAAE,EAAE,CAAC,KAAW,EAAE,EAAE,CAAC,WAAW;CACP,CAAC;AAE3B,MAAM,qBAAqB,GAAG,IAAI,6CAAqB,CAAC,OAAO,CAAC,CAAC;AAEjE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACtC,MAAM,EAAE,GAAG;QACV,IAAI,EAAE,oEAAoE;QAC1E,MAAM,EAAE,QAAQ;KAChB,CAAC;IAEF,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACzD,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,gBAAgB,GAAG;gBACxB,EAAE;gBACF,MAAM,EAAE;oBACP;wBACC,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,UAAU;wBACnB,QAAQ,EAAE,KAAK;wBACf,YAAY,EAAE,IAAI;qBAClB;oBACD;wBACC,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,UAAU;wBACnB,QAAQ,EAAE,IAAI;wBACd,YAAY,EAAE,IAAI;qBAClB;iBACD;aACD,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,kBAAkB,CAC9D,sBAAe,EACf,QAAQ,EAAE,sDAAsD;YAChE,CAAC,EAAE,EAAE,EAAE,C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AAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -12,4 +12,11 @@ export declare class AccountsBalanceInfoService extends AbstractService {
|
|
|
12
12
|
* @param token Token to get the balance info of.
|
|
13
13
|
*/
|
|
14
14
|
fetchAccountBalanceInfo(hash: BlockHash, historicApi: ApiDecoration<'promise'>, address: string, token: string): Promise<IAccountBalanceInfo>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns HttpError with the correct err message for querying accounts balances.
|
|
17
|
+
*
|
|
18
|
+
* @param address Address that was queried
|
|
19
|
+
* @param err Error returned from the promise
|
|
20
|
+
*/
|
|
21
|
+
private createHttpError;
|
|
15
22
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccountsBalanceInfoService = void 0;
|
|
4
|
+
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
4
5
|
const http_errors_1 = require("http-errors");
|
|
5
6
|
const AbstractService_1 = require("../AbstractService");
|
|
6
7
|
class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
@@ -31,7 +32,9 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
31
32
|
historicApi.query.balances.locks(address),
|
|
32
33
|
historicApi.query.balances.reservedBalance(address),
|
|
33
34
|
historicApi.query.system.accountNonce(address),
|
|
34
|
-
])
|
|
35
|
+
]).catch((err) => {
|
|
36
|
+
throw this.createHttpError(address, err);
|
|
37
|
+
});
|
|
35
38
|
// Values dont exist for these historic runtimes
|
|
36
39
|
const miscFrozen = api.registry.createType('Balance', 0), feeFrozen = api.registry.createType('Balance', 0);
|
|
37
40
|
const at = {
|
|
@@ -59,7 +62,9 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
59
62
|
api.rpc.chain.getHeader(hash),
|
|
60
63
|
historicApi.query.system.account(address),
|
|
61
64
|
historicApi.query.balances.locks(address),
|
|
62
|
-
])
|
|
65
|
+
]).catch((err) => {
|
|
66
|
+
throw this.createHttpError(address, err);
|
|
67
|
+
});
|
|
63
68
|
const { data: { free, reserved, feeFrozen, miscFrozen }, nonce, } = accountInfo;
|
|
64
69
|
const at = {
|
|
65
70
|
hash,
|
|
@@ -88,7 +93,9 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
88
93
|
api.rpc.chain.getHeader(hash),
|
|
89
94
|
historicApi.query.balances.locks(address),
|
|
90
95
|
historicApi.query.system.account(address),
|
|
91
|
-
])
|
|
96
|
+
]).catch((err) => {
|
|
97
|
+
throw this.createHttpError(address, err);
|
|
98
|
+
});
|
|
92
99
|
accountData =
|
|
93
100
|
accountInfo.data != null
|
|
94
101
|
? accountInfo.data
|
|
@@ -137,6 +144,17 @@ class AccountsBalanceInfoService extends AbstractService_1.AbstractService {
|
|
|
137
144
|
throw new http_errors_1.BadRequest('Account not found');
|
|
138
145
|
}
|
|
139
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Returns HttpError with the correct err message for querying accounts balances.
|
|
149
|
+
*
|
|
150
|
+
* @param address Address that was queried
|
|
151
|
+
* @param err Error returned from the promise
|
|
152
|
+
*/
|
|
153
|
+
createHttpError(address, err) {
|
|
154
|
+
return (0, util_crypto_1.isEthereumAddress)(address)
|
|
155
|
+
? new http_errors_1.BadRequest(`Etheurem addresses may not be supported on this network: ${err.message}`)
|
|
156
|
+
: new http_errors_1.BadRequest(err.message);
|
|
157
|
+
}
|
|
140
158
|
}
|
|
141
159
|
exports.AccountsBalanceInfoService = AccountsBalanceInfoService;
|
|
142
160
|
//# sourceMappingURL=AccountsBalanceInfoService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsBalanceInfoService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsBalanceInfoService.ts"],"names":[],"mappings":";;;AASA,
|
|
1
|
+
{"version":3,"file":"AccountsBalanceInfoService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsBalanceInfoService.ts"],"names":[],"mappings":";;;AASA,uDAA0D;AAC1D,6CAAoD;AAGpD,wDAAqD;AAErD,MAAa,0BAA2B,SAAQ,iCAAe;IAC9D;;;;;;;OAOG;IACH,KAAK,CAAC,uBAAuB,CAC5B,IAAe,EACf,WAAqC,EACrC,OAAe,EACf,KAAa;QAEb,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrB;;;;;;;;;WASG;QACH,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE;YAC3C,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC7B,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAqB;gBACnE,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC;gBACzC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAqB;gBACvE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAmB;aAChE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE;gBACvB,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YAEH,gDAAgD;YAChD,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,EACvD,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YAE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AA7KD,gEA6KC"}
|
|
@@ -1,117 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const sanitizeNumbers_1 = require("../../sanitize/sanitizeNumbers");
|
|
4
|
-
const statemintMetadata_1 = require("../../test-helpers/metadata/statemintMetadata");
|
|
5
|
-
const registries_1 = require("../../test-helpers/registries");
|
|
6
|
-
const typeFactory_1 = require("../../test-helpers/typeFactory");
|
|
7
|
-
const typeFactory_2 = require("../../test-helpers/typeFactory");
|
|
8
4
|
const mock_1 = require("../test-helpers/mock");
|
|
5
|
+
const mockAssetData_1 = require("../test-helpers/mock/assets/mockAssetData");
|
|
9
6
|
const PalletsAssetsService_1 = require("./PalletsAssetsService");
|
|
10
|
-
/**
|
|
11
|
-
* Asset specific constants.
|
|
12
|
-
* Note: It borrows some variables used in the parachains constant section
|
|
13
|
-
*
|
|
14
|
-
* Used in `/assets` and `/accounts` endpoints
|
|
15
|
-
*/
|
|
16
|
-
const statemintApiV1 = (0, typeFactory_1.createApiWithAugmentations)(statemintMetadata_1.statemintV1);
|
|
17
|
-
const statemintTypeFactory = new typeFactory_2.TypeFactory(statemintApiV1);
|
|
18
|
-
const falseBool = registries_1.rococoRegistry.createType('bool', false);
|
|
19
|
-
const trueBool = registries_1.rococoRegistry.createType('bool', true);
|
|
20
|
-
const assetTBalanceOne = registries_1.rococoRegistry.createType('u64', 10000000);
|
|
21
|
-
const assetTBalanceTwo = registries_1.rococoRegistry.createType('u64', 20000000);
|
|
22
|
-
const accountIdOne = registries_1.rococoRegistry.createType('AccountId', '1TYrFCWxwHA5bhiXf6uLvPfG6eEvrzzL7uiPK3Yc6yHLUqc');
|
|
23
|
-
const accountIdTwo = registries_1.rococoRegistry.createType('AccountId', '13NXiLYYzVEjXxU3eaZNcrjEX9vPyVDNNpURCzK8Bj9BiCWH');
|
|
24
|
-
const balanceOfTwo = registries_1.rococoRegistry.createType('BalanceOf', 2000000);
|
|
25
|
-
const assetsInfo = () => Promise.resolve().then(() => {
|
|
26
|
-
const responseObj = {
|
|
27
|
-
owner: accountIdOne,
|
|
28
|
-
issue: accountIdTwo,
|
|
29
|
-
admin: accountIdTwo,
|
|
30
|
-
freezer: accountIdTwo,
|
|
31
|
-
supply: assetTBalanceOne,
|
|
32
|
-
deposit: balanceOfTwo,
|
|
33
|
-
minBalance: registries_1.rococoRegistry.createType('u64', 10000),
|
|
34
|
-
isSufficient: trueBool,
|
|
35
|
-
accounts: registries_1.rococoRegistry.createType('u32', 10),
|
|
36
|
-
sufficients: registries_1.rococoRegistry.createType('u32', 15),
|
|
37
|
-
approvals: registries_1.rococoRegistry.createType('u32', 20),
|
|
38
|
-
isFrozen: falseBool,
|
|
39
|
-
};
|
|
40
|
-
return registries_1.rococoRegistry.createType('AssetDetails', responseObj);
|
|
41
|
-
});
|
|
42
|
-
const assetsMetadata = () => Promise.resolve().then(() => {
|
|
43
|
-
const responseObj = {
|
|
44
|
-
deposit: balanceOfTwo,
|
|
45
|
-
name: registries_1.rococoRegistry.createType('Bytes', 'statemint'),
|
|
46
|
-
symbol: registries_1.rococoRegistry.createType('Bytes', 'DOT'),
|
|
47
|
-
decimals: registries_1.rococoRegistry.createType('u8', 10),
|
|
48
|
-
isFrozen: falseBool,
|
|
49
|
-
};
|
|
50
|
-
return registries_1.rococoRegistry.createType('AssetMetadata', responseObj);
|
|
51
|
-
});
|
|
52
|
-
const assetBalanceObjOne = {
|
|
53
|
-
balance: assetTBalanceOne,
|
|
54
|
-
isFrozen: falseBool,
|
|
55
|
-
sufficient: trueBool,
|
|
56
|
-
};
|
|
57
|
-
const assetBalanceObjTwo = {
|
|
58
|
-
balance: assetTBalanceTwo,
|
|
59
|
-
isFrozen: trueBool,
|
|
60
|
-
sufficient: trueBool,
|
|
61
|
-
};
|
|
62
|
-
const assetBalanceObjThree = {
|
|
63
|
-
balance: assetTBalanceTwo,
|
|
64
|
-
isFrozen: falseBool,
|
|
65
|
-
sufficient: falseBool,
|
|
66
|
-
};
|
|
67
|
-
const assetBalanceFactory = {
|
|
68
|
-
'10': assetBalanceObjOne,
|
|
69
|
-
'20': assetBalanceObjTwo,
|
|
70
|
-
'30': assetBalanceObjThree,
|
|
71
|
-
};
|
|
72
|
-
const assetStorageKeyOne = statemintTypeFactory.storageKey(10, 'AssetId', statemintApiV1.query.assets.asset);
|
|
73
|
-
const assetStorageKeyTwo = statemintTypeFactory.storageKey(20, 'AssetId', statemintApiV1.query.assets.asset);
|
|
74
|
-
const assetStorageKeyThree = statemintTypeFactory.storageKey(30, 'AssetId', statemintApiV1.query.assets.asset);
|
|
75
|
-
const assetsAccountKeysAt = () => Promise.resolve().then(() => {
|
|
76
|
-
return [assetStorageKeyOne, assetStorageKeyTwo, assetStorageKeyThree];
|
|
77
|
-
});
|
|
78
|
-
/**
|
|
79
|
-
* Attach `keysAt` to mockApi.query.assets.asset
|
|
80
|
-
*/
|
|
81
|
-
Object.assign(assetsInfo, {
|
|
82
|
-
keysAt: assetsAccountKeysAt,
|
|
83
|
-
});
|
|
84
|
-
/**
|
|
85
|
-
* @param assetId options are 10, 20, 30
|
|
86
|
-
*/
|
|
87
|
-
const assetsAccount = (assetId, _address) => {
|
|
88
|
-
const id = typeof assetId === 'number' ? assetId : parseInt(assetId.toString());
|
|
89
|
-
switch (id) {
|
|
90
|
-
case 10:
|
|
91
|
-
return assetBalanceFactory[10];
|
|
92
|
-
case 20:
|
|
93
|
-
return assetBalanceFactory[20];
|
|
94
|
-
case 30:
|
|
95
|
-
return assetBalanceFactory[30];
|
|
96
|
-
default:
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const assetApprovals = () => Promise.resolve().then(() => {
|
|
101
|
-
const assetObj = {
|
|
102
|
-
amount: assetTBalanceOne,
|
|
103
|
-
deposit: balanceOfTwo,
|
|
104
|
-
};
|
|
105
|
-
return registries_1.rococoRegistry.createType('Option<AssetApproval>', assetObj);
|
|
106
|
-
});
|
|
107
7
|
const mockApi = {
|
|
108
8
|
...mock_1.defaultMockApi,
|
|
109
9
|
query: {
|
|
110
10
|
assets: {
|
|
111
|
-
asset: assetsInfo,
|
|
112
|
-
approvals: assetApprovals,
|
|
113
|
-
account: assetsAccount,
|
|
114
|
-
metadata: assetsMetadata,
|
|
11
|
+
asset: mockAssetData_1.assetsInfo,
|
|
12
|
+
approvals: mockAssetData_1.assetApprovals,
|
|
13
|
+
account: mockAssetData_1.assetsAccount,
|
|
14
|
+
metadata: mockAssetData_1.assetsMetadata,
|
|
115
15
|
},
|
|
116
16
|
},
|
|
117
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PalletsAssetsService.spec.js","sourceRoot":"","sources":["../../../../src/services/pallets/PalletsAssetsService.spec.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"PalletsAssetsService.spec.js","sourceRoot":"","sources":["../../../../src/services/pallets/PalletsAssetsService.spec.ts"],"names":[],"mappings":";;AAEA,oEAAiE;AACjE,+CAAuE;AACvE,6EAKmD;AACnD,iEAA8D;AAE9D,MAAM,OAAO,GAAG;IACf,GAAG,qBAAc;IACjB,KAAK,EAAE;QACN,MAAM,EAAE;YACP,KAAK,EAAE,0BAAU;YACjB,SAAS,EAAE,8BAAc;YACzB,OAAO,EAAE,6BAAa;YACtB,QAAQ,EAAE,8BAAc;SACxB;KACD;CACwB,CAAC;AAE3B,MAAM,oBAAoB,GAAG,IAAI,2CAAoB,CAAC,OAAO,CAAC,CAAC;AAE/D,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;QACpD,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;YAClE,MAAM,gBAAgB,GAAG;gBACxB,EAAE,EAAE;oBACH,IAAI,EAAE,oEAAoE;oBAC1E,MAAM,EAAE,QAAQ;iBAChB;gBACD,SAAS,EAAE;oBACV,KAAK,EAAE,kDAAkD;oBACzD,MAAM,EAAE,kDAAkD;oBAC1D,KAAK,EAAE,kDAAkD;oBACzD,OAAO,EAAE,kDAAkD;oBAC3D,MAAM,EAAE,UAAU;oBAClB,OAAO,EAAE,SAAS;oBAClB,UAAU,EAAE,OAAO;oBACnB,YAAY,EAAE,IAAI;oBAClB,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,IAAI;oBACjB,SAAS,EAAE,IAAI;oBACf,QAAQ,EAAE,KAAK;iBACf;gBACD,aAAa,EAAE;oBACd,OAAO,EAAE,SAAS;oBAClB,IAAI,EAAE,sBAAsB;oBAC5B,MAAM,EAAE,UAAU;oBAClB,QAAQ,EAAE,IAAI;oBACd,QAAQ,EAAE,KAAK;iBACf;aACD,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,cAAc,CACzD,sBAAe,EACf,EAAE,CACF,CAAC;YAEF,MAAM,CAAC,IAAA,iCAAe,EAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -22,7 +22,7 @@ export interface IAssetBalance {
|
|
|
22
22
|
* an ED in the Balances pallet or whatever else is used to control user-account state
|
|
23
23
|
* growth).
|
|
24
24
|
*/
|
|
25
|
-
isSufficient: bool;
|
|
25
|
+
isSufficient: bool | boolean;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Response from `/accounts/{accountId}/assets-balances?asset=assetId`
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "11.3.
|
|
2
|
+
"version": "11.3.7",
|
|
3
3
|
"name": "@substrate/api-sidecar",
|
|
4
4
|
"description": "REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.",
|
|
5
5
|
"homepage": "https://github.com/paritytech/substrate-api-sidecar#readme",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"test:test-release": "yarn start:test-release"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@polkadot/api": "^7.
|
|
53
|
+
"@polkadot/api": "^7.2.1",
|
|
54
54
|
"@polkadot/apps-config": "0.98.2-164",
|
|
55
55
|
"@polkadot/util-crypto": "^8.2.2",
|
|
56
56
|
"@polkadot/x-rxjs": "^6.11.1",
|
|
57
|
-
"@substrate/calc": "^0.2.
|
|
57
|
+
"@substrate/calc": "^0.2.7",
|
|
58
58
|
"argparse": "^2.0.1",
|
|
59
59
|
"confmgr": "1.0.7",
|
|
60
60
|
"express": "^4.17.1",
|
|
@@ -72,20 +72,18 @@
|
|
|
72
72
|
"@types/lru-cache": "^5.1.1",
|
|
73
73
|
"@types/morgan": "1.9.3",
|
|
74
74
|
"@types/triple-beam": "^1.3.2",
|
|
75
|
-
"standard-version": "9.3.2",
|
|
76
75
|
"tsc-watch": "^4.4.0"
|
|
77
76
|
},
|
|
78
77
|
"resolutions": {
|
|
79
|
-
"@polkadot/api": "7.
|
|
78
|
+
"@polkadot/api": "7.2.1",
|
|
80
79
|
"@polkadot/keyring": "8.2.2",
|
|
81
80
|
"@polkadot/networks": "8.2.2",
|
|
82
|
-
"@polkadot/types": "7.
|
|
83
|
-
"@polkadot/types-known": "7.
|
|
81
|
+
"@polkadot/types": "7.2.1",
|
|
82
|
+
"@polkadot/types-known": "7.2.1",
|
|
84
83
|
"@polkadot/util": "8.2.2",
|
|
85
84
|
"@polkadot/util-crypto": "8.2.2",
|
|
86
85
|
"@polkadot/wasm-crypto": "4.5.1",
|
|
87
86
|
"bn.js": "4.12.0",
|
|
88
|
-
"node-forge": ">=0.10.0",
|
|
89
87
|
"node-fetch": ">=2.6.1",
|
|
90
88
|
"prismjs": ">=1.23.0",
|
|
91
89
|
"typescript": "4.4.3"
|