@libid/contracts 0.3.0 → 0.4.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.
@@ -9,6 +9,19 @@ export const identityNamesAbi = [
9
9
  "inputs": [],
10
10
  "stateMutability": "nonpayable"
11
11
  },
12
+ {
13
+ "type": "function",
14
+ "name": "INITIAL_VERSION",
15
+ "inputs": [],
16
+ "outputs": [
17
+ {
18
+ "name": "",
19
+ "type": "uint32",
20
+ "internalType": "uint32"
21
+ }
22
+ ],
23
+ "stateMutability": "view"
24
+ },
12
25
  {
13
26
  "type": "function",
14
27
  "name": "MAX_FUTURE_OBSERVATION",
@@ -65,12 +78,40 @@ export const identityNamesAbi = [
65
78
  "outputs": [],
66
79
  "stateMutability": "nonpayable"
67
80
  },
81
+ {
82
+ "type": "function",
83
+ "name": "bindAtVersion",
84
+ "inputs": [
85
+ {
86
+ "name": "platformId",
87
+ "type": "bytes32",
88
+ "internalType": "bytes32"
89
+ },
90
+ {
91
+ "name": "version",
92
+ "type": "uint32",
93
+ "internalType": "uint32"
94
+ },
95
+ {
96
+ "name": "proof",
97
+ "type": "bytes",
98
+ "internalType": "bytes"
99
+ },
100
+ {
101
+ "name": "publishName",
102
+ "type": "bool",
103
+ "internalType": "bool"
104
+ }
105
+ ],
106
+ "outputs": [],
107
+ "stateMutability": "nonpayable"
108
+ },
68
109
  {
69
110
  "type": "function",
70
111
  "name": "byHandle",
71
112
  "inputs": [
72
113
  {
73
- "name": "",
114
+ "name": "handleNode",
74
115
  "type": "bytes32",
75
116
  "internalType": "bytes32"
76
117
  }
@@ -85,6 +126,11 @@ export const identityNamesAbi = [
85
126
  "name": "observedAt",
86
127
  "type": "uint64",
87
128
  "internalType": "uint64"
129
+ },
130
+ {
131
+ "name": "version",
132
+ "type": "uint32",
133
+ "internalType": "uint32"
88
134
  }
89
135
  ],
90
136
  "stateMutability": "view"
@@ -94,7 +140,7 @@ export const identityNamesAbi = [
94
140
  "name": "byId",
95
141
  "inputs": [
96
142
  {
97
- "name": "",
143
+ "name": "idNode",
98
144
  "type": "bytes32",
99
145
  "internalType": "bytes32"
100
146
  }
@@ -109,6 +155,11 @@ export const identityNamesAbi = [
109
155
  "name": "observedAt",
110
156
  "type": "uint64",
111
157
  "internalType": "uint64"
158
+ },
159
+ {
160
+ "name": "version",
161
+ "type": "uint32",
162
+ "internalType": "uint32"
112
163
  }
113
164
  ],
114
165
  "stateMutability": "view"
@@ -126,6 +177,25 @@ export const identityNamesAbi = [
126
177
  "outputs": [],
127
178
  "stateMutability": "nonpayable"
128
179
  },
180
+ {
181
+ "type": "function",
182
+ "name": "latestVersionOf",
183
+ "inputs": [
184
+ {
185
+ "name": "platformId",
186
+ "type": "bytes32",
187
+ "internalType": "bytes32"
188
+ }
189
+ ],
190
+ "outputs": [
191
+ {
192
+ "name": "",
193
+ "type": "uint32",
194
+ "internalType": "uint32"
195
+ }
196
+ ],
197
+ "stateMutability": "view"
198
+ },
129
199
  {
130
200
  "type": "function",
131
201
  "name": "owner",
@@ -278,6 +348,24 @@ export const identityNamesAbi = [
278
348
  ],
279
349
  "stateMutability": "view"
280
350
  },
351
+ {
352
+ "type": "function",
353
+ "name": "retireVerifier",
354
+ "inputs": [
355
+ {
356
+ "name": "platformId",
357
+ "type": "bytes32",
358
+ "internalType": "bytes32"
359
+ },
360
+ {
361
+ "name": "version",
362
+ "type": "uint32",
363
+ "internalType": "uint32"
364
+ }
365
+ ],
366
+ "outputs": [],
367
+ "stateMutability": "nonpayable"
368
+ },
281
369
  {
282
370
  "type": "function",
283
371
  "name": "reverseOf",
@@ -304,7 +392,7 @@ export const identityNamesAbi = [
304
392
  },
305
393
  {
306
394
  "type": "function",
307
- "name": "setPlatform",
395
+ "name": "setLatestVersion",
308
396
  "inputs": [
309
397
  {
310
398
  "name": "platformId",
@@ -312,14 +400,22 @@ export const identityNamesAbi = [
312
400
  "internalType": "bytes32"
313
401
  },
314
402
  {
315
- "name": "verifier",
316
- "type": "address",
317
- "internalType": "contract IIdentityVerifier"
318
- },
403
+ "name": "version",
404
+ "type": "uint32",
405
+ "internalType": "uint32"
406
+ }
407
+ ],
408
+ "outputs": [],
409
+ "stateMutability": "nonpayable"
410
+ },
411
+ {
412
+ "type": "function",
413
+ "name": "setPlatform",
414
+ "inputs": [
319
415
  {
320
- "name": "maxFutureObservation",
321
- "type": "uint64",
322
- "internalType": "uint64"
416
+ "name": "platformId",
417
+ "type": "bytes32",
418
+ "internalType": "bytes32"
323
419
  },
324
420
  {
325
421
  "name": "rules",
@@ -357,6 +453,34 @@ export const identityNamesAbi = [
357
453
  "outputs": [],
358
454
  "stateMutability": "nonpayable"
359
455
  },
456
+ {
457
+ "type": "function",
458
+ "name": "setVerifier",
459
+ "inputs": [
460
+ {
461
+ "name": "platformId",
462
+ "type": "bytes32",
463
+ "internalType": "bytes32"
464
+ },
465
+ {
466
+ "name": "version",
467
+ "type": "uint32",
468
+ "internalType": "uint32"
469
+ },
470
+ {
471
+ "name": "verifier",
472
+ "type": "address",
473
+ "internalType": "contract IIdentityVerifier"
474
+ },
475
+ {
476
+ "name": "maxFutureObservation",
477
+ "type": "uint64",
478
+ "internalType": "uint64"
479
+ }
480
+ ],
481
+ "outputs": [],
482
+ "stateMutability": "nonpayable"
483
+ },
360
484
  {
361
485
  "type": "function",
362
486
  "name": "transferOwnership",
@@ -409,6 +533,11 @@ export const identityNamesAbi = [
409
533
  "name": "platformId",
410
534
  "type": "bytes32",
411
535
  "internalType": "bytes32"
536
+ },
537
+ {
538
+ "name": "version",
539
+ "type": "uint32",
540
+ "internalType": "uint32"
412
541
  }
413
542
  ],
414
543
  "outputs": [
@@ -496,6 +625,12 @@ export const identityNamesAbi = [
496
625
  "type": "bool",
497
626
  "indexed": false,
498
627
  "internalType": "bool"
628
+ },
629
+ {
630
+ "name": "version",
631
+ "type": "uint32",
632
+ "indexed": false,
633
+ "internalType": "uint32"
499
634
  }
500
635
  ],
501
636
  "anonymous": false
@@ -513,6 +648,25 @@ export const identityNamesAbi = [
513
648
  ],
514
649
  "anonymous": false
515
650
  },
651
+ {
652
+ "type": "event",
653
+ "name": "LatestVersionChanged",
654
+ "inputs": [
655
+ {
656
+ "name": "platformId",
657
+ "type": "bytes32",
658
+ "indexed": true,
659
+ "internalType": "bytes32"
660
+ },
661
+ {
662
+ "name": "version",
663
+ "type": "uint32",
664
+ "indexed": true,
665
+ "internalType": "uint32"
666
+ }
667
+ ],
668
+ "anonymous": false
669
+ },
516
670
  {
517
671
  "type": "event",
518
672
  "name": "NameUnpublished",
@@ -579,25 +733,69 @@ export const identityNamesAbi = [
579
733
  "type": "bytes32",
580
734
  "indexed": true,
581
735
  "internalType": "bytes32"
736
+ }
737
+ ],
738
+ "anonymous": false
739
+ },
740
+ {
741
+ "type": "event",
742
+ "name": "Upgraded",
743
+ "inputs": [
744
+ {
745
+ "name": "implementation",
746
+ "type": "address",
747
+ "indexed": true,
748
+ "internalType": "address"
749
+ }
750
+ ],
751
+ "anonymous": false
752
+ },
753
+ {
754
+ "type": "event",
755
+ "name": "VerifierConfigured",
756
+ "inputs": [
757
+ {
758
+ "name": "platformId",
759
+ "type": "bytes32",
760
+ "indexed": true,
761
+ "internalType": "bytes32"
762
+ },
763
+ {
764
+ "name": "version",
765
+ "type": "uint32",
766
+ "indexed": true,
767
+ "internalType": "uint32"
582
768
  },
583
769
  {
584
770
  "name": "verifier",
585
771
  "type": "address",
586
772
  "indexed": false,
587
773
  "internalType": "address"
774
+ },
775
+ {
776
+ "name": "maxFutureObservation",
777
+ "type": "uint64",
778
+ "indexed": false,
779
+ "internalType": "uint64"
588
780
  }
589
781
  ],
590
782
  "anonymous": false
591
783
  },
592
784
  {
593
785
  "type": "event",
594
- "name": "Upgraded",
786
+ "name": "VerifierRetired",
595
787
  "inputs": [
596
788
  {
597
- "name": "implementation",
598
- "type": "address",
789
+ "name": "platformId",
790
+ "type": "bytes32",
599
791
  "indexed": true,
600
- "internalType": "address"
792
+ "internalType": "bytes32"
793
+ },
794
+ {
795
+ "name": "version",
796
+ "type": "uint32",
797
+ "indexed": true,
798
+ "internalType": "uint32"
601
799
  }
602
800
  ],
603
801
  "anonymous": false
@@ -796,5 +994,42 @@ export const identityNamesAbi = [
796
994
  "internalType": "bytes32"
797
995
  }
798
996
  ]
997
+ },
998
+ {
999
+ "type": "error",
1000
+ "name": "UnknownVersion",
1001
+ "inputs": [
1002
+ {
1003
+ "name": "platformId",
1004
+ "type": "bytes32",
1005
+ "internalType": "bytes32"
1006
+ },
1007
+ {
1008
+ "name": "version",
1009
+ "type": "uint32",
1010
+ "internalType": "uint32"
1011
+ }
1012
+ ]
1013
+ },
1014
+ {
1015
+ "type": "error",
1016
+ "name": "VersionInUseAsLatest",
1017
+ "inputs": [
1018
+ {
1019
+ "name": "platformId",
1020
+ "type": "bytes32",
1021
+ "internalType": "bytes32"
1022
+ },
1023
+ {
1024
+ "name": "version",
1025
+ "type": "uint32",
1026
+ "internalType": "uint32"
1027
+ }
1028
+ ]
1029
+ },
1030
+ {
1031
+ "type": "error",
1032
+ "name": "ZeroVersion",
1033
+ "inputs": []
799
1034
  }
800
1035
  ] as const satisfies Abi
@@ -183,6 +183,17 @@ export interface Call {
183
183
  /// an indexer never needs it — say true only when something on chain must
184
184
  /// display the name. For Google the handle is an email address, which is worth
185
185
  /// a thought before publishing it.
186
+ ///
187
+ /// **The proof version is resolved on chain, at the moment the call lands** —
188
+ /// not when this calldata is built. The day the owner moves a platform's
189
+ /// default, this call starts handing the proof to the new format's verifier.
190
+ /// That is right for a client that builds its proof fresh from this package
191
+ /// each time, because both sides move together.
192
+ ///
193
+ /// It is wrong for a client pinned to one format: a shipped wallet that still
194
+ /// encodes version 1 would hand version-1 bytes to a version-2 verifier, and
195
+ /// the best case is an opaque revert. Such a client wants
196
+ /// `bindAtVersionCall`.
186
197
  export function bindCall(names: Address, platformId: Hex, proof: Hex, publishName: boolean): Call {
187
198
  return {
188
199
  to: names,
@@ -194,6 +205,33 @@ export function bindCall(names: Address, platformId: Hex, proof: Hex, publishNam
194
205
  }
195
206
  }
196
207
 
208
+ /// Bind with a named proof version.
209
+ ///
210
+ /// A platform's proof can change shape while the account behind it does not —
211
+ /// X gaining OIDC, say — so several formats are accepted at once while users
212
+ /// migrate. `bindCall` uses whichever version the platform currently defaults
213
+ /// to, which is what a client building its proof fresh each time wants.
214
+ ///
215
+ /// Use this when the client is pinned to a format: a proof built for version 1
216
+ /// keeps binding on the day the default moves to 2, and stops only when the
217
+ /// owner retires version 1 outright.
218
+ export function bindAtVersionCall(
219
+ names: Address,
220
+ platformId: Hex,
221
+ version: number,
222
+ proof: Hex,
223
+ publishName: boolean,
224
+ ): Call {
225
+ return {
226
+ to: names,
227
+ data: encodeFunctionData({
228
+ abi: identityNamesAbi,
229
+ functionName: 'bindAtVersion',
230
+ args: [platformId, version, proof, publishName],
231
+ }),
232
+ }
233
+ }
234
+
197
235
  /// Withdraw a published handle. The binding itself stays: this stops the chain
198
236
  /// displaying the string, and needs no proof, because withdrawing what you
199
237
  /// chose to show must not depend on being able to log in again.