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

feat: add CType block number support #694

Merged
merged 26 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1e2ec5a
Update and dedupe dependencie
ntn-x2 Dec 14, 2022
85feebd
Update type definitions
ntn-x2 Dec 1, 2022
9cb393a
Add relevant CType chain functions
ntn-x2 Dec 1, 2022
79176d2
Refactor utils into own module
ntn-x2 Dec 13, 2022
2b32267
Complete features
ntn-x2 Dec 13, 2022
e697c20
Fix CType integration tests
ntn-x2 Dec 13, 2022
b7cf33a
Add CType integration tests
ntn-x2 Dec 14, 2022
8adbe63
Update creation block number property name
ntn-x2 Dec 14, 2022
76dbb74
Fix block parsing logic for CType
ntn-x2 Dec 14, 2022
c41855a
Update creation block number in augmented types
ntn-x2 Dec 14, 2022
5f48a39
Address Tom's points
ntn-x2 Dec 14, 2022
79fb28d
Adjust use of toUtf8()
ntn-x2 Dec 14, 2022
f5cfd29
Refactor CType.chain
ntn-x2 Dec 16, 2022
1089de0
Refactor public credentials
ntn-x2 Dec 16, 2022
1b76747
Fix integration tests
ntn-x2 Dec 16, 2022
b91dc6f
Minor stilistic fixes
ntn-x2 Dec 16, 2022
0a7c915
Merge commit '1b87f38a1ed7bea2e67042b71b430b584ab851f3' into aa/ctype…
ntn-x2 Dec 16, 2022
b678b67
Merge commit '92c90f61637d9313ba6b0d27509c119a5acceba2' into aa/ctype…
ntn-x2 Dec 16, 2022
1baa04f
Mirror for CType what's done for credentials
ntn-x2 Dec 16, 2022
6ab64aa
Merge commit 'f3f6fd809420fbf3466c4996480a6a70579f85eb' into aa/ctype…
ntn-x2 Dec 16, 2022
d5d8615
Ignore new utils module from unit test coverage
ntn-x2 Dec 16, 2022
dbb00ed
Merge commit '65e5267c79af55e951a4b2a91ac3ae0e117c5059' into aa/ctype…
ntn-x2 Jan 24, 2023
3aee058
Fixes
ntn-x2 Jan 24, 2023
3edc49f
Fix ctype extrinsic filtering logic
ntn-x2 Jan 24, 2023
036e1cd
Fix public credentials integration test
ntn-x2 Jan 24, 2023
b277ced
Increase time-out
ntn-x2 Jan 24, 2023
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/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@kiltprotocol/sdk-js": "workspace:*",
"@polkadot/keyring": "^10.0.0",
"@polkadot/types": "^9.4.1",
"@polkadot/types": "^9.10.2",
"@polkadot/util": "^10.0.0",
"typescript-logging": "^0.6.4",
"@polkadot/util-crypto": "^10.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/augment-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"bugs": "https://github.com/KILTprotocol/sdk-js/issues",
"homepage": "https://github.com/KILTprotocol/sdk-js#readme",
"devDependencies": {
"@polkadot/api": "^9.4.1",
"@polkadot/typegen": "^9.4.1",
"@polkadot/api": "^9.10.2",
"@polkadot/typegen": "^9.10.2",
"@types/websocket": "^1.0.0",
"glob": "^7.1.1",
"rimraf": "^3.0.2",
Expand Down
5 changes: 5 additions & 0 deletions packages/augment-api/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ declare module '@polkadot/api-base/types/events' {
* \[creator identifier, CType hash\]
**/
CTypeCreated: AugmentedEvent<ApiType, [AccountId32, H256]>;
/**
* Information about a CType has been updated.
* \[CType hash\]
**/
CTypeUpdated: AugmentedEvent<ApiType, [H256]>;
};
cumulusXcm: {
/**
Expand Down
7 changes: 4 additions & 3 deletions packages/augment-api/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/
import type { BTreeMap, Bytes, Null, Option, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, Weight } from '@polkadot/types/interfaces/runtime';
import type { AttestationAttestationsAttestationDetails, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, DelegationDelegationHierarchyDelegationHierarchyDetails, DelegationDelegationHierarchyDelegationNode, DidDidDetails, DidServiceEndpointsDidEndpoint, FrameSupportWeightsPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KiltAssetDidsV1AssetDid, PalletAuthorshipUncleEntryItem, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletCollectiveVotes, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletDidLookupConnectionRecord, PalletDidLookupLinkableAccountLinkableAccountId, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletSchedulerScheduledV3, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletWeb3NamesWeb3NameWeb3NameOwnership, ParachainStakingCandidate, ParachainStakingDelegationCounter, ParachainStakingInflationInflationInfo, ParachainStakingRoundInfo, ParachainStakingStake, ParachainStakingTotalStake, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, PublicCredentialsCredentialsCredentialEntry, RuntimeCommonAssetsAssetDid, RuntimeCommonAuthorizationAuthorizationId, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpTrieStorageProof, SpiritnetRuntimeSessionKeys } from '@polkadot/types/lookup';
import type { AttestationAttestationsAttestationDetails, CtypeCtypeEntry, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, DelegationDelegationHierarchyDelegationHierarchyDetails, DelegationDelegationHierarchyDelegationNode, DidDidDetails, DidServiceEndpointsDidEndpoint, FrameSupportWeightsPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KiltAssetDidsV1AssetDid, PalletAuthorshipUncleEntryItem, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletCollectiveVotes, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletDidLookupConnectionRecord, PalletDidLookupLinkableAccountLinkableAccountId, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletSchedulerScheduledV3, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletWeb3NamesWeb3NameWeb3NameOwnership, ParachainStakingCandidate, ParachainStakingDelegationCounter, ParachainStakingInflationInflationInfo, ParachainStakingRoundInfo, ParachainStakingStake, ParachainStakingTotalStake, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, PublicCredentialsCredentialsCredentialEntry, RuntimeCommonAssetsAssetDid, RuntimeCommonAuthorizationAuthorizationId, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpTrieStorageProof, SpiritnetRuntimeSessionKeys } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';

export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
Expand Down Expand Up @@ -145,9 +145,10 @@ declare module '@polkadot/api-base/types/storage' {
/**
* CTypes stored on chain.
*
* It maps from a CType hash to its creator.
* It maps from a CType hash to its creator and block number in which it
* was created.
**/
ctypes: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<AccountId32>>, [H256]>;
ctypes: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<CtypeCtypeEntry>>, [H256]>;
};
delegation: {
/**
Expand Down
6 changes: 6 additions & 0 deletions packages/augment-api/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ declare module '@polkadot/api-base/types/submittable' {
* # </weight>
**/
add: AugmentedSubmittable<(ctype: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Set the creation block number for a given CType, if found.
*
* Emits `CTypeUpdated`.
**/
setBlockNumber: AugmentedSubmittable<(ctypeHash: H256 | string | Uint8Array, blockNumber: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256, u64]>;
};
delegation: {
/**
Expand Down
16 changes: 14 additions & 2 deletions packages/augment-api/src/interfaces/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,8 @@ export default {
**/
CtypeEvent: {
_enum: {
CTypeCreated: '(AccountId32,H256)'
CTypeCreated: '(AccountId32,H256)',
CTypeUpdated: 'H256'
}
},
/**
Expand Down Expand Up @@ -2482,7 +2483,11 @@ export default {
CtypeCall: {
_enum: {
add: {
ctype: 'Bytes'
ctype: 'Bytes',
},
set_block_number: {
ctypeHash: 'H256',
blockNumber: 'u64'
}
}
},
Expand Down Expand Up @@ -3332,6 +3337,13 @@ export default {
tips: 'Vec<(AccountId32,u128)>',
findersFee: 'bool'
},
/**
* Lookup396: ctype::ctype_entry::CtypeEntry<sp_core::crypto::AccountId32, BlockNumber>
**/
CtypeCtypeEntry: {
creator: 'AccountId32',
createdAt: 'u64'
},
/**
* Lookup398: pallet_tips::pallet::Error<T, I>
**/
Expand Down
Loading