@turnkey/core 1.9.0 → 1.11.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 (51) hide show
  1. package/dist/__clients__/core.d.ts +2 -1
  2. package/dist/__clients__/core.d.ts.map +1 -1
  3. package/dist/__clients__/core.js +112 -18
  4. package/dist/__clients__/core.js.map +1 -1
  5. package/dist/__clients__/core.mjs +111 -17
  6. package/dist/__clients__/core.mjs.map +1 -1
  7. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  8. package/dist/__generated__/sdk-client-base.js +314 -122
  9. package/dist/__generated__/sdk-client-base.js.map +1 -1
  10. package/dist/__generated__/sdk-client-base.mjs +314 -122
  11. package/dist/__generated__/sdk-client-base.mjs.map +1 -1
  12. package/dist/__generated__/version.d.ts +1 -1
  13. package/dist/__generated__/version.d.ts.map +1 -1
  14. package/dist/__generated__/version.js +1 -1
  15. package/dist/__generated__/version.mjs +1 -1
  16. package/dist/__stampers__/api/base.d.ts +2 -0
  17. package/dist/__stampers__/api/base.d.ts.map +1 -1
  18. package/dist/__stampers__/api/base.js +19 -0
  19. package/dist/__stampers__/api/base.js.map +1 -1
  20. package/dist/__stampers__/api/base.mjs +19 -0
  21. package/dist/__stampers__/api/base.mjs.map +1 -1
  22. package/dist/__stampers__/api/mobile/stamper.d.ts +2 -0
  23. package/dist/__stampers__/api/mobile/stamper.d.ts.map +1 -1
  24. package/dist/__stampers__/api/mobile/stamper.js +19 -0
  25. package/dist/__stampers__/api/mobile/stamper.js.map +1 -1
  26. package/dist/__stampers__/api/mobile/stamper.mjs +20 -1
  27. package/dist/__stampers__/api/mobile/stamper.mjs.map +1 -1
  28. package/dist/__stampers__/api/web/stamper.d.ts +2 -1
  29. package/dist/__stampers__/api/web/stamper.d.ts.map +1 -1
  30. package/dist/__stampers__/api/web/stamper.js +9 -4
  31. package/dist/__stampers__/api/web/stamper.js.map +1 -1
  32. package/dist/__stampers__/api/web/stamper.mjs +9 -4
  33. package/dist/__stampers__/api/web/stamper.mjs.map +1 -1
  34. package/dist/__types__/auth.d.ts +2 -0
  35. package/dist/__types__/auth.d.ts.map +1 -1
  36. package/dist/__types__/auth.js.map +1 -1
  37. package/dist/__types__/auth.mjs.map +1 -1
  38. package/dist/__types__/method-types/shared.d.ts +2 -0
  39. package/dist/__types__/method-types/shared.d.ts.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +3 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.mjs +1 -1
  45. package/dist/utils.d.ts +20 -1
  46. package/dist/utils.d.ts.map +1 -1
  47. package/dist/utils.js +57 -0
  48. package/dist/utils.js.map +1 -1
  49. package/dist/utils.mjs +55 -1
  50. package/dist/utils.mjs.map +1 -1
  51. package/package.json +7 -7
@@ -23,10 +23,13 @@ class TurnkeySDKClientBase {
23
23
  if (!activeStamper) {
24
24
  return undefined;
25
25
  }
26
+ const session = await this.storageManager?.getActiveSession();
26
27
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_activity";
27
28
  const body = {
28
29
  ...input,
29
- organizationId: input.organizationId,
30
+ organizationId: input.organizationId ??
31
+ session?.organizationId ??
32
+ this.config.organizationId,
30
33
  };
31
34
  const stringifiedBody = JSON.stringify(body);
32
35
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -50,10 +53,13 @@ class TurnkeySDKClientBase {
50
53
  if (!activeStamper) {
51
54
  return undefined;
52
55
  }
56
+ const session = await this.storageManager?.getActiveSession();
53
57
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_api_key";
54
58
  const body = {
55
59
  ...input,
56
- organizationId: input.organizationId,
60
+ organizationId: input.organizationId ??
61
+ session?.organizationId ??
62
+ this.config.organizationId,
57
63
  };
58
64
  const stringifiedBody = JSON.stringify(body);
59
65
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -77,10 +83,13 @@ class TurnkeySDKClientBase {
77
83
  if (!activeStamper) {
78
84
  return undefined;
79
85
  }
86
+ const session = await this.storageManager?.getActiveSession();
80
87
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_api_keys";
81
88
  const body = {
82
89
  ...input,
83
- organizationId: input.organizationId,
90
+ organizationId: input.organizationId ??
91
+ session?.organizationId ??
92
+ this.config.organizationId,
84
93
  };
85
94
  const stringifiedBody = JSON.stringify(body);
86
95
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -104,10 +113,13 @@ class TurnkeySDKClientBase {
104
113
  if (!activeStamper) {
105
114
  return undefined;
106
115
  }
116
+ const session = await this.storageManager?.getActiveSession();
107
117
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_attestation";
108
118
  const body = {
109
119
  ...input,
110
- organizationId: input.organizationId,
120
+ organizationId: input.organizationId ??
121
+ session?.organizationId ??
122
+ this.config.organizationId,
111
123
  };
112
124
  const stringifiedBody = JSON.stringify(body);
113
125
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -131,10 +143,13 @@ class TurnkeySDKClientBase {
131
143
  if (!activeStamper) {
132
144
  return undefined;
133
145
  }
146
+ const session = await this.storageManager?.getActiveSession();
134
147
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_authenticator";
135
148
  const body = {
136
149
  ...input,
137
- organizationId: input.organizationId,
150
+ organizationId: input.organizationId ??
151
+ session?.organizationId ??
152
+ this.config.organizationId,
138
153
  };
139
154
  const stringifiedBody = JSON.stringify(body);
140
155
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -158,10 +173,13 @@ class TurnkeySDKClientBase {
158
173
  if (!activeStamper) {
159
174
  return undefined;
160
175
  }
176
+ const session = await this.storageManager?.getActiveSession();
161
177
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_authenticators";
162
178
  const body = {
163
179
  ...input,
164
- organizationId: input.organizationId,
180
+ organizationId: input.organizationId ??
181
+ session?.organizationId ??
182
+ this.config.organizationId,
165
183
  };
166
184
  const stringifiedBody = JSON.stringify(body);
167
185
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -185,10 +203,13 @@ class TurnkeySDKClientBase {
185
203
  if (!activeStamper) {
186
204
  return undefined;
187
205
  }
206
+ const session = await this.storageManager?.getActiveSession();
188
207
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_boot_proof";
189
208
  const body = {
190
209
  ...input,
191
- organizationId: input.organizationId,
210
+ organizationId: input.organizationId ??
211
+ session?.organizationId ??
212
+ this.config.organizationId,
192
213
  };
193
214
  const stringifiedBody = JSON.stringify(body);
194
215
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -212,10 +233,13 @@ class TurnkeySDKClientBase {
212
233
  if (!activeStamper) {
213
234
  return undefined;
214
235
  }
236
+ const session = await this.storageManager?.getActiveSession();
215
237
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_gas_usage";
216
238
  const body = {
217
239
  ...input,
218
- organizationId: input.organizationId,
240
+ organizationId: input.organizationId ??
241
+ session?.organizationId ??
242
+ this.config.organizationId,
219
243
  };
220
244
  const stringifiedBody = JSON.stringify(body);
221
245
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -239,10 +263,13 @@ class TurnkeySDKClientBase {
239
263
  if (!activeStamper) {
240
264
  return undefined;
241
265
  }
266
+ const session = await this.storageManager?.getActiveSession();
242
267
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_latest_boot_proof";
243
268
  const body = {
244
269
  ...input,
245
- organizationId: input.organizationId,
270
+ organizationId: input.organizationId ??
271
+ session?.organizationId ??
272
+ this.config.organizationId,
246
273
  };
247
274
  const stringifiedBody = JSON.stringify(body);
248
275
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -266,10 +293,13 @@ class TurnkeySDKClientBase {
266
293
  if (!activeStamper) {
267
294
  return undefined;
268
295
  }
296
+ const session = await this.storageManager?.getActiveSession();
269
297
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_nonces";
270
298
  const body = {
271
299
  ...input,
272
- organizationId: input.organizationId,
300
+ organizationId: input.organizationId ??
301
+ session?.organizationId ??
302
+ this.config.organizationId,
273
303
  };
274
304
  const stringifiedBody = JSON.stringify(body);
275
305
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -293,10 +323,13 @@ class TurnkeySDKClientBase {
293
323
  if (!activeStamper) {
294
324
  return undefined;
295
325
  }
326
+ const session = await this.storageManager?.getActiveSession();
296
327
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth2_credential";
297
328
  const body = {
298
329
  ...input,
299
- organizationId: input.organizationId,
330
+ organizationId: input.organizationId ??
331
+ session?.organizationId ??
332
+ this.config.organizationId,
300
333
  };
301
334
  const stringifiedBody = JSON.stringify(body);
302
335
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -320,10 +353,13 @@ class TurnkeySDKClientBase {
320
353
  if (!activeStamper) {
321
354
  return undefined;
322
355
  }
356
+ const session = await this.storageManager?.getActiveSession();
323
357
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth_providers";
324
358
  const body = {
325
359
  ...input,
326
- organizationId: input.organizationId,
360
+ organizationId: input.organizationId ??
361
+ session?.organizationId ??
362
+ this.config.organizationId,
327
363
  };
328
364
  const stringifiedBody = JSON.stringify(body);
329
365
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -347,10 +383,13 @@ class TurnkeySDKClientBase {
347
383
  if (!activeStamper) {
348
384
  return undefined;
349
385
  }
386
+ const session = await this.storageManager?.getActiveSession();
350
387
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_onramp_transaction_status";
351
388
  const body = {
352
389
  ...input,
353
- organizationId: input.organizationId,
390
+ organizationId: input.organizationId ??
391
+ session?.organizationId ??
392
+ this.config.organizationId,
354
393
  };
355
394
  const stringifiedBody = JSON.stringify(body);
356
395
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -374,10 +413,13 @@ class TurnkeySDKClientBase {
374
413
  if (!activeStamper) {
375
414
  return undefined;
376
415
  }
416
+ const session = await this.storageManager?.getActiveSession();
377
417
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization";
378
418
  const body = {
379
419
  ...input,
380
- organizationId: input.organizationId,
420
+ organizationId: input.organizationId ??
421
+ session?.organizationId ??
422
+ this.config.organizationId,
381
423
  };
382
424
  const stringifiedBody = JSON.stringify(body);
383
425
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -401,10 +443,13 @@ class TurnkeySDKClientBase {
401
443
  if (!activeStamper) {
402
444
  return undefined;
403
445
  }
446
+ const session = await this.storageManager?.getActiveSession();
404
447
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization_configs";
405
448
  const body = {
406
449
  ...input,
407
- organizationId: input.organizationId,
450
+ organizationId: input.organizationId ??
451
+ session?.organizationId ??
452
+ this.config.organizationId,
408
453
  };
409
454
  const stringifiedBody = JSON.stringify(body);
410
455
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -428,10 +473,13 @@ class TurnkeySDKClientBase {
428
473
  if (!activeStamper) {
429
474
  return undefined;
430
475
  }
476
+ const session = await this.storageManager?.getActiveSession();
431
477
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy";
432
478
  const body = {
433
479
  ...input,
434
- organizationId: input.organizationId,
480
+ organizationId: input.organizationId ??
481
+ session?.organizationId ??
482
+ this.config.organizationId,
435
483
  };
436
484
  const stringifiedBody = JSON.stringify(body);
437
485
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -455,10 +503,13 @@ class TurnkeySDKClientBase {
455
503
  if (!activeStamper) {
456
504
  return undefined;
457
505
  }
506
+ const session = await this.storageManager?.getActiveSession();
458
507
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy_evaluations";
459
508
  const body = {
460
509
  ...input,
461
- organizationId: input.organizationId,
510
+ organizationId: input.organizationId ??
511
+ session?.organizationId ??
512
+ this.config.organizationId,
462
513
  };
463
514
  const stringifiedBody = JSON.stringify(body);
464
515
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -482,10 +533,13 @@ class TurnkeySDKClientBase {
482
533
  if (!activeStamper) {
483
534
  return undefined;
484
535
  }
536
+ const session = await this.storageManager?.getActiveSession();
485
537
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_private_key";
486
538
  const body = {
487
539
  ...input,
488
- organizationId: input.organizationId,
540
+ organizationId: input.organizationId ??
541
+ session?.organizationId ??
542
+ this.config.organizationId,
489
543
  };
490
544
  const stringifiedBody = JSON.stringify(body);
491
545
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -509,10 +563,13 @@ class TurnkeySDKClientBase {
509
563
  if (!activeStamper) {
510
564
  return undefined;
511
565
  }
566
+ const session = await this.storageManager?.getActiveSession();
512
567
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_send_transaction_status";
513
568
  const body = {
514
569
  ...input,
515
- organizationId: input.organizationId,
570
+ organizationId: input.organizationId ??
571
+ session?.organizationId ??
572
+ this.config.organizationId,
516
573
  };
517
574
  const stringifiedBody = JSON.stringify(body);
518
575
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -536,10 +593,13 @@ class TurnkeySDKClientBase {
536
593
  if (!activeStamper) {
537
594
  return undefined;
538
595
  }
596
+ const session = await this.storageManager?.getActiveSession();
539
597
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_smart_contract_interface";
540
598
  const body = {
541
599
  ...input,
542
- organizationId: input.organizationId,
600
+ organizationId: input.organizationId ??
601
+ session?.organizationId ??
602
+ this.config.organizationId,
543
603
  };
544
604
  const stringifiedBody = JSON.stringify(body);
545
605
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -563,10 +623,13 @@ class TurnkeySDKClientBase {
563
623
  if (!activeStamper) {
564
624
  return undefined;
565
625
  }
626
+ const session = await this.storageManager?.getActiveSession();
566
627
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_user";
567
628
  const body = {
568
629
  ...input,
569
- organizationId: input.organizationId,
630
+ organizationId: input.organizationId ??
631
+ session?.organizationId ??
632
+ this.config.organizationId,
570
633
  };
571
634
  const stringifiedBody = JSON.stringify(body);
572
635
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -590,10 +653,13 @@ class TurnkeySDKClientBase {
590
653
  if (!activeStamper) {
591
654
  return undefined;
592
655
  }
656
+ const session = await this.storageManager?.getActiveSession();
593
657
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet";
594
658
  const body = {
595
659
  ...input,
596
- organizationId: input.organizationId,
660
+ organizationId: input.organizationId ??
661
+ session?.organizationId ??
662
+ this.config.organizationId,
597
663
  };
598
664
  const stringifiedBody = JSON.stringify(body);
599
665
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -617,10 +683,13 @@ class TurnkeySDKClientBase {
617
683
  if (!activeStamper) {
618
684
  return undefined;
619
685
  }
686
+ const session = await this.storageManager?.getActiveSession();
620
687
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet_account";
621
688
  const body = {
622
689
  ...input,
623
- organizationId: input.organizationId,
690
+ organizationId: input.organizationId ??
691
+ session?.organizationId ??
692
+ this.config.organizationId,
624
693
  };
625
694
  const stringifiedBody = JSON.stringify(body);
626
695
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -644,10 +713,13 @@ class TurnkeySDKClientBase {
644
713
  if (!activeStamper) {
645
714
  return undefined;
646
715
  }
716
+ const session = await this.storageManager?.getActiveSession();
647
717
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_activities";
648
718
  const body = {
649
719
  ...input,
650
- organizationId: input.organizationId,
720
+ organizationId: input.organizationId ??
721
+ session?.organizationId ??
722
+ this.config.organizationId,
651
723
  };
652
724
  const stringifiedBody = JSON.stringify(body);
653
725
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -671,10 +743,13 @@ class TurnkeySDKClientBase {
671
743
  if (!activeStamper) {
672
744
  return undefined;
673
745
  }
746
+ const session = await this.storageManager?.getActiveSession();
674
747
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_app_proofs";
675
748
  const body = {
676
749
  ...input,
677
- organizationId: input.organizationId,
750
+ organizationId: input.organizationId ??
751
+ session?.organizationId ??
752
+ this.config.organizationId,
678
753
  };
679
754
  const stringifiedBody = JSON.stringify(body);
680
755
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -698,10 +773,13 @@ class TurnkeySDKClientBase {
698
773
  if (!activeStamper) {
699
774
  return undefined;
700
775
  }
776
+ const session = await this.storageManager?.getActiveSession();
701
777
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_fiat_on_ramp_credentials";
702
778
  const body = {
703
779
  ...input,
704
- organizationId: input.organizationId,
780
+ organizationId: input.organizationId ??
781
+ session?.organizationId ??
782
+ this.config.organizationId,
705
783
  };
706
784
  const stringifiedBody = JSON.stringify(body);
707
785
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -725,10 +803,13 @@ class TurnkeySDKClientBase {
725
803
  if (!activeStamper) {
726
804
  return undefined;
727
805
  }
806
+ const session = await this.storageManager?.getActiveSession();
728
807
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_oauth2_credentials";
729
808
  const body = {
730
809
  ...input,
731
- organizationId: input.organizationId,
810
+ organizationId: input.organizationId ??
811
+ session?.organizationId ??
812
+ this.config.organizationId,
732
813
  };
733
814
  const stringifiedBody = JSON.stringify(body);
734
815
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -752,10 +833,13 @@ class TurnkeySDKClientBase {
752
833
  if (!activeStamper) {
753
834
  return undefined;
754
835
  }
836
+ const session = await this.storageManager?.getActiveSession();
755
837
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_policies";
756
838
  const body = {
757
839
  ...input,
758
- organizationId: input.organizationId,
840
+ organizationId: input.organizationId ??
841
+ session?.organizationId ??
842
+ this.config.organizationId,
759
843
  };
760
844
  const stringifiedBody = JSON.stringify(body);
761
845
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -779,10 +863,13 @@ class TurnkeySDKClientBase {
779
863
  if (!activeStamper) {
780
864
  return undefined;
781
865
  }
866
+ const session = await this.storageManager?.getActiveSession();
782
867
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_key_tags";
783
868
  const body = {
784
869
  ...input,
785
- organizationId: input.organizationId,
870
+ organizationId: input.organizationId ??
871
+ session?.organizationId ??
872
+ this.config.organizationId,
786
873
  };
787
874
  const stringifiedBody = JSON.stringify(body);
788
875
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -806,10 +893,13 @@ class TurnkeySDKClientBase {
806
893
  if (!activeStamper) {
807
894
  return undefined;
808
895
  }
896
+ const session = await this.storageManager?.getActiveSession();
809
897
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_keys";
810
898
  const body = {
811
899
  ...input,
812
- organizationId: input.organizationId,
900
+ organizationId: input.organizationId ??
901
+ session?.organizationId ??
902
+ this.config.organizationId,
813
903
  };
814
904
  const stringifiedBody = JSON.stringify(body);
815
905
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -833,11 +923,14 @@ class TurnkeySDKClientBase {
833
923
  if (!activeStamper) {
834
924
  return undefined;
835
925
  }
926
+ const session = await this.storageManager?.getActiveSession();
836
927
  const fullUrl = this.config.apiBaseUrl +
837
928
  "/public/v1/query/list_smart_contract_interfaces";
838
929
  const body = {
839
930
  ...input,
840
- organizationId: input.organizationId,
931
+ organizationId: input.organizationId ??
932
+ session?.organizationId ??
933
+ this.config.organizationId,
841
934
  };
842
935
  const stringifiedBody = JSON.stringify(body);
843
936
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -861,10 +954,13 @@ class TurnkeySDKClientBase {
861
954
  if (!activeStamper) {
862
955
  return undefined;
863
956
  }
957
+ const session = await this.storageManager?.getActiveSession();
864
958
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_suborgs";
865
959
  const body = {
866
960
  ...input,
867
- organizationId: input.organizationId,
961
+ organizationId: input.organizationId ??
962
+ session?.organizationId ??
963
+ this.config.organizationId,
868
964
  };
869
965
  const stringifiedBody = JSON.stringify(body);
870
966
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -888,10 +984,13 @@ class TurnkeySDKClientBase {
888
984
  if (!activeStamper) {
889
985
  return undefined;
890
986
  }
987
+ const session = await this.storageManager?.getActiveSession();
891
988
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_user_tags";
892
989
  const body = {
893
990
  ...input,
894
- organizationId: input.organizationId,
991
+ organizationId: input.organizationId ??
992
+ session?.organizationId ??
993
+ this.config.organizationId,
895
994
  };
896
995
  const stringifiedBody = JSON.stringify(body);
897
996
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -915,10 +1014,13 @@ class TurnkeySDKClientBase {
915
1014
  if (!activeStamper) {
916
1015
  return undefined;
917
1016
  }
1017
+ const session = await this.storageManager?.getActiveSession();
918
1018
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_users";
919
1019
  const body = {
920
1020
  ...input,
921
- organizationId: input.organizationId,
1021
+ organizationId: input.organizationId ??
1022
+ session?.organizationId ??
1023
+ this.config.organizationId,
922
1024
  };
923
1025
  const stringifiedBody = JSON.stringify(body);
924
1026
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -942,10 +1044,13 @@ class TurnkeySDKClientBase {
942
1044
  if (!activeStamper) {
943
1045
  return undefined;
944
1046
  }
1047
+ const session = await this.storageManager?.getActiveSession();
945
1048
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_verified_suborgs";
946
1049
  const body = {
947
1050
  ...input,
948
- organizationId: input.organizationId,
1051
+ organizationId: input.organizationId ??
1052
+ session?.organizationId ??
1053
+ this.config.organizationId,
949
1054
  };
950
1055
  const stringifiedBody = JSON.stringify(body);
951
1056
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -969,10 +1074,13 @@ class TurnkeySDKClientBase {
969
1074
  if (!activeStamper) {
970
1075
  return undefined;
971
1076
  }
1077
+ const session = await this.storageManager?.getActiveSession();
972
1078
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallet_accounts";
973
1079
  const body = {
974
1080
  ...input,
975
- organizationId: input.organizationId,
1081
+ organizationId: input.organizationId ??
1082
+ session?.organizationId ??
1083
+ this.config.organizationId,
976
1084
  };
977
1085
  const stringifiedBody = JSON.stringify(body);
978
1086
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -996,10 +1104,13 @@ class TurnkeySDKClientBase {
996
1104
  if (!activeStamper) {
997
1105
  return undefined;
998
1106
  }
1107
+ const session = await this.storageManager?.getActiveSession();
999
1108
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallets";
1000
1109
  const body = {
1001
1110
  ...input,
1002
- organizationId: input.organizationId,
1111
+ organizationId: input.organizationId ??
1112
+ session?.organizationId ??
1113
+ this.config.organizationId,
1003
1114
  };
1004
1115
  const stringifiedBody = JSON.stringify(body);
1005
1116
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -1023,10 +1134,13 @@ class TurnkeySDKClientBase {
1023
1134
  if (!activeStamper) {
1024
1135
  return undefined;
1025
1136
  }
1137
+ const session = await this.storageManager?.getActiveSession();
1026
1138
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/whoami";
1027
1139
  const body = {
1028
1140
  ...input,
1029
- organizationId: input.organizationId,
1141
+ organizationId: input.organizationId ??
1142
+ session?.organizationId ??
1143
+ this.config.organizationId,
1030
1144
  };
1031
1145
  const stringifiedBody = JSON.stringify(body);
1032
1146
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -1054,10 +1168,11 @@ class TurnkeySDKClientBase {
1054
1168
  return undefined;
1055
1169
  }
1056
1170
  const { organizationId, timestampMs, ...parameters } = input;
1171
+ const session = await this.storageManager?.getActiveSession();
1057
1172
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/approve_activity";
1058
1173
  const bodyWithType = {
1059
1174
  parameters,
1060
- organizationId,
1175
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1061
1176
  timestampMs: timestampMs ?? String(Date.now()),
1062
1177
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
1063
1178
  };
@@ -1087,10 +1202,11 @@ class TurnkeySDKClientBase {
1087
1202
  return undefined;
1088
1203
  }
1089
1204
  const { organizationId, timestampMs, ...parameters } = input;
1205
+ const session = await this.storageManager?.getActiveSession();
1090
1206
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_keys";
1091
1207
  const bodyWithType = {
1092
1208
  parameters,
1093
- organizationId,
1209
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1094
1210
  timestampMs: timestampMs ?? String(Date.now()),
1095
1211
  type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
1096
1212
  };
@@ -1120,10 +1236,11 @@ class TurnkeySDKClientBase {
1120
1236
  return undefined;
1121
1237
  }
1122
1238
  const { organizationId, timestampMs, ...parameters } = input;
1239
+ const session = await this.storageManager?.getActiveSession();
1123
1240
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_only_users";
1124
1241
  const bodyWithType = {
1125
1242
  parameters,
1126
- organizationId,
1243
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1127
1244
  timestampMs: timestampMs ?? String(Date.now()),
1128
1245
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
1129
1246
  };
@@ -1153,10 +1270,11 @@ class TurnkeySDKClientBase {
1153
1270
  return undefined;
1154
1271
  }
1155
1272
  const { organizationId, timestampMs, ...parameters } = input;
1273
+ const session = await this.storageManager?.getActiveSession();
1156
1274
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_authenticators";
1157
1275
  const bodyWithType = {
1158
1276
  parameters,
1159
- organizationId,
1277
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1160
1278
  timestampMs: timestampMs ?? String(Date.now()),
1161
1279
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
1162
1280
  };
@@ -1186,11 +1304,12 @@ class TurnkeySDKClientBase {
1186
1304
  return undefined;
1187
1305
  }
1188
1306
  const { organizationId, timestampMs, ...parameters } = input;
1307
+ const session = await this.storageManager?.getActiveSession();
1189
1308
  const fullUrl = this.config.apiBaseUrl +
1190
1309
  "/public/v1/submit/create_fiat_on_ramp_credential";
1191
1310
  const bodyWithType = {
1192
1311
  parameters,
1193
- organizationId,
1312
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1194
1313
  timestampMs: timestampMs ?? String(Date.now()),
1195
1314
  type: "ACTIVITY_TYPE_CREATE_FIAT_ON_RAMP_CREDENTIAL",
1196
1315
  };
@@ -1220,10 +1339,11 @@ class TurnkeySDKClientBase {
1220
1339
  return undefined;
1221
1340
  }
1222
1341
  const { organizationId, timestampMs, ...parameters } = input;
1342
+ const session = await this.storageManager?.getActiveSession();
1223
1343
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_invitations";
1224
1344
  const bodyWithType = {
1225
1345
  parameters,
1226
- organizationId,
1346
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1227
1347
  timestampMs: timestampMs ?? String(Date.now()),
1228
1348
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
1229
1349
  };
@@ -1253,10 +1373,11 @@ class TurnkeySDKClientBase {
1253
1373
  return undefined;
1254
1374
  }
1255
1375
  const { organizationId, timestampMs, ...parameters } = input;
1376
+ const session = await this.storageManager?.getActiveSession();
1256
1377
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth2_credential";
1257
1378
  const bodyWithType = {
1258
1379
  parameters,
1259
- organizationId,
1380
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1260
1381
  timestampMs: timestampMs ?? String(Date.now()),
1261
1382
  type: "ACTIVITY_TYPE_CREATE_OAUTH2CREDENTIAL",
1262
1383
  };
@@ -1286,10 +1407,11 @@ class TurnkeySDKClientBase {
1286
1407
  return undefined;
1287
1408
  }
1288
1409
  const { organizationId, timestampMs, ...parameters } = input;
1410
+ const session = await this.storageManager?.getActiveSession();
1289
1411
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth_providers";
1290
1412
  const bodyWithType = {
1291
1413
  parameters,
1292
- organizationId,
1414
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1293
1415
  timestampMs: timestampMs ?? String(Date.now()),
1294
1416
  type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
1295
1417
  };
@@ -1319,10 +1441,11 @@ class TurnkeySDKClientBase {
1319
1441
  return undefined;
1320
1442
  }
1321
1443
  const { organizationId, timestampMs, ...parameters } = input;
1444
+ const session = await this.storageManager?.getActiveSession();
1322
1445
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policies";
1323
1446
  const bodyWithType = {
1324
1447
  parameters,
1325
- organizationId,
1448
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1326
1449
  timestampMs: timestampMs ?? String(Date.now()),
1327
1450
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
1328
1451
  };
@@ -1352,10 +1475,11 @@ class TurnkeySDKClientBase {
1352
1475
  return undefined;
1353
1476
  }
1354
1477
  const { organizationId, timestampMs, ...parameters } = input;
1478
+ const session = await this.storageManager?.getActiveSession();
1355
1479
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policy";
1356
1480
  const bodyWithType = {
1357
1481
  parameters,
1358
- organizationId,
1482
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1359
1483
  timestampMs: timestampMs ?? String(Date.now()),
1360
1484
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
1361
1485
  };
@@ -1385,10 +1509,11 @@ class TurnkeySDKClientBase {
1385
1509
  return undefined;
1386
1510
  }
1387
1511
  const { organizationId, timestampMs, ...parameters } = input;
1512
+ const session = await this.storageManager?.getActiveSession();
1388
1513
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_key_tag";
1389
1514
  const bodyWithType = {
1390
1515
  parameters,
1391
- organizationId,
1516
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1392
1517
  timestampMs: timestampMs ?? String(Date.now()),
1393
1518
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
1394
1519
  };
@@ -1418,10 +1543,11 @@ class TurnkeySDKClientBase {
1418
1543
  return undefined;
1419
1544
  }
1420
1545
  const { organizationId, timestampMs, ...parameters } = input;
1546
+ const session = await this.storageManager?.getActiveSession();
1421
1547
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_keys";
1422
1548
  const bodyWithType = {
1423
1549
  parameters,
1424
- organizationId,
1550
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1425
1551
  timestampMs: timestampMs ?? String(Date.now()),
1426
1552
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
1427
1553
  };
@@ -1451,10 +1577,11 @@ class TurnkeySDKClientBase {
1451
1577
  return undefined;
1452
1578
  }
1453
1579
  const { organizationId, timestampMs, ...parameters } = input;
1580
+ const session = await this.storageManager?.getActiveSession();
1454
1581
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_only_session";
1455
1582
  const bodyWithType = {
1456
1583
  parameters,
1457
- organizationId,
1584
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1458
1585
  timestampMs: timestampMs ?? String(Date.now()),
1459
1586
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
1460
1587
  };
@@ -1484,10 +1611,11 @@ class TurnkeySDKClientBase {
1484
1611
  return undefined;
1485
1612
  }
1486
1613
  const { organizationId, timestampMs, ...parameters } = input;
1614
+ const session = await this.storageManager?.getActiveSession();
1487
1615
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_write_session";
1488
1616
  const bodyWithType = {
1489
1617
  parameters,
1490
- organizationId,
1618
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1491
1619
  timestampMs: timestampMs ?? String(Date.now()),
1492
1620
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
1493
1621
  };
@@ -1517,11 +1645,12 @@ class TurnkeySDKClientBase {
1517
1645
  return undefined;
1518
1646
  }
1519
1647
  const { organizationId, timestampMs, ...parameters } = input;
1648
+ const session = await this.storageManager?.getActiveSession();
1520
1649
  const fullUrl = this.config.apiBaseUrl +
1521
1650
  "/public/v1/submit/create_smart_contract_interface";
1522
1651
  const bodyWithType = {
1523
1652
  parameters,
1524
- organizationId,
1653
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1525
1654
  timestampMs: timestampMs ?? String(Date.now()),
1526
1655
  type: "ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE",
1527
1656
  };
@@ -1551,10 +1680,11 @@ class TurnkeySDKClientBase {
1551
1680
  return undefined;
1552
1681
  }
1553
1682
  const { organizationId, timestampMs, ...parameters } = input;
1683
+ const session = await this.storageManager?.getActiveSession();
1554
1684
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_sub_organization";
1555
1685
  const bodyWithType = {
1556
1686
  parameters,
1557
- organizationId,
1687
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1558
1688
  timestampMs: timestampMs ?? String(Date.now()),
1559
1689
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1560
1690
  };
@@ -1584,10 +1714,11 @@ class TurnkeySDKClientBase {
1584
1714
  return undefined;
1585
1715
  }
1586
1716
  const { organizationId, timestampMs, ...parameters } = input;
1717
+ const session = await this.storageManager?.getActiveSession();
1587
1718
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_user_tag";
1588
1719
  const bodyWithType = {
1589
1720
  parameters,
1590
- organizationId,
1721
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1591
1722
  timestampMs: timestampMs ?? String(Date.now()),
1592
1723
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
1593
1724
  };
@@ -1617,10 +1748,11 @@ class TurnkeySDKClientBase {
1617
1748
  return undefined;
1618
1749
  }
1619
1750
  const { organizationId, timestampMs, ...parameters } = input;
1751
+ const session = await this.storageManager?.getActiveSession();
1620
1752
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_users";
1621
1753
  const bodyWithType = {
1622
1754
  parameters,
1623
- organizationId,
1755
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1624
1756
  timestampMs: timestampMs ?? String(Date.now()),
1625
1757
  type: "ACTIVITY_TYPE_CREATE_USERS_V3",
1626
1758
  };
@@ -1650,10 +1782,11 @@ class TurnkeySDKClientBase {
1650
1782
  return undefined;
1651
1783
  }
1652
1784
  const { organizationId, timestampMs, ...parameters } = input;
1785
+ const session = await this.storageManager?.getActiveSession();
1653
1786
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet";
1654
1787
  const bodyWithType = {
1655
1788
  parameters,
1656
- organizationId,
1789
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1657
1790
  timestampMs: timestampMs ?? String(Date.now()),
1658
1791
  type: "ACTIVITY_TYPE_CREATE_WALLET",
1659
1792
  };
@@ -1683,10 +1816,11 @@ class TurnkeySDKClientBase {
1683
1816
  return undefined;
1684
1817
  }
1685
1818
  const { organizationId, timestampMs, ...parameters } = input;
1819
+ const session = await this.storageManager?.getActiveSession();
1686
1820
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet_accounts";
1687
1821
  const bodyWithType = {
1688
1822
  parameters,
1689
- organizationId,
1823
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1690
1824
  timestampMs: timestampMs ?? String(Date.now()),
1691
1825
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
1692
1826
  };
@@ -1716,10 +1850,11 @@ class TurnkeySDKClientBase {
1716
1850
  return undefined;
1717
1851
  }
1718
1852
  const { organizationId, timestampMs, ...parameters } = input;
1853
+ const session = await this.storageManager?.getActiveSession();
1719
1854
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_api_keys";
1720
1855
  const bodyWithType = {
1721
1856
  parameters,
1722
- organizationId,
1857
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1723
1858
  timestampMs: timestampMs ?? String(Date.now()),
1724
1859
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
1725
1860
  };
@@ -1749,10 +1884,11 @@ class TurnkeySDKClientBase {
1749
1884
  return undefined;
1750
1885
  }
1751
1886
  const { organizationId, timestampMs, ...parameters } = input;
1887
+ const session = await this.storageManager?.getActiveSession();
1752
1888
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_authenticators";
1753
1889
  const bodyWithType = {
1754
1890
  parameters,
1755
- organizationId,
1891
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1756
1892
  timestampMs: timestampMs ?? String(Date.now()),
1757
1893
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
1758
1894
  };
@@ -1782,11 +1918,12 @@ class TurnkeySDKClientBase {
1782
1918
  return undefined;
1783
1919
  }
1784
1920
  const { organizationId, timestampMs, ...parameters } = input;
1921
+ const session = await this.storageManager?.getActiveSession();
1785
1922
  const fullUrl = this.config.apiBaseUrl +
1786
1923
  "/public/v1/submit/delete_fiat_on_ramp_credential";
1787
1924
  const bodyWithType = {
1788
1925
  parameters,
1789
- organizationId,
1926
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1790
1927
  timestampMs: timestampMs ?? String(Date.now()),
1791
1928
  type: "ACTIVITY_TYPE_DELETE_FIAT_ON_RAMP_CREDENTIAL",
1792
1929
  };
@@ -1816,10 +1953,11 @@ class TurnkeySDKClientBase {
1816
1953
  return undefined;
1817
1954
  }
1818
1955
  const { organizationId, timestampMs, ...parameters } = input;
1956
+ const session = await this.storageManager?.getActiveSession();
1819
1957
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_invitation";
1820
1958
  const bodyWithType = {
1821
1959
  parameters,
1822
- organizationId,
1960
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1823
1961
  timestampMs: timestampMs ?? String(Date.now()),
1824
1962
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
1825
1963
  };
@@ -1849,10 +1987,11 @@ class TurnkeySDKClientBase {
1849
1987
  return undefined;
1850
1988
  }
1851
1989
  const { organizationId, timestampMs, ...parameters } = input;
1990
+ const session = await this.storageManager?.getActiveSession();
1852
1991
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth2_credential";
1853
1992
  const bodyWithType = {
1854
1993
  parameters,
1855
- organizationId,
1994
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1856
1995
  timestampMs: timestampMs ?? String(Date.now()),
1857
1996
  type: "ACTIVITY_TYPE_DELETE_OAUTH2CREDENTIAL",
1858
1997
  };
@@ -1882,10 +2021,11 @@ class TurnkeySDKClientBase {
1882
2021
  return undefined;
1883
2022
  }
1884
2023
  const { organizationId, timestampMs, ...parameters } = input;
2024
+ const session = await this.storageManager?.getActiveSession();
1885
2025
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth_providers";
1886
2026
  const bodyWithType = {
1887
2027
  parameters,
1888
- organizationId,
2028
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1889
2029
  timestampMs: timestampMs ?? String(Date.now()),
1890
2030
  type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
1891
2031
  };
@@ -1915,10 +2055,11 @@ class TurnkeySDKClientBase {
1915
2055
  return undefined;
1916
2056
  }
1917
2057
  const { organizationId, timestampMs, ...parameters } = input;
2058
+ const session = await this.storageManager?.getActiveSession();
1918
2059
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policies";
1919
2060
  const bodyWithType = {
1920
2061
  parameters,
1921
- organizationId,
2062
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1922
2063
  timestampMs: timestampMs ?? String(Date.now()),
1923
2064
  type: "ACTIVITY_TYPE_DELETE_POLICIES",
1924
2065
  };
@@ -1948,10 +2089,11 @@ class TurnkeySDKClientBase {
1948
2089
  return undefined;
1949
2090
  }
1950
2091
  const { organizationId, timestampMs, ...parameters } = input;
2092
+ const session = await this.storageManager?.getActiveSession();
1951
2093
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policy";
1952
2094
  const bodyWithType = {
1953
2095
  parameters,
1954
- organizationId,
2096
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1955
2097
  timestampMs: timestampMs ?? String(Date.now()),
1956
2098
  type: "ACTIVITY_TYPE_DELETE_POLICY",
1957
2099
  };
@@ -1981,10 +2123,11 @@ class TurnkeySDKClientBase {
1981
2123
  return undefined;
1982
2124
  }
1983
2125
  const { organizationId, timestampMs, ...parameters } = input;
2126
+ const session = await this.storageManager?.getActiveSession();
1984
2127
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_key_tags";
1985
2128
  const bodyWithType = {
1986
2129
  parameters,
1987
- organizationId,
2130
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1988
2131
  timestampMs: timestampMs ?? String(Date.now()),
1989
2132
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
1990
2133
  };
@@ -2014,10 +2157,11 @@ class TurnkeySDKClientBase {
2014
2157
  return undefined;
2015
2158
  }
2016
2159
  const { organizationId, timestampMs, ...parameters } = input;
2160
+ const session = await this.storageManager?.getActiveSession();
2017
2161
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_keys";
2018
2162
  const bodyWithType = {
2019
2163
  parameters,
2020
- organizationId,
2164
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2021
2165
  timestampMs: timestampMs ?? String(Date.now()),
2022
2166
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
2023
2167
  };
@@ -2047,11 +2191,12 @@ class TurnkeySDKClientBase {
2047
2191
  return undefined;
2048
2192
  }
2049
2193
  const { organizationId, timestampMs, ...parameters } = input;
2194
+ const session = await this.storageManager?.getActiveSession();
2050
2195
  const fullUrl = this.config.apiBaseUrl +
2051
2196
  "/public/v1/submit/delete_smart_contract_interface";
2052
2197
  const bodyWithType = {
2053
2198
  parameters,
2054
- organizationId,
2199
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2055
2200
  timestampMs: timestampMs ?? String(Date.now()),
2056
2201
  type: "ACTIVITY_TYPE_DELETE_SMART_CONTRACT_INTERFACE",
2057
2202
  };
@@ -2081,10 +2226,11 @@ class TurnkeySDKClientBase {
2081
2226
  return undefined;
2082
2227
  }
2083
2228
  const { organizationId, timestampMs, ...parameters } = input;
2229
+ const session = await this.storageManager?.getActiveSession();
2084
2230
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_sub_organization";
2085
2231
  const bodyWithType = {
2086
2232
  parameters,
2087
- organizationId,
2233
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2088
2234
  timestampMs: timestampMs ?? String(Date.now()),
2089
2235
  type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
2090
2236
  };
@@ -2114,10 +2260,11 @@ class TurnkeySDKClientBase {
2114
2260
  return undefined;
2115
2261
  }
2116
2262
  const { organizationId, timestampMs, ...parameters } = input;
2263
+ const session = await this.storageManager?.getActiveSession();
2117
2264
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_user_tags";
2118
2265
  const bodyWithType = {
2119
2266
  parameters,
2120
- organizationId,
2267
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2121
2268
  timestampMs: timestampMs ?? String(Date.now()),
2122
2269
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
2123
2270
  };
@@ -2147,10 +2294,11 @@ class TurnkeySDKClientBase {
2147
2294
  return undefined;
2148
2295
  }
2149
2296
  const { organizationId, timestampMs, ...parameters } = input;
2297
+ const session = await this.storageManager?.getActiveSession();
2150
2298
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_users";
2151
2299
  const bodyWithType = {
2152
2300
  parameters,
2153
- organizationId,
2301
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2154
2302
  timestampMs: timestampMs ?? String(Date.now()),
2155
2303
  type: "ACTIVITY_TYPE_DELETE_USERS",
2156
2304
  };
@@ -2180,10 +2328,11 @@ class TurnkeySDKClientBase {
2180
2328
  return undefined;
2181
2329
  }
2182
2330
  const { organizationId, timestampMs, ...parameters } = input;
2331
+ const session = await this.storageManager?.getActiveSession();
2183
2332
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallet_accounts";
2184
2333
  const bodyWithType = {
2185
2334
  parameters,
2186
- organizationId,
2335
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2187
2336
  timestampMs: timestampMs ?? String(Date.now()),
2188
2337
  type: "ACTIVITY_TYPE_DELETE_WALLET_ACCOUNTS",
2189
2338
  };
@@ -2213,10 +2362,11 @@ class TurnkeySDKClientBase {
2213
2362
  return undefined;
2214
2363
  }
2215
2364
  const { organizationId, timestampMs, ...parameters } = input;
2365
+ const session = await this.storageManager?.getActiveSession();
2216
2366
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallets";
2217
2367
  const bodyWithType = {
2218
2368
  parameters,
2219
- organizationId,
2369
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2220
2370
  timestampMs: timestampMs ?? String(Date.now()),
2221
2371
  type: "ACTIVITY_TYPE_DELETE_WALLETS",
2222
2372
  };
@@ -2237,7 +2387,7 @@ class TurnkeySDKClientBase {
2237
2387
  session?.organizationId ??
2238
2388
  this.config.organizationId,
2239
2389
  timestampMs: timestampMs ?? String(Date.now()),
2240
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2390
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2241
2391
  }, "emailAuthResult", stampWith);
2242
2392
  };
2243
2393
  this.stampEmailAuth = async (input, stampWith) => {
@@ -2246,12 +2396,13 @@ class TurnkeySDKClientBase {
2246
2396
  return undefined;
2247
2397
  }
2248
2398
  const { organizationId, timestampMs, ...parameters } = input;
2399
+ const session = await this.storageManager?.getActiveSession();
2249
2400
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/email_auth";
2250
2401
  const bodyWithType = {
2251
2402
  parameters,
2252
- organizationId,
2403
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2253
2404
  timestampMs: timestampMs ?? String(Date.now()),
2254
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2405
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2255
2406
  };
2256
2407
  const stringifiedBody = JSON.stringify(bodyWithType);
2257
2408
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2279,10 +2430,11 @@ class TurnkeySDKClientBase {
2279
2430
  return undefined;
2280
2431
  }
2281
2432
  const { organizationId, timestampMs, ...parameters } = input;
2433
+ const session = await this.storageManager?.getActiveSession();
2282
2434
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_raw_transaction";
2283
2435
  const bodyWithType = {
2284
2436
  parameters,
2285
- organizationId,
2437
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2286
2438
  timestampMs: timestampMs ?? String(Date.now()),
2287
2439
  type: "ACTIVITY_TYPE_ETH_SEND_RAW_TRANSACTION",
2288
2440
  };
@@ -2312,10 +2464,11 @@ class TurnkeySDKClientBase {
2312
2464
  return undefined;
2313
2465
  }
2314
2466
  const { organizationId, timestampMs, ...parameters } = input;
2467
+ const session = await this.storageManager?.getActiveSession();
2315
2468
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_transaction";
2316
2469
  const bodyWithType = {
2317
2470
  parameters,
2318
- organizationId,
2471
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2319
2472
  timestampMs: timestampMs ?? String(Date.now()),
2320
2473
  type: "ACTIVITY_TYPE_ETH_SEND_TRANSACTION",
2321
2474
  };
@@ -2345,10 +2498,11 @@ class TurnkeySDKClientBase {
2345
2498
  return undefined;
2346
2499
  }
2347
2500
  const { organizationId, timestampMs, ...parameters } = input;
2501
+ const session = await this.storageManager?.getActiveSession();
2348
2502
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_private_key";
2349
2503
  const bodyWithType = {
2350
2504
  parameters,
2351
- organizationId,
2505
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2352
2506
  timestampMs: timestampMs ?? String(Date.now()),
2353
2507
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
2354
2508
  };
@@ -2378,10 +2532,11 @@ class TurnkeySDKClientBase {
2378
2532
  return undefined;
2379
2533
  }
2380
2534
  const { organizationId, timestampMs, ...parameters } = input;
2535
+ const session = await this.storageManager?.getActiveSession();
2381
2536
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet";
2382
2537
  const bodyWithType = {
2383
2538
  parameters,
2384
- organizationId,
2539
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2385
2540
  timestampMs: timestampMs ?? String(Date.now()),
2386
2541
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
2387
2542
  };
@@ -2411,10 +2566,11 @@ class TurnkeySDKClientBase {
2411
2566
  return undefined;
2412
2567
  }
2413
2568
  const { organizationId, timestampMs, ...parameters } = input;
2569
+ const session = await this.storageManager?.getActiveSession();
2414
2570
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet_account";
2415
2571
  const bodyWithType = {
2416
2572
  parameters,
2417
- organizationId,
2573
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2418
2574
  timestampMs: timestampMs ?? String(Date.now()),
2419
2575
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
2420
2576
  };
@@ -2444,10 +2600,11 @@ class TurnkeySDKClientBase {
2444
2600
  return undefined;
2445
2601
  }
2446
2602
  const { organizationId, timestampMs, ...parameters } = input;
2603
+ const session = await this.storageManager?.getActiveSession();
2447
2604
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_private_key";
2448
2605
  const bodyWithType = {
2449
2606
  parameters,
2450
- organizationId,
2607
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2451
2608
  timestampMs: timestampMs ?? String(Date.now()),
2452
2609
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
2453
2610
  };
@@ -2477,10 +2634,11 @@ class TurnkeySDKClientBase {
2477
2634
  return undefined;
2478
2635
  }
2479
2636
  const { organizationId, timestampMs, ...parameters } = input;
2637
+ const session = await this.storageManager?.getActiveSession();
2480
2638
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_wallet";
2481
2639
  const bodyWithType = {
2482
2640
  parameters,
2483
- organizationId,
2641
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2484
2642
  timestampMs: timestampMs ?? String(Date.now()),
2485
2643
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
2486
2644
  };
@@ -2510,10 +2668,11 @@ class TurnkeySDKClientBase {
2510
2668
  return undefined;
2511
2669
  }
2512
2670
  const { organizationId, timestampMs, ...parameters } = input;
2671
+ const session = await this.storageManager?.getActiveSession();
2513
2672
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_fiat_on_ramp";
2514
2673
  const bodyWithType = {
2515
2674
  parameters,
2516
- organizationId,
2675
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2517
2676
  timestampMs: timestampMs ?? String(Date.now()),
2518
2677
  type: "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
2519
2678
  };
@@ -2543,10 +2702,11 @@ class TurnkeySDKClientBase {
2543
2702
  return undefined;
2544
2703
  }
2545
2704
  const { organizationId, timestampMs, ...parameters } = input;
2705
+ const session = await this.storageManager?.getActiveSession();
2546
2706
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_private_key";
2547
2707
  const bodyWithType = {
2548
2708
  parameters,
2549
- organizationId,
2709
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2550
2710
  timestampMs: timestampMs ?? String(Date.now()),
2551
2711
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
2552
2712
  };
@@ -2576,10 +2736,11 @@ class TurnkeySDKClientBase {
2576
2736
  return undefined;
2577
2737
  }
2578
2738
  const { organizationId, timestampMs, ...parameters } = input;
2739
+ const session = await this.storageManager?.getActiveSession();
2579
2740
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_wallet";
2580
2741
  const bodyWithType = {
2581
2742
  parameters,
2582
- organizationId,
2743
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2583
2744
  timestampMs: timestampMs ?? String(Date.now()),
2584
2745
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
2585
2746
  };
@@ -2600,7 +2761,7 @@ class TurnkeySDKClientBase {
2600
2761
  session?.organizationId ??
2601
2762
  this.config.organizationId,
2602
2763
  timestampMs: timestampMs ?? String(Date.now()),
2603
- type: "ACTIVITY_TYPE_INIT_OTP",
2764
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2604
2765
  }, "initOtpResult", stampWith);
2605
2766
  };
2606
2767
  this.stampInitOtp = async (input, stampWith) => {
@@ -2609,12 +2770,13 @@ class TurnkeySDKClientBase {
2609
2770
  return undefined;
2610
2771
  }
2611
2772
  const { organizationId, timestampMs, ...parameters } = input;
2773
+ const session = await this.storageManager?.getActiveSession();
2612
2774
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
2613
2775
  const bodyWithType = {
2614
2776
  parameters,
2615
- organizationId,
2777
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2616
2778
  timestampMs: timestampMs ?? String(Date.now()),
2617
- type: "ACTIVITY_TYPE_INIT_OTP",
2779
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2618
2780
  };
2619
2781
  const stringifiedBody = JSON.stringify(bodyWithType);
2620
2782
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2633,7 +2795,7 @@ class TurnkeySDKClientBase {
2633
2795
  session?.organizationId ??
2634
2796
  this.config.organizationId,
2635
2797
  timestampMs: timestampMs ?? String(Date.now()),
2636
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2798
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2637
2799
  }, "initOtpAuthResult", stampWith);
2638
2800
  };
2639
2801
  this.stampInitOtpAuth = async (input, stampWith) => {
@@ -2642,12 +2804,13 @@ class TurnkeySDKClientBase {
2642
2804
  return undefined;
2643
2805
  }
2644
2806
  const { organizationId, timestampMs, ...parameters } = input;
2807
+ const session = await this.storageManager?.getActiveSession();
2645
2808
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp_auth";
2646
2809
  const bodyWithType = {
2647
2810
  parameters,
2648
- organizationId,
2811
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2649
2812
  timestampMs: timestampMs ?? String(Date.now()),
2650
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2813
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2651
2814
  };
2652
2815
  const stringifiedBody = JSON.stringify(bodyWithType);
2653
2816
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2666,7 +2829,7 @@ class TurnkeySDKClientBase {
2666
2829
  session?.organizationId ??
2667
2830
  this.config.organizationId,
2668
2831
  timestampMs: timestampMs ?? String(Date.now()),
2669
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2832
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2670
2833
  }, "initUserEmailRecoveryResult", stampWith);
2671
2834
  };
2672
2835
  this.stampInitUserEmailRecovery = async (input, stampWith) => {
@@ -2675,12 +2838,13 @@ class TurnkeySDKClientBase {
2675
2838
  return undefined;
2676
2839
  }
2677
2840
  const { organizationId, timestampMs, ...parameters } = input;
2841
+ const session = await this.storageManager?.getActiveSession();
2678
2842
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_user_email_recovery";
2679
2843
  const bodyWithType = {
2680
2844
  parameters,
2681
- organizationId,
2845
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2682
2846
  timestampMs: timestampMs ?? String(Date.now()),
2683
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2847
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2684
2848
  };
2685
2849
  const stringifiedBody = JSON.stringify(bodyWithType);
2686
2850
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2708,10 +2872,11 @@ class TurnkeySDKClientBase {
2708
2872
  return undefined;
2709
2873
  }
2710
2874
  const { organizationId, timestampMs, ...parameters } = input;
2875
+ const session = await this.storageManager?.getActiveSession();
2711
2876
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth";
2712
2877
  const bodyWithType = {
2713
2878
  parameters,
2714
- organizationId,
2879
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2715
2880
  timestampMs: timestampMs ?? String(Date.now()),
2716
2881
  type: "ACTIVITY_TYPE_OAUTH",
2717
2882
  };
@@ -2741,10 +2906,11 @@ class TurnkeySDKClientBase {
2741
2906
  return undefined;
2742
2907
  }
2743
2908
  const { organizationId, timestampMs, ...parameters } = input;
2909
+ const session = await this.storageManager?.getActiveSession();
2744
2910
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth2_authenticate";
2745
2911
  const bodyWithType = {
2746
2912
  parameters,
2747
- organizationId,
2913
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2748
2914
  timestampMs: timestampMs ?? String(Date.now()),
2749
2915
  type: "ACTIVITY_TYPE_OAUTH2AUTHENTICATE",
2750
2916
  };
@@ -2774,10 +2940,11 @@ class TurnkeySDKClientBase {
2774
2940
  return undefined;
2775
2941
  }
2776
2942
  const { organizationId, timestampMs, ...parameters } = input;
2943
+ const session = await this.storageManager?.getActiveSession();
2777
2944
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
2778
2945
  const bodyWithType = {
2779
2946
  parameters,
2780
- organizationId,
2947
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2781
2948
  timestampMs: timestampMs ?? String(Date.now()),
2782
2949
  type: "ACTIVITY_TYPE_OAUTH_LOGIN",
2783
2950
  };
@@ -2807,10 +2974,11 @@ class TurnkeySDKClientBase {
2807
2974
  return undefined;
2808
2975
  }
2809
2976
  const { organizationId, timestampMs, ...parameters } = input;
2977
+ const session = await this.storageManager?.getActiveSession();
2810
2978
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_auth";
2811
2979
  const bodyWithType = {
2812
2980
  parameters,
2813
- organizationId,
2981
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2814
2982
  timestampMs: timestampMs ?? String(Date.now()),
2815
2983
  type: "ACTIVITY_TYPE_OTP_AUTH",
2816
2984
  };
@@ -2840,10 +3008,11 @@ class TurnkeySDKClientBase {
2840
3008
  return undefined;
2841
3009
  }
2842
3010
  const { organizationId, timestampMs, ...parameters } = input;
3011
+ const session = await this.storageManager?.getActiveSession();
2843
3012
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
2844
3013
  const bodyWithType = {
2845
3014
  parameters,
2846
- organizationId,
3015
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2847
3016
  timestampMs: timestampMs ?? String(Date.now()),
2848
3017
  type: "ACTIVITY_TYPE_OTP_LOGIN",
2849
3018
  };
@@ -2873,10 +3042,11 @@ class TurnkeySDKClientBase {
2873
3042
  return undefined;
2874
3043
  }
2875
3044
  const { organizationId, timestampMs, ...parameters } = input;
3045
+ const session = await this.storageManager?.getActiveSession();
2876
3046
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/recover_user";
2877
3047
  const bodyWithType = {
2878
3048
  parameters,
2879
- organizationId,
3049
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2880
3050
  timestampMs: timestampMs ?? String(Date.now()),
2881
3051
  type: "ACTIVITY_TYPE_RECOVER_USER",
2882
3052
  };
@@ -2906,10 +3076,11 @@ class TurnkeySDKClientBase {
2906
3076
  return undefined;
2907
3077
  }
2908
3078
  const { organizationId, timestampMs, ...parameters } = input;
3079
+ const session = await this.storageManager?.getActiveSession();
2909
3080
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/reject_activity";
2910
3081
  const bodyWithType = {
2911
3082
  parameters,
2912
- organizationId,
3083
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2913
3084
  timestampMs: timestampMs ?? String(Date.now()),
2914
3085
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
2915
3086
  };
@@ -2939,10 +3110,11 @@ class TurnkeySDKClientBase {
2939
3110
  return undefined;
2940
3111
  }
2941
3112
  const { organizationId, timestampMs, ...parameters } = input;
3113
+ const session = await this.storageManager?.getActiveSession();
2942
3114
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/remove_organization_feature";
2943
3115
  const bodyWithType = {
2944
3116
  parameters,
2945
- organizationId,
3117
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2946
3118
  timestampMs: timestampMs ?? String(Date.now()),
2947
3119
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
2948
3120
  };
@@ -2972,10 +3144,11 @@ class TurnkeySDKClientBase {
2972
3144
  return undefined;
2973
3145
  }
2974
3146
  const { organizationId, timestampMs, ...parameters } = input;
3147
+ const session = await this.storageManager?.getActiveSession();
2975
3148
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/set_organization_feature";
2976
3149
  const bodyWithType = {
2977
3150
  parameters,
2978
- organizationId,
3151
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2979
3152
  timestampMs: timestampMs ?? String(Date.now()),
2980
3153
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
2981
3154
  };
@@ -3005,10 +3178,11 @@ class TurnkeySDKClientBase {
3005
3178
  return undefined;
3006
3179
  }
3007
3180
  const { organizationId, timestampMs, ...parameters } = input;
3181
+ const session = await this.storageManager?.getActiveSession();
3008
3182
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payload";
3009
3183
  const bodyWithType = {
3010
3184
  parameters,
3011
- organizationId,
3185
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3012
3186
  timestampMs: timestampMs ?? String(Date.now()),
3013
3187
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
3014
3188
  };
@@ -3038,10 +3212,11 @@ class TurnkeySDKClientBase {
3038
3212
  return undefined;
3039
3213
  }
3040
3214
  const { organizationId, timestampMs, ...parameters } = input;
3215
+ const session = await this.storageManager?.getActiveSession();
3041
3216
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payloads";
3042
3217
  const bodyWithType = {
3043
3218
  parameters,
3044
- organizationId,
3219
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3045
3220
  timestampMs: timestampMs ?? String(Date.now()),
3046
3221
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
3047
3222
  };
@@ -3071,10 +3246,11 @@ class TurnkeySDKClientBase {
3071
3246
  return undefined;
3072
3247
  }
3073
3248
  const { organizationId, timestampMs, ...parameters } = input;
3249
+ const session = await this.storageManager?.getActiveSession();
3074
3250
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_transaction";
3075
3251
  const bodyWithType = {
3076
3252
  parameters,
3077
- organizationId,
3253
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3078
3254
  timestampMs: timestampMs ?? String(Date.now()),
3079
3255
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
3080
3256
  };
@@ -3104,10 +3280,11 @@ class TurnkeySDKClientBase {
3104
3280
  return undefined;
3105
3281
  }
3106
3282
  const { organizationId, timestampMs, ...parameters } = input;
3283
+ const session = await this.storageManager?.getActiveSession();
3107
3284
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
3108
3285
  const bodyWithType = {
3109
3286
  parameters,
3110
- organizationId,
3287
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3111
3288
  timestampMs: timestampMs ?? String(Date.now()),
3112
3289
  type: "ACTIVITY_TYPE_STAMP_LOGIN",
3113
3290
  };
@@ -3137,11 +3314,12 @@ class TurnkeySDKClientBase {
3137
3314
  return undefined;
3138
3315
  }
3139
3316
  const { organizationId, timestampMs, ...parameters } = input;
3317
+ const session = await this.storageManager?.getActiveSession();
3140
3318
  const fullUrl = this.config.apiBaseUrl +
3141
3319
  "/public/v1/submit/update_fiat_on_ramp_credential";
3142
3320
  const bodyWithType = {
3143
3321
  parameters,
3144
- organizationId,
3322
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3145
3323
  timestampMs: timestampMs ?? String(Date.now()),
3146
3324
  type: "ACTIVITY_TYPE_UPDATE_FIAT_ON_RAMP_CREDENTIAL",
3147
3325
  };
@@ -3171,10 +3349,11 @@ class TurnkeySDKClientBase {
3171
3349
  return undefined;
3172
3350
  }
3173
3351
  const { organizationId, timestampMs, ...parameters } = input;
3352
+ const session = await this.storageManager?.getActiveSession();
3174
3353
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_oauth2_credential";
3175
3354
  const bodyWithType = {
3176
3355
  parameters,
3177
- organizationId,
3356
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3178
3357
  timestampMs: timestampMs ?? String(Date.now()),
3179
3358
  type: "ACTIVITY_TYPE_UPDATE_OAUTH2CREDENTIAL",
3180
3359
  };
@@ -3204,10 +3383,11 @@ class TurnkeySDKClientBase {
3204
3383
  return undefined;
3205
3384
  }
3206
3385
  const { organizationId, timestampMs, ...parameters } = input;
3386
+ const session = await this.storageManager?.getActiveSession();
3207
3387
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_policy";
3208
3388
  const bodyWithType = {
3209
3389
  parameters,
3210
- organizationId,
3390
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3211
3391
  timestampMs: timestampMs ?? String(Date.now()),
3212
3392
  type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
3213
3393
  };
@@ -3237,10 +3417,11 @@ class TurnkeySDKClientBase {
3237
3417
  return undefined;
3238
3418
  }
3239
3419
  const { organizationId, timestampMs, ...parameters } = input;
3420
+ const session = await this.storageManager?.getActiveSession();
3240
3421
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_private_key_tag";
3241
3422
  const bodyWithType = {
3242
3423
  parameters,
3243
- organizationId,
3424
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3244
3425
  timestampMs: timestampMs ?? String(Date.now()),
3245
3426
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
3246
3427
  };
@@ -3270,10 +3451,11 @@ class TurnkeySDKClientBase {
3270
3451
  return undefined;
3271
3452
  }
3272
3453
  const { organizationId, timestampMs, ...parameters } = input;
3454
+ const session = await this.storageManager?.getActiveSession();
3273
3455
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_root_quorum";
3274
3456
  const bodyWithType = {
3275
3457
  parameters,
3276
- organizationId,
3458
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3277
3459
  timestampMs: timestampMs ?? String(Date.now()),
3278
3460
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
3279
3461
  };
@@ -3303,10 +3485,11 @@ class TurnkeySDKClientBase {
3303
3485
  return undefined;
3304
3486
  }
3305
3487
  const { organizationId, timestampMs, ...parameters } = input;
3488
+ const session = await this.storageManager?.getActiveSession();
3306
3489
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user";
3307
3490
  const bodyWithType = {
3308
3491
  parameters,
3309
- organizationId,
3492
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3310
3493
  timestampMs: timestampMs ?? String(Date.now()),
3311
3494
  type: "ACTIVITY_TYPE_UPDATE_USER",
3312
3495
  };
@@ -3336,10 +3519,11 @@ class TurnkeySDKClientBase {
3336
3519
  return undefined;
3337
3520
  }
3338
3521
  const { organizationId, timestampMs, ...parameters } = input;
3522
+ const session = await this.storageManager?.getActiveSession();
3339
3523
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_email";
3340
3524
  const bodyWithType = {
3341
3525
  parameters,
3342
- organizationId,
3526
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3343
3527
  timestampMs: timestampMs ?? String(Date.now()),
3344
3528
  type: "ACTIVITY_TYPE_UPDATE_USER_EMAIL",
3345
3529
  };
@@ -3369,10 +3553,11 @@ class TurnkeySDKClientBase {
3369
3553
  return undefined;
3370
3554
  }
3371
3555
  const { organizationId, timestampMs, ...parameters } = input;
3556
+ const session = await this.storageManager?.getActiveSession();
3372
3557
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_name";
3373
3558
  const bodyWithType = {
3374
3559
  parameters,
3375
- organizationId,
3560
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3376
3561
  timestampMs: timestampMs ?? String(Date.now()),
3377
3562
  type: "ACTIVITY_TYPE_UPDATE_USER_NAME",
3378
3563
  };
@@ -3402,10 +3587,11 @@ class TurnkeySDKClientBase {
3402
3587
  return undefined;
3403
3588
  }
3404
3589
  const { organizationId, timestampMs, ...parameters } = input;
3590
+ const session = await this.storageManager?.getActiveSession();
3405
3591
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_phone_number";
3406
3592
  const bodyWithType = {
3407
3593
  parameters,
3408
- organizationId,
3594
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3409
3595
  timestampMs: timestampMs ?? String(Date.now()),
3410
3596
  type: "ACTIVITY_TYPE_UPDATE_USER_PHONE_NUMBER",
3411
3597
  };
@@ -3435,10 +3621,11 @@ class TurnkeySDKClientBase {
3435
3621
  return undefined;
3436
3622
  }
3437
3623
  const { organizationId, timestampMs, ...parameters } = input;
3624
+ const session = await this.storageManager?.getActiveSession();
3438
3625
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_tag";
3439
3626
  const bodyWithType = {
3440
3627
  parameters,
3441
- organizationId,
3628
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3442
3629
  timestampMs: timestampMs ?? String(Date.now()),
3443
3630
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
3444
3631
  };
@@ -3468,10 +3655,11 @@ class TurnkeySDKClientBase {
3468
3655
  return undefined;
3469
3656
  }
3470
3657
  const { organizationId, timestampMs, ...parameters } = input;
3658
+ const session = await this.storageManager?.getActiveSession();
3471
3659
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_wallet";
3472
3660
  const bodyWithType = {
3473
3661
  parameters,
3474
- organizationId,
3662
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3475
3663
  timestampMs: timestampMs ?? String(Date.now()),
3476
3664
  type: "ACTIVITY_TYPE_UPDATE_WALLET",
3477
3665
  };
@@ -3501,10 +3689,11 @@ class TurnkeySDKClientBase {
3501
3689
  return undefined;
3502
3690
  }
3503
3691
  const { organizationId, timestampMs, ...parameters } = input;
3692
+ const session = await this.storageManager?.getActiveSession();
3504
3693
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
3505
3694
  const bodyWithType = {
3506
3695
  parameters,
3507
- organizationId,
3696
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3508
3697
  timestampMs: timestampMs ?? String(Date.now()),
3509
3698
  type: "ACTIVITY_TYPE_VERIFY_OTP",
3510
3699
  };
@@ -3530,10 +3719,13 @@ class TurnkeySDKClientBase {
3530
3719
  if (!activeStamper) {
3531
3720
  return undefined;
3532
3721
  }
3722
+ const session = await this.storageManager?.getActiveSession();
3533
3723
  const fullUrl = this.config.apiBaseUrl + "/tkhq/api/v1/test_rate_limits";
3534
3724
  const body = {
3535
3725
  ...input,
3536
- organizationId: input.organizationId,
3726
+ organizationId: input.organizationId ??
3727
+ session?.organizationId ??
3728
+ this.config.organizationId,
3537
3729
  };
3538
3730
  const stringifiedBody = JSON.stringify(body);
3539
3731
  const stamp = await activeStamper.stamp(stringifiedBody);