Skip to content

Commit

Permalink
feat(types): upgrade types according to Polymesh 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVicente committed Apr 7, 2021
1 parent 2c1286d commit 46beef3
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 200 deletions.
3 changes: 2 additions & 1 deletion scripts/transactions.json
Expand Up @@ -308,7 +308,8 @@
"add_investor_uniqueness_claim": "add_investor_uniqueness_claim",
"gc_add_cdd_claim": "gc_add_cdd_claim",
"gc_revoke_cdd_claim": "gc_revoke_cdd_claim",
"add_investor_uniqueness_claim_v2": "add_investor_uniqueness_claim_v2"
"add_investor_uniqueness_claim_v2": "add_investor_uniqueness_claim_v2",
"revoke_claim_by_index": "revoke_claim_by_index"
},
"Bridge": {
"change_controller": "change_controller",
Expand Down
28 changes: 5 additions & 23 deletions src/polkadot/asset/definitions.ts
Expand Up @@ -2,7 +2,8 @@
export default {
rpc: {
canTransfer: {
description: 'Checks whether a transaction with given parameters can take place or not',
description:
'Checks whether a transaction with ' + 'given parameters can take place or ' + 'not',
params: [
{
name: 'sender',
Expand Down Expand Up @@ -49,7 +50,9 @@ export default {
},
canTransferGranular: {
description:
'Checks whether a transaction with given parameters can take place or not. The result is granular meaning each check is run and returned regardless of outcome.',
'Checks whether a transaction with given parameters ' +
'can take place or not. The result is granular meaning ' +
'each check is run and returned regardless of outcome.',
params: [
{
name: 'from_custodian',
Expand Down Expand Up @@ -89,27 +92,6 @@ export default {
],
type: 'GranularCanTransferResult',
},
balanceAt: {
description: 'Returns the ticker balances of identities at a checkpoint.',
params: [
{
name: 'ticker',
type: 'Ticker',
isOptional: false,
},
{
name: 'checkpoint',
type: 'CheckpointId',
isOptional: false,
},
{
name: 'dids',
type: 'Vec<IdentityId>',
isOptional: false,
},
],
type: 'BalanceAtResult',
},
},
types: {},
};
25 changes: 23 additions & 2 deletions src/polkadot/augment-api-consts.ts
Expand Up @@ -20,7 +20,9 @@ import type { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/consts' {
export interface AugmentedConsts<ApiType> {
asset: {
allowedGasLimit: u64 & AugmentedConst<ApiType>;
assetNameMaxLength: u32 & AugmentedConst<ApiType>;
fundingRoundNameMaxLength: u32 & AugmentedConst<ApiType>;
maxNumberOfTmExtensionForAsset: u32 & AugmentedConst<ApiType>;
};
babe: {
/**
Expand All @@ -39,11 +41,13 @@ declare module '@polkadot/api/types/consts' {
};
balances: {
/**
* This is no longer needed but kept for compatibility reasons
* The minimum amount required to keep an account open.
**/
existentialDeposit: Balance & AugmentedConst<ApiType>;
};
base: {
maxLen: u32 & AugmentedConst<ApiType>;
};
baseContracts: {
/**
* The maximum nesting level of a call/instantiate stack. A reasonable default
Expand Down Expand Up @@ -94,12 +98,19 @@ declare module '@polkadot/api/types/consts' {
**/
tombstoneDeposit: BalanceOf & AugmentedConst<ApiType>;
};
complianceManager: {
maxConditionComplexity: u32 & AugmentedConst<ApiType>;
};
contracts: {
/**
* The minimum amount required to generate a tombstone.
**/
networkShareInInstantiationFee: Perbill & AugmentedConst<ApiType>;
};
corporateAction: {
maxDidWhts: u32 & AugmentedConst<ApiType>;
maxTargetIds: u32 & AugmentedConst<ApiType>;
};
finalityTracker: {
/**
* The delay after which point things become suspicious. Default is 1000.
Expand All @@ -110,6 +121,9 @@ declare module '@polkadot/api/types/consts' {
**/
windowSize: BlockNumber & AugmentedConst<ApiType>;
};
identity: {
initialPolyx: Balance & AugmentedConst<ApiType>;
};
indices: {
/**
* The deposit needed for reserving an index.
Expand Down Expand Up @@ -158,6 +172,10 @@ declare module '@polkadot/api/types/consts' {
* Maximum amount of `T::currency::total_issuance()` after that non-inflated rewards get paid.
**/
maxVariableInflationTotalIssuance: BalanceOf & AugmentedConst<ApiType>;
/**
* Minimum amount of POLYX that must be bonded for a new bond.
**/
minimumBond: BalanceOf & AugmentedConst<ApiType>;
/**
* The threshold of improvement that should be provided for a new solution to be accepted.
**/
Expand All @@ -175,6 +193,9 @@ declare module '@polkadot/api/types/consts' {
**/
slashDeferDuration: EraIndex & AugmentedConst<ApiType>;
};
statistics: {
maxTransferManagersPerAsset: u32 & AugmentedConst<ApiType>;
};
system: {
/**
* The base weight of executing a block, independent of the transactions in the block.
Expand Down
8 changes: 8 additions & 0 deletions src/polkadot/augment-api-errors.ts
Expand Up @@ -385,6 +385,10 @@ declare module '@polkadot/api/types/errors' {
* The token holder has already been paid their benefit.
**/
HolderAlreadyPaid: AugmentedError<ApiType>;
/**
* A distribution has insufficient remaining amount of currency to distribute.
**/
InsufficientRemainingAmount: AugmentedError<ApiType>;
/**
* A capital distribution doesn't exist for this CA.
**/
Expand Down Expand Up @@ -729,6 +733,10 @@ declare module '@polkadot/api/types/errors' {
* CDDId should be unique & same within all cdd claims possessed by a DID.
**/
CDDIdNotUniqueForIdentity: AugmentedError<ApiType>;
/**
* Claim and Proof versions are different.
**/
ClaimAndProofVersionsDoNotMatch: AugmentedError<ApiType>;
/**
* Try to add a claim variant using un-designated extrinsic.
**/
Expand Down
32 changes: 0 additions & 32 deletions src/polkadot/augment-api-rpc.ts
Expand Up @@ -80,16 +80,12 @@ import type {
AssetDidResult,
Authorization,
AuthorizationType,
BalanceAtResult,
CanTransferResult,
CappedFee,
CddStatus,
CheckpointId,
DidRecords,
DidStatus,
GranularCanTransferResult,
HistoricalVotingByAddress,
HistoricalVotingById,
IdentityId,
KeyIdentityData,
PortfolioId,
Expand All @@ -102,16 +98,6 @@ import type {
declare module '@polkadot/rpc-core/types.jsonrpc' {
export interface RpcInterface {
asset: {
/**
* Returns the ticker balances of identities at a checkpoint.
**/
balanceAt: AugmentedRpc<
(
ticker: Ticker | string | Uint8Array,
checkpoint: CheckpointId | AnyNumber | Uint8Array,
dids: Vec<IdentityId> | (IdentityId | string | Uint8Array)[]
) => Observable<BalanceAtResult>
>;
/**
* Checks whether a transaction with given parameters can take place or not
**/
Expand Down Expand Up @@ -794,24 +780,6 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
blockHash?: Hash | string | Uint8Array
) => Observable<Vec<u32>>
>;
/**
* Retrieves proposal `address` indices voted on
**/
votingHistoryByAddress: AugmentedRpc<
(
address: AccountId | string | Uint8Array,
blockHash?: Hash | string | Uint8Array
) => Observable<HistoricalVotingByAddress>
>;
/**
* Retrieve historical voting of `id` identity
**/
votingHistoryById: AugmentedRpc<
(
id: IdentityId | string | Uint8Array,
blockHash?: Hash | string | Uint8Array
) => Observable<HistoricalVotingById>
>;
};
protocolFee: {
/**
Expand Down
55 changes: 49 additions & 6 deletions src/polkadot/augment-api-tx.ts
Expand Up @@ -54,6 +54,7 @@ import type {
CAId,
CAKind,
Claim,
ClaimType,
ClassicTickerImport,
ComplianceRequirement,
Condition,
Expand Down Expand Up @@ -84,6 +85,7 @@ import type {
RecordDateSpec,
ScheduleId,
ScheduleSpec,
Scope,
ScopeClaimProof,
ScopeId,
SecondaryKey,
Expand Down Expand Up @@ -2300,6 +2302,7 @@ declare module '@polkadot/api/types/submittable' {
| { Blocked: any }
| { InvestorUniqueness: any }
| { NoData: any }
| { InvestorUniquenessV2: any }
| string
| Uint8Array,
expiry: Option<Moment> | null | object | string | Uint8Array
Expand Down Expand Up @@ -2343,6 +2346,7 @@ declare module '@polkadot/api/types/submittable' {
| { Blocked: any }
| { InvestorUniqueness: any }
| { NoData: any }
| { InvestorUniquenessV2: any }
| string
| Uint8Array,
proof: InvestorZKProofData | string | Uint8Array,
Expand All @@ -2353,6 +2357,13 @@ declare module '@polkadot/api/types/submittable' {
addInvestorUniquenessClaimV2: AugmentedSubmittable<
(
target: IdentityId | string | Uint8Array,
scope:
| Scope
| { Identity: any }
| { Ticker: any }
| { Custom: any }
| string
| Uint8Array,
claim:
| Claim
| { Accredited: any }
Expand All @@ -2366,6 +2377,7 @@ declare module '@polkadot/api/types/submittable' {
| { Blocked: any }
| { InvestorUniqueness: any }
| { NoData: any }
| { InvestorUniquenessV2: any }
| string
| Uint8Array,
proof:
Expand All @@ -2375,7 +2387,7 @@ declare module '@polkadot/api/types/submittable' {
| Uint8Array,
expiry: Option<Moment> | null | object | string | Uint8Array
) => SubmittableExtrinsic<ApiType>,
[IdentityId, Claim, ScopeClaimProof, Option<Moment>]
[IdentityId, Scope, Claim, ScopeClaimProof, Option<Moment>]
>;
/**
* It adds secondary keys to target identity `id`.
Expand Down Expand Up @@ -2461,11 +2473,8 @@ declare module '@polkadot/api/types/submittable' {
* Assuming this is executed by the GC voting majority, adds a new cdd claim record.
**/
gcAddCddClaim: AugmentedSubmittable<
(
target: IdentityId | string | Uint8Array,
expiry: Option<Moment> | null | object | string | Uint8Array
) => SubmittableExtrinsic<ApiType>,
[IdentityId, Option<Moment>]
(target: IdentityId | string | Uint8Array) => SubmittableExtrinsic<ApiType>,
[IdentityId]
>;
/**
* Assuming this is executed by the GC voting majority, removes an existing cdd claim record.
Expand Down Expand Up @@ -2576,11 +2585,45 @@ declare module '@polkadot/api/types/submittable' {
| { Blocked: any }
| { InvestorUniqueness: any }
| { NoData: any }
| { InvestorUniquenessV2: any }
| string
| Uint8Array
) => SubmittableExtrinsic<ApiType>,
[IdentityId, Claim]
>;
/**
* Revokes a specific claim using its [Claim Unique Index](/pallet_identity/index.html#claim-unique-index) composed by `target`,
* `claim_type`, and `scope`.
*
* Please note that `origin` must be the issuer of the target claim.
*
* # Errors
* - `TargetHasNonZeroBalanceAtScopeId` when you try to revoke a `InvestorUniqueness*`
* claim, and `target` identity still have any balance on the given `scope`.
**/
revokeClaimByIndex: AugmentedSubmittable<
(
target: IdentityId | string | Uint8Array,
claimType:
| ClaimType
| 'Accredited'
| 'Affiliate'
| 'BuyLockup'
| 'SellLockup'
| 'CustomerDueDiligence'
| 'KnowYourCustomer'
| 'Jurisdiction'
| 'Exempted'
| 'Blocked'
| 'InvestorUniqueness'
| 'NoData'
| 'InvestorUniquenessV2'
| number
| Uint8Array,
scope: Option<Scope> | null | object | string | Uint8Array
) => SubmittableExtrinsic<ApiType>,
[IdentityId, ClaimType, Option<Scope>]
>;
/**
* It revokes the `auth` off-chain authorization of `signer`. It only takes effect if
* the authorized transaction is not yet executed.
Expand Down

0 comments on commit 46beef3

Please sign in to comment.