Skip to content

Commit c6d330b

Browse files
authored
Add set for contract ReturnFlags (#4397)
1 parent e16786a commit c6d330b

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

packages/types-augment/src/registry.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
1717
import type { StatementKind } from '@polkadot/types/interfaces/claims';
1818
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
1919
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
20-
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
20+
import type { AliveContractInfo, CodeHash, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
2121
import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV2, ContractContractSpecV0, ContractContractSpecV2, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
2222
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
2323
import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
@@ -212,6 +212,7 @@ declare module '@polkadot/types/types/registry' {
212212
Consensus: Consensus;
213213
ConsensusEngineId: ConsensusEngineId;
214214
ConsumedWeight: ConsumedWeight;
215+
ContractCallFlags: ContractCallFlags;
215216
ContractCallRequest: ContractCallRequest;
216217
ContractConstructorSpecLatest: ContractConstructorSpecLatest;
217218
ContractConstructorSpecV0: ContractConstructorSpecV0;
@@ -264,6 +265,7 @@ declare module '@polkadot/types/types/registry' {
264265
ContractProjectInfo: ContractProjectInfo;
265266
ContractProjectSource: ContractProjectSource;
266267
ContractProjectV0: ContractProjectV0;
268+
ContractReturnFlags: ContractReturnFlags;
267269
ContractSelector: ContractSelector;
268270
ContractStorageKey: ContractStorageKey;
269271
ContractStorageLayout: ContractStorageLayout;

packages/types/src/interfaces/contracts/definitions.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default {
4242
}
4343
},
4444
ContractExecResultSuccessTo260: {
45-
flags: 'u32',
45+
flags: 'ContractReturnFlags',
4646
data: 'Bytes',
4747
gasConsumed: 'u64'
4848
},
@@ -66,7 +66,7 @@ export default {
6666
}
6767
},
6868
ContractExecResultOk: {
69-
flags: 'u32',
69+
flags: 'ContractReturnFlags',
7070
data: 'Bytes'
7171
},
7272
ContractExecResultResult: {
@@ -93,13 +93,28 @@ export default {
9393
Tombstone: 'TombstoneContractInfo'
9494
}
9595
},
96+
ContractCallFlags: {
97+
_set: {
98+
_bitLength: 32,
99+
ForwardInput: 0b0000_0001,
100+
CloneInput: 0b0000_0010,
101+
TailCall: 0b0000_0100,
102+
AllowReentry: 0b0000_1000
103+
}
104+
},
105+
ContractReturnFlags: {
106+
_set: {
107+
_bitLength: 32,
108+
Revert: 0x0000_0001
109+
}
110+
},
96111
ContractStorageKey: '[u8; 32]',
97112
DeletedContract: {
98113
pairCount: 'u32',
99114
trieId: 'TrieId'
100115
},
101116
ExecReturnValue: {
102-
flags: 'u32',
117+
flags: 'ContractReturnFlags',
103118
data: 'Bytes'
104119
},
105120
Gas: 'u64',

packages/types/src/interfaces/contracts/types.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
22
/* eslint-disable */
33

4-
import type { Bytes, Compact, Enum, Null, Option, Raw, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec';
4+
import type { Bytes, Compact, Enum, Null, Option, Raw, Set, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec';
55
import type { AccountId, Balance, BlockNumber, Hash, Weight } from '@polkadot/types/interfaces/runtime';
66

77
/** @name AliveContractInfo */
@@ -20,6 +20,14 @@ export interface AliveContractInfo extends Struct {
2020
/** @name CodeHash */
2121
export interface CodeHash extends Hash {}
2222

23+
/** @name ContractCallFlags */
24+
export interface ContractCallFlags extends Set {
25+
readonly isForwardInput: boolean;
26+
readonly isCloneInput: boolean;
27+
readonly isTailCall: boolean;
28+
readonly isAllowReentry: boolean;
29+
}
30+
2331
/** @name ContractCallRequest */
2432
export interface ContractCallRequest extends Struct {
2533
readonly origin: AccountId;
@@ -59,7 +67,7 @@ export interface ContractExecResultErrModule extends Struct {
5967

6068
/** @name ContractExecResultOk */
6169
export interface ContractExecResultOk extends Struct {
62-
readonly flags: u32;
70+
readonly flags: ContractReturnFlags;
6371
readonly data: Bytes;
6472
}
6573

@@ -80,7 +88,7 @@ export interface ContractExecResultSuccessTo255 extends Struct {
8088

8189
/** @name ContractExecResultSuccessTo260 */
8290
export interface ContractExecResultSuccessTo260 extends Struct {
83-
readonly flags: u32;
91+
readonly flags: ContractReturnFlags;
8492
readonly data: Bytes;
8593
readonly gasConsumed: u64;
8694
}
@@ -133,6 +141,11 @@ export interface ContractInstantiateResultTo267 extends Enum {
133141
readonly type: 'Ok' | 'Err';
134142
}
135143

144+
/** @name ContractReturnFlags */
145+
export interface ContractReturnFlags extends Set {
146+
readonly isRevert: boolean;
147+
}
148+
136149
/** @name ContractStorageKey */
137150
export interface ContractStorageKey extends U8aFixed {}
138151

@@ -144,7 +157,7 @@ export interface DeletedContract extends Struct {
144157

145158
/** @name ExecReturnValue */
146159
export interface ExecReturnValue extends Struct {
147-
readonly flags: u32;
160+
readonly flags: ContractReturnFlags;
148161
readonly data: Bytes;
149162
}
150163

0 commit comments

Comments
 (0)