@idos-network/kwil-infra 1.5.0 → 2.2.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +46 -1
  3. package/dist/actions/index.d.mts +2 -2
  4. package/dist/actions/index.mjs +1 -1370
  5. package/dist/actions/index.mjs.map +1 -1
  6. package/dist/facesign/index.d.mts +1 -1
  7. package/dist/facesign/index.mjs +1 -2
  8. package/dist/{facesign-signer-BC24j1eN.d.mts → facesign-signer-5I8juA7p.d.mts} +2 -1
  9. package/dist/facesign-signer-5I8juA7p.d.mts.map +1 -0
  10. package/dist/facesign-signer-z5T312uQ.mjs +2 -0
  11. package/dist/facesign-signer-z5T312uQ.mjs.map +1 -0
  12. package/dist/{index-iqkJfgWf.d.mts → index-Bqz6trCk.d.mts} +223 -136
  13. package/dist/index-Bqz6trCk.d.mts.map +1 -0
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +1 -429
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/signature-verification/index.d.mts +3 -4
  18. package/dist/signature-verification/index.d.mts.map +1 -1
  19. package/dist/signature-verification/index.mjs +1 -134
  20. package/dist/signature-verification/index.mjs.map +1 -1
  21. package/dist/xrp/utils.d.mts +130 -20
  22. package/dist/xrp/utils.d.mts.map +1 -1
  23. package/dist/xrp/utils.mjs +1 -104
  24. package/dist/xrp/utils.mjs.map +1 -1
  25. package/dist/xrpl-credentials/index.d.mts +6 -7
  26. package/dist/xrpl-credentials/index.d.mts.map +1 -1
  27. package/dist/xrpl-credentials/index.mjs +1 -223
  28. package/dist/xrpl-credentials/index.mjs.map +1 -1
  29. package/package.json +7 -7
  30. package/src/actions/actions.test.ts +189 -0
  31. package/src/actions/actions.ts +368 -467
  32. package/src/actions/index.ts +38 -0
  33. package/src/create-kgw-authenticated-fetch.test.ts +377 -0
  34. package/src/create-kgw-authenticated-fetch.ts +321 -0
  35. package/src/create-kwil-client.ts +33 -10
  36. package/src/create-kwil-signer.test.ts +80 -0
  37. package/src/create-kwil-signer.ts +31 -5
  38. package/src/facesign/facesign-signer.test.ts +77 -0
  39. package/src/facesign/facesign-signer.ts +50 -2
  40. package/src/index.ts +2 -0
  41. package/src/mm-token/create-mm-token-kwil-signer.test.ts +148 -0
  42. package/src/mm-token/create-mm-token-kwil-signer.ts +166 -0
  43. package/src/near/create-near-wallet-kwil-signer.ts +1 -1
  44. package/src/signature-verification/index.test.ts +18 -0
  45. package/src/signature-verification/index.ts +7 -1
  46. package/src/wait-for-kwil-tx.test.ts +92 -0
  47. package/src/wait-for-kwil-tx.ts +111 -0
  48. package/tsdown.config.ts +1 -0
  49. package/dist/facesign-signer-BC24j1eN.d.mts.map +0 -1
  50. package/dist/facesign-signer-qzCcwunk.mjs +0 -244
  51. package/dist/facesign-signer-qzCcwunk.mjs.map +0 -1
  52. package/dist/index-iqkJfgWf.d.mts.map +0 -1
@@ -1,1371 +1,2 @@
1
- import { Utils } from "@idos-network/kwil-js";
2
- import * as z from "zod";
3
- //#region src/actions/actions.ts
4
- const DataType = Utils.DataType;
5
- const WALLET_TYPES = [
6
- "EVM",
7
- "NEAR",
8
- "XRPL",
9
- "Stellar",
10
- "FaceSign"
11
- ];
12
- const walletTypeSchema = z.enum(WALLET_TYPES);
13
- const ENCRYPTION_PASSWORD_STORES = ["user", "mpc"];
14
- const encryptionPasswordStoreSchema = z.enum(ENCRYPTION_PASSWORD_STORES);
15
- const actionSchema = {
16
- add_inserter_as_owner: [{
17
- name: "id",
18
- type: DataType.Uuid
19
- }, {
20
- name: "name",
21
- type: DataType.Text
22
- }],
23
- delete_inserter_as_owner: [{
24
- name: "id",
25
- type: DataType.Uuid
26
- }],
27
- add_delegate_as_owner: [{
28
- name: "address",
29
- type: DataType.Text
30
- }, {
31
- name: "inserter_id",
32
- type: DataType.Uuid
33
- }],
34
- delete_delegate_as_owner: [{
35
- name: "address",
36
- type: DataType.Text
37
- }],
38
- add_user_as_inserter: [
39
- {
40
- name: "id",
41
- type: DataType.Uuid
42
- },
43
- {
44
- name: "recipient_encryption_public_key",
45
- type: DataType.Text
46
- },
47
- {
48
- name: "encryption_password_store",
49
- type: DataType.Text
50
- }
51
- ],
52
- update_user_pub_key_as_inserter: [
53
- {
54
- name: "id",
55
- type: DataType.Uuid
56
- },
57
- {
58
- name: "recipient_encryption_public_key",
59
- type: DataType.Text
60
- },
61
- {
62
- name: "encryption_password_store",
63
- type: DataType.Text
64
- }
65
- ],
66
- get_user: [],
67
- get_user_as_inserter: [{
68
- name: "id",
69
- type: DataType.Uuid
70
- }],
71
- upsert_wallet_as_inserter: [
72
- {
73
- name: "id",
74
- type: DataType.Uuid
75
- },
76
- {
77
- name: "user_id",
78
- type: DataType.Uuid
79
- },
80
- {
81
- name: "address",
82
- type: DataType.Text
83
- },
84
- {
85
- name: "public_key",
86
- type: DataType.Text
87
- },
88
- {
89
- name: "wallet_type",
90
- type: DataType.Text
91
- },
92
- {
93
- name: "message",
94
- type: DataType.Text
95
- },
96
- {
97
- name: "signature",
98
- type: DataType.Text
99
- }
100
- ],
101
- add_wallet: [
102
- {
103
- name: "id",
104
- type: DataType.Uuid
105
- },
106
- {
107
- name: "address",
108
- type: DataType.Text
109
- },
110
- {
111
- name: "public_key",
112
- type: DataType.Text
113
- },
114
- {
115
- name: "wallet_type",
116
- type: DataType.Text
117
- },
118
- {
119
- name: "message",
120
- type: DataType.Text
121
- },
122
- {
123
- name: "signature",
124
- type: DataType.Text
125
- }
126
- ],
127
- get_wallets: [],
128
- remove_wallet: [{
129
- name: "id",
130
- type: DataType.Uuid
131
- }],
132
- upsert_credential_as_inserter: [
133
- {
134
- name: "id",
135
- type: DataType.Uuid
136
- },
137
- {
138
- name: "user_id",
139
- type: DataType.Uuid
140
- },
141
- {
142
- name: "issuer_auth_public_key",
143
- type: DataType.Text
144
- },
145
- {
146
- name: "encryptor_public_key",
147
- type: DataType.Text
148
- },
149
- {
150
- name: "content",
151
- type: DataType.Text
152
- },
153
- {
154
- name: "public_notes",
155
- type: DataType.Text
156
- },
157
- {
158
- name: "public_notes_signature",
159
- type: DataType.Text
160
- },
161
- {
162
- name: "broader_signature",
163
- type: DataType.Text
164
- }
165
- ],
166
- add_credential: [
167
- {
168
- name: "id",
169
- type: DataType.Uuid
170
- },
171
- {
172
- name: "issuer_auth_public_key",
173
- type: DataType.Text
174
- },
175
- {
176
- name: "encryptor_public_key",
177
- type: DataType.Text
178
- },
179
- {
180
- name: "content",
181
- type: DataType.Text
182
- },
183
- {
184
- name: "public_notes",
185
- type: DataType.Text
186
- },
187
- {
188
- name: "public_notes_signature",
189
- type: DataType.Text
190
- },
191
- {
192
- name: "broader_signature",
193
- type: DataType.Text
194
- }
195
- ],
196
- get_credentials: [],
197
- get_credentials_shared_by_user: [{
198
- name: "user_id",
199
- type: DataType.Uuid
200
- }, {
201
- name: "original_issuer_auth_public_key",
202
- type: DataType.Text
203
- }],
204
- edit_credential: [
205
- {
206
- name: "id",
207
- type: DataType.Uuid
208
- },
209
- {
210
- name: "public_notes",
211
- type: DataType.Text
212
- },
213
- {
214
- name: "public_notes_signature",
215
- type: DataType.Text
216
- },
217
- {
218
- name: "broader_signature",
219
- type: DataType.Text
220
- },
221
- {
222
- name: "content",
223
- type: DataType.Text
224
- },
225
- {
226
- name: "encryptor_public_key",
227
- type: DataType.Text
228
- },
229
- {
230
- name: "issuer_auth_public_key",
231
- type: DataType.Text
232
- }
233
- ],
234
- edit_public_notes_as_issuer: [{
235
- name: "public_notes_id",
236
- type: DataType.Text
237
- }, {
238
- name: "public_notes",
239
- type: DataType.Text
240
- }],
241
- remove_credential: [{
242
- name: "id",
243
- type: DataType.Uuid
244
- }],
245
- rescind_shared_credential: [{
246
- name: "credential_id",
247
- type: DataType.Uuid
248
- }],
249
- share_credential: [
250
- {
251
- name: "id",
252
- type: DataType.Uuid
253
- },
254
- {
255
- name: "original_credential_id",
256
- type: DataType.Uuid
257
- },
258
- {
259
- name: "public_notes",
260
- type: DataType.Text
261
- },
262
- {
263
- name: "public_notes_signature",
264
- type: DataType.Text
265
- },
266
- {
267
- name: "broader_signature",
268
- type: DataType.Text
269
- },
270
- {
271
- name: "content",
272
- type: DataType.Text
273
- },
274
- {
275
- name: "content_hash",
276
- type: DataType.Text
277
- },
278
- {
279
- name: "encryptor_public_key",
280
- type: DataType.Text
281
- },
282
- {
283
- name: "issuer_auth_public_key",
284
- type: DataType.Text
285
- },
286
- {
287
- name: "grantee_wallet_identifier",
288
- type: DataType.Text
289
- },
290
- {
291
- name: "locked_until",
292
- type: DataType.Int
293
- }
294
- ],
295
- create_credentials_by_dwg: [
296
- {
297
- name: "issuer_auth_public_key",
298
- type: DataType.Text
299
- },
300
- {
301
- name: "original_encryptor_public_key",
302
- type: DataType.Text
303
- },
304
- {
305
- name: "original_credential_id",
306
- type: DataType.Uuid
307
- },
308
- {
309
- name: "original_content",
310
- type: DataType.Text
311
- },
312
- {
313
- name: "original_public_notes",
314
- type: DataType.Text
315
- },
316
- {
317
- name: "original_public_notes_signature",
318
- type: DataType.Text
319
- },
320
- {
321
- name: "original_broader_signature",
322
- type: DataType.Text
323
- },
324
- {
325
- name: "copy_encryptor_public_key",
326
- type: DataType.Text
327
- },
328
- {
329
- name: "copy_credential_id",
330
- type: DataType.Uuid
331
- },
332
- {
333
- name: "copy_content",
334
- type: DataType.Text
335
- },
336
- {
337
- name: "copy_public_notes_signature",
338
- type: DataType.Text
339
- },
340
- {
341
- name: "copy_broader_signature",
342
- type: DataType.Text
343
- },
344
- {
345
- name: "content_hash",
346
- type: DataType.Text
347
- },
348
- {
349
- name: "dwg_owner",
350
- type: DataType.Text
351
- },
352
- {
353
- name: "dwg_grantee",
354
- type: DataType.Text
355
- },
356
- {
357
- name: "dwg_issuer_public_key",
358
- type: DataType.Text
359
- },
360
- {
361
- name: "dwg_id",
362
- type: DataType.Uuid
363
- },
364
- {
365
- name: "dwg_access_grant_timelock",
366
- type: DataType.Text
367
- },
368
- {
369
- name: "dwg_not_before",
370
- type: DataType.Text
371
- },
372
- {
373
- name: "dwg_not_after",
374
- type: DataType.Text
375
- },
376
- {
377
- name: "dwg_signature",
378
- type: DataType.Text
379
- }
380
- ],
381
- credential_exist_as_inserter: [{
382
- name: "id",
383
- type: DataType.Uuid
384
- }],
385
- get_credential_owned: [{
386
- name: "id",
387
- type: DataType.Uuid
388
- }],
389
- get_credential_shared: [{
390
- name: "id",
391
- type: DataType.Uuid
392
- }],
393
- get_sibling_credential_id: [{
394
- name: "content_hash",
395
- type: DataType.Text
396
- }],
397
- add_attribute_as_inserter: [
398
- {
399
- name: "id",
400
- type: DataType.Uuid
401
- },
402
- {
403
- name: "user_id",
404
- type: DataType.Uuid
405
- },
406
- {
407
- name: "attribute_key",
408
- type: DataType.Text
409
- },
410
- {
411
- name: "value",
412
- type: DataType.Text
413
- }
414
- ],
415
- add_attribute: [
416
- {
417
- name: "id",
418
- type: DataType.Uuid
419
- },
420
- {
421
- name: "attribute_key",
422
- type: DataType.Text
423
- },
424
- {
425
- name: "value",
426
- type: DataType.Text
427
- }
428
- ],
429
- get_attributes: [],
430
- edit_attribute: [
431
- {
432
- name: "id",
433
- type: DataType.Uuid
434
- },
435
- {
436
- name: "attribute_key",
437
- type: DataType.Text
438
- },
439
- {
440
- name: "value",
441
- type: DataType.Text
442
- }
443
- ],
444
- remove_attribute: [{
445
- name: "id",
446
- type: DataType.Uuid
447
- }],
448
- share_attribute: [
449
- {
450
- name: "id",
451
- type: DataType.Uuid
452
- },
453
- {
454
- name: "original_attribute_id",
455
- type: DataType.Uuid
456
- },
457
- {
458
- name: "attribute_key",
459
- type: DataType.Text
460
- },
461
- {
462
- name: "value",
463
- type: DataType.Text
464
- }
465
- ],
466
- dwg_message: [
467
- {
468
- name: "owner_wallet_identifier",
469
- type: DataType.Text
470
- },
471
- {
472
- name: "grantee_wallet_identifier",
473
- type: DataType.Text
474
- },
475
- {
476
- name: "issuer_public_key",
477
- type: DataType.Text
478
- },
479
- {
480
- name: "id",
481
- type: DataType.Uuid
482
- },
483
- {
484
- name: "access_grant_timelock",
485
- type: DataType.Text
486
- },
487
- {
488
- name: "not_usable_before",
489
- type: DataType.Text
490
- },
491
- {
492
- name: "not_usable_after",
493
- type: DataType.Text
494
- }
495
- ],
496
- revoke_access_grant: [{
497
- name: "id",
498
- type: DataType.Uuid
499
- }],
500
- get_access_grants_owned: [],
501
- get_access_grants_granted: [
502
- {
503
- name: "user_id",
504
- type: DataType.Uuid
505
- },
506
- {
507
- name: "page",
508
- type: DataType.Int
509
- },
510
- {
511
- name: "size",
512
- type: DataType.Int
513
- }
514
- ],
515
- get_access_grants_granted_count: [{
516
- name: "user_id",
517
- type: DataType.Uuid
518
- }],
519
- has_locked_access_grants: [{
520
- name: "id",
521
- type: DataType.Uuid
522
- }],
523
- dag_message: [
524
- {
525
- name: "dag_owner_wallet_identifier",
526
- type: DataType.Text
527
- },
528
- {
529
- name: "dag_grantee_wallet_identifier",
530
- type: DataType.Text
531
- },
532
- {
533
- name: "dag_data_id",
534
- type: DataType.Uuid
535
- },
536
- {
537
- name: "dag_locked_until",
538
- type: DataType.Int
539
- },
540
- {
541
- name: "dag_content_hash",
542
- type: DataType.Text
543
- }
544
- ],
545
- create_ag_by_dag_for_copy: [
546
- {
547
- name: "dag_owner_wallet_identifier",
548
- type: DataType.Text
549
- },
550
- {
551
- name: "dag_grantee_wallet_identifier",
552
- type: DataType.Text
553
- },
554
- {
555
- name: "dag_data_id",
556
- type: DataType.Uuid
557
- },
558
- {
559
- name: "dag_locked_until",
560
- type: DataType.Int
561
- },
562
- {
563
- name: "dag_content_hash",
564
- type: DataType.Text
565
- },
566
- {
567
- name: "dag_signature",
568
- type: DataType.Text
569
- }
570
- ],
571
- get_access_grants_for_credential: [{
572
- name: "credential_id",
573
- type: DataType.Uuid
574
- }],
575
- has_profile: [{
576
- name: "address",
577
- type: DataType.Text
578
- }],
579
- check_balance: [{
580
- name: "address",
581
- type: DataType.Text
582
- }, {
583
- name: "token",
584
- type: DataType.Text
585
- }],
586
- get_wallet_with_balance: [{
587
- name: "token",
588
- type: DataType.Text
589
- }],
590
- request_withdrawal: [{
591
- name: "token",
592
- type: DataType.Text
593
- }],
594
- get_allowance: [],
595
- action_costing_gas: [],
596
- action_costing_idos_token: [{
597
- name: "amount",
598
- type: DataType.Int
599
- }],
600
- get_issuer_fee: [{
601
- name: "credential_id",
602
- type: DataType.Uuid
603
- }],
604
- action_costing_fee: [{
605
- name: "credential_id",
606
- type: DataType.Uuid
607
- }],
608
- request_balance_withdrawal: [{
609
- name: "token",
610
- type: DataType.Text
611
- }, {
612
- name: "evm_address_to",
613
- type: DataType.Text
614
- }]
615
- };
616
- const AddInserterAsOwnerInputSchema = z.object({
617
- id: z.uuid(),
618
- name: z.string()
619
- });
620
- /** INSERTER AND DELEGATE ACTIONS */
621
- async function addInserterAsOwner(kwilClient, params) {
622
- const inputs = AddInserterAsOwnerInputSchema.parse(params);
623
- await kwilClient.execute({
624
- name: "add_inserter_as_owner",
625
- inputs,
626
- description: "Add inserter as owner"
627
- });
628
- }
629
- const DeleteInserterAsOwnerInputSchema = z.object({ id: z.uuid() });
630
- async function deleteInserterAsOwner(kwilClient, params) {
631
- const inputs = DeleteInserterAsOwnerInputSchema.parse(params);
632
- await kwilClient.execute({
633
- name: "delete_inserter_as_owner",
634
- inputs,
635
- description: "Delete inserter as owner"
636
- });
637
- }
638
- const AddDelegateAsOwnerInputSchema = z.object({
639
- address: z.string(),
640
- inserter_id: z.uuid()
641
- });
642
- async function addDelegateAsOwner(kwilClient, params) {
643
- const inputs = AddDelegateAsOwnerInputSchema.parse(params);
644
- await kwilClient.execute({
645
- name: "add_delegate_as_owner",
646
- inputs,
647
- description: "Add a delegate as owner"
648
- });
649
- }
650
- const DeleteDelegateAsOwnerInputSchema = z.object({ address: z.string() });
651
- async function deleteDelegateAsOwner(kwilClient, params) {
652
- const inputs = DeleteDelegateAsOwnerInputSchema.parse(params);
653
- await kwilClient.execute({
654
- name: "delete_delegate_as_owner",
655
- inputs,
656
- description: "Delete a delegate from idOS"
657
- });
658
- }
659
- const AddUserAsInserterInputSchema = z.object({
660
- id: z.uuid(),
661
- recipient_encryption_public_key: z.string(),
662
- encryption_password_store: encryptionPasswordStoreSchema
663
- });
664
- /** USER ACTIONS */
665
- async function addUserAsInserter(kwilClient, params) {
666
- const inputs = AddUserAsInserterInputSchema.parse(params);
667
- await kwilClient.execute({
668
- name: "add_user_as_inserter",
669
- inputs,
670
- description: "Add a user to idOS"
671
- });
672
- }
673
- const UpdateUserPubKeyAsInserterInputSchema = z.object({
674
- id: z.uuid(),
675
- recipient_encryption_public_key: z.string(),
676
- encryption_password_store: encryptionPasswordStoreSchema
677
- });
678
- async function updateUserPubKeyAsInserter(kwilClient, params) {
679
- const inputs = UpdateUserPubKeyAsInserterInputSchema.parse(params);
680
- await kwilClient.execute({
681
- name: "update_user_pub_key_as_inserter",
682
- inputs,
683
- description: "Update user's encryption key and password store in idOS as inserter (profile creator)"
684
- });
685
- }
686
- const GetUserOutputSchema = z.object({
687
- id: z.uuid(),
688
- recipient_encryption_public_key: z.string(),
689
- encryption_password_store: encryptionPasswordStoreSchema
690
- });
691
- async function getUser(kwilClient) {
692
- return await kwilClient.call({
693
- name: "get_user",
694
- inputs: {}
695
- }).then((result) => result[0]);
696
- }
697
- const GetUserAsInserterInputSchema = z.object({ id: z.uuid() });
698
- const GetUserAsInserterOutputSchema = z.object({
699
- id: z.uuid(),
700
- recipient_encryption_public_key: z.string(),
701
- encryption_password_store: encryptionPasswordStoreSchema,
702
- inserter: z.string()
703
- });
704
- async function getUserAsInserter(kwilClient, params) {
705
- const inputs = GetUserAsInserterInputSchema.parse(params);
706
- return await kwilClient.call({
707
- name: "get_user_as_inserter",
708
- inputs
709
- }).then((result) => result[0]);
710
- }
711
- const UpsertWalletAsInserterInputSchema = z.object({
712
- id: z.uuid(),
713
- user_id: z.uuid(),
714
- address: z.string(),
715
- public_key: z.string().nullable(),
716
- wallet_type: walletTypeSchema,
717
- message: z.string(),
718
- signature: z.string()
719
- });
720
- /** WALLET ACTIONS */
721
- async function upsertWalletAsInserter(kwilClient, params) {
722
- const inputs = UpsertWalletAsInserterInputSchema.parse(params);
723
- await kwilClient.execute({
724
- name: "upsert_wallet_as_inserter",
725
- inputs,
726
- description: "Add a wallet to idOS by inserter (profile creator)"
727
- });
728
- }
729
- const AddWalletInputSchema = z.object({
730
- id: z.uuid(),
731
- address: z.string(),
732
- public_key: z.string().nullable(),
733
- wallet_type: walletTypeSchema,
734
- message: z.string(),
735
- signature: z.string()
736
- });
737
- async function addWallet(kwilClient, params) {
738
- const inputs = AddWalletInputSchema.parse(params);
739
- await kwilClient.execute({
740
- name: "add_wallet",
741
- inputs,
742
- description: "Add a wallet to idOS"
743
- });
744
- }
745
- const GetWalletsOutputSchema = z.object({
746
- id: z.uuid(),
747
- user_id: z.uuid(),
748
- address: z.string(),
749
- public_key: z.string().nullable(),
750
- wallet_type: walletTypeSchema,
751
- message: z.string(),
752
- signature: z.string(),
753
- inserter: z.string().nullable()
754
- });
755
- async function getWallets(kwilClient) {
756
- return await kwilClient.call({
757
- name: "get_wallets",
758
- inputs: {}
759
- });
760
- }
761
- const RemoveWalletInputSchema = z.object({ id: z.uuid() });
762
- async function removeWallet(kwilClient, params) {
763
- const inputs = RemoveWalletInputSchema.parse(params);
764
- await kwilClient.execute({
765
- name: "remove_wallet",
766
- inputs,
767
- description: "Remove a wallet from idOS"
768
- });
769
- }
770
- const UpsertCredentialAsInserterInputSchema = z.object({
771
- id: z.uuid(),
772
- user_id: z.uuid(),
773
- issuer_auth_public_key: z.string(),
774
- encryptor_public_key: z.string(),
775
- content: z.string(),
776
- public_notes: z.string(),
777
- public_notes_signature: z.string(),
778
- broader_signature: z.string()
779
- });
780
- /**
781
- * CREDENTIAL ACTIONS
782
- * throw an error if not authorized
783
- */
784
- async function upsertCredentialAsInserter(kwilClient, params) {
785
- const inputs = UpsertCredentialAsInserterInputSchema.parse(params);
786
- await kwilClient.execute({
787
- name: "upsert_credential_as_inserter",
788
- inputs,
789
- description: "Add or update a credential in idOS on behalf of a user by permissioned profile creator (inserter) "
790
- });
791
- }
792
- const AddCredentialInputSchema = z.object({
793
- id: z.uuid(),
794
- issuer_auth_public_key: z.string(),
795
- encryptor_public_key: z.string(),
796
- content: z.string(),
797
- public_notes: z.string(),
798
- public_notes_signature: z.string(),
799
- broader_signature: z.string()
800
- });
801
- async function addCredential(kwilClient, params) {
802
- const inputs = AddCredentialInputSchema.parse(params);
803
- await kwilClient.execute({
804
- name: "add_credential",
805
- inputs,
806
- description: "Add a new credential"
807
- });
808
- }
809
- const GetCredentialsOutputSchema = z.object({
810
- id: z.uuid(),
811
- user_id: z.uuid(),
812
- public_notes: z.string(),
813
- issuer_auth_public_key: z.string(),
814
- inserter: z.string().nullable(),
815
- original_id: z.uuid().nullable()
816
- });
817
- async function getCredentials(kwilClient) {
818
- return await kwilClient.call({
819
- name: "get_credentials",
820
- inputs: {}
821
- });
822
- }
823
- const GetCredentialsSharedByUserInputSchema = z.object({
824
- user_id: z.uuid(),
825
- original_issuer_auth_public_key: z.string().nullable()
826
- });
827
- const GetCredentialsSharedByUserOutputSchema = z.object({
828
- id: z.uuid(),
829
- user_id: z.uuid(),
830
- public_notes: z.string(),
831
- encryptor_public_key: z.string(),
832
- issuer_auth_public_key: z.string(),
833
- inserter: z.string().nullable(),
834
- original_id: z.uuid().nullable()
835
- });
836
- async function getCredentialsSharedByUser(kwilClient, params) {
837
- const inputs = GetCredentialsSharedByUserInputSchema.parse(params);
838
- return await kwilClient.call({
839
- name: "get_credentials_shared_by_user",
840
- inputs
841
- });
842
- }
843
- const EditCredentialInputSchema = z.object({
844
- id: z.uuid(),
845
- public_notes: z.string(),
846
- public_notes_signature: z.string(),
847
- broader_signature: z.string(),
848
- content: z.string(),
849
- encryptor_public_key: z.string(),
850
- issuer_auth_public_key: z.string()
851
- });
852
- /**
853
- * we forbid to edit a copy
854
- * only copies can have AGs, so data_id in AGs is id of a copy
855
- * if $id is shared_credentials.copy_id - it is a copy
856
- */
857
- async function editCredential(kwilClient, params) {
858
- const inputs = EditCredentialInputSchema.parse(params);
859
- await kwilClient.execute({
860
- name: "edit_credential",
861
- inputs,
862
- description: "Edit a credential"
863
- });
864
- }
865
- const EditPublicNotesAsIssuerInputSchema = z.object({
866
- public_notes_id: z.string(),
867
- public_notes: z.string()
868
- });
869
- /**
870
- * Be aware that @caller here is ed25519 public key, hex encoded.
871
- * All other @caller in the schema are either secp256k1 or nep413
872
- * This action can't be called by kwil-cli (as kwil-cli uses secp256k1 only)
873
- */
874
- async function editPublicNotesAsIssuer(kwilClient, params) {
875
- const inputs = EditPublicNotesAsIssuerInputSchema.parse(params);
876
- await kwilClient.execute({
877
- name: "edit_public_notes_as_issuer",
878
- inputs,
879
- description: "Edit public notes in a credential as issuer"
880
- });
881
- }
882
- const RemoveCredentialInputSchema = z.object({ id: z.uuid() });
883
- async function removeCredential(kwilClient, params) {
884
- const inputs = RemoveCredentialInputSchema.parse(params);
885
- await kwilClient.execute({
886
- name: "remove_credential",
887
- inputs,
888
- description: "Remove a credential from your idOS profile"
889
- });
890
- }
891
- const RescindSharedCredentialInputSchema = z.object({ credential_id: z.uuid() });
892
- async function rescindSharedCredential(kwilClient, params) {
893
- const inputs = RescindSharedCredentialInputSchema.parse(params);
894
- await kwilClient.execute({
895
- name: "rescind_shared_credential",
896
- inputs,
897
- description: "Rescind a shared credential as a grantee"
898
- });
899
- }
900
- const ShareCredentialInputSchema = z.object({
901
- id: z.uuid(),
902
- original_credential_id: z.uuid(),
903
- public_notes: z.string(),
904
- public_notes_signature: z.string(),
905
- broader_signature: z.string(),
906
- content: z.string(),
907
- content_hash: z.string(),
908
- encryptor_public_key: z.string(),
909
- issuer_auth_public_key: z.string(),
910
- grantee_wallet_identifier: z.string(),
911
- locked_until: z.number()
912
- });
913
- async function shareCredential(kwilClient, params) {
914
- const inputs = ShareCredentialInputSchema.parse(params);
915
- await kwilClient.execute({
916
- name: "share_credential",
917
- inputs,
918
- description: "Share a credential with creating AG"
919
- });
920
- }
921
- const CreateCredentialsByDwgInputSchema = z.object({
922
- issuer_auth_public_key: z.string(),
923
- original_encryptor_public_key: z.string(),
924
- original_credential_id: z.uuid(),
925
- original_content: z.string(),
926
- original_public_notes: z.string(),
927
- original_public_notes_signature: z.string(),
928
- original_broader_signature: z.string(),
929
- copy_encryptor_public_key: z.string(),
930
- copy_credential_id: z.uuid(),
931
- copy_content: z.string(),
932
- copy_public_notes_signature: z.string(),
933
- copy_broader_signature: z.string(),
934
- content_hash: z.string(),
935
- dwg_owner: z.string(),
936
- dwg_grantee: z.string(),
937
- dwg_issuer_public_key: z.string(),
938
- dwg_id: z.uuid(),
939
- dwg_access_grant_timelock: z.string(),
940
- dwg_not_before: z.string(),
941
- dwg_not_after: z.string(),
942
- dwg_signature: z.string()
943
- });
944
- /**
945
- * Delegated write credential actions
946
- * For access grant
947
- * Check the content creator (encryptor) of credentials is the issuer that user delegated to issue the credentials
948
- * Get the wallet type and public key for XRPL/NEAR wallets from database
949
- * Will fail if not in the RFC3339 format
950
- * Check the format and precedence
951
- * Check if current block timestamp in time range allowed by write grant.
952
- * @block_timestamp is a timestamp of previous block, which is can be a few seconds earlier
953
- * (max is 6 seconds in current network consensus settings) then a time on a requester's machine.
954
- * Also, if requester's machine has wrong time, it can be an issue.
955
- * Insert original credential
956
- * Insert copy credential
957
- */
958
- async function createCredentialsByDwg(kwilClient, params) {
959
- const inputs = CreateCredentialsByDwgInputSchema.parse(params);
960
- await kwilClient.execute({
961
- name: "create_credentials_by_dwg",
962
- inputs,
963
- description: "Add original credential and copy credential with AG on behalf of a user (using delegated write grant given by the user)"
964
- });
965
- }
966
- const CredentialExistAsInserterInputSchema = z.object({ id: z.uuid() });
967
- const CredentialExistAsInserterOutputSchema = z.object({ credential_exist: z.boolean() });
968
- async function credentialExistAsInserter(kwilClient, params) {
969
- const inputs = CredentialExistAsInserterInputSchema.parse(params);
970
- return await kwilClient.call({
971
- name: "credential_exist_as_inserter",
972
- inputs
973
- }).then((result) => result[0]);
974
- }
975
- const GetCredentialOwnedInputSchema = z.object({ id: z.uuid() });
976
- const GetCredentialOwnedOutputSchema = z.object({
977
- id: z.uuid(),
978
- user_id: z.uuid(),
979
- public_notes: z.string(),
980
- content: z.string(),
981
- encryptor_public_key: z.string(),
982
- issuer_auth_public_key: z.string(),
983
- inserter: z.string().nullable()
984
- });
985
- async function getCredentialOwned(kwilClient, params) {
986
- const inputs = GetCredentialOwnedInputSchema.parse(params);
987
- return await kwilClient.call({
988
- name: "get_credential_owned",
989
- inputs
990
- });
991
- }
992
- const GetCredentialSharedInputSchema = z.object({ id: z.uuid() });
993
- const GetCredentialSharedOutputSchema = z.object({
994
- id: z.uuid(),
995
- user_id: z.uuid(),
996
- public_notes: z.string(),
997
- content: z.string(),
998
- encryptor_public_key: z.string(),
999
- issuer_auth_public_key: z.string(),
1000
- inserter: z.string().nullable()
1001
- });
1002
- /** As a credential copy doesn't contain PUBLIC notes, we return respective original credential PUBLIC notes */
1003
- async function getCredentialShared(kwilClient, params) {
1004
- const inputs = GetCredentialSharedInputSchema.parse(params);
1005
- return await kwilClient.call({
1006
- name: "get_credential_shared",
1007
- inputs
1008
- });
1009
- }
1010
- const GetSiblingCredentialIdInputSchema = z.object({ content_hash: z.string() });
1011
- const GetSiblingCredentialIdOutputSchema = z.object({ id: z.uuid() });
1012
- async function getSiblingCredentialId(kwilClient, params) {
1013
- const inputs = GetSiblingCredentialIdInputSchema.parse(params);
1014
- return await kwilClient.call({
1015
- name: "get_sibling_credential_id",
1016
- inputs
1017
- }).then((result) => result[0]);
1018
- }
1019
- const AddAttributeAsInserterInputSchema = z.object({
1020
- id: z.uuid(),
1021
- user_id: z.uuid(),
1022
- attribute_key: z.string(),
1023
- value: z.string()
1024
- });
1025
- /** ATTRIBUTE ACTIONS */
1026
- async function addAttributeAsInserter(kwilClient, params) {
1027
- const inputs = AddAttributeAsInserterInputSchema.parse(params);
1028
- await kwilClient.execute({
1029
- name: "add_attribute_as_inserter",
1030
- inputs,
1031
- description: "Add a new attribute as inserter"
1032
- });
1033
- }
1034
- const AddAttributeInputSchema = z.object({
1035
- id: z.uuid(),
1036
- attribute_key: z.string(),
1037
- value: z.string()
1038
- });
1039
- async function addAttribute(kwilClient, params) {
1040
- const inputs = AddAttributeInputSchema.parse(params);
1041
- await kwilClient.execute({
1042
- name: "add_attribute",
1043
- inputs,
1044
- description: "Create a new attribute in your idOS profile"
1045
- });
1046
- }
1047
- const GetAttributesOutputSchema = z.object({
1048
- id: z.uuid(),
1049
- user_id: z.uuid(),
1050
- attribute_key: z.string(),
1051
- value: z.string(),
1052
- original_id: z.uuid()
1053
- });
1054
- async function getAttributes(kwilClient) {
1055
- return await kwilClient.call({
1056
- name: "get_attributes",
1057
- inputs: {}
1058
- });
1059
- }
1060
- const EditAttributeInputSchema = z.object({
1061
- id: z.uuid(),
1062
- attribute_key: z.string(),
1063
- value: z.string()
1064
- });
1065
- async function editAttribute(kwilClient, params) {
1066
- const inputs = EditAttributeInputSchema.parse(params);
1067
- await kwilClient.execute({
1068
- name: "edit_attribute",
1069
- inputs,
1070
- description: "Edit an existing attribute"
1071
- });
1072
- }
1073
- const RemoveAttributeInputSchema = z.object({ id: z.uuid() });
1074
- async function removeAttribute(kwilClient, params) {
1075
- const inputs = RemoveAttributeInputSchema.parse(params);
1076
- await kwilClient.execute({
1077
- name: "remove_attribute",
1078
- inputs,
1079
- description: "Remove an existing attribute"
1080
- });
1081
- }
1082
- const ShareAttributeInputSchema = z.object({
1083
- id: z.uuid(),
1084
- original_attribute_id: z.uuid(),
1085
- attribute_key: z.string(),
1086
- value: z.string()
1087
- });
1088
- async function shareAttribute(kwilClient, params) {
1089
- const inputs = ShareAttributeInputSchema.parse(params);
1090
- await kwilClient.execute({
1091
- name: "share_attribute",
1092
- inputs,
1093
- description: "Share an attribute"
1094
- });
1095
- }
1096
- const DwgMessageInputSchema = z.object({
1097
- owner_wallet_identifier: z.string(),
1098
- grantee_wallet_identifier: z.string(),
1099
- issuer_public_key: z.string(),
1100
- id: z.uuid(),
1101
- access_grant_timelock: z.string(),
1102
- not_usable_before: z.string(),
1103
- not_usable_after: z.string()
1104
- });
1105
- const DwgMessageOutputSchema = z.object({ message: z.string() });
1106
- /**
1107
- * WRITE GRANTS ACTIONS
1108
- * Must be in yyyy-mm-ddThh:mm:ssZ format
1109
- * Must be in yyyy-mm-ddThh:mm:ssZ format
1110
- * Must be in yyyy-mm-ddThh:mm:ssZ format
1111
- * Will fail if not in the yyyy-mm-ddThh:mm:ssZ format, and not comply to RFC3339
1112
- * Check the format and precedence
1113
- */
1114
- async function dwgMessage(kwilClient, params) {
1115
- const inputs = DwgMessageInputSchema.parse(params);
1116
- return await kwilClient.call({
1117
- name: "dwg_message",
1118
- inputs
1119
- }).then((result) => result[0]);
1120
- }
1121
- const RevokeAccessGrantInputSchema = z.object({ id: z.uuid() });
1122
- /** ACCESS GRANTS ACTIONS */
1123
- async function revokeAccessGrant(kwilClient, params) {
1124
- const inputs = RevokeAccessGrantInputSchema.parse(params);
1125
- await kwilClient.execute({
1126
- name: "revoke_access_grant",
1127
- inputs,
1128
- description: "Revoke an Access Grant from idOS"
1129
- });
1130
- }
1131
- const GetAccessGrantsOwnedOutputSchema = z.object({
1132
- id: z.uuid(),
1133
- ag_owner_user_id: z.uuid(),
1134
- ag_grantee_wallet_identifier: z.string(),
1135
- data_id: z.uuid(),
1136
- locked_until: z.number(),
1137
- content_hash: z.string().nullable(),
1138
- inserter_type: z.string(),
1139
- inserter_id: z.string()
1140
- });
1141
- async function getAccessGrantsOwned(kwilClient) {
1142
- return await kwilClient.call({
1143
- name: "get_access_grants_owned",
1144
- inputs: {}
1145
- });
1146
- }
1147
- const GetAccessGrantsGrantedInputSchema = z.object({
1148
- user_id: z.uuid().nullable(),
1149
- page: z.number(),
1150
- size: z.number()
1151
- });
1152
- const GetAccessGrantsGrantedOutputSchema = z.object({
1153
- id: z.uuid(),
1154
- ag_owner_user_id: z.uuid(),
1155
- ag_grantee_wallet_identifier: z.string(),
1156
- data_id: z.uuid(),
1157
- locked_until: z.number(),
1158
- content_hash: z.string().nullable(),
1159
- inserter_type: z.string(),
1160
- inserter_id: z.string()
1161
- });
1162
- /**
1163
- * As arguments can be undefined (user can not send them at all), we have to have default values: page=1, size=20
1164
- * Page number starts from 1, as UI usually shows to user in pagination element
1165
- * Ordering is consistent because we use height as first ordering parameter
1166
- */
1167
- async function getAccessGrantsGranted(kwilClient, params) {
1168
- const inputs = GetAccessGrantsGrantedInputSchema.parse(params);
1169
- return await kwilClient.call({
1170
- name: "get_access_grants_granted",
1171
- inputs
1172
- });
1173
- }
1174
- const GetAccessGrantsGrantedCountInputSchema = z.object({ user_id: z.uuid().nullable() });
1175
- const GetAccessGrantsGrantedCountOutputSchema = z.object({ count: z.number() });
1176
- async function getAccessGrantsGrantedCount(kwilClient, params) {
1177
- const inputs = GetAccessGrantsGrantedCountInputSchema.parse(params);
1178
- return await kwilClient.call({
1179
- name: "get_access_grants_granted_count",
1180
- inputs
1181
- }).then((result) => result[0]);
1182
- }
1183
- const HasLockedAccessGrantsInputSchema = z.object({ id: z.uuid() });
1184
- const HasLockedAccessGrantsOutputSchema = z.object({ has: z.boolean() });
1185
- async function hasLockedAccessGrants(kwilClient, params) {
1186
- const inputs = HasLockedAccessGrantsInputSchema.parse(params);
1187
- return await kwilClient.call({
1188
- name: "has_locked_access_grants",
1189
- inputs
1190
- }).then((result) => result[0]);
1191
- }
1192
- const DagMessageInputSchema = z.object({
1193
- dag_owner_wallet_identifier: z.string(),
1194
- dag_grantee_wallet_identifier: z.string(),
1195
- dag_data_id: z.uuid(),
1196
- dag_locked_until: z.number(),
1197
- dag_content_hash: z.string()
1198
- });
1199
- const DagMessageOutputSchema = z.object({ message: z.string() });
1200
- async function dagMessage(kwilClient, params) {
1201
- const inputs = DagMessageInputSchema.parse(params);
1202
- return await kwilClient.call({
1203
- name: "dag_message",
1204
- inputs
1205
- }).then((result) => result[0]);
1206
- }
1207
- const CreateAgByDagForCopyInputSchema = z.object({
1208
- dag_owner_wallet_identifier: z.string(),
1209
- dag_grantee_wallet_identifier: z.string(),
1210
- dag_data_id: z.uuid(),
1211
- dag_locked_until: z.number(),
1212
- dag_content_hash: z.string(),
1213
- dag_signature: z.string()
1214
- });
1215
- /**
1216
- * Get the wallet type and public key for XRPL/NEAR wallets from database
1217
- * This works for EVM-compatible signatures only
1218
- */
1219
- async function createAgByDagForCopy(kwilClient, params) {
1220
- const inputs = CreateAgByDagForCopyInputSchema.parse(params);
1221
- await kwilClient.execute({
1222
- name: "create_ag_by_dag_for_copy",
1223
- inputs,
1224
- description: "Create an Access Grant in idOS"
1225
- });
1226
- }
1227
- const GetAccessGrantsForCredentialInputSchema = z.object({ credential_id: z.uuid() });
1228
- const GetAccessGrantsForCredentialOutputSchema = z.object({
1229
- id: z.uuid(),
1230
- ag_owner_user_id: z.uuid(),
1231
- ag_grantee_wallet_identifier: z.string(),
1232
- data_id: z.uuid(),
1233
- locked_until: z.number(),
1234
- content_hash: z.string().nullable(),
1235
- inserter_type: z.string(),
1236
- inserter_id: z.string()
1237
- });
1238
- async function getAccessGrantsForCredential(kwilClient, params) {
1239
- const inputs = GetAccessGrantsForCredentialInputSchema.parse(params);
1240
- return await kwilClient.call({
1241
- name: "get_access_grants_for_credential",
1242
- inputs
1243
- });
1244
- }
1245
- const HasProfileInputSchema = z.object({ address: z.string() });
1246
- const HasProfileOutputSchema = z.object({ has_profile: z.boolean() });
1247
- /**
1248
- * OTHER ACTIONS
1249
- * Should we improve it to work with near wallets too?
1250
- */
1251
- async function hasProfile(kwilClient, params) {
1252
- const inputs = HasProfileInputSchema.parse(params);
1253
- return await kwilClient.call({
1254
- name: "has_profile",
1255
- inputs
1256
- }, void 0).then((result) => result[0]);
1257
- }
1258
- const CheckBalanceInputSchema = z.object({
1259
- address: z.string(),
1260
- token: z.string()
1261
- });
1262
- const CheckBalanceOutputSchema = z.object({ balance: z.number() });
1263
- /** GAS AND FEES */
1264
- async function checkBalance(kwilClient, params) {
1265
- const inputs = CheckBalanceInputSchema.parse(params);
1266
- return await kwilClient.call({
1267
- name: "check_balance",
1268
- inputs
1269
- }).then((result) => result[0]);
1270
- }
1271
- const GetWalletWithBalanceInputSchema = z.object({ token: z.string() });
1272
- const GetWalletWithBalanceOutputSchema = z.object({ wallet_address: z.string() });
1273
- /**
1274
- * even if the @caller is not EVM address, there is no harm to try to get the balance, it will return nothing
1275
- * because bridge.balance can only have records with EVM addresses (it is filled from EVM-compatible contract events)
1276
- */
1277
- async function getWalletWithBalance(kwilClient, params) {
1278
- const inputs = GetWalletWithBalanceInputSchema.parse(params);
1279
- return await kwilClient.call({
1280
- name: "get_wallet_with_balance",
1281
- inputs
1282
- }).then((result) => result[0]);
1283
- }
1284
- const RequestWithdrawalInputSchema = z.object({ token: z.string() });
1285
- /** we use lock_admin()+issue() because bridge() is tied to @caller */
1286
- async function requestWithdrawal(kwilClient, params) {
1287
- const inputs = RequestWithdrawalInputSchema.parse(params);
1288
- await kwilClient.execute({
1289
- name: "request_withdrawal",
1290
- inputs,
1291
- description: "Request a withdrawal of all tokens from idOS to user's EVM wallet"
1292
- });
1293
- }
1294
- const GetAllowanceOutputSchema = z.object({ gas_allowance: z.number() });
1295
- /** FaceSign should not be able to call this */
1296
- async function getAllowance(kwilClient) {
1297
- return await kwilClient.call({
1298
- name: "get_allowance",
1299
- inputs: {}
1300
- }).then((result) => result[0]);
1301
- }
1302
- async function actionCostingGas(kwilClient) {
1303
- await kwilClient.execute({
1304
- name: "action_costing_gas",
1305
- inputs: {},
1306
- description: "Get cost of action for 1.2 gas"
1307
- });
1308
- }
1309
- const ActionCostingIdosTokenInputSchema = z.object({ amount: z.number() });
1310
- async function actionCostingIdosToken(kwilClient, params) {
1311
- const inputs = ActionCostingIdosTokenInputSchema.parse(params);
1312
- await kwilClient.execute({
1313
- name: "action_costing_idos_token",
1314
- inputs,
1315
- description: "Action that captures IDOS tokens from the caller"
1316
- });
1317
- }
1318
- const GetIssuerFeeInputSchema = z.object({ credential_id: z.uuid() });
1319
- const GetIssuerFeeOutputSchema = z.object({ issuer_fee: z.number() });
1320
- async function getIssuerFee(kwilClient, params) {
1321
- const inputs = GetIssuerFeeInputSchema.parse(params);
1322
- return await kwilClient.call({
1323
- name: "get_issuer_fee",
1324
- inputs
1325
- }).then((result) => result[0]);
1326
- }
1327
- const ActionCostingFeeInputSchema = z.object({ credential_id: z.uuid() });
1328
- async function actionCostingFee(kwilClient, params) {
1329
- const inputs = ActionCostingFeeInputSchema.parse(params);
1330
- await kwilClient.execute({
1331
- name: "action_costing_fee",
1332
- inputs,
1333
- description: "Capture fee from credentials"
1334
- });
1335
- }
1336
- const RequestBalanceWithdrawalInputSchema = z.object({
1337
- token: z.string(),
1338
- evm_address_to: z.string()
1339
- });
1340
- async function requestBalanceWithdrawal(kwilClient, params) {
1341
- const inputs = RequestBalanceWithdrawalInputSchema.parse(params);
1342
- await kwilClient.execute({
1343
- name: "request_balance_withdrawal",
1344
- inputs,
1345
- description: "Request a withdrawal of all tokens from idOS to specified EVM address"
1346
- });
1347
- }
1348
- //#endregion
1349
- //#region src/actions/index.ts
1350
- async function addWallets(kwilClient, wallets) {
1351
- await Promise.all(wallets.map((wallet) => addWallet(kwilClient, wallet)));
1352
- }
1353
- async function removeWallets(kwilClient, ids) {
1354
- await Promise.all(ids.map((id) => removeWallet(kwilClient, { id })));
1355
- }
1356
- const GET_GRANTS_DEFAULT_RECORDS_PER_PAGE = 10;
1357
- async function getGrants(kwilClient, params = {
1358
- page: 1,
1359
- size: 10,
1360
- user_id: null
1361
- }) {
1362
- return getAccessGrantsGranted(kwilClient, {
1363
- page: params.page ?? 1,
1364
- size: params.size ?? 10,
1365
- user_id: params.user_id ?? null
1366
- });
1367
- }
1368
- //#endregion
1369
- export { ActionCostingFeeInputSchema, ActionCostingIdosTokenInputSchema, AddAttributeAsInserterInputSchema, AddAttributeInputSchema, AddCredentialInputSchema, AddDelegateAsOwnerInputSchema, AddInserterAsOwnerInputSchema, AddUserAsInserterInputSchema, AddWalletInputSchema, CheckBalanceInputSchema, CheckBalanceOutputSchema, CreateAgByDagForCopyInputSchema, CreateCredentialsByDwgInputSchema, CredentialExistAsInserterInputSchema, CredentialExistAsInserterOutputSchema, DagMessageInputSchema, DagMessageOutputSchema, DataType, DeleteDelegateAsOwnerInputSchema, DeleteInserterAsOwnerInputSchema, DwgMessageInputSchema, DwgMessageOutputSchema, ENCRYPTION_PASSWORD_STORES, EditAttributeInputSchema, EditCredentialInputSchema, EditPublicNotesAsIssuerInputSchema, GET_GRANTS_DEFAULT_RECORDS_PER_PAGE, GetAccessGrantsForCredentialInputSchema, GetAccessGrantsForCredentialOutputSchema, GetAccessGrantsGrantedCountInputSchema, GetAccessGrantsGrantedCountOutputSchema, GetAccessGrantsGrantedInputSchema, GetAccessGrantsGrantedOutputSchema, GetAccessGrantsOwnedOutputSchema, GetAllowanceOutputSchema, GetAttributesOutputSchema, GetCredentialOwnedInputSchema, GetCredentialOwnedOutputSchema, GetCredentialSharedInputSchema, GetCredentialSharedOutputSchema, GetCredentialsOutputSchema, GetCredentialsSharedByUserInputSchema, GetCredentialsSharedByUserOutputSchema, GetIssuerFeeInputSchema, GetIssuerFeeOutputSchema, GetSiblingCredentialIdInputSchema, GetSiblingCredentialIdOutputSchema, GetUserAsInserterInputSchema, GetUserAsInserterOutputSchema, GetUserOutputSchema, GetWalletWithBalanceInputSchema, GetWalletWithBalanceOutputSchema, GetWalletsOutputSchema, HasLockedAccessGrantsInputSchema, HasLockedAccessGrantsOutputSchema, HasProfileInputSchema, HasProfileOutputSchema, RemoveAttributeInputSchema, RemoveCredentialInputSchema, RemoveWalletInputSchema, RequestBalanceWithdrawalInputSchema, RequestWithdrawalInputSchema, RescindSharedCredentialInputSchema, RevokeAccessGrantInputSchema, ShareAttributeInputSchema, ShareCredentialInputSchema, UpdateUserPubKeyAsInserterInputSchema, UpsertCredentialAsInserterInputSchema, UpsertWalletAsInserterInputSchema, WALLET_TYPES, actionCostingFee, actionCostingGas, actionCostingIdosToken, actionSchema, addAttribute, addAttributeAsInserter, addCredential, addDelegateAsOwner, addInserterAsOwner, addUserAsInserter, addWallet, addWallets, checkBalance, createAgByDagForCopy, createCredentialsByDwg, credentialExistAsInserter, dagMessage, deleteDelegateAsOwner, deleteInserterAsOwner, dwgMessage, editAttribute, editCredential, editPublicNotesAsIssuer, encryptionPasswordStoreSchema, getAccessGrantsForCredential, getAccessGrantsGranted, getAccessGrantsGrantedCount, getAccessGrantsOwned, getAllowance, getAttributes, getCredentialOwned, getCredentialShared, getCredentials, getCredentialsSharedByUser, getGrants, getIssuerFee, getSiblingCredentialId, getUser, getUserAsInserter, getWalletWithBalance, getWallets, hasLockedAccessGrants, hasProfile, removeAttribute, removeCredential, removeWallet, removeWallets, requestBalanceWithdrawal, requestWithdrawal, rescindSharedCredential, revokeAccessGrant, shareAttribute, shareCredential, updateUserPubKeyAsInserter, upsertCredentialAsInserter, upsertWalletAsInserter, walletTypeSchema };
1370
-
1
+ import{Utils as e}from"@idos-network/kwil-js";import*as t from"zod";const n=e.DataType,r=[`EVM`,`NEAR`,`XRPL`,`Stellar`,`FaceSign`,`MM`],i=t.enum(r),ee=[`user`,`mpc`,`mm`],a=t.enum(ee),o=`ipfs://`,s=`ukyc://`,c=t.string().refine(e=>e.startsWith(o)||e.startsWith(s),`content_uri must start with ${o} or ${s}`),l=t.number().int().positive(),u=t.iso.datetime({precision:0}),te={add_user_as_inserter:[{name:`id`,type:n.Uuid},{name:`recipient_encryption_public_key`,type:n.Text},{name:`encryption_password_store`,type:n.Text}],update_user_pub_key_as_inserter:[{name:`id`,type:n.Uuid},{name:`recipient_encryption_public_key`,type:n.Text},{name:`encryption_password_store`,type:n.Text}],get_user:[],get_user_as_inserter:[{name:`id`,type:n.Uuid}],upsert_wallet_as_inserter:[{name:`id`,type:n.Uuid},{name:`user_id`,type:n.Uuid},{name:`address`,type:n.Text},{name:`public_key`,type:n.Text},{name:`wallet_type`,type:n.Text},{name:`not_before`,type:n.Text},{name:`not_after`,type:n.Text},{name:`signature`,type:n.Text}],add_wallet_message:[{name:`address`,type:n.Text},{name:`wallet_type`,type:n.Text},{name:`user_id`,type:n.Uuid},{name:`not_before`,type:n.Text},{name:`not_after`,type:n.Text}],add_wallet:[{name:`id`,type:n.Uuid},{name:`address`,type:n.Text},{name:`public_key`,type:n.Text},{name:`wallet_type`,type:n.Text},{name:`not_before`,type:n.Text},{name:`not_after`,type:n.Text},{name:`signature`,type:n.Text}],get_wallets:[],remove_wallet:[{name:`id`,type:n.Uuid}],create_preliminary_credential:[{name:`request_id`,type:n.Uuid},{name:`credential_id`,type:n.Uuid},{name:`issuer_auth_public_key`,type:n.Text},{name:`encryptor_public_key`,type:n.Text},{name:`content_uri`,type:n.Text},{name:`content_size`,type:n.Int},{name:`content_hash`,type:n.Text},{name:`public_notes`,type:n.Text},{name:`public_notes_signature`,type:n.Text},{name:`broader_signature`,type:n.Text}],get_credentials:[],get_credentials_shared_by_user:[{name:`user_id`,type:n.Uuid},{name:`original_issuer_auth_public_key`,type:n.Text}],edit_public_notes_as_issuer:[{name:`public_notes_id`,type:n.Text},{name:`public_notes`,type:n.Text}],remove_credential:[{name:`id`,type:n.Uuid}],rescind_shared_credential:[{name:`credential_id`,type:n.Uuid}],share_preliminary_credential:[{name:`request_id`,type:n.Uuid},{name:`copy_id`,type:n.Uuid},{name:`original_id`,type:n.Uuid},{name:`public_notes`,type:n.Text},{name:`public_notes_signature`,type:n.Text},{name:`broader_signature`,type:n.Text},{name:`content_uri`,type:n.Text},{name:`content_size`,type:n.Int},{name:`content_hash`,type:n.Text},{name:`encryptor_public_key`,type:n.Text},{name:`issuer_auth_public_key`,type:n.Text},{name:`grantee_wallet_identifier`,type:n.Text},{name:`locked_until`,type:n.Int}],create_preliminary_credentials_by_dwg:[{name:`request_id`,type:n.Uuid},{name:`issuer_auth_public_key`,type:n.Text},{name:`original_encryptor_public_key`,type:n.Text},{name:`original_id`,type:n.Uuid},{name:`original_content_uri`,type:n.Text},{name:`original_content_size`,type:n.Int},{name:`original_public_notes`,type:n.Text},{name:`original_public_notes_signature`,type:n.Text},{name:`original_broader_signature`,type:n.Text},{name:`copy_encryptor_public_key`,type:n.Text},{name:`copy_id`,type:n.Uuid},{name:`copy_content_uri`,type:n.Text},{name:`copy_content_size`,type:n.Int},{name:`copy_public_notes_signature`,type:n.Text},{name:`copy_broader_signature`,type:n.Text},{name:`content_hash`,type:n.Text},{name:`dwg_owner`,type:n.Text},{name:`dwg_grantee`,type:n.Text},{name:`dwg_issuer_public_key`,type:n.Text},{name:`dwg_id`,type:n.Uuid},{name:`dwg_access_grant_timelock`,type:n.Text},{name:`dwg_not_before`,type:n.Text},{name:`dwg_not_after`,type:n.Text},{name:`dwg_signature`,type:n.Text}],credential_exist_as_inserter:[{name:`id`,type:n.Uuid}],get_credential_owned:[{name:`id`,type:n.Uuid}],get_credential_shared:[{name:`id`,type:n.Uuid}],get_sibling_credential_id:[{name:`content_hash`,type:n.Text}],add_attribute_as_inserter:[{name:`id`,type:n.Uuid},{name:`user_id`,type:n.Uuid},{name:`attribute_key`,type:n.Text},{name:`value`,type:n.Text}],add_attribute:[{name:`id`,type:n.Uuid},{name:`attribute_key`,type:n.Text},{name:`value`,type:n.Text}],get_attributes:[],edit_attribute:[{name:`id`,type:n.Uuid},{name:`attribute_key`,type:n.Text},{name:`value`,type:n.Text}],remove_attribute:[{name:`id`,type:n.Uuid}],share_attribute:[{name:`id`,type:n.Uuid},{name:`original_attribute_id`,type:n.Uuid},{name:`attribute_key`,type:n.Text},{name:`value`,type:n.Text}],dwg_message:[{name:`owner_wallet_identifier`,type:n.Text},{name:`grantee_wallet_identifier`,type:n.Text},{name:`issuer_public_key`,type:n.Text},{name:`id`,type:n.Uuid},{name:`access_grant_timelock`,type:n.Text},{name:`not_usable_before`,type:n.Text},{name:`not_usable_after`,type:n.Text}],revoke_access_grant:[{name:`id`,type:n.Uuid}],get_access_grants_owned:[],get_access_grants_granted:[{name:`user_id`,type:n.Uuid},{name:`page`,type:n.Int},{name:`size`,type:n.Int}],get_access_grants_granted_count:[{name:`user_id`,type:n.Uuid}],has_locked_access_grants:[{name:`id`,type:n.Uuid}],get_access_grants_for_credential:[{name:`credential_id`,type:n.Uuid}],has_profile:[{name:`address`,type:n.Text}],set_caller_payer:[{name:`address`,type:n.Text}],check_caller_payer:[{name:`address`,type:n.Text}],unset_caller_payer:[{name:`address`,type:n.Text}],check_balance:[{name:`address`,type:n.Text},{name:`token`,type:n.Text}],get_wallet_with_balance:[{name:`token`,type:n.Text},{name:`minimum_balance`,type:n.Int}],request_withdrawal:[{name:`token`,type:n.Text}],get_allowance:[],action_costing_gas:[],action_costing_idos_token:[{name:`amount`,type:n.Int}],get_issuer_fee:[{name:`credential_id`,type:n.Uuid}],action_costing_fee:[{name:`credential_id`,type:n.Uuid}],request_balance_withdrawal:[{name:`token`,type:n.Text},{name:`evm_address_to`,type:n.Text}]},d=t.object({id:t.uuid(),recipient_encryption_public_key:t.string(),encryption_password_store:a});async function ne(e,t){let n=d.parse(t);await e.execute({name:`add_user_as_inserter`,inputs:n,description:`Add a user to idOS`})}const f=t.object({id:t.uuid(),recipient_encryption_public_key:t.string(),encryption_password_store:a});async function re(e,t){let n=f.parse(t);await e.execute({name:`update_user_pub_key_as_inserter`,inputs:n,description:`Update user's encryption key and password store in idOS as inserter (profile creator)`})}const ie=t.object({id:t.uuid(),recipient_encryption_public_key:t.string(),encryption_password_store:a});async function ae(e){return await e.call({name:`get_user`,inputs:{}}).then(e=>{if(!e[0])throw Error(`get_user returned no rows`);return e[0]})}const p=t.object({id:t.uuid()}),oe=t.object({id:t.uuid(),recipient_encryption_public_key:t.string(),encryption_password_store:a,inserter:t.string()});async function se(e,t){let n=p.parse(t);return await e.call({name:`get_user_as_inserter`,inputs:n}).then(e=>e[0])}const m=t.object({id:t.uuid(),user_id:t.uuid(),address:t.string(),public_key:t.string().nullish(),wallet_type:i,not_before:u.nullish(),not_after:u.nullish(),signature:t.string()}).refine(e=>e.wallet_type===`MM`==(e.not_before==null),{path:[`not_before`],message:`not_before must be null when wallet_type is MM, and set otherwise`}).refine(e=>e.wallet_type===`MM`==(e.not_after==null),{path:[`not_after`],message:`not_after must be null when wallet_type is MM, and set otherwise`});async function ce(e,t){let n=m.parse(t);await e.execute({name:`upsert_wallet_as_inserter`,inputs:n,description:`Add a wallet to idOS by inserter (profile creator)`})}const h=t.object({address:t.string(),wallet_type:i,user_id:t.uuid(),not_before:u,not_after:u}),le=t.object({message:t.string()});async function ue(e,t){let n=h.parse(t);return await e.call({name:`add_wallet_message`,inputs:n}).then(e=>{if(!e[0])throw Error(`add_wallet_message returned no rows`);return e[0]})}const g=t.object({id:t.uuid(),address:t.string(),public_key:t.string().nullish(),wallet_type:i,not_before:u,not_after:u,signature:t.string()});async function _(e,t){let n=g.parse(t);await e.execute({name:`add_wallet`,inputs:n,description:`Add a wallet to idOS`})}const de=t.object({id:t.uuid(),user_id:t.uuid(),address:t.string(),public_key:t.string().nullable(),wallet_type:i,message:t.string(),signature:t.string(),inserter:t.string().nullable()});async function fe(e){return await e.call({name:`get_wallets`,inputs:{}})}const v=t.object({id:t.uuid()});async function y(e,t){let n=v.parse(t);await e.execute({name:`remove_wallet`,inputs:n,description:`Remove a wallet from idOS`})}const b=t.object({request_id:t.uuid(),credential_id:t.uuid(),issuer_auth_public_key:t.string(),encryptor_public_key:t.string(),content_uri:c,content_size:l,content_hash:t.string(),public_notes:t.string(),public_notes_signature:t.string(),broader_signature:t.string()});async function pe(e,t){let n=b.parse(t);await e.execute({name:`create_preliminary_credential`,inputs:n,description:`Create a new preliminary credential`})}const me=t.object({id:t.uuid(),user_id:t.uuid(),public_notes:t.string(),content_uri:t.string().nullable(),content_size:t.number().nullable(),issuer_auth_public_key:t.string(),inserter_type:t.string().nullable(),inserter_id:t.string().nullable(),original_id:t.uuid().nullable()});async function he(e){return await e.call({name:`get_credentials`,inputs:{}})}const x=t.object({user_id:t.uuid(),original_issuer_auth_public_key:t.string().nullish()}),ge=t.object({id:t.uuid(),user_id:t.uuid(),public_notes:t.string(),encryptor_public_key:t.string(),issuer_auth_public_key:t.string(),inserter_type:t.string().nullable(),inserter_id:t.string().nullable(),original_id:t.uuid().nullable()});async function _e(e,t){let n=x.parse(t);return await e.call({name:`get_credentials_shared_by_user`,inputs:n})}const S=t.object({public_notes_id:t.string(),public_notes:t.string()});async function ve(e,t){let n=S.parse(t);await e.execute({name:`edit_public_notes_as_issuer`,inputs:n,description:`Edit public notes in a credential as issuer`})}const C=t.object({id:t.uuid()});async function ye(e,t){let n=C.parse(t);await e.execute({name:`remove_credential`,inputs:n,description:`Remove a credential from your idOS profile`})}const w=t.object({credential_id:t.uuid()});async function be(e,t){let n=w.parse(t);await e.execute({name:`rescind_shared_credential`,inputs:n,description:`Rescind a shared credential as a grantee`})}const T=t.object({request_id:t.uuid(),copy_id:t.uuid(),original_id:t.uuid(),public_notes:t.string(),public_notes_signature:t.string(),broader_signature:t.string(),content_uri:c,content_size:l,content_hash:t.string(),encryptor_public_key:t.string(),issuer_auth_public_key:t.string(),grantee_wallet_identifier:t.string(),locked_until:t.number()});async function E(e,t){let n=T.parse(t);await e.execute({name:`share_preliminary_credential`,inputs:n,description:`Share a credential with creating AG`})}const D=t.object({request_id:t.uuid(),issuer_auth_public_key:t.string(),original_encryptor_public_key:t.string(),original_id:t.uuid(),original_content_uri:c,original_content_size:l,original_public_notes:t.string(),original_public_notes_signature:t.string(),original_broader_signature:t.string(),copy_encryptor_public_key:t.string(),copy_id:t.uuid(),copy_content_uri:c,copy_content_size:l,copy_public_notes_signature:t.string(),copy_broader_signature:t.string(),content_hash:t.string(),dwg_owner:t.string(),dwg_grantee:t.string(),dwg_issuer_public_key:t.string(),dwg_id:t.uuid(),dwg_access_grant_timelock:u,dwg_not_before:u,dwg_not_after:u,dwg_signature:t.string()});async function O(e,t){let n=D.parse(t);await e.execute({name:`create_preliminary_credentials_by_dwg`,inputs:n,description:`Add original credential and copy credential with AG on behalf of a user (using delegated write grant given by the user)`})}const k=t.object({id:t.uuid()}),xe=t.object({credential_exist:t.boolean()});async function Se(e,t){let n=k.parse(t);return await e.call({name:`credential_exist_as_inserter`,inputs:n}).then(e=>e[0])}const A=t.object({id:t.uuid()}),Ce=t.object({id:t.uuid(),user_id:t.uuid(),public_notes:t.string(),content:t.string().nullable(),content_uri:t.string().nullable(),content_size:t.number().nullable(),encryptor_public_key:t.string(),issuer_auth_public_key:t.string(),inserter_type:t.string().nullable(),inserter_id:t.string().nullable()});async function we(e,t){let n=A.parse(t);return await e.call({name:`get_credential_owned`,inputs:n})}const j=t.object({id:t.uuid()}),Te=t.object({id:t.uuid(),user_id:t.uuid(),public_notes:t.string(),content:t.string().nullable(),content_uri:t.string().nullable(),content_size:t.number().nullable(),encryptor_public_key:t.string(),issuer_auth_public_key:t.string(),inserter_type:t.string().nullable(),inserter_id:t.string().nullable()});async function Ee(e,t){let n=j.parse(t);return await e.call({name:`get_credential_shared`,inputs:n})}const M=t.object({content_hash:t.string()}),De=t.object({id:t.uuid()});async function Oe(e,t){let n=M.parse(t);return await e.call({name:`get_sibling_credential_id`,inputs:n}).then(e=>e[0])}const N=t.object({id:t.uuid(),user_id:t.uuid(),attribute_key:t.string(),value:t.string()});async function ke(e,t){let n=N.parse(t);await e.execute({name:`add_attribute_as_inserter`,inputs:n,description:`Add a new attribute as inserter`})}const P=t.object({id:t.uuid(),attribute_key:t.string(),value:t.string()});async function Ae(e,t){let n=P.parse(t);await e.execute({name:`add_attribute`,inputs:n,description:`Create a new attribute in your idOS profile`})}const je=t.object({id:t.uuid(),user_id:t.uuid(),attribute_key:t.string(),value:t.string(),original_id:t.uuid()});async function Me(e){return await e.call({name:`get_attributes`,inputs:{}})}const F=t.object({id:t.uuid(),attribute_key:t.string(),value:t.string()});async function Ne(e,t){let n=F.parse(t);await e.execute({name:`edit_attribute`,inputs:n,description:`Edit an existing attribute`})}const I=t.object({id:t.uuid()});async function Pe(e,t){let n=I.parse(t);await e.execute({name:`remove_attribute`,inputs:n,description:`Remove an existing attribute`})}const L=t.object({id:t.uuid(),original_attribute_id:t.uuid(),attribute_key:t.string(),value:t.string()});async function Fe(e,t){let n=L.parse(t);await e.execute({name:`share_attribute`,inputs:n,description:`Share an attribute`})}const R=t.object({owner_wallet_identifier:t.string(),grantee_wallet_identifier:t.string(),issuer_public_key:t.string(),id:t.uuid(),access_grant_timelock:u,not_usable_before:u,not_usable_after:u}),Ie=t.object({message:t.string()});async function Le(e,t){let n=R.parse(t);return await e.call({name:`dwg_message`,inputs:n}).then(e=>e[0])}const z=t.object({id:t.uuid()});async function Re(e,t){let n=z.parse(t);await e.execute({name:`revoke_access_grant`,inputs:n,description:`Revoke an Access Grant from idOS`})}const ze=t.object({id:t.uuid(),ag_owner_user_id:t.uuid(),ag_grantee_wallet_identifier:t.string(),data_id:t.uuid(),locked_until:t.number(),content_hash:t.string().nullable(),inserter_type:t.string(),inserter_id:t.string()});async function Be(e){return await e.call({name:`get_access_grants_owned`,inputs:{}})}const B=t.object({user_id:t.uuid().nullish(),page:t.number(),size:t.number()}),Ve=t.object({id:t.uuid(),ag_owner_user_id:t.uuid(),ag_grantee_wallet_identifier:t.string(),data_id:t.uuid(),locked_until:t.number(),content_hash:t.string().nullable(),inserter_type:t.string(),inserter_id:t.string()});async function V(e,t){let n=B.parse(t);return await e.call({name:`get_access_grants_granted`,inputs:n})}const H=t.object({user_id:t.uuid().nullish()}),He=t.object({count:t.number()});async function Ue(e,t){let n=H.parse(t);return await e.call({name:`get_access_grants_granted_count`,inputs:n}).then(e=>e[0])}const U=t.object({id:t.uuid()}),We=t.object({has:t.boolean()});async function Ge(e,t){let n=U.parse(t);return await e.call({name:`has_locked_access_grants`,inputs:n}).then(e=>e[0])}const W=t.object({credential_id:t.uuid()}),Ke=t.object({id:t.uuid(),ag_owner_user_id:t.uuid(),ag_grantee_wallet_identifier:t.string(),data_id:t.uuid(),locked_until:t.number(),content_hash:t.string().nullable(),inserter_type:t.string(),inserter_id:t.string()});async function qe(e,t){let n=W.parse(t);return await e.call({name:`get_access_grants_for_credential`,inputs:n})}const G=t.object({address:t.string()}),Je=t.object({has_profile:t.boolean()});async function Ye(e,t){let n=G.parse(t);return await e.call({name:`has_profile`,inputs:n},void 0).then(e=>e[0])}const K=t.object({address:t.string()});async function Xe(e,t){let n=K.parse(t);await e.execute({name:`set_caller_payer`,inputs:n,description:`Set the caller as a payer for a specific EVM address`})}const q=t.object({address:t.string()}),Ze=t.object({is_payer:t.boolean()});async function Qe(e,t){let n=q.parse(t);return await e.call({name:`check_caller_payer`,inputs:n}).then(e=>e[0])}const J=t.object({address:t.string()});async function $e(e,t){let n=J.parse(t);await e.execute({name:`unset_caller_payer`,inputs:n,description:`Remove the caller as a payer for a specific EVM address`})}const Y=t.object({address:t.string(),token:t.string()}),et=t.object({balance:t.number()});async function tt(e,t){let n=Y.parse(t);return await e.call({name:`check_balance`,inputs:n}).then(e=>e[0])}const X=t.object({token:t.string(),minimum_balance:t.number()}),nt=t.object({wallet_address:t.string()});async function rt(e,t){let n=X.parse(t);return await e.call({name:`get_wallet_with_balance`,inputs:n}).then(e=>e[0])}const Z=t.object({token:t.string()});async function it(e,t){let n=Z.parse(t);await e.execute({name:`request_withdrawal`,inputs:n,description:`Request a withdrawal of all tokens from idOS to user's EVM wallet`})}const at=t.object({gas_allowance:t.number()});async function ot(e){return await e.call({name:`get_allowance`,inputs:{}}).then(e=>e[0])}async function st(e){await e.execute({name:`action_costing_gas`,inputs:{},description:`Get cost of action for 1.2 gas`})}const Q=t.object({amount:t.number()});async function ct(e,t){let n=Q.parse(t);await e.execute({name:`action_costing_idos_token`,inputs:n,description:`Action that captures IDOS tokens from the caller`})}const lt=t.object({credential_id:t.uuid()}),ut=t.object({issuer_fee:t.number()});async function dt(e,t){let n=lt.parse(t);return await e.call({name:`get_issuer_fee`,inputs:n}).then(e=>e[0])}const ft=t.object({credential_id:t.uuid()});async function pt(e,t){let n=ft.parse(t);await e.execute({name:`action_costing_fee`,inputs:n,description:`Capture fee from credentials`})}const $=t.object({token:t.string(),evm_address_to:t.string()});async function mt(e,t){let n=$.parse(t);await e.execute({name:`request_balance_withdrawal`,inputs:n,description:`Request a withdrawal of all tokens from idOS to specified EVM address`})}function ht(e){return{id:e.id,ownerWalletIdentifier:e.owner_wallet_identifier,consumerWalletIdentifier:e.grantee_wallet_identifier,issuerPublicKey:e.issuer_public_key,accessGrantTimelock:e.access_grant_timelock,notUsableBefore:e.not_usable_before,notUsableAfter:e.not_usable_after}}async function gt(e,t){await Promise.all(t.map(t=>_(e,t)))}async function _t(e,t){await Promise.all(t.map(t=>y(e,{id:t})))}const vt=10;async function yt(e,t={page:1,size:10,user_id:null}){return V(e,{page:t.page??1,size:t.size??10,user_id:t.user_id??null})}export{ft as ActionCostingFeeInputSchema,Q as ActionCostingIdosTokenInputSchema,N as AddAttributeAsInserterInputSchema,P as AddAttributeInputSchema,d as AddUserAsInserterInputSchema,g as AddWalletInputSchema,h as AddWalletMessageInputSchema,le as AddWalletMessageOutputSchema,Y as CheckBalanceInputSchema,et as CheckBalanceOutputSchema,q as CheckCallerPayerInputSchema,Ze as CheckCallerPayerOutputSchema,D as CreateCredentialsByDwgInputSchema,D as CreatePreliminaryCredentialsByDwgInputSchema,b as CreatePreliminaryCredentialInputSchema,k as CredentialExistAsInserterInputSchema,xe as CredentialExistAsInserterOutputSchema,n as DataType,R as DwgMessageInputSchema,Ie as DwgMessageOutputSchema,ee as ENCRYPTION_PASSWORD_STORES,F as EditAttributeInputSchema,S as EditPublicNotesAsIssuerInputSchema,vt as GET_GRANTS_DEFAULT_RECORDS_PER_PAGE,W as GetAccessGrantsForCredentialInputSchema,Ke as GetAccessGrantsForCredentialOutputSchema,H as GetAccessGrantsGrantedCountInputSchema,He as GetAccessGrantsGrantedCountOutputSchema,B as GetAccessGrantsGrantedInputSchema,Ve as GetAccessGrantsGrantedOutputSchema,ze as GetAccessGrantsOwnedOutputSchema,at as GetAllowanceOutputSchema,je as GetAttributesOutputSchema,A as GetCredentialOwnedInputSchema,Ce as GetCredentialOwnedOutputSchema,j as GetCredentialSharedInputSchema,Te as GetCredentialSharedOutputSchema,me as GetCredentialsOutputSchema,x as GetCredentialsSharedByUserInputSchema,ge as GetCredentialsSharedByUserOutputSchema,lt as GetIssuerFeeInputSchema,ut as GetIssuerFeeOutputSchema,M as GetSiblingCredentialIdInputSchema,De as GetSiblingCredentialIdOutputSchema,p as GetUserAsInserterInputSchema,oe as GetUserAsInserterOutputSchema,ie as GetUserOutputSchema,X as GetWalletWithBalanceInputSchema,nt as GetWalletWithBalanceOutputSchema,de as GetWalletsOutputSchema,U as HasLockedAccessGrantsInputSchema,We as HasLockedAccessGrantsOutputSchema,G as HasProfileInputSchema,Je as HasProfileOutputSchema,I as RemoveAttributeInputSchema,C as RemoveCredentialInputSchema,v as RemoveWalletInputSchema,$ as RequestBalanceWithdrawalInputSchema,Z as RequestWithdrawalInputSchema,w as RescindSharedCredentialInputSchema,z as RevokeAccessGrantInputSchema,K as SetCallerPayerInputSchema,L as ShareAttributeInputSchema,T as ShareCredentialInputSchema,T as SharePreliminaryCredentialInputSchema,J as UnsetCallerPayerInputSchema,f as UpdateUserPubKeyAsInserterInputSchema,m as UpsertWalletAsInserterInputSchema,r as WALLET_TYPES,pt as actionCostingFee,st as actionCostingGas,ct as actionCostingIdosToken,te as actionSchema,Ae as addAttribute,ke as addAttributeAsInserter,ne as addUserAsInserter,_ as addWallet,ue as addWalletMessage,gt as addWallets,tt as checkBalance,Qe as checkCallerPayer,O as createCredentialsByDwg,O as createPreliminaryCredentialsByDwg,pe as createPreliminaryCredential,Se as credentialExistAsInserter,Le as dwgMessage,Ne as editAttribute,ve as editPublicNotesAsIssuer,a as encryptionPasswordStoreSchema,qe as getAccessGrantsForCredential,V as getAccessGrantsGranted,Ue as getAccessGrantsGrantedCount,Be as getAccessGrantsOwned,ot as getAllowance,Me as getAttributes,we as getCredentialOwned,Ee as getCredentialShared,he as getCredentials,_e as getCredentialsSharedByUser,yt as getGrants,dt as getIssuerFee,Oe as getSiblingCredentialId,ae as getUser,se as getUserAsInserter,rt as getWalletWithBalance,fe as getWallets,Ge as hasLockedAccessGrants,Ye as hasProfile,Pe as removeAttribute,ye as removeCredential,y as removeWallet,_t as removeWallets,mt as requestBalanceWithdrawal,it as requestWithdrawal,be as rescindSharedCredential,Re as revokeAccessGrant,Xe as setCallerPayer,Fe as shareAttribute,E as shareCredential,E as sharePreliminaryCredential,ht as toDelegatedWriteGrantBaseParams,$e as unsetCallerPayer,re as updateUserPubKeyAsInserter,ce as upsertWalletAsInserter,i as walletTypeSchema};
1371
2
  //# sourceMappingURL=index.mjs.map