Skip to content

Commit 91b2dda

Browse files
Merge pull request #55 from UniqueNetwork/bugfix/collection-rate-limit-format
Fix collection converting limits_sponsore_data_rate
2 parents 27f06fb + 8c6b1e9 commit 91b2dda

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

lib/collectionData.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,25 @@ function getSponsorship (collection) {
3030
return result;
3131
}
3232

33+
function getSponsoredRateLimit(sourceLimit) {
34+
if (sourceLimit === 'SponsoringDisabled') {
35+
return -1;
36+
}
37+
38+
if (Number.isInteger(sourceLimit?.blocks)) {
39+
return sourceLimit.blocks;
40+
}
41+
42+
return null;
43+
}
44+
3345
function getLimits (collection) {
3446
const limits = collection.Limits;
3547
const result = {};
3648
result.tokenLimit = limits.TokenLimit || 0;
3749
result.limitsAccoutOwnership = limits.AccountTokenOwnershipLimit || 0;
3850
result.limitsSponsoreDataSize = limits.SponsoredDataSize;
39-
result.limitsSponsoreDataRate = limits.SponsoredDataRateLimit;
51+
result.limitsSponsoreDataRate = getSponsoredRateLimit(limits.SponsoredDataRateLimit);
4052
result.ownerCanTrasfer = limits.OwnerCanTransfer;
4153
result.ownerCanDestroy = limits.OwnerCanDestroy;
4254
return result;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"types": "module",
77
"scripts": {
88
"start": "npm run migration && node -r dotenv/config index.js",
9+
"debug": "npm run migration && node inspect -r dotenv/config index.js",
910
"docker": "docker-compose --env-file .env -f docker/polkastats-backend/docker-compose.yml up -d",
1011
"docker:polkadot": "docker-compose -f docker/polkastats-backend/docker-compose.yml up",
1112
"docker:local": "docker-compose --env-file .env -f docker/polkastats-backend/docker-compose.local.yml up",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface, Sequelize) => {
5+
return queryInterface.sequelize.query('DROP INDEX IF EXISTS extrinsic_args_idx;');
6+
},
7+
8+
down: async (queryInterface, Sequelize) => {}
9+
};

0 commit comments

Comments
 (0)