Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dhiway/cord.js into add-…
Browse files Browse the repository at this point in the history
…registries-1
  • Loading branch information
vatsa287 committed Oct 4, 2024
2 parents 14171ec + 98fc7b5 commit 3ed4876
Show file tree
Hide file tree
Showing 11 changed files with 1,575 additions and 563 deletions.
18 changes: 1 addition & 17 deletions demo/src/func-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import { randomUUID } from 'crypto'
import { addNetworkMember } from './utils/createAuthorities'
import { createAccount } from './utils/createAccount'

import {
requestJudgement,
setIdentity,
setRegistrar,
provideJudgement,
} from './utils/createRegistrar'

function getChallenge(): string {
return Cord.Utils.UUID.generate()
}
Expand All @@ -27,7 +20,6 @@ async function main() {

// Step 1: Setup Membership
// Setup transaction author account - CORD Account.

console.log(`\n❄️ New Network Member`)
const authorityAuthorIdentity = Cord.Utils.Crypto.makeKeypairFromUri(
process.env.ANCHOR_URI ? process.env.ANCHOR_URI : '//Alice',
Expand All @@ -39,20 +31,12 @@ async function main() {
`🏦 Member (${authorityIdentity.type}): ${authorityIdentity.address}`
)
await addNetworkMember(authorityAuthorIdentity, authorityIdentity.address)
await setRegistrar(authorityAuthorIdentity, authorityIdentity.address)
console.log('✅ Network Authority created!')

// Setup network member account.
const { account: authorIdentity } = await createAccount()
console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`)
await addNetworkMember(authorityAuthorIdentity, authorIdentity.address)
console.log(`🔏 Member permissions updated`)
await setIdentity(authorIdentity)
console.log(`🔏 Member identity info updated`)
await requestJudgement(authorIdentity, authorityIdentity.address)
console.log(`🔏 Member identity judgement requested`)
await provideJudgement(authorityIdentity, authorIdentity.address)
console.log(`🔏 Member identity judgement provided`)
console.log('✅ Network Member added!')

// Step 2: Setup Identities
Expand Down Expand Up @@ -443,7 +427,7 @@ async function main() {
keyType: delegateTwoKeys.authentication.type,
})
)
console.log(`✅ Statement revoked!`)
console.log(`✅ Statement restored!`)

console.log(`\n❄️ Statement Re-verification `)
const reReVerificationResult = await Cord.Statement.verifyAgainstProperties(
Expand Down
2 changes: 1 addition & 1 deletion packages/augment-api/metadata/cord.json

Large diffs are not rendered by default.

35 changes: 21 additions & 14 deletions packages/augment-api/src/interfaces/augment-api-consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import '@polkadot/api-base/types/consts';

import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
import type { Option, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Perbill, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportTokensFungibleUnionOfNativeOrWithId, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsEnvironment, PalletContractsSchedule, SpVersionRuntimeVersion, SpWeightsRuntimeDbWeight, SpWeightsWeightV2Weight } from '@polkadot/types/lookup';

Expand Down Expand Up @@ -200,6 +200,11 @@ declare module '@polkadot/api-base/types/consts' {
* The maximum allowable length in bytes for storage keys.
**/
maxStorageKeyLen: u32 & AugmentedConst<ApiType>;
/**
* The maximum size of the transient storage in bytes.
* This includes keys, values, and previous entries used for storage rollback.
**/
maxTransientStorageSize: u32 & AugmentedConst<ApiType>;
/**
* Cost schedule and limits.
**/
Expand Down Expand Up @@ -286,6 +291,16 @@ declare module '@polkadot/api-base/types/consts' {
**/
minNameLength: u32 & AugmentedConst<ApiType>;
};
entries: {
/**
* The maximum encoded length available for naming.
**/
maxEncodedInputLength: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of bytes in size a Registry Entry Blob can hold.
**/
maxRegistryEntryBlobSize: u32 & AugmentedConst<ApiType>;
};
grandpa: {
/**
* Max Authorities in use
Expand Down Expand Up @@ -430,6 +445,11 @@ declare module '@polkadot/api-base/types/consts' {
**/
stringLimit: u32 & AugmentedConst<ApiType>;
};
registries: {
maxEncodedInputLength: u32 & AugmentedConst<ApiType>;
maxRegistryBlobSize: u32 & AugmentedConst<ApiType>;
maxRegistryDelegates: u32 & AugmentedConst<ApiType>;
};
scheduler: {
/**
* The maximum weight that may be scheduled per block for any dispatchables.
Expand Down Expand Up @@ -549,19 +569,6 @@ declare module '@polkadot/api-base/types/consts' {
* The period during which an approved treasury spend has to be claimed.
**/
payoutPeriod: u32 & AugmentedConst<ApiType>;
/**
* Fraction of a proposal's value that should be bonded in order to place the proposal.
* An accepted proposal gets these back. A rejected proposal does not.
**/
proposalBond: Permill & AugmentedConst<ApiType>;
/**
* Maximum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMaximum: Option<u128> & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMinimum: u128 & AugmentedConst<ApiType>;
/**
* Period between successive spends.
**/
Expand Down
108 changes: 104 additions & 4 deletions packages/augment-api/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ declare module '@polkadot/api-base/types/errors' {
* The asset is not live, and likely being destroyed.
**/
AssetNotLive: AugmentedError<ApiType>;
/**
* The asset ID must be equal to the [`NextAssetId`].
**/
BadAssetId: AugmentedError<ApiType>;
/**
* Invalid metadata given.
**/
Expand Down Expand Up @@ -488,6 +492,10 @@ declare module '@polkadot/api-base/types/errors' {
* The executed contract exhausted its gas limit.
**/
OutOfGas: AugmentedError<ApiType>;
/**
* Can not add more data to transient storage.
**/
OutOfTransientStorage: AugmentedError<ApiType>;
/**
* The output buffer supplied to a contract API call was too small.
**/
Expand Down Expand Up @@ -784,6 +792,32 @@ declare module '@polkadot/api-base/types/errors' {
**/
SuffixTooLong: AugmentedError<ApiType>;
};
entries: {
/**
* Invalid Identifer Length
**/
InvalidIdentifierLength: AugmentedError<ApiType>;
/**
* Identifier Invalid or Not of DeDir Type
**/
InvalidRegistryEntryIdentifier: AugmentedError<ApiType>;
/**
* Registry Entry Identifier Already Exists
**/
RegistryEntryIdentifierAlreadyExists: AugmentedError<ApiType>;
/**
* Registry Entry Identifier Does Not Exists
**/
RegistryEntryIdentifierDoesNotExist: AugmentedError<ApiType>;
/**
* Registry Entry has not been revoked.
**/
RegistryEntryNotRevoked: AugmentedError<ApiType>;
/**
* Account has no valid authorization
**/
UnauthorizedOperation: AugmentedError<ApiType>;
};
grandpa: {
/**
* Attempt to signal GRANDPA change with one already pending.
Expand Down Expand Up @@ -1178,6 +1212,10 @@ declare module '@polkadot/api-base/types/errors' {
* The asset is not live, and likely being destroyed.
**/
AssetNotLive: AugmentedError<ApiType>;
/**
* The asset ID must be equal to the [`NextAssetId`].
**/
BadAssetId: AugmentedError<ApiType>;
/**
* Invalid metadata given.
**/
Expand Down Expand Up @@ -1259,6 +1297,10 @@ declare module '@polkadot/api-base/types/errors' {
* Preimage has already been noted on-chain.
**/
AlreadyNoted: AugmentedError<ApiType>;
/**
* No ticket with a cost was returned by [`Config::Consideration`] to store the preimage.
**/
NoCost: AugmentedError<ApiType>;
/**
* The user is not authorized to perform this action.
**/
Expand Down Expand Up @@ -1288,6 +1330,68 @@ declare module '@polkadot/api-base/types/errors' {
**/
TooMany: AugmentedError<ApiType>;
};
registries: {
/**
* Authorization Id not found
**/
AuthorizationNotFound: AugmentedError<ApiType>;
/**
* Authority already added
**/
DelegateAlreadyAdded: AugmentedError<ApiType>;
/**
* Delegate not found.
**/
DelegateNotFound: AugmentedError<ApiType>;
/**
* Invalid Identifier
**/
InvalidIdentifier: AugmentedError<ApiType>;
/**
* Invalid Identifier Length
**/
InvalidIdentifierLength: AugmentedError<ApiType>;
/**
* Registry identifier is not unique
**/
RegistryAlreadyAnchored: AugmentedError<ApiType>;
/**
* Registry already arhived.
**/
RegistryAlreadyArchived: AugmentedError<ApiType>;
/**
* Registry already revoked
**/
RegistryAlreadyRevoked: AugmentedError<ApiType>;
/**
* Registry not archived.
**/
RegistryArchived: AugmentedError<ApiType>;
/**
* Registry delegation limit exceeded
**/
RegistryDelegatesLimitExceeded: AugmentedError<ApiType>;
/**
* Registry not archived.
**/
RegistryNotArchived: AugmentedError<ApiType>;
/**
* Registry identifier not found
**/
RegistryNotFound: AugmentedError<ApiType>;
/**
* Registry not revoked.
**/
RegistryNotRevoked: AugmentedError<ApiType>;
/**
* Registry revoked.
**/
RegistryRevoked: AugmentedError<ApiType>;
/**
* Only when the author is not the controller or delegate.
**/
UnauthorizedOperation: AugmentedError<ApiType>;
};
remark: {
/**
* Attempted to call `store` outside of block execution.
Expand Down Expand Up @@ -1618,10 +1722,6 @@ declare module '@polkadot/api-base/types/errors' {
* amount to be spent.
**/
InsufficientPermission: AugmentedError<ApiType>;
/**
* Proposer's balance is too low.
**/
InsufficientProposersBalance: AugmentedError<ApiType>;
/**
* No proposal, bounty or spend at that index.
**/
Expand Down
72 changes: 64 additions & 8 deletions packages/augment-api/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,28 @@ declare module '@polkadot/api-base/types/events' {
**/
DidNameUnbanned: AugmentedEvent<ApiType, [name: Bytes], { name: Bytes }>;
};
entries: {
/**
* A new registry entry has been created.
* \[creator, registry_identifier, registry_entry_identifier\]
**/
RegistryEntryCreated: AugmentedEvent<ApiType, [creator: AccountId32, registryId: Bytes, registryEntryId: Bytes], { creator: AccountId32, registryId: Bytes, registryEntryId: Bytes }>;
/**
* A existing registry entry has been reinstated.
* \[updater, registry_enrtry_identifier\]
**/
RegistryEntryReinstated: AugmentedEvent<ApiType, [updater: AccountId32, registryEntryId: Bytes], { updater: AccountId32, registryEntryId: Bytes }>;
/**
* A existing registry entry has been revoked.
* \[updater, registry_entry_identifier\]
**/
RegistryEntryRevoked: AugmentedEvent<ApiType, [updater: AccountId32, registryEntryId: Bytes], { updater: AccountId32, registryEntryId: Bytes }>;
/**
* A existing registry entry has been updated.
* \[updater, registry_entry_identifier\]
**/
RegistryEntryUpdated: AugmentedEvent<ApiType, [updater: AccountId32, registryEntryId: Bytes], { updater: AccountId32, registryEntryId: Bytes }>;
};
grandpa: {
/**
* New authority set has been applied.
Expand Down Expand Up @@ -846,6 +868,48 @@ declare module '@polkadot/api-base/types/events' {
**/
Requested: AugmentedEvent<ApiType, [hash_: H256], { hash_: H256 }>;
};
registries: {
/**
* A registry has been archived.
* \[registry identifier, authority\]
**/
Archive: AugmentedEvent<ApiType, [registryId: Bytes, authority: AccountId32], { registryId: Bytes, authority: AccountId32 }>;
/**
* A new registry authorization has been added.
* \[registry identifier, authorization, delegate\]
**/
Authorization: AugmentedEvent<ApiType, [registryId: Bytes, authorization: Bytes, delegate: AccountId32], { registryId: Bytes, authorization: Bytes, delegate: AccountId32 }>;
/**
* A new registry has been created.
* \[registry identifier, creator, authorization\]
**/
Create: AugmentedEvent<ApiType, [registryId: Bytes, creator: AccountId32, authorization: Bytes], { registryId: Bytes, creator: AccountId32, authorization: Bytes }>;
/**
* A registry authorization has been removed.
* \[registry identifier, authorization, ]
**/
Deauthorization: AugmentedEvent<ApiType, [registryId: Bytes, authorization: Bytes], { registryId: Bytes, authorization: Bytes }>;
/**
* A registry has been reinstated.
* \[registry identifier, authority\]
**/
Reinstate: AugmentedEvent<ApiType, [registryId: Bytes, authority: AccountId32], { registryId: Bytes, authority: AccountId32 }>;
/**
* A registry has been restored.
* \[registry identifier, authority\]
**/
Restore: AugmentedEvent<ApiType, [registryId: Bytes, authority: AccountId32], { registryId: Bytes, authority: AccountId32 }>;
/**
* A registry has been revoked.
* \[registry identifier, authority\]
**/
Revoke: AugmentedEvent<ApiType, [registryId: Bytes, authority: AccountId32], { registryId: Bytes, authority: AccountId32 }>;
/**
* A existing registry has been updated.
* \[registry identifier, updater, authorization\]
**/
Update: AugmentedEvent<ApiType, [registryId: Bytes, updater: AccountId32, authorization: Bytes], { registryId: Bytes, updater: AccountId32, authorization: Bytes }>;
};
remark: {
/**
* Stored data off chain.
Expand Down Expand Up @@ -1102,14 +1166,6 @@ declare module '@polkadot/api-base/types/events' {
* A payment failed and can be retried.
**/
PaymentFailed: AugmentedEvent<ApiType, [index: u32, paymentId: Null], { index: u32, paymentId: Null }>;
/**
* New proposal.
**/
Proposed: AugmentedEvent<ApiType, [proposalIndex: u32], { proposalIndex: u32 }>;
/**
* A proposal was rejected; funds were slashed.
**/
Rejected: AugmentedEvent<ApiType, [proposalIndex: u32, slashed: u128], { proposalIndex: u32, slashed: u128 }>;
/**
* Spending has finished; this is the amount that rolls over until next spend.
**/
Expand Down
Loading

0 comments on commit 3ed4876

Please sign in to comment.