Skip to content

Commit

Permalink
Add guessTheNumber and getParentchainsInfo to the integritee work…
Browse files Browse the repository at this point in the history
…er (#113)

* add guess the number game trusted call variants

* add guess the number trusted call method

* add guess the number public getter variant

* implement guess the number public getters

* successfully submit the guess the number trusted call.

* define remaining trusted getters/calls

* implement guess the number trusted/public getters

* fix getAccountInfoGetter

* fix guess the number definitions

* fix getting guess attempts, get the number info getter fails to be constructed for some reason.

* fix getting the info of the guess game

* more consistent naming

* add parentchainsInfo getter

* rename GuessTheNumberArgs to guessArgs

* add skip to worker test

* v0.15.1-alpha.1
  • Loading branch information
clangenb authored Oct 11, 2024
1 parent f32b2e8 commit b91e972
Show file tree
Hide file tree
Showing 17 changed files with 633 additions and 125 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"publishConfig": {
"directory": "build"
},
"version": "0.15.1-alpha.0"
"version": "0.15.1-alpha.1"
}
4 changes: 2 additions & 2 deletions packages/node-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"sideEffects": false,
"type": "module",
"version": "0.15.1-alpha.0",
"version": "0.15.1-alpha.1",
"main": "index.js",
"dependencies": {
"@encointer/types": "^0.15.1-alpha.0",
"@encointer/types": "^0.15.1-alpha.1",
"@polkadot/api": "^11.2.1",
"tslib": "^2.6.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"sideEffects": false,
"type": "module",
"version": "0.15.1-alpha.0",
"version": "0.15.1-alpha.1",
"main": "index.js",
"scripts": {
"generate:defs": "node --experimental-specifier-resolution=node --loader ts-node/esm ../../node_modules/.bin/polkadot-types-from-defs --package @encointer/types/interfaces --input ./src/interfaces",
Expand Down
14 changes: 12 additions & 2 deletions packages/types/src/interfaces/augment-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import type { Assignment, AssignmentCount, AssignmentParams, Attestation, Attest
import type { FixedI64F64, IpfsCid, PalletString } from '@encointer/types/interfaces/common';
import type { AnnouncementSigner, Bip340, CidDigest, CidName, CommunityCeremony, CommunityIdentifier, CommunityMetadataType, CommunityRules, DegreeFixed, DegreeRpc, GeoHash, Location, LocationRpc, NominalIncomeType } from '@encointer/types/interfaces/community';
import type { EncointerBalanceTransferArgs, EncointerGetter, EncointerGetterArgs, EncointerPublicGetter, EncointerTrustedCall, EncointerTrustedCallSigned, EncointerTrustedGetter, EncointerTrustedGetterSigned, GrantReputationArgs, RegisterAttestationsArgs, RegisterParticipantArgs } from '@encointer/types/interfaces/encointerWorker';
import type { BalanceSetBalanceArgs, BalanceShieldArgs, BalanceTransferArgs, BalanceUnshieldArgs, IntegriteeGetter, IntegriteePublicGetter, IntegriteeTrustedCall, IntegriteeTrustedCallSigned, IntegriteeTrustedGetter, IntegriteeTrustedGetterSigned, IntegriteeTrustedOperation, TimestampSetArgs } from '@encointer/types/interfaces/integriteeWorker';
import type { AttemptsArg, BalanceSetBalanceArgs, BalanceShieldArgs, BalanceTransferArgs, BalanceUnshieldArgs, GuessArgs, GuessTheNumberInfo, GuessTheNumberPublicGetter, GuessTheNumberSetWinningsArgs, GuessTheNumberTrustedCall, GuessTheNumberTrustedGetter, GuessType, IntegriteeGetter, IntegriteePublicGetter, IntegriteeTrustedCall, IntegriteeTrustedCallSigned, IntegriteeTrustedGetter, IntegriteeTrustedGetterSigned, IntegriteeTrustedOperation, TimestampSetArgs } from '@encointer/types/interfaces/integriteeWorker';
import type { SchedulerState, SystemNumber } from '@encointer/types/interfaces/scheduler';
import type { DirectRequestStatus, Enclave, EnclaveFingerprint, GetterArgs, ParentchainId, Request, RpcReturnValue, ShardIdentifier, TrustedOperationStatus, Vault, WorkerEncoded } from '@encointer/types/interfaces/worker';
import type { DirectRequestStatus, Enclave, EnclaveFingerprint, GetterArgs, ParentchainId, ParentchainInfo, ParentchainsInfo, Request, RpcReturnValue, ShardIdentifier, TrustedOperationStatus, Vault, WorkerEncoded } from '@encointer/types/interfaces/worker';
import type { Data, StorageKey } from '@polkadot/types';
import type { BitVec, Bool, Bytes, F32, F64, I128, I16, I256, I32, I64, I8, ISize, Json, Null, OptionBool, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, f32, f64, i128, i16, i256, i32, i64, i8, isize, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
import type { TAssetConversion } from '@polkadot/types/interfaces/assetConversion';
Expand Down Expand Up @@ -139,6 +139,7 @@ declare module '@polkadot/types/types/registry' {
AssignmentKind: AssignmentKind;
AssignmentParams: AssignmentParams;
AsyncBackingParams: AsyncBackingParams;
AttemptsArg: AttemptsArg;
Attestation: Attestation;
AttestationIndexType: AttestationIndexType;
AttestedCandidate: AttestedCandidate;
Expand Down Expand Up @@ -594,6 +595,13 @@ declare module '@polkadot/types/types/registry' {
GrantReputationArgs: GrantReputationArgs;
GroupIndex: GroupIndex;
GroupRotationInfo: GroupRotationInfo;
GuessArgs: GuessArgs;
GuessTheNumberInfo: GuessTheNumberInfo;
GuessTheNumberPublicGetter: GuessTheNumberPublicGetter;
GuessTheNumberSetWinningsArgs: GuessTheNumberSetWinningsArgs;
GuessTheNumberTrustedCall: GuessTheNumberTrustedCall;
GuessTheNumberTrustedGetter: GuessTheNumberTrustedGetter;
GuessType: GuessType;
H1024: H1024;
H128: H128;
H160: H160;
Expand Down Expand Up @@ -880,6 +888,8 @@ declare module '@polkadot/types/types/registry' {
ParathreadEntry: ParathreadEntry;
ParaValidatorIndex: ParaValidatorIndex;
ParentchainId: ParentchainId;
ParentchainInfo: ParentchainInfo;
ParentchainsInfo: ParentchainsInfo;
ParticipantIndexType: ParticipantIndexType;
ParticipantRegistration: ParticipantRegistration;
Pays: Pays;
Expand Down
195 changes: 183 additions & 12 deletions packages/types/src/interfaces/integriteeWorker/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,112 @@ export default {
types: {
IntegriteePublicGetter: {
_enum: {
total_issuance: 'CommunityIdentifier',
participant_count: 'CommunityIdentifier',
meetup_count: 'CommunityIdentifier',
ceremony_reward: 'CommunityIdentifier',
location_tolerance: 'CommunityIdentifier',
time_tolerance: 'CommunityIdentifier',
scheduler_state: 'CommunityIdentifier'
some_value: null,
total_issuance: null,
unused_index_2: null,
unused_index_3: null,
unused_index_4: null,
unused_index_5: null,
unused_index_6: null,
unused_index_7: null,
unused_index_8: null,
unused_index_9: null,
parentchains_info: null,
unused_index_11: null,
unused_index_12: null,
unused_index_13: null,
unused_index_14: null,
unused_index_15: null,
unused_index_16: null,
unused_index_17: null,
unused_index_18: null,
unused_index_19: null,
unused_index_20: null,
unused_index_21: null,
unused_index_22: null,
unused_index_23: null,
unused_index_24: null,
unused_index_25: null,
unused_index_26: null,
unused_index_27: null,
unused_index_28: null,
unused_index_29: null,
unused_index_30: null,
unused_index_31: null,
unused_index_32: null,
unused_index_33: null,
unused_index_34: null,
unused_index_35: null,
unused_index_36: null,
unused_index_37: null,
unused_index_38: null,
unused_index_39: null,
unused_index_40: null,
unused_index_41: null,
unused_index_42: null,
unused_index_43: null,
unused_index_44: null,
unused_index_45: null,
unused_index_46: null,
unused_index_47: null,
unused_index_48: null,
unused_index_49: null,
guess_the_number: 'GuessTheNumberPublicGetter',
}
},
IntegriteeTrustedGetter: {
_enum: {
account_info: 'AccountId',
unused_index_1: null,
unused_index_2: null,
unused_index_3: null,
unused_index_4: null,
unused_index_5: null,
unused_index_6: null,
unused_index_7: null,
unused_index_8: null,
unused_index_9: null,
unused_index_10: null,
unused_index_11: null,
unused_index_12: null,
unused_index_13: null,
unused_index_14: null,
unused_index_15: null,
unused_index_16: null,
unused_index_17: null,
unused_index_18: null,
unused_index_19: null,
unused_index_20: null,
unused_index_21: null,
unused_index_22: null,
unused_index_23: null,
unused_index_24: null,
unused_index_25: null,
unused_index_26: null,
unused_index_27: null,
unused_index_28: null,
unused_index_29: null,
unused_index_30: null,
unused_index_31: null,
unused_index_32: null,
unused_index_33: null,
unused_index_34: null,
unused_index_35: null,
unused_index_36: null,
unused_index_37: null,
unused_index_38: null,
unused_index_39: null,
unused_index_40: null,
unused_index_41: null,
unused_index_42: null,
unused_index_43: null,
unused_index_44: null,
unused_index_45: null,
unused_index_46: null,
unused_index_47: null,
unused_index_48: null,
unused_index_49: null,
guess_the_number: 'GuessTheNumberTrustedGetter',
}
},
IntegriteeTrustedGetterSigned: {
Expand Down Expand Up @@ -42,17 +136,94 @@ export default {
IntegriteeTrustedCall: {
_enum: {
noop: 'AccountId',
balance_set_balance: 'BalanceSetBalanceArgs',
timestamp_set: 'TimestampSetArgs',
balance_transfer: 'BalanceTransferArgs',
balance_unshield: 'BalanceUnshieldArgs',
balance_shield: 'BalanceShieldArgs',
timestamp_set: 'TimestampSetArgs',
balance_set_balance: 'BalanceSetBalanceArgs',
unused_index_6: null,
unused_index_7: null,
unused_index_8: null,
unused_index_9: null,
unused_index_10: null,
unused_index_11: null,
unused_index_12: null,
unused_index_13: null,
unused_index_14: null,
unused_index_15: null,
unused_index_16: null,
unused_index_17: null,
unused_index_18: null,
unused_index_19: null,
unused_index_20: null,
unused_index_21: null,
unused_index_22: null,
unused_index_23: null,
unused_index_24: null,
unused_index_25: null,
unused_index_26: null,
unused_index_27: null,
unused_index_28: null,
unused_index_29: null,
unused_index_30: null,
unused_index_31: null,
unused_index_32: null,
unused_index_33: null,
unused_index_34: null,
unused_index_35: null,
unused_index_36: null,
unused_index_37: null,
unused_index_38: null,
unused_index_39: null,
unused_index_40: null,
unused_index_41: null,
unused_index_42: null,
unused_index_43: null,
unused_index_44: null,
unused_index_45: null,
unused_index_46: null,
unused_index_47: null,
unused_index_48: null,
unused_index_49: null,
guess_the_number: 'GuessTheNumberTrustedCall'
}
},
BalanceSetBalanceArgs: '(AccountId, AccountId, BalanceType, BalanceType)',
TimestampSetArgs: '(AccountId, H160, BalanceType)',
BalanceTransferArgs: '(AccountId, AccountId, BalanceType)',
BalanceUnshieldArgs: '(AccountId, AccountId, BalanceType, ShardIdentifier)',
BalanceShieldArgs: '(AccountId, AccountId, BalanceType, ParentchainId)',
TimestampSetArgs: '(AccountId, H160, BalanceType)',
BalanceUnshieldArgs: '(AccountId, AccountId, BalanceType, ShardIdentifier)',
BalanceSetBalanceArgs: '(AccountId, AccountId, BalanceType, BalanceType)',
GuessTheNumberPublicGetter: {
_enum: {
guess_the_number_info: null,
}
},
GuessTheNumberTrustedGetter: {
_enum: {
attempts: 'AttemptsArg'
}
},
AttemptsArg: {
origin: 'AccountId'
},
GuessTheNumberTrustedCall: {
_enum: {
set_winnings: 'GuessTheNumberSetWinningsArgs',
push_by_one_day: 'AccountId',
guess: 'GuessArgs',
}
},
GuessType: 'u32',
GuessTheNumberInfo: {
account: 'AccountId',
balance: 'Balance',
winnings: 'Balance',
next_round_timestamp: 'Moment',
last_winners: 'Vec<AccountId>',
maybe_last_lucky_number: 'Option<GuessType>',
maybe_last_winning_distance: 'Option<GuessType>',
},
GuessTheNumberSetWinningsArgs: '(AccountId, Balance)',
GuessArgs: '(AccountId, GuessType)',
}
}
Loading

0 comments on commit b91e972

Please sign in to comment.