@parity/product-sdk 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parity/product-sdk",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Unified SDK for building products in the Polkadot ecosystem - umbrella package",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -72,19 +72,19 @@
72
72
  "dependencies": {
73
73
  "polkadot-api": "^2.1.6",
74
74
  "@parity/product-sdk-address": "0.2.0",
75
- "@parity/product-sdk-cloud-storage": "0.11.2",
76
75
  "@parity/product-sdk-crypto": "0.1.1",
77
- "@parity/product-sdk-chain-client": "0.12.2",
78
- "@parity/product-sdk-contracts": "0.10.6",
79
- "@parity/product-sdk-host": "0.19.0",
80
- "@parity/product-sdk-individuality": "0.3.0",
81
- "@parity/product-sdk-keys": "0.3.23",
76
+ "@parity/product-sdk-individuality": "0.4.0",
77
+ "@parity/product-sdk-contracts": "0.10.7",
78
+ "@parity/product-sdk-host": "0.19.1",
79
+ "@parity/product-sdk-chain-client": "0.12.3",
80
+ "@parity/product-sdk-keys": "0.3.24",
82
81
  "@parity/product-sdk-logger": "0.1.1",
83
- "@parity/product-sdk-errors": "0.2.0",
84
- "@parity/product-sdk-local-storage": "0.3.8",
85
- "@parity/product-sdk-tx": "0.4.6",
82
+ "@parity/product-sdk-signer": "0.14.4",
86
83
  "@parity/result": "0.2.0",
87
- "@parity/product-sdk-signer": "0.14.3"
84
+ "@parity/product-sdk-errors": "0.2.0",
85
+ "@parity/product-sdk-tx": "0.4.7",
86
+ "@parity/product-sdk-local-storage": "0.3.9",
87
+ "@parity/product-sdk-cloud-storage": "0.11.3"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "react": "^18.0.0 || ^19.0.0"
@@ -32,6 +32,7 @@
32
32
  */
33
33
  import type { getChainAPI } from "@parity/product-sdk-chain-client";
34
34
  import type {
35
+ RingLocation as HostRingLocation,
35
36
  RingVRFProof as HostRingVRFProof,
36
37
  VrfSignature as HostVrfSignature,
37
38
  VrfTranscriptItem as HostVrfTranscriptItem,
@@ -43,8 +44,15 @@ import type {
43
44
  GameChain,
44
45
  GamePlayersChain,
45
46
  IndividualityChain,
47
+ LegacySuffixChain,
48
+ LiteSignUpChain,
49
+ NetworkSuffixChain,
46
50
  PapiIndividualityChain,
47
51
  PrizeStatusChain,
52
+ RegisterChain,
53
+ RegistrationEligibilityChain,
54
+ RingLocation as SdkRingLocation,
55
+ ScoreContextChain,
48
56
  SignUpChain,
49
57
  AccountVrfSignature,
50
58
  VrfTranscriptItem as IndividualityVrfTranscriptItem,
@@ -117,11 +125,38 @@ type FromPapiSatisfiesContracts = Assert<
117
125
  PapiIndividualityChain<PaseoClient["individuality"]> extends IndividualityChain &
118
126
  AirdropChain &
119
127
  GameChain &
120
- GamePlayersChain
128
+ GamePlayersChain &
129
+ ScoreContextChain &
130
+ SignUpChain &
131
+ LiteSignUpChain
121
132
  ? true
122
133
  : false
123
134
  >;
124
135
 
136
+ type PaseoSatisfiesScoreContext = Assert<PaseoClient extends ScoreContextChain ? true : false>;
137
+ type DevnetSatisfiesScoreContext = Assert<DevnetClient extends ScoreContextChain ? true : false>;
138
+ type PreviewnetSatisfiesScoreContext = Assert<
139
+ PreviewnetClient extends ScoreContextChain ? true : false
140
+ >;
141
+
142
+ // Negative on purpose: a re-pin that flips either is the prompt to re-run the
143
+ // read against that chain.
144
+ type PreviewnetSatisfiesLegacySuffix = Assert<
145
+ PreviewnetClient extends LegacySuffixChain ? true : false
146
+ >;
147
+ type PaseoPredatesTheLegacySuffix = Assert<PaseoClient extends LegacySuffixChain ? false : true>;
148
+ type DevnetPredatesTheLegacySuffix = Assert<DevnetClient extends LegacySuffixChain ? false : true>;
149
+ type PreviewnetHasNoSuffixStorage = Assert<
150
+ PreviewnetClient extends NetworkSuffixChain ? false : true
151
+ >;
152
+ type PaseoHasNoSuffixStorage = Assert<PaseoClient extends NetworkSuffixChain ? false : true>;
153
+ type DevnetHasNoSuffixStorage = Assert<DevnetClient extends NetworkSuffixChain ? false : true>;
154
+
155
+ // The two are declared separately, so a rename on either side would go
156
+ // unnoticed anywhere but here.
157
+ type LocalRingLocationFitsHost = Assert<SdkRingLocation extends HostRingLocation ? true : false>;
158
+ type HostRingLocationFitsLocal = Assert<HostRingLocation extends SdkRingLocation ? true : false>;
159
+
125
160
  // Negative control, kept type-only so it emits no runtime code. If
126
161
  // `IndividualityChain` ever stopped constraining, this flips to `false` and the
127
162
  // file fails to typecheck, which is what keeps the assertions above honest.
@@ -353,6 +388,82 @@ type RejectsItemMissingValue = Assert<
353
388
  { label: Uint8Array } extends IndividualityVrfTranscriptItem ? false : true
354
389
  >;
355
390
 
391
+ // The lite sign-up surface: the alias binding, the lite-person marker, the
392
+ // invite pin, the ring membership entry and the free sign-up call. Paseo and
393
+ // previewnet carry all five; devnet predates `Game.LiteInvites` and the call,
394
+ // so it is asserted negatively, like the game surface it composes with.
395
+ type PaseoSatisfiesLiteSignUpContract = Assert<PaseoClient extends LiteSignUpChain ? true : false>;
396
+ type PreviewnetSatisfiesLiteSignUpContract = Assert<
397
+ PreviewnetClient extends LiteSignUpChain ? true : false
398
+ >;
399
+ type DevnetPredatesTheLiteSignUpContract = Assert<
400
+ DevnetClient extends LiteSignUpChain ? false : true
401
+ >;
402
+ type RejectsBogusLiteSignUpClient = Assert<
403
+ ClientWithoutIndividuality extends LiteSignUpChain ? false : true
404
+ >;
405
+
406
+ // `LiteSignUpChain` alone proves nothing about what the read accepts: it takes
407
+ // an intersection and resolves a suffix.
408
+ type LiteSignUpReadBase = GameChain & SignUpChain & ScoreContextChain & LiteSignUpChain;
409
+ type PaseoSatisfiesTheLiteReadWithATld = Assert<
410
+ PaseoClient extends LiteSignUpReadBase ? true : false
411
+ >;
412
+ type PaseoCannotResolveTheSuffixItself = Assert<
413
+ PaseoClient extends LiteSignUpReadBase & LegacySuffixChain ? false : true
414
+ >;
415
+ type PreviewnetSatisfiesTheLiteReadFromItsConstant = Assert<
416
+ PreviewnetClient extends LiteSignUpReadBase & LegacySuffixChain ? true : false
417
+ >;
418
+ type DevnetPredatesTheLiteRead = Assert<DevnetClient extends LiteSignUpReadBase ? false : true>;
419
+
420
+ // Pinned by name for the same reason `sign_up_with_account`'s are: PAPI encodes
421
+ // the object it is handed, so a renamed field silently encodes as `undefined` —
422
+ // and `account` here is a call argument, not implied by the signer.
423
+ type LiteInviteArgs = Parameters<GameTx["sign_up_with_account_lite_invite"]>[0];
424
+ type LiteInviteTakesTheDocumentedArgs = Assert<
425
+ "account" extends keyof LiteInviteArgs
426
+ ? "identifier_key" extends keyof LiteInviteArgs
427
+ ? "airdrops" extends keyof LiteInviteArgs
428
+ ? true
429
+ : false
430
+ : false
431
+ : false
432
+ >;
433
+ type LiteInviteAirdropsIsOptional = Assert<
434
+ undefined extends LiteInviteArgs["airdrops"] ? true : false
435
+ >;
436
+
437
+ // `PeopleLite.AccountToAlias`: the three fields the lite requirement read uses.
438
+ // The context matters as much as the alias — a binding outside the score
439
+ // context does not satisfy the game's origin check — so it is pinned by name.
440
+ type LiteBindingValue = NonNullable<
441
+ Awaited<
442
+ ReturnType<
443
+ PaseoClient["individuality"]["query"]["PeopleLite"]["AccountToAlias"]["getValue"]
444
+ >
445
+ >
446
+ >;
447
+ type LiteBindingHasTheDocumentedFields = Assert<
448
+ "revision" extends keyof LiteBindingValue
449
+ ? "ring" extends keyof LiteBindingValue
450
+ ? LiteBindingValue["ca"] extends { alias: string; context: string }
451
+ ? true
452
+ : false
453
+ : false
454
+ : false
455
+ >;
456
+
457
+ // `Members.Members` is a double map (collection id, member key), which is what
458
+ // lets the membership check be a point read. A collapsed key would silently
459
+ // turn the varargs call into a mistyped one, so the arity is pinned.
460
+ type MembersKey = Parameters<
461
+ PaseoClient["individuality"]["query"]["Members"]["Members"]["getValue"]
462
+ >;
463
+ type MembersTakesTwoKeys = Assert<
464
+ MembersKey extends [unknown, unknown, ...unknown[]] ? true : false
465
+ >;
466
+
356
467
  // `Game.Players`: the variant spelling the read keys by, and the one field it uses.
357
468
  // Sibling reads got exactly these pins.
358
469
  type PlayersEntry = PaseoClient["individuality"]["query"]["Game"]["Players"];
@@ -366,6 +477,44 @@ type RejectsAliasSpelling = Assert<
366
477
  type PlayersValue = NonNullable<Awaited<ReturnType<PlayersEntry["getValue"]>>>;
367
478
  type PlayersHasRegistered = Assert<"registered" extends keyof PlayersValue ? true : false>;
368
479
 
480
+ type PaseoSatisfiesRegisterContract = Assert<PaseoClient extends RegisterChain ? true : false>;
481
+ type PreviewnetSatisfiesRegisterContract = Assert<
482
+ PreviewnetClient extends RegisterChain ? true : false
483
+ >;
484
+ type DevnetSatisfiesRegisterContract = Assert<DevnetClient extends RegisterChain ? true : false>;
485
+ type RejectsBogusRegisterClient = Assert<
486
+ ClientWithoutIndividuality extends RegisterChain ? false : true
487
+ >;
488
+
489
+ type PaseoSatisfiesEligibilityContract = Assert<
490
+ PaseoClient extends RegistrationEligibilityChain ? true : false
491
+ >;
492
+ type PreviewnetSatisfiesEligibilityContract = Assert<
493
+ PreviewnetClient extends RegistrationEligibilityChain ? true : false
494
+ >;
495
+ type DevnetSatisfiesEligibilityContract = Assert<
496
+ DevnetClient extends RegistrationEligibilityChain ? true : false
497
+ >;
498
+ type RejectsBogusEligibilityClient = Assert<
499
+ ClientWithoutIndividuality extends RegistrationEligibilityChain ? false : true
500
+ >;
501
+
502
+ // The same trap as `claim_airdrop`'s pins, and worse: `key` is an `Option`, so a
503
+ // renamed argument encodes as `None` — the resume arm this builder never means.
504
+ type ScoreTx = PaseoClient["individuality"]["tx"]["Score"];
505
+ type RegisterExists = Assert<"register" extends keyof ScoreTx ? true : false>;
506
+ type RegisterArgs = Parameters<ScoreTx["register"]>[0];
507
+ type RegisterTakesKey = Assert<"key" extends keyof RegisterArgs ? true : false>;
508
+ type RegisterKeyIsOptional = Assert<undefined extends RegisterArgs["key"] ? true : false>;
509
+
510
+ // `ValueQuery` is what lets the read type the threshold as a plain number, and
511
+ // `Participants` being optional is what makes "never seen" a null, not a throw.
512
+ type ScoreStorage = PaseoClient["individuality"]["query"]["Score"];
513
+ type ThresholdValue = Awaited<ReturnType<ScoreStorage["PersonhoodThreshold"]["getValue"]>>;
514
+ type ThresholdIsNotOptional = Assert<undefined extends ThresholdValue ? false : true>;
515
+ type ParticipantsValue = Awaited<ReturnType<ScoreStorage["Participants"]["getValue"]>>;
516
+ type ParticipantsIsOptional = Assert<undefined extends ParticipantsValue ? true : false>;
517
+
369
518
  test("the individuality chain contract is asserted at compile time", () => {
370
519
  // The type assertions above are the test. This keeps vitest from reporting
371
520
  // the file as an empty suite.