Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: fundInfo with updated polkadot/api #570

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dist/app.bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/src/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2386,10 +2386,10 @@ components:
enum:
- preEnding
- ending
firstSlot:
firstPeriod:
Copy link
Member

@niklasad1 niklasad1 May 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before publishing the next release this PR updates the type FundInfo to correctly match the type generated from @polkadot/api

I don't understand this, the variable is just renamed and the type is not changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea so the fields firstSlot, and lastSlot within the FundInfo type has been renamed to firstPeriod and lastPeriod. I worded the description wrong it should say:

"updates the fields 'firstSlot' and 'lastSlot' within the type FundInfo"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given FundInfo is a public type, changing it's member names like this is a breaking change right? So the next release is major?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed. This would be a breaking change, fixed the commit name.

type: string
format: unsignedInteger
lastSlot:
lastPeriod:
type: string
format: unsignedInteger
trieIndex:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"test:init-runtime-tests": "python3 ./scripts/run_chain_tests.py"
},
"dependencies": {
"@polkadot/api": "^4.11.2",
"@polkadot/api": "^4.12.1",
"@polkadot/apps-config": "^0.91.2",
"@polkadot/util-crypto": "^6.5.1",
"@polkadot/util-crypto": "^6.6.1",
"@substrate/calc": "^0.2.0",
"confmgr": "^1.0.6",
"express": "^4.17.1",
Expand Down
4 changes: 2 additions & 2 deletions src/services/paras/ParasService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe('ParasService', () => {
end: '200000',
cap: '100000000000000000',
lastContribution: { preEnding: '6' },
firstSlot: '13',
lastSlot: '16',
firstPeriod: '13',
lastPeriod: '16',
trieIndex: '60',
};

Expand Down
4 changes: 2 additions & 2 deletions src/services/paras/ParasService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export class ParasService extends AbstractService {
let fundInfo, leasePeriods;
if (fund.isSome) {
fundInfo = fund.unwrap();
const firstSlot = fundInfo.firstSlot.toNumber();
const firstSlot = fundInfo.firstPeriod.toNumber();
// number of lease periods this crowdloan covers
const leasePeriodCount = fundInfo.lastSlot.toNumber() - firstSlot + 1;
const leasePeriodCount = fundInfo.lastPeriod.toNumber() - firstSlot + 1;
leasePeriods = Array(leasePeriodCount)
.fill(0)
.map((_, i) => i + firstSlot);
Expand Down
4 changes: 2 additions & 2 deletions src/services/test-helpers/mock/mockApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ const funds = {
lastContribution: rococoRegistry.createType('LastContribution', {
preEnding: 6,
}),
firstSlot: rococoRegistry.createType('LeasePeriod', 13),
lastSlot: rococoRegistry.createType('LeasePeriod', 16),
firstPeriod: rococoRegistry.createType('LeasePeriod', 13),
lastPeriod: rococoRegistry.createType('LeasePeriod', 16),
trieIndex: rococoRegistry.createType('TrieIndex', 60),
};

Expand Down
Loading