diff --git a/CHANGELOG.md b/CHANGELOG.md index 922d5ada65..9fd9c081c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.77.1 + +- Add TresuryProposal (not the same as democracy, type aliassed) + # 0.76.1 - Caching improvements (duplicate queries, no duplicate subscriptions) diff --git a/packages/types/README.md b/packages/types/README.md index 94a93b42c5..b87b349960 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -8,7 +8,7 @@ There primitive types are available: [[Bool]], [[Bytes]], [[Data]], [[H160]], [[ ## Substrate types -These types implement specific types that are found as part of the Substrate base: [[AccountId]], [[AccountIndex]], [[Address]], [[Amount]], [[AssetOf]], [[AttestedCandidate]], [[AuthorityId]], [[Balance]], [[BalanceLock]], [[BalanceOf]], [[Block]], [[BlockNumber]], [[CodeHash]], [[Digest]], [[Event]], [[EventRecord]], [[Exposure]], [[Extrinsic]], [[ExtrinsicEra]], [[ExtrinsicSignature]], [[Gas]], [[Hash]], [[Header]], [[IndividualExposure]], [[InherentOfflineReport]], [[Justification]], [[Key]], [[KeyValue]], [[LockIdentifier]], [[MisbehaviorReport]], [[NewAccountOutcome]], [[Nonce]], [[Origin]], [[ParaId]], [[Perbill]], [[Permill]], [[PrefabWasmModule]], [[PropIndex]], [[Proposal]], [[ProposalIndex]], [[ReferendumIndex]], [[ReferendumInfo]], [[RewardDestination]], [[Schedule]], [[SeedOf]], [[SessionKey]], [[Signature]], [[SignaturePayload]], [[StakingLedger]], [[StoredPendingChange]], [[UnlockChunk]], [[ValidatorPrefs]], [[VestingSchedule]], [[Vote]], [[VoteIndex]], [[VoteThreshold]], [[WithdrawReasons]] +These types implement specific types that are found as part of the Substrate base: [[AccountId]], [[AccountIndex]], [[Address]], [[Amount]], [[AssetOf]], [[AttestedCandidate]], [[AuthorityId]], [[Balance]], [[BalanceLock]], [[BalanceOf]], [[Block]], [[BlockNumber]], [[CodeHash]], [[Digest]], [[Event]], [[EventRecord]], [[Exposure]], [[Extrinsic]], [[ExtrinsicEra]], [[ExtrinsicSignature]], [[Gas]], [[Hash]], [[Header]], [[IndividualExposure]], [[InherentOfflineReport]], [[Justification]], [[Key]], [[KeyValue]], [[LockIdentifier]], [[MisbehaviorReport]], [[NewAccountOutcome]], [[Nonce]], [[Origin]], [[ParaId]], [[Perbill]], [[Permill]], [[PrefabWasmModule]], [[PropIndex]], [[Proposal]], [[ProposalIndex]], [[ReferendumIndex]], [[ReferendumInfo]], [[RewardDestination]], [[Schedule]], [[SeedOf]], [[SessionKey]], [[Signature]], [[SignaturePayload]], [[StakingLedger]], [[StoredPendingChange]], [[TreasuryProposal]], [[UnlockChunk]], [[ValidatorPrefs]], [[VestingSchedule]], [[Vote]], [[VoteIndex]], [[VoteThreshold]], [[WithdrawReasons]] ## Codec types diff --git a/packages/types/src/Metadata/v1/latest.substrate.v0.json b/packages/types/src/Metadata/v1/latest.substrate.v0.json index 6ea63e420d..955fb67d86 100644 --- a/packages/types/src/Metadata/v1/latest.substrate.v0.json +++ b/packages/types/src/Metadata/v1/latest.substrate.v0.json @@ -2708,7 +2708,7 @@ "type": { "MapType": { "key": "ProposalIndex", - "value": "Proposal" + "value": "TreasuryProposal" } }, "default": "0x00", diff --git a/packages/types/src/Metadata/v1/latest.substrate.v1.json b/packages/types/src/Metadata/v1/latest.substrate.v1.json index c1224b1b4c..299c7e04e5 100644 --- a/packages/types/src/Metadata/v1/latest.substrate.v1.json +++ b/packages/types/src/Metadata/v1/latest.substrate.v1.json @@ -2461,7 +2461,7 @@ "type": { "MapType": { "key": "ProposalIndex", - "value": "Proposal" + "value": "TreasuryProposal" } }, "fallback": "0x00", diff --git a/packages/types/src/Metadata/v2/latest.substrate.v2.json b/packages/types/src/Metadata/v2/latest.substrate.v2.json index 6ca0b3a37a..888cd8e20e 100644 --- a/packages/types/src/Metadata/v2/latest.substrate.v2.json +++ b/packages/types/src/Metadata/v2/latest.substrate.v2.json @@ -2573,7 +2573,7 @@ "type": { "MapType": { "key": "ProposalIndex", - "value": "Proposal", + "value": "TreasuryProposal", "isLinked": false } }, diff --git a/packages/types/src/Metadata/v3/latest.substrate.v3.json b/packages/types/src/Metadata/v3/latest.substrate.v3.json index 01272f230b..792928382e 100644 --- a/packages/types/src/Metadata/v3/latest.substrate.v3.json +++ b/packages/types/src/Metadata/v3/latest.substrate.v3.json @@ -2632,7 +2632,7 @@ "type": { "MapType": { "key": "ProposalIndex", - "value": "Proposal", + "value": "TreasuryProposal", "isLinked": false } }, diff --git a/packages/types/src/primitive/Type.ts b/packages/types/src/primitive/Type.ts index a28ce0d5ab..cda5cb36e2 100644 --- a/packages/types/src/primitive/Type.ts +++ b/packages/types/src/primitive/Type.ts @@ -37,6 +37,8 @@ export default class Type extends Text { const mappings: Array = [ // alias ::Inherent -> InherentOfflineReport Type._alias('::Inherent', 'InherentOfflineReport'), + // alias TreasuryProposal from Proposal> + Type._alias('Proposal>', 'TreasuryProposal'), // Type._cleanupCompact(), // Remove all the trait prefixes diff --git a/packages/types/src/type/TreasuryProposal.ts b/packages/types/src/type/TreasuryProposal.ts new file mode 100644 index 0000000000..682bf27238 --- /dev/null +++ b/packages/types/src/type/TreasuryProposal.ts @@ -0,0 +1,51 @@ +// Copyright 2017-2019 @polkadot/types authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +import Struct from '../codec/Struct'; +import AccountId from './AccountId'; +import Balance from './Balance'; + +/** + * @name TreasuryProposal + * @description + * A Proposal made for Treasury + */ +export default class TreasuryProposal extends Struct { + constructor (value: any) { + super({ + proposer: AccountId, + value: Balance, + beneficiary: AccountId, + bond: Balance + }, value); + } + + /** + * @description The beneficiary + */ + get beneficiary (): AccountId { + return this.get('beneficiary') as AccountId; + } + + /** + * @description The bond + */ + get bond (): Balance { + return this.get('bond') as Balance; + } + + /** + * @description The proposer + */ + get proposer (): AccountId { + return this.get('proposer') as AccountId; + } + + /** + * @description The bond + */ + get value (): Balance { + return this.get('value') as Balance; + } +} diff --git a/packages/types/src/type/index.ts b/packages/types/src/type/index.ts index 4823e7ae60..03b6069361 100644 --- a/packages/types/src/type/index.ts +++ b/packages/types/src/type/index.ts @@ -64,6 +64,7 @@ export { default as SessionKey } from './SessionKey'; export { default as Signature, Ed25519Signature, Sr25519Signature } from './Signature'; export { default as StakingLedger } from './StakingLedger'; export { default as StoredPendingChange } from './StoredPendingChange'; +export { default as TreasuryProposal } from './TreasuryProposal'; export { default as UnlockChunk } from './UnlockChunk'; export { default as ValidatorPrefs } from './ValidatorPrefs'; export { default as VestingSchedule } from './VestingSchedule';