Skip to content

Commit

Permalink
chore(polkadot): upgrade types and polkadot API version
Browse files Browse the repository at this point in the history
Also updated checkSettle compliance result types

BREAKING CHANGE: `RequirementCompliance` renamed to `Compliance`. There is now a new type called
`RequirementCompliance` which represents compliance to a specific asset requirement. Each condition
inside it has its own `complies` flag
  • Loading branch information
monitz87 committed Nov 13, 2020
1 parent ba69f96 commit f36f129
Show file tree
Hide file tree
Showing 14 changed files with 1,480 additions and 430 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -28,7 +28,7 @@
"@commitlint/config-conventional": "^7.6.0",
"@graphql-codegen/cli": "1.17.7",
"@graphql-codegen/typescript": "1.17.7",
"@polkadot/typegen": "2.3.1",
"@polkadot/typegen": "2.6.1",
"@semantic-release/changelog": "^3.0.4",
"@types/bluebird": "^3.5.30",
"@types/jest": "^23.3.10",
Expand Down Expand Up @@ -84,9 +84,9 @@
"access": "public"
},
"dependencies": {
"@polkadot/api": "2.3.1",
"@polkadot/util": "3.6.1",
"@polkadot/util-crypto": "3.6.1",
"@polkadot/api": "2.6.1",
"@polkadot/util": "4.0",
"@polkadot/util-crypto": "4.0",
"@types/bignumber.js": "^5.0.0",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
Expand Down
8 changes: 4 additions & 4 deletions src/api/entities/SecurityToken/Compliance/Requirements.ts
Expand Up @@ -9,9 +9,9 @@ import {
togglePauseRequirements,
} from '~/api/procedures';
import { TransactionQueue } from '~/base';
import { Requirement, RequirementCompliance, SubCallback, UnsubCallback } from '~/types';
import { Compliance, Requirement, SubCallback, UnsubCallback } from '~/types';
import {
assetComplianceResultToRequirementCompliance,
assetComplianceResultToCompliance,
boolToBoolean,
complianceRequirementToRequirement,
identityIdToString,
Expand Down Expand Up @@ -149,7 +149,7 @@ export class Requirements extends Namespace<SecurityToken> {
public async checkSettle(args: {
from?: string | Identity;
to: string | Identity;
}): Promise<RequirementCompliance> {
}): Promise<Compliance> {
const {
parent: { ticker },
context: {
Expand All @@ -174,7 +174,7 @@ export class Requirements extends Namespace<SecurityToken> {
primaryIssuanceAgent ? stringToIdentityId(primaryIssuanceAgent.did, context) : null
);

return assetComplianceResultToRequirementCompliance(res, context);
return assetComplianceResultToCompliance(res, context);
}

/**
Expand Down
Expand Up @@ -367,7 +367,7 @@ describe('Requirements class', () => {
stringToIdentityIdStub = sinon.stub(utilsModule, 'stringToIdentityId');
assetComplianceResultToRequirementComplianceStub = sinon.stub(
utilsModule,
'assetComplianceResultToRequirementCompliance'
'assetComplianceResultToCompliance'
);
stringToTickerStub = sinon.stub(utilsModule, 'stringToTicker');
});
Expand Down
1 change: 1 addition & 0 deletions src/base/Context.ts
Expand Up @@ -177,6 +177,7 @@ export class Context {
}

context.isArchiveNode = await context.isCurrentNodeArchive();
// context.isArchiveNode = true;

return context;
}
Expand Down
192 changes: 164 additions & 28 deletions src/polkadot/augment-api-query.ts
Expand Up @@ -113,12 +113,14 @@ import {
ProposalDetails,
ProtocolOp,
ProverTickerKey,
Referendum,
STO,
SecurityToken,
Signatory,
SkippedCount,
SmartExtension,
SmartExtensionType,
SnapshotMetadata,
SnapshottedPip,
TargetIdAuthorization,
Ticker,
TickerRangeProof,
Expand Down Expand Up @@ -472,6 +474,10 @@ declare module '@polkadot/api/types/storage' {
* The current "active" membership, stored as an ordered Vec.
**/
activeMembers: AugmentedQuery<ApiType, () => Observable<Vec<IdentityId>>>;
/**
* Limit of how many "active" members there can be.
**/
activeMembersLimit: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The current "inactive" membership, stored as an ordered Vec.
**/
Expand All @@ -482,6 +488,10 @@ declare module '@polkadot/api/types/storage' {
* The current "active" membership, stored as an ordered Vec.
**/
activeMembers: AugmentedQuery<ApiType, () => Observable<Vec<IdentityId>>>;
/**
* Limit of how many "active" members there can be.
**/
activeMembersLimit: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The current "inactive" membership, stored as an ordered Vec.
**/
Expand Down Expand Up @@ -927,6 +937,20 @@ declare module '@polkadot/api/types/storage' {
>;
};
pips: {
/**
* Total count of current pending or scheduled PIPs.
**/
activePipCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The maximum allowed number for `ActivePipCount`.
* Once reached, new PIPs cannot be proposed by community members.
**/
activePipLimit: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* All existing PIPs where the proposer is a committee.
* This list is a cache of all ids in `Proposals` with `Proposer::Committee(_)`.
**/
committeePips: AugmentedQuery<ApiType, () => Observable<Vec<PipId>>>;
/**
* Default enactment period that will be use after a proposal is accepted by GC.
**/
Expand All @@ -943,22 +967,45 @@ declare module '@polkadot/api/types/storage' {
) => Observable<DepositInfo>
>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
* Maps block numbers to list of PIPs which should be executed at the block number.
* block number -> Pip id
**/
executionSchedule: AugmentedQuery<
ApiType,
(arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Vec<PipId>>
>;
/**
* Maximum times a PIP can be skipped before triggering `CannotSkipPip` in `enact_snapshot_results`.
**/
maxPipSkipCount: AugmentedQuery<ApiType, () => Observable<SkippedCount>>;
/**
* The minimum amount to be used as a deposit for community PIP creation.
**/
minimumProposalDeposit: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
/**
* Proposals so far. id can be used to keep track of PIPs off-chain.
**/
pipIdSequence: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The number of times a certain PIP has been skipped.
* Once a (configurable) threshhold is exceeded, a PIP cannot be skipped again.
**/
pipSkipCount: AugmentedQuery<
ApiType,
(arg: PipId | AnyNumber | Uint8Array) => Observable<SkippedCount>
>;
/**
* Maps PIPs to the block at which they will be executed, if any.
**/
pipToSchedule: AugmentedQuery<
ApiType,
(arg: PipId | AnyNumber | Uint8Array) => Observable<Option<BlockNumber>>
>;
/**
* During Cool-off period, proposal owner can amend any PIP detail or cancel the entire
* proposal.
**/
proposalCoolOffPeriod: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
/**
* How long (in blocks) a ballot runs
**/
proposalDuration: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
/**
* The metadata of the active proposals.
**/
Expand All @@ -982,13 +1029,6 @@ declare module '@polkadot/api/types/storage' {
ApiType,
(arg: PipId | AnyNumber | Uint8Array) => Observable<Option<Pip>>
>;
/**
* It maps the block number where a list of proposal are considered as matured.
**/
proposalsMaturingAt: AugmentedQuery<
ApiType,
(arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Vec<PipId>>
>;
/**
* Votes per Proposal and account. Used to avoid double vote issue.
* (proposal id, account) -> Vote
Expand All @@ -998,32 +1038,28 @@ declare module '@polkadot/api/types/storage' {
(
key1: PipId | AnyNumber | Uint8Array,
key2: AccountId | string | Uint8Array
) => Observable<Vote>
) => Observable<Option<Vote>>
>;
/**
* Determines whether historical PIP data is persisted or removed
**/
pruneHistoricalPips: AugmentedQuery<ApiType, () => Observable<bool>>;
/**
* Minimum stake a proposal must gather in order to be considered by the committee.
* Snapshots so far. id can be used to keep track of snapshots off-chain.
**/
quorumThreshold: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
snapshotIdSequence: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* Proposals that have met the quorum threshold to be put forward to a governance committee
* proposal id -> proposal
* The metadata of the snapshot, if there is one.
**/
referendums: AugmentedQuery<
ApiType,
(arg: PipId | AnyNumber | Uint8Array) => Observable<Option<Referendum>>
>;
snapshotMeta: AugmentedQuery<ApiType, () => Observable<Option<SnapshotMetadata>>>;
/**
* List of id's of current scheduled referendums.
* block number -> Pip id
* The priority queue (lowest priority at index 0) of PIPs at the point of snapshotting.
* Priority is defined by the `weight` in the `SnapshottedPIP`.
*
* A queued PIP can be skipped. Doing so bumps the `pip_skip_count`.
* Once a (configurable) threshhold is exceeded, a PIP cannot be skipped again.
**/
scheduledReferendumsAt: AugmentedQuery<
ApiType,
(arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Vec<PipId>>
>;
snapshotQueue: AugmentedQuery<ApiType, () => Observable<Vec<SnapshottedPip>>>;
};
polymeshCommittee: {
/**
Expand Down Expand Up @@ -1763,6 +1799,56 @@ declare module '@polkadot/api/types/storage' {
**/
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>>;
};
technicalCommittee: {
/**
* The current members of the committee.
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<IdentityId>>>;
/**
* Proposals so far.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* Actual proposal for a given hash.
**/
proposalOf: AugmentedQuery<
ApiType,
(arg: Hash | string | Uint8Array) => Observable<Option<Proposal>>
>;
/**
* The hashes of the active proposals.
**/
proposals: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>>;
/**
* Release coordinator.
**/
releaseCoordinator: AugmentedQuery<ApiType, () => Observable<Option<IdentityId>>>;
/**
* Vote threshold for an approval.
**/
voteThreshold: AugmentedQuery<ApiType, () => Observable<ITuple<[u32, u32]>>>;
/**
* PolymeshVotes on a given proposal, if it is ongoing.
**/
voting: AugmentedQuery<
ApiType,
(arg: Hash | string | Uint8Array) => Observable<Option<PolymeshVotes>>
>;
};
technicalCommitteeMembership: {
/**
* The current "active" membership, stored as an ordered Vec.
**/
activeMembers: AugmentedQuery<ApiType, () => Observable<Vec<IdentityId>>>;
/**
* Limit of how many "active" members there can be.
**/
activeMembersLimit: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The current "inactive" membership, stored as an ordered Vec.
**/
inactiveMembers: AugmentedQuery<ApiType, () => Observable<Vec<InactiveMember>>>;
};
timestamp: {
/**
* Did the timestamp get updated in this block?
Expand All @@ -1776,6 +1862,56 @@ declare module '@polkadot/api/types/storage' {
transactionPayment: {
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>>;
};
upgradeCommittee: {
/**
* The current members of the committee.
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<IdentityId>>>;
/**
* Proposals so far.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* Actual proposal for a given hash.
**/
proposalOf: AugmentedQuery<
ApiType,
(arg: Hash | string | Uint8Array) => Observable<Option<Proposal>>
>;
/**
* The hashes of the active proposals.
**/
proposals: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>>;
/**
* Release coordinator.
**/
releaseCoordinator: AugmentedQuery<ApiType, () => Observable<Option<IdentityId>>>;
/**
* Vote threshold for an approval.
**/
voteThreshold: AugmentedQuery<ApiType, () => Observable<ITuple<[u32, u32]>>>;
/**
* PolymeshVotes on a given proposal, if it is ongoing.
**/
voting: AugmentedQuery<
ApiType,
(arg: Hash | string | Uint8Array) => Observable<Option<PolymeshVotes>>
>;
};
upgradeCommitteeMembership: {
/**
* The current "active" membership, stored as an ordered Vec.
**/
activeMembers: AugmentedQuery<ApiType, () => Observable<Vec<IdentityId>>>;
/**
* Limit of how many "active" members there can be.
**/
activeMembersLimit: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The current "inactive" membership, stored as an ordered Vec.
**/
inactiveMembers: AugmentedQuery<ApiType, () => Observable<Vec<InactiveMember>>>;
};
utility: {
nonces: AugmentedQuery<
ApiType,
Expand Down

0 comments on commit f36f129

Please sign in to comment.