Skip to content

Commit

Permalink
fix: 馃悰 upgrade chain types
Browse files Browse the repository at this point in the history
  • Loading branch information
monitz87 committed Dec 22, 2021
1 parent db11c43 commit bf1b08a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/middleware/__tests__/queries.ts
Expand Up @@ -23,8 +23,8 @@ import {
proposalVotes,
scopesByIdentity,
settlements,
tickerExternalAgentHistory,
tickerExternalAgentActions,
tickerExternalAgentHistory,
tokensByTrustedClaimIssuer,
tokensHeldByDid,
transactionByHash,
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('tickerExternalAgentHistory', () => {
};

const result = tickerExternalAgentHistory(variables);

expect(result.query).toBeDefined();
expect(result.variables).toEqual(variables);
});
Expand Down
18 changes: 18 additions & 0 deletions src/polkadot/augment-api-events.ts
Expand Up @@ -1495,6 +1495,24 @@ declare module '@polkadot/api/types/events' {
**/
MembersSwapped: AugmentedEvent<ApiType, [IdentityId, IdentityId, IdentityId]>;
};
testUtils: {
/**
* Shows the `DID` associated to the `AccountId`, and a flag indicates if that DID has a
* valid CDD claim.
* (Target DID, Target Account, a valid CDD claim exists)
**/
CddStatus: AugmentedEvent<ApiType, [Option<IdentityId>, AccountId, bool]>;
/**
* Emits the `IdentityId` and the `AccountId` of the caller.
* (Caller DID, Caller account)
**/
DidStatus: AugmentedEvent<ApiType, [IdentityId, AccountId]>;
/**
* A new mocked `InvestorUid` has been created for the given Identity.
* (Target DID, New InvestorUid)
**/
MockInvestorUIDCreated: AugmentedEvent<ApiType, [IdentityId, InvestorUid]>;
};
treasury: {
/**
* Disbursement to a target Identity.
Expand Down
7 changes: 4 additions & 3 deletions src/polkadot/augment-api-query.ts
Expand Up @@ -755,7 +755,7 @@ declare module '@polkadot/api/types/storage' {
* The `CorporateActions` map stores `Ticker => LocalId => The CA`,
* so we can infer `Ticker => CAId`. Therefore, we don't need a double map.
**/
caDocLink: AugmentedQuery<
cADocLink: AugmentedQuery<
ApiType,
(
arg: CAId | { ticker?: any; local_id?: any } | string | Uint8Array
Expand All @@ -766,7 +766,7 @@ declare module '@polkadot/api/types/storage' {
* The next per-`Ticker` CA ID in the sequence.
* The full ID is defined as a combination of `Ticker` and a number in this sequence.
**/
caIdSequence: AugmentedQuery<
cAIdSequence: AugmentedQuery<
ApiType,
(arg: Ticker | string | Uint8Array) => Observable<LocalCAId>,
[Ticker]
Expand Down Expand Up @@ -1186,7 +1186,7 @@ declare module '@polkadot/api/types/storage' {
};
multiSig: {
/**
* Maps a multisig secondary key to a multisig address.
* Maps a multisig signer key to a multisig address.
**/
keyToMultiSig: AugmentedQuery<
ApiType,
Expand Down Expand Up @@ -2440,6 +2440,7 @@ declare module '@polkadot/api/types/storage' {
**/
inactiveMembers: AugmentedQuery<ApiType, () => Observable<Vec<InactiveMember>>, []>;
};
testUtils: {};
timestamp: {
/**
* Did the timestamp get updated in this block?
Expand Down
61 changes: 59 additions & 2 deletions src/polkadot/augment-api-tx.ts
Expand Up @@ -64,6 +64,7 @@ import type {
FundingRoundName,
FundraiserName,
IdentityId,
InvestorUid,
InvestorZKProofData,
ItnRewardStatus,
Leg,
Expand Down Expand Up @@ -1552,6 +1553,9 @@ declare module '@polkadot/api/types/submittable' {
/**
* Replaces an asset's compliance by ticker with a new compliance.
*
* Compliance requirements will be sorted (ascending by id) before
* replacing the current requirements.
*
* # Arguments
* * `ticker` - the asset ticker,
* * `asset_compliance - the new asset compliance.
Expand Down Expand Up @@ -3873,7 +3877,7 @@ declare module '@polkadot/api/types/submittable' {
* # Arguments
* * `instruction_id` - Instruction id to affirm.
* * `portfolios` - Portfolios that the sender controls and wants to affirm this instruction.
* * `legs` - List of legs needs to affirmed.
* * `max_legs_count` - Number of legs that need to be affirmed.
*
* # Permissions
* * Portfolio
Expand Down Expand Up @@ -4116,6 +4120,7 @@ declare module '@polkadot/api/types/submittable' {
* # Arguments
* * `instruction_id` - Instruction id for that affirmation get withdrawn.
* * `portfolios` - Portfolios that the sender controls and wants to withdraw affirmation.
* * `max_legs_count` - Number of legs that need to be un-affirmed.
*
* # Permissions
* * Portfolio
Expand Down Expand Up @@ -4608,7 +4613,7 @@ declare module '@polkadot/api/types/submittable' {
[Vec<AccountId>]
>;
/**
* Changes min bond value to be used in bond(). Only Governance
* Changes min bond value to be used in validate(). Only Governance
* committee is allowed to change this value.
*
* # Arguments
Expand Down Expand Up @@ -5600,6 +5605,58 @@ declare module '@polkadot/api/types/submittable' {
[IdentityId, IdentityId]
>;
};
testUtils: {
/**
* Emits an event with caller's identity and CDD status.
**/
getCddOf: AugmentedSubmittable<
(of: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>,
[AccountId]
>;
/**
* Emits an event with caller's identity.
**/
getMyDid: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
* Registers a new Identity for the `target_account` and issues a CDD claim to it.
* The Investor UID is generated deterministically by the hash of the generated DID and
* then we fix it to be compliant with UUID v4.
*
* # See
* - [RFC 4122: UUID](https://tools.ietf.org/html/rfc4122)
*
* # Failure
* - `origin` has to be an active CDD provider. Inactive CDD providers cannot add new
* claims.
* - `target_account` (primary key of the new Identity) can be linked to just one and only
* one identity.
**/
mockCddRegisterDid: AugmentedSubmittable<
(targetAccount: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>,
[AccountId]
>;
/**
* Generates a new `IdentityID` for the caller, and issues a self-generated CDD claim.
*
* The caller account will be the primary key of that identity.
* For each account of `secondary_keys`, a new `JoinIdentity` authorization is created, so
* each of them will need to accept it before become part of this new `IdentityID`.
*
* # Errors
* - `AlreadyLinked` if the caller account or if any of the given `secondary_keys` has already linked to an `IdentityID`
* - `SecondaryKeysContainPrimaryKey` if `secondary_keys` contains the caller account.
* - `DidAlreadyExists` if auto-generated DID already exists.
**/
registerDid: AugmentedSubmittable<
(
uid: InvestorUid | string | Uint8Array,
secondaryKeys:
| Vec<SecondaryKey>
| (SecondaryKey | { signer?: any; permissions?: any } | string | Uint8Array)[]
) => SubmittableExtrinsic<ApiType>,
[InvestorUid, Vec<SecondaryKey>]
>;
};
timestamp: {
/**
* Set the current time.
Expand Down
12 changes: 11 additions & 1 deletion src/polkadot/types.ts
Expand Up @@ -419,6 +419,13 @@ export enum RewardsTx {
SetItnRewardStatus = 'rewards.setItnRewardStatus',
}

export enum TestUtilsTx {
RegisterDid = 'testUtils.registerDid',
MockCddRegisterDid = 'testUtils.mockCddRegisterDid',
GetMyDid = 'testUtils.getMyDid',
GetCddOf = 'testUtils.getCddOf',
}

export enum ModuleName {
System = 'system',
Babe = 'babe',
Expand Down Expand Up @@ -459,6 +466,7 @@ export enum ModuleName {
ExternalAgents = 'externalAgents',
Relayer = 'relayer',
Rewards = 'rewards',
TestUtils = 'testUtils',
}

export type TxTag =
Expand Down Expand Up @@ -500,7 +508,8 @@ export type TxTag =
| UtilityTx
| ExternalAgentsTx
| RelayerTx
| RewardsTx;
| RewardsTx
| TestUtilsTx;

export const TxTags = {
system: SystemTx,
Expand Down Expand Up @@ -542,4 +551,5 @@ export const TxTags = {
externalAgents: ExternalAgentsTx,
relayer: RelayerTx,
rewards: RewardsTx,
testUtils: TestUtilsTx,
};

0 comments on commit bf1b08a

Please sign in to comment.