@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
@@ -21,10 +21,13 @@ class TurnkeySDKClientBase {
21
21
  if (!activeStamper) {
22
22
  return undefined;
23
23
  }
24
+ const session = await this.storageManager?.getActiveSession();
24
25
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_activity";
25
26
  const body = {
26
27
  ...input,
27
- organizationId: input.organizationId,
28
+ organizationId: input.organizationId ??
29
+ session?.organizationId ??
30
+ this.config.organizationId,
28
31
  };
29
32
  const stringifiedBody = JSON.stringify(body);
30
33
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -48,10 +51,13 @@ class TurnkeySDKClientBase {
48
51
  if (!activeStamper) {
49
52
  return undefined;
50
53
  }
54
+ const session = await this.storageManager?.getActiveSession();
51
55
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_api_key";
52
56
  const body = {
53
57
  ...input,
54
- organizationId: input.organizationId,
58
+ organizationId: input.organizationId ??
59
+ session?.organizationId ??
60
+ this.config.organizationId,
55
61
  };
56
62
  const stringifiedBody = JSON.stringify(body);
57
63
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -75,10 +81,13 @@ class TurnkeySDKClientBase {
75
81
  if (!activeStamper) {
76
82
  return undefined;
77
83
  }
84
+ const session = await this.storageManager?.getActiveSession();
78
85
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_api_keys";
79
86
  const body = {
80
87
  ...input,
81
- organizationId: input.organizationId,
88
+ organizationId: input.organizationId ??
89
+ session?.organizationId ??
90
+ this.config.organizationId,
82
91
  };
83
92
  const stringifiedBody = JSON.stringify(body);
84
93
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -102,10 +111,13 @@ class TurnkeySDKClientBase {
102
111
  if (!activeStamper) {
103
112
  return undefined;
104
113
  }
114
+ const session = await this.storageManager?.getActiveSession();
105
115
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_attestation";
106
116
  const body = {
107
117
  ...input,
108
- organizationId: input.organizationId,
118
+ organizationId: input.organizationId ??
119
+ session?.organizationId ??
120
+ this.config.organizationId,
109
121
  };
110
122
  const stringifiedBody = JSON.stringify(body);
111
123
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -129,10 +141,13 @@ class TurnkeySDKClientBase {
129
141
  if (!activeStamper) {
130
142
  return undefined;
131
143
  }
144
+ const session = await this.storageManager?.getActiveSession();
132
145
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_authenticator";
133
146
  const body = {
134
147
  ...input,
135
- organizationId: input.organizationId,
148
+ organizationId: input.organizationId ??
149
+ session?.organizationId ??
150
+ this.config.organizationId,
136
151
  };
137
152
  const stringifiedBody = JSON.stringify(body);
138
153
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -156,10 +171,13 @@ class TurnkeySDKClientBase {
156
171
  if (!activeStamper) {
157
172
  return undefined;
158
173
  }
174
+ const session = await this.storageManager?.getActiveSession();
159
175
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_authenticators";
160
176
  const body = {
161
177
  ...input,
162
- organizationId: input.organizationId,
178
+ organizationId: input.organizationId ??
179
+ session?.organizationId ??
180
+ this.config.organizationId,
163
181
  };
164
182
  const stringifiedBody = JSON.stringify(body);
165
183
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -183,10 +201,13 @@ class TurnkeySDKClientBase {
183
201
  if (!activeStamper) {
184
202
  return undefined;
185
203
  }
204
+ const session = await this.storageManager?.getActiveSession();
186
205
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_boot_proof";
187
206
  const body = {
188
207
  ...input,
189
- organizationId: input.organizationId,
208
+ organizationId: input.organizationId ??
209
+ session?.organizationId ??
210
+ this.config.organizationId,
190
211
  };
191
212
  const stringifiedBody = JSON.stringify(body);
192
213
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -210,10 +231,13 @@ class TurnkeySDKClientBase {
210
231
  if (!activeStamper) {
211
232
  return undefined;
212
233
  }
234
+ const session = await this.storageManager?.getActiveSession();
213
235
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_gas_usage";
214
236
  const body = {
215
237
  ...input,
216
- organizationId: input.organizationId,
238
+ organizationId: input.organizationId ??
239
+ session?.organizationId ??
240
+ this.config.organizationId,
217
241
  };
218
242
  const stringifiedBody = JSON.stringify(body);
219
243
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -237,10 +261,13 @@ class TurnkeySDKClientBase {
237
261
  if (!activeStamper) {
238
262
  return undefined;
239
263
  }
264
+ const session = await this.storageManager?.getActiveSession();
240
265
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_latest_boot_proof";
241
266
  const body = {
242
267
  ...input,
243
- organizationId: input.organizationId,
268
+ organizationId: input.organizationId ??
269
+ session?.organizationId ??
270
+ this.config.organizationId,
244
271
  };
245
272
  const stringifiedBody = JSON.stringify(body);
246
273
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -264,10 +291,13 @@ class TurnkeySDKClientBase {
264
291
  if (!activeStamper) {
265
292
  return undefined;
266
293
  }
294
+ const session = await this.storageManager?.getActiveSession();
267
295
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_nonces";
268
296
  const body = {
269
297
  ...input,
270
- organizationId: input.organizationId,
298
+ organizationId: input.organizationId ??
299
+ session?.organizationId ??
300
+ this.config.organizationId,
271
301
  };
272
302
  const stringifiedBody = JSON.stringify(body);
273
303
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -291,10 +321,13 @@ class TurnkeySDKClientBase {
291
321
  if (!activeStamper) {
292
322
  return undefined;
293
323
  }
324
+ const session = await this.storageManager?.getActiveSession();
294
325
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth2_credential";
295
326
  const body = {
296
327
  ...input,
297
- organizationId: input.organizationId,
328
+ organizationId: input.organizationId ??
329
+ session?.organizationId ??
330
+ this.config.organizationId,
298
331
  };
299
332
  const stringifiedBody = JSON.stringify(body);
300
333
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -318,10 +351,13 @@ class TurnkeySDKClientBase {
318
351
  if (!activeStamper) {
319
352
  return undefined;
320
353
  }
354
+ const session = await this.storageManager?.getActiveSession();
321
355
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth_providers";
322
356
  const body = {
323
357
  ...input,
324
- organizationId: input.organizationId,
358
+ organizationId: input.organizationId ??
359
+ session?.organizationId ??
360
+ this.config.organizationId,
325
361
  };
326
362
  const stringifiedBody = JSON.stringify(body);
327
363
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -345,10 +381,13 @@ class TurnkeySDKClientBase {
345
381
  if (!activeStamper) {
346
382
  return undefined;
347
383
  }
384
+ const session = await this.storageManager?.getActiveSession();
348
385
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_onramp_transaction_status";
349
386
  const body = {
350
387
  ...input,
351
- organizationId: input.organizationId,
388
+ organizationId: input.organizationId ??
389
+ session?.organizationId ??
390
+ this.config.organizationId,
352
391
  };
353
392
  const stringifiedBody = JSON.stringify(body);
354
393
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -372,10 +411,13 @@ class TurnkeySDKClientBase {
372
411
  if (!activeStamper) {
373
412
  return undefined;
374
413
  }
414
+ const session = await this.storageManager?.getActiveSession();
375
415
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization";
376
416
  const body = {
377
417
  ...input,
378
- organizationId: input.organizationId,
418
+ organizationId: input.organizationId ??
419
+ session?.organizationId ??
420
+ this.config.organizationId,
379
421
  };
380
422
  const stringifiedBody = JSON.stringify(body);
381
423
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -399,10 +441,13 @@ class TurnkeySDKClientBase {
399
441
  if (!activeStamper) {
400
442
  return undefined;
401
443
  }
444
+ const session = await this.storageManager?.getActiveSession();
402
445
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization_configs";
403
446
  const body = {
404
447
  ...input,
405
- organizationId: input.organizationId,
448
+ organizationId: input.organizationId ??
449
+ session?.organizationId ??
450
+ this.config.organizationId,
406
451
  };
407
452
  const stringifiedBody = JSON.stringify(body);
408
453
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -426,10 +471,13 @@ class TurnkeySDKClientBase {
426
471
  if (!activeStamper) {
427
472
  return undefined;
428
473
  }
474
+ const session = await this.storageManager?.getActiveSession();
429
475
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy";
430
476
  const body = {
431
477
  ...input,
432
- organizationId: input.organizationId,
478
+ organizationId: input.organizationId ??
479
+ session?.organizationId ??
480
+ this.config.organizationId,
433
481
  };
434
482
  const stringifiedBody = JSON.stringify(body);
435
483
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -453,10 +501,13 @@ class TurnkeySDKClientBase {
453
501
  if (!activeStamper) {
454
502
  return undefined;
455
503
  }
504
+ const session = await this.storageManager?.getActiveSession();
456
505
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy_evaluations";
457
506
  const body = {
458
507
  ...input,
459
- organizationId: input.organizationId,
508
+ organizationId: input.organizationId ??
509
+ session?.organizationId ??
510
+ this.config.organizationId,
460
511
  };
461
512
  const stringifiedBody = JSON.stringify(body);
462
513
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -480,10 +531,13 @@ class TurnkeySDKClientBase {
480
531
  if (!activeStamper) {
481
532
  return undefined;
482
533
  }
534
+ const session = await this.storageManager?.getActiveSession();
483
535
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_private_key";
484
536
  const body = {
485
537
  ...input,
486
- organizationId: input.organizationId,
538
+ organizationId: input.organizationId ??
539
+ session?.organizationId ??
540
+ this.config.organizationId,
487
541
  };
488
542
  const stringifiedBody = JSON.stringify(body);
489
543
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -507,10 +561,13 @@ class TurnkeySDKClientBase {
507
561
  if (!activeStamper) {
508
562
  return undefined;
509
563
  }
564
+ const session = await this.storageManager?.getActiveSession();
510
565
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_send_transaction_status";
511
566
  const body = {
512
567
  ...input,
513
- organizationId: input.organizationId,
568
+ organizationId: input.organizationId ??
569
+ session?.organizationId ??
570
+ this.config.organizationId,
514
571
  };
515
572
  const stringifiedBody = JSON.stringify(body);
516
573
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -534,10 +591,13 @@ class TurnkeySDKClientBase {
534
591
  if (!activeStamper) {
535
592
  return undefined;
536
593
  }
594
+ const session = await this.storageManager?.getActiveSession();
537
595
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_smart_contract_interface";
538
596
  const body = {
539
597
  ...input,
540
- organizationId: input.organizationId,
598
+ organizationId: input.organizationId ??
599
+ session?.organizationId ??
600
+ this.config.organizationId,
541
601
  };
542
602
  const stringifiedBody = JSON.stringify(body);
543
603
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -561,10 +621,13 @@ class TurnkeySDKClientBase {
561
621
  if (!activeStamper) {
562
622
  return undefined;
563
623
  }
624
+ const session = await this.storageManager?.getActiveSession();
564
625
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_user";
565
626
  const body = {
566
627
  ...input,
567
- organizationId: input.organizationId,
628
+ organizationId: input.organizationId ??
629
+ session?.organizationId ??
630
+ this.config.organizationId,
568
631
  };
569
632
  const stringifiedBody = JSON.stringify(body);
570
633
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -588,10 +651,13 @@ class TurnkeySDKClientBase {
588
651
  if (!activeStamper) {
589
652
  return undefined;
590
653
  }
654
+ const session = await this.storageManager?.getActiveSession();
591
655
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet";
592
656
  const body = {
593
657
  ...input,
594
- organizationId: input.organizationId,
658
+ organizationId: input.organizationId ??
659
+ session?.organizationId ??
660
+ this.config.organizationId,
595
661
  };
596
662
  const stringifiedBody = JSON.stringify(body);
597
663
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -615,10 +681,13 @@ class TurnkeySDKClientBase {
615
681
  if (!activeStamper) {
616
682
  return undefined;
617
683
  }
684
+ const session = await this.storageManager?.getActiveSession();
618
685
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet_account";
619
686
  const body = {
620
687
  ...input,
621
- organizationId: input.organizationId,
688
+ organizationId: input.organizationId ??
689
+ session?.organizationId ??
690
+ this.config.organizationId,
622
691
  };
623
692
  const stringifiedBody = JSON.stringify(body);
624
693
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -642,10 +711,13 @@ class TurnkeySDKClientBase {
642
711
  if (!activeStamper) {
643
712
  return undefined;
644
713
  }
714
+ const session = await this.storageManager?.getActiveSession();
645
715
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_activities";
646
716
  const body = {
647
717
  ...input,
648
- organizationId: input.organizationId,
718
+ organizationId: input.organizationId ??
719
+ session?.organizationId ??
720
+ this.config.organizationId,
649
721
  };
650
722
  const stringifiedBody = JSON.stringify(body);
651
723
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -669,10 +741,13 @@ class TurnkeySDKClientBase {
669
741
  if (!activeStamper) {
670
742
  return undefined;
671
743
  }
744
+ const session = await this.storageManager?.getActiveSession();
672
745
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_app_proofs";
673
746
  const body = {
674
747
  ...input,
675
- organizationId: input.organizationId,
748
+ organizationId: input.organizationId ??
749
+ session?.organizationId ??
750
+ this.config.organizationId,
676
751
  };
677
752
  const stringifiedBody = JSON.stringify(body);
678
753
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -696,10 +771,13 @@ class TurnkeySDKClientBase {
696
771
  if (!activeStamper) {
697
772
  return undefined;
698
773
  }
774
+ const session = await this.storageManager?.getActiveSession();
699
775
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_fiat_on_ramp_credentials";
700
776
  const body = {
701
777
  ...input,
702
- organizationId: input.organizationId,
778
+ organizationId: input.organizationId ??
779
+ session?.organizationId ??
780
+ this.config.organizationId,
703
781
  };
704
782
  const stringifiedBody = JSON.stringify(body);
705
783
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -723,10 +801,13 @@ class TurnkeySDKClientBase {
723
801
  if (!activeStamper) {
724
802
  return undefined;
725
803
  }
804
+ const session = await this.storageManager?.getActiveSession();
726
805
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_oauth2_credentials";
727
806
  const body = {
728
807
  ...input,
729
- organizationId: input.organizationId,
808
+ organizationId: input.organizationId ??
809
+ session?.organizationId ??
810
+ this.config.organizationId,
730
811
  };
731
812
  const stringifiedBody = JSON.stringify(body);
732
813
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -750,10 +831,13 @@ class TurnkeySDKClientBase {
750
831
  if (!activeStamper) {
751
832
  return undefined;
752
833
  }
834
+ const session = await this.storageManager?.getActiveSession();
753
835
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_policies";
754
836
  const body = {
755
837
  ...input,
756
- organizationId: input.organizationId,
838
+ organizationId: input.organizationId ??
839
+ session?.organizationId ??
840
+ this.config.organizationId,
757
841
  };
758
842
  const stringifiedBody = JSON.stringify(body);
759
843
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -777,10 +861,13 @@ class TurnkeySDKClientBase {
777
861
  if (!activeStamper) {
778
862
  return undefined;
779
863
  }
864
+ const session = await this.storageManager?.getActiveSession();
780
865
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_key_tags";
781
866
  const body = {
782
867
  ...input,
783
- organizationId: input.organizationId,
868
+ organizationId: input.organizationId ??
869
+ session?.organizationId ??
870
+ this.config.organizationId,
784
871
  };
785
872
  const stringifiedBody = JSON.stringify(body);
786
873
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -804,10 +891,13 @@ class TurnkeySDKClientBase {
804
891
  if (!activeStamper) {
805
892
  return undefined;
806
893
  }
894
+ const session = await this.storageManager?.getActiveSession();
807
895
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_keys";
808
896
  const body = {
809
897
  ...input,
810
- organizationId: input.organizationId,
898
+ organizationId: input.organizationId ??
899
+ session?.organizationId ??
900
+ this.config.organizationId,
811
901
  };
812
902
  const stringifiedBody = JSON.stringify(body);
813
903
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -831,11 +921,14 @@ class TurnkeySDKClientBase {
831
921
  if (!activeStamper) {
832
922
  return undefined;
833
923
  }
924
+ const session = await this.storageManager?.getActiveSession();
834
925
  const fullUrl = this.config.apiBaseUrl +
835
926
  "/public/v1/query/list_smart_contract_interfaces";
836
927
  const body = {
837
928
  ...input,
838
- organizationId: input.organizationId,
929
+ organizationId: input.organizationId ??
930
+ session?.organizationId ??
931
+ this.config.organizationId,
839
932
  };
840
933
  const stringifiedBody = JSON.stringify(body);
841
934
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -859,10 +952,13 @@ class TurnkeySDKClientBase {
859
952
  if (!activeStamper) {
860
953
  return undefined;
861
954
  }
955
+ const session = await this.storageManager?.getActiveSession();
862
956
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_suborgs";
863
957
  const body = {
864
958
  ...input,
865
- organizationId: input.organizationId,
959
+ organizationId: input.organizationId ??
960
+ session?.organizationId ??
961
+ this.config.organizationId,
866
962
  };
867
963
  const stringifiedBody = JSON.stringify(body);
868
964
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -886,10 +982,13 @@ class TurnkeySDKClientBase {
886
982
  if (!activeStamper) {
887
983
  return undefined;
888
984
  }
985
+ const session = await this.storageManager?.getActiveSession();
889
986
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_user_tags";
890
987
  const body = {
891
988
  ...input,
892
- organizationId: input.organizationId,
989
+ organizationId: input.organizationId ??
990
+ session?.organizationId ??
991
+ this.config.organizationId,
893
992
  };
894
993
  const stringifiedBody = JSON.stringify(body);
895
994
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -913,10 +1012,13 @@ class TurnkeySDKClientBase {
913
1012
  if (!activeStamper) {
914
1013
  return undefined;
915
1014
  }
1015
+ const session = await this.storageManager?.getActiveSession();
916
1016
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_users";
917
1017
  const body = {
918
1018
  ...input,
919
- organizationId: input.organizationId,
1019
+ organizationId: input.organizationId ??
1020
+ session?.organizationId ??
1021
+ this.config.organizationId,
920
1022
  };
921
1023
  const stringifiedBody = JSON.stringify(body);
922
1024
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -940,10 +1042,13 @@ class TurnkeySDKClientBase {
940
1042
  if (!activeStamper) {
941
1043
  return undefined;
942
1044
  }
1045
+ const session = await this.storageManager?.getActiveSession();
943
1046
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_verified_suborgs";
944
1047
  const body = {
945
1048
  ...input,
946
- organizationId: input.organizationId,
1049
+ organizationId: input.organizationId ??
1050
+ session?.organizationId ??
1051
+ this.config.organizationId,
947
1052
  };
948
1053
  const stringifiedBody = JSON.stringify(body);
949
1054
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -967,10 +1072,13 @@ class TurnkeySDKClientBase {
967
1072
  if (!activeStamper) {
968
1073
  return undefined;
969
1074
  }
1075
+ const session = await this.storageManager?.getActiveSession();
970
1076
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallet_accounts";
971
1077
  const body = {
972
1078
  ...input,
973
- organizationId: input.organizationId,
1079
+ organizationId: input.organizationId ??
1080
+ session?.organizationId ??
1081
+ this.config.organizationId,
974
1082
  };
975
1083
  const stringifiedBody = JSON.stringify(body);
976
1084
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -994,10 +1102,13 @@ class TurnkeySDKClientBase {
994
1102
  if (!activeStamper) {
995
1103
  return undefined;
996
1104
  }
1105
+ const session = await this.storageManager?.getActiveSession();
997
1106
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallets";
998
1107
  const body = {
999
1108
  ...input,
1000
- organizationId: input.organizationId,
1109
+ organizationId: input.organizationId ??
1110
+ session?.organizationId ??
1111
+ this.config.organizationId,
1001
1112
  };
1002
1113
  const stringifiedBody = JSON.stringify(body);
1003
1114
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -1021,10 +1132,13 @@ class TurnkeySDKClientBase {
1021
1132
  if (!activeStamper) {
1022
1133
  return undefined;
1023
1134
  }
1135
+ const session = await this.storageManager?.getActiveSession();
1024
1136
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/whoami";
1025
1137
  const body = {
1026
1138
  ...input,
1027
- organizationId: input.organizationId,
1139
+ organizationId: input.organizationId ??
1140
+ session?.organizationId ??
1141
+ this.config.organizationId,
1028
1142
  };
1029
1143
  const stringifiedBody = JSON.stringify(body);
1030
1144
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -1052,10 +1166,11 @@ class TurnkeySDKClientBase {
1052
1166
  return undefined;
1053
1167
  }
1054
1168
  const { organizationId, timestampMs, ...parameters } = input;
1169
+ const session = await this.storageManager?.getActiveSession();
1055
1170
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/approve_activity";
1056
1171
  const bodyWithType = {
1057
1172
  parameters,
1058
- organizationId,
1173
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1059
1174
  timestampMs: timestampMs ?? String(Date.now()),
1060
1175
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
1061
1176
  };
@@ -1085,10 +1200,11 @@ class TurnkeySDKClientBase {
1085
1200
  return undefined;
1086
1201
  }
1087
1202
  const { organizationId, timestampMs, ...parameters } = input;
1203
+ const session = await this.storageManager?.getActiveSession();
1088
1204
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_keys";
1089
1205
  const bodyWithType = {
1090
1206
  parameters,
1091
- organizationId,
1207
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1092
1208
  timestampMs: timestampMs ?? String(Date.now()),
1093
1209
  type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
1094
1210
  };
@@ -1118,10 +1234,11 @@ class TurnkeySDKClientBase {
1118
1234
  return undefined;
1119
1235
  }
1120
1236
  const { organizationId, timestampMs, ...parameters } = input;
1237
+ const session = await this.storageManager?.getActiveSession();
1121
1238
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_only_users";
1122
1239
  const bodyWithType = {
1123
1240
  parameters,
1124
- organizationId,
1241
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1125
1242
  timestampMs: timestampMs ?? String(Date.now()),
1126
1243
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
1127
1244
  };
@@ -1151,10 +1268,11 @@ class TurnkeySDKClientBase {
1151
1268
  return undefined;
1152
1269
  }
1153
1270
  const { organizationId, timestampMs, ...parameters } = input;
1271
+ const session = await this.storageManager?.getActiveSession();
1154
1272
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_authenticators";
1155
1273
  const bodyWithType = {
1156
1274
  parameters,
1157
- organizationId,
1275
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1158
1276
  timestampMs: timestampMs ?? String(Date.now()),
1159
1277
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
1160
1278
  };
@@ -1184,11 +1302,12 @@ class TurnkeySDKClientBase {
1184
1302
  return undefined;
1185
1303
  }
1186
1304
  const { organizationId, timestampMs, ...parameters } = input;
1305
+ const session = await this.storageManager?.getActiveSession();
1187
1306
  const fullUrl = this.config.apiBaseUrl +
1188
1307
  "/public/v1/submit/create_fiat_on_ramp_credential";
1189
1308
  const bodyWithType = {
1190
1309
  parameters,
1191
- organizationId,
1310
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1192
1311
  timestampMs: timestampMs ?? String(Date.now()),
1193
1312
  type: "ACTIVITY_TYPE_CREATE_FIAT_ON_RAMP_CREDENTIAL",
1194
1313
  };
@@ -1218,10 +1337,11 @@ class TurnkeySDKClientBase {
1218
1337
  return undefined;
1219
1338
  }
1220
1339
  const { organizationId, timestampMs, ...parameters } = input;
1340
+ const session = await this.storageManager?.getActiveSession();
1221
1341
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_invitations";
1222
1342
  const bodyWithType = {
1223
1343
  parameters,
1224
- organizationId,
1344
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1225
1345
  timestampMs: timestampMs ?? String(Date.now()),
1226
1346
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
1227
1347
  };
@@ -1251,10 +1371,11 @@ class TurnkeySDKClientBase {
1251
1371
  return undefined;
1252
1372
  }
1253
1373
  const { organizationId, timestampMs, ...parameters } = input;
1374
+ const session = await this.storageManager?.getActiveSession();
1254
1375
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth2_credential";
1255
1376
  const bodyWithType = {
1256
1377
  parameters,
1257
- organizationId,
1378
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1258
1379
  timestampMs: timestampMs ?? String(Date.now()),
1259
1380
  type: "ACTIVITY_TYPE_CREATE_OAUTH2CREDENTIAL",
1260
1381
  };
@@ -1284,10 +1405,11 @@ class TurnkeySDKClientBase {
1284
1405
  return undefined;
1285
1406
  }
1286
1407
  const { organizationId, timestampMs, ...parameters } = input;
1408
+ const session = await this.storageManager?.getActiveSession();
1287
1409
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth_providers";
1288
1410
  const bodyWithType = {
1289
1411
  parameters,
1290
- organizationId,
1412
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1291
1413
  timestampMs: timestampMs ?? String(Date.now()),
1292
1414
  type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
1293
1415
  };
@@ -1317,10 +1439,11 @@ class TurnkeySDKClientBase {
1317
1439
  return undefined;
1318
1440
  }
1319
1441
  const { organizationId, timestampMs, ...parameters } = input;
1442
+ const session = await this.storageManager?.getActiveSession();
1320
1443
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policies";
1321
1444
  const bodyWithType = {
1322
1445
  parameters,
1323
- organizationId,
1446
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1324
1447
  timestampMs: timestampMs ?? String(Date.now()),
1325
1448
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
1326
1449
  };
@@ -1350,10 +1473,11 @@ class TurnkeySDKClientBase {
1350
1473
  return undefined;
1351
1474
  }
1352
1475
  const { organizationId, timestampMs, ...parameters } = input;
1476
+ const session = await this.storageManager?.getActiveSession();
1353
1477
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policy";
1354
1478
  const bodyWithType = {
1355
1479
  parameters,
1356
- organizationId,
1480
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1357
1481
  timestampMs: timestampMs ?? String(Date.now()),
1358
1482
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
1359
1483
  };
@@ -1383,10 +1507,11 @@ class TurnkeySDKClientBase {
1383
1507
  return undefined;
1384
1508
  }
1385
1509
  const { organizationId, timestampMs, ...parameters } = input;
1510
+ const session = await this.storageManager?.getActiveSession();
1386
1511
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_key_tag";
1387
1512
  const bodyWithType = {
1388
1513
  parameters,
1389
- organizationId,
1514
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1390
1515
  timestampMs: timestampMs ?? String(Date.now()),
1391
1516
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
1392
1517
  };
@@ -1416,10 +1541,11 @@ class TurnkeySDKClientBase {
1416
1541
  return undefined;
1417
1542
  }
1418
1543
  const { organizationId, timestampMs, ...parameters } = input;
1544
+ const session = await this.storageManager?.getActiveSession();
1419
1545
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_keys";
1420
1546
  const bodyWithType = {
1421
1547
  parameters,
1422
- organizationId,
1548
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1423
1549
  timestampMs: timestampMs ?? String(Date.now()),
1424
1550
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
1425
1551
  };
@@ -1449,10 +1575,11 @@ class TurnkeySDKClientBase {
1449
1575
  return undefined;
1450
1576
  }
1451
1577
  const { organizationId, timestampMs, ...parameters } = input;
1578
+ const session = await this.storageManager?.getActiveSession();
1452
1579
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_only_session";
1453
1580
  const bodyWithType = {
1454
1581
  parameters,
1455
- organizationId,
1582
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1456
1583
  timestampMs: timestampMs ?? String(Date.now()),
1457
1584
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
1458
1585
  };
@@ -1482,10 +1609,11 @@ class TurnkeySDKClientBase {
1482
1609
  return undefined;
1483
1610
  }
1484
1611
  const { organizationId, timestampMs, ...parameters } = input;
1612
+ const session = await this.storageManager?.getActiveSession();
1485
1613
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_write_session";
1486
1614
  const bodyWithType = {
1487
1615
  parameters,
1488
- organizationId,
1616
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1489
1617
  timestampMs: timestampMs ?? String(Date.now()),
1490
1618
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
1491
1619
  };
@@ -1515,11 +1643,12 @@ class TurnkeySDKClientBase {
1515
1643
  return undefined;
1516
1644
  }
1517
1645
  const { organizationId, timestampMs, ...parameters } = input;
1646
+ const session = await this.storageManager?.getActiveSession();
1518
1647
  const fullUrl = this.config.apiBaseUrl +
1519
1648
  "/public/v1/submit/create_smart_contract_interface";
1520
1649
  const bodyWithType = {
1521
1650
  parameters,
1522
- organizationId,
1651
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1523
1652
  timestampMs: timestampMs ?? String(Date.now()),
1524
1653
  type: "ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE",
1525
1654
  };
@@ -1549,10 +1678,11 @@ class TurnkeySDKClientBase {
1549
1678
  return undefined;
1550
1679
  }
1551
1680
  const { organizationId, timestampMs, ...parameters } = input;
1681
+ const session = await this.storageManager?.getActiveSession();
1552
1682
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_sub_organization";
1553
1683
  const bodyWithType = {
1554
1684
  parameters,
1555
- organizationId,
1685
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1556
1686
  timestampMs: timestampMs ?? String(Date.now()),
1557
1687
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1558
1688
  };
@@ -1582,10 +1712,11 @@ class TurnkeySDKClientBase {
1582
1712
  return undefined;
1583
1713
  }
1584
1714
  const { organizationId, timestampMs, ...parameters } = input;
1715
+ const session = await this.storageManager?.getActiveSession();
1585
1716
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_user_tag";
1586
1717
  const bodyWithType = {
1587
1718
  parameters,
1588
- organizationId,
1719
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1589
1720
  timestampMs: timestampMs ?? String(Date.now()),
1590
1721
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
1591
1722
  };
@@ -1615,10 +1746,11 @@ class TurnkeySDKClientBase {
1615
1746
  return undefined;
1616
1747
  }
1617
1748
  const { organizationId, timestampMs, ...parameters } = input;
1749
+ const session = await this.storageManager?.getActiveSession();
1618
1750
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_users";
1619
1751
  const bodyWithType = {
1620
1752
  parameters,
1621
- organizationId,
1753
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1622
1754
  timestampMs: timestampMs ?? String(Date.now()),
1623
1755
  type: "ACTIVITY_TYPE_CREATE_USERS_V3",
1624
1756
  };
@@ -1648,10 +1780,11 @@ class TurnkeySDKClientBase {
1648
1780
  return undefined;
1649
1781
  }
1650
1782
  const { organizationId, timestampMs, ...parameters } = input;
1783
+ const session = await this.storageManager?.getActiveSession();
1651
1784
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet";
1652
1785
  const bodyWithType = {
1653
1786
  parameters,
1654
- organizationId,
1787
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1655
1788
  timestampMs: timestampMs ?? String(Date.now()),
1656
1789
  type: "ACTIVITY_TYPE_CREATE_WALLET",
1657
1790
  };
@@ -1681,10 +1814,11 @@ class TurnkeySDKClientBase {
1681
1814
  return undefined;
1682
1815
  }
1683
1816
  const { organizationId, timestampMs, ...parameters } = input;
1817
+ const session = await this.storageManager?.getActiveSession();
1684
1818
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet_accounts";
1685
1819
  const bodyWithType = {
1686
1820
  parameters,
1687
- organizationId,
1821
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1688
1822
  timestampMs: timestampMs ?? String(Date.now()),
1689
1823
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
1690
1824
  };
@@ -1714,10 +1848,11 @@ class TurnkeySDKClientBase {
1714
1848
  return undefined;
1715
1849
  }
1716
1850
  const { organizationId, timestampMs, ...parameters } = input;
1851
+ const session = await this.storageManager?.getActiveSession();
1717
1852
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_api_keys";
1718
1853
  const bodyWithType = {
1719
1854
  parameters,
1720
- organizationId,
1855
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1721
1856
  timestampMs: timestampMs ?? String(Date.now()),
1722
1857
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
1723
1858
  };
@@ -1747,10 +1882,11 @@ class TurnkeySDKClientBase {
1747
1882
  return undefined;
1748
1883
  }
1749
1884
  const { organizationId, timestampMs, ...parameters } = input;
1885
+ const session = await this.storageManager?.getActiveSession();
1750
1886
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_authenticators";
1751
1887
  const bodyWithType = {
1752
1888
  parameters,
1753
- organizationId,
1889
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1754
1890
  timestampMs: timestampMs ?? String(Date.now()),
1755
1891
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
1756
1892
  };
@@ -1780,11 +1916,12 @@ class TurnkeySDKClientBase {
1780
1916
  return undefined;
1781
1917
  }
1782
1918
  const { organizationId, timestampMs, ...parameters } = input;
1919
+ const session = await this.storageManager?.getActiveSession();
1783
1920
  const fullUrl = this.config.apiBaseUrl +
1784
1921
  "/public/v1/submit/delete_fiat_on_ramp_credential";
1785
1922
  const bodyWithType = {
1786
1923
  parameters,
1787
- organizationId,
1924
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1788
1925
  timestampMs: timestampMs ?? String(Date.now()),
1789
1926
  type: "ACTIVITY_TYPE_DELETE_FIAT_ON_RAMP_CREDENTIAL",
1790
1927
  };
@@ -1814,10 +1951,11 @@ class TurnkeySDKClientBase {
1814
1951
  return undefined;
1815
1952
  }
1816
1953
  const { organizationId, timestampMs, ...parameters } = input;
1954
+ const session = await this.storageManager?.getActiveSession();
1817
1955
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_invitation";
1818
1956
  const bodyWithType = {
1819
1957
  parameters,
1820
- organizationId,
1958
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1821
1959
  timestampMs: timestampMs ?? String(Date.now()),
1822
1960
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
1823
1961
  };
@@ -1847,10 +1985,11 @@ class TurnkeySDKClientBase {
1847
1985
  return undefined;
1848
1986
  }
1849
1987
  const { organizationId, timestampMs, ...parameters } = input;
1988
+ const session = await this.storageManager?.getActiveSession();
1850
1989
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth2_credential";
1851
1990
  const bodyWithType = {
1852
1991
  parameters,
1853
- organizationId,
1992
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1854
1993
  timestampMs: timestampMs ?? String(Date.now()),
1855
1994
  type: "ACTIVITY_TYPE_DELETE_OAUTH2CREDENTIAL",
1856
1995
  };
@@ -1880,10 +2019,11 @@ class TurnkeySDKClientBase {
1880
2019
  return undefined;
1881
2020
  }
1882
2021
  const { organizationId, timestampMs, ...parameters } = input;
2022
+ const session = await this.storageManager?.getActiveSession();
1883
2023
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth_providers";
1884
2024
  const bodyWithType = {
1885
2025
  parameters,
1886
- organizationId,
2026
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1887
2027
  timestampMs: timestampMs ?? String(Date.now()),
1888
2028
  type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
1889
2029
  };
@@ -1913,10 +2053,11 @@ class TurnkeySDKClientBase {
1913
2053
  return undefined;
1914
2054
  }
1915
2055
  const { organizationId, timestampMs, ...parameters } = input;
2056
+ const session = await this.storageManager?.getActiveSession();
1916
2057
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policies";
1917
2058
  const bodyWithType = {
1918
2059
  parameters,
1919
- organizationId,
2060
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1920
2061
  timestampMs: timestampMs ?? String(Date.now()),
1921
2062
  type: "ACTIVITY_TYPE_DELETE_POLICIES",
1922
2063
  };
@@ -1946,10 +2087,11 @@ class TurnkeySDKClientBase {
1946
2087
  return undefined;
1947
2088
  }
1948
2089
  const { organizationId, timestampMs, ...parameters } = input;
2090
+ const session = await this.storageManager?.getActiveSession();
1949
2091
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policy";
1950
2092
  const bodyWithType = {
1951
2093
  parameters,
1952
- organizationId,
2094
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1953
2095
  timestampMs: timestampMs ?? String(Date.now()),
1954
2096
  type: "ACTIVITY_TYPE_DELETE_POLICY",
1955
2097
  };
@@ -1979,10 +2121,11 @@ class TurnkeySDKClientBase {
1979
2121
  return undefined;
1980
2122
  }
1981
2123
  const { organizationId, timestampMs, ...parameters } = input;
2124
+ const session = await this.storageManager?.getActiveSession();
1982
2125
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_key_tags";
1983
2126
  const bodyWithType = {
1984
2127
  parameters,
1985
- organizationId,
2128
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1986
2129
  timestampMs: timestampMs ?? String(Date.now()),
1987
2130
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
1988
2131
  };
@@ -2012,10 +2155,11 @@ class TurnkeySDKClientBase {
2012
2155
  return undefined;
2013
2156
  }
2014
2157
  const { organizationId, timestampMs, ...parameters } = input;
2158
+ const session = await this.storageManager?.getActiveSession();
2015
2159
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_keys";
2016
2160
  const bodyWithType = {
2017
2161
  parameters,
2018
- organizationId,
2162
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2019
2163
  timestampMs: timestampMs ?? String(Date.now()),
2020
2164
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
2021
2165
  };
@@ -2045,11 +2189,12 @@ class TurnkeySDKClientBase {
2045
2189
  return undefined;
2046
2190
  }
2047
2191
  const { organizationId, timestampMs, ...parameters } = input;
2192
+ const session = await this.storageManager?.getActiveSession();
2048
2193
  const fullUrl = this.config.apiBaseUrl +
2049
2194
  "/public/v1/submit/delete_smart_contract_interface";
2050
2195
  const bodyWithType = {
2051
2196
  parameters,
2052
- organizationId,
2197
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2053
2198
  timestampMs: timestampMs ?? String(Date.now()),
2054
2199
  type: "ACTIVITY_TYPE_DELETE_SMART_CONTRACT_INTERFACE",
2055
2200
  };
@@ -2079,10 +2224,11 @@ class TurnkeySDKClientBase {
2079
2224
  return undefined;
2080
2225
  }
2081
2226
  const { organizationId, timestampMs, ...parameters } = input;
2227
+ const session = await this.storageManager?.getActiveSession();
2082
2228
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_sub_organization";
2083
2229
  const bodyWithType = {
2084
2230
  parameters,
2085
- organizationId,
2231
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2086
2232
  timestampMs: timestampMs ?? String(Date.now()),
2087
2233
  type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
2088
2234
  };
@@ -2112,10 +2258,11 @@ class TurnkeySDKClientBase {
2112
2258
  return undefined;
2113
2259
  }
2114
2260
  const { organizationId, timestampMs, ...parameters } = input;
2261
+ const session = await this.storageManager?.getActiveSession();
2115
2262
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_user_tags";
2116
2263
  const bodyWithType = {
2117
2264
  parameters,
2118
- organizationId,
2265
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2119
2266
  timestampMs: timestampMs ?? String(Date.now()),
2120
2267
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
2121
2268
  };
@@ -2145,10 +2292,11 @@ class TurnkeySDKClientBase {
2145
2292
  return undefined;
2146
2293
  }
2147
2294
  const { organizationId, timestampMs, ...parameters } = input;
2295
+ const session = await this.storageManager?.getActiveSession();
2148
2296
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_users";
2149
2297
  const bodyWithType = {
2150
2298
  parameters,
2151
- organizationId,
2299
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2152
2300
  timestampMs: timestampMs ?? String(Date.now()),
2153
2301
  type: "ACTIVITY_TYPE_DELETE_USERS",
2154
2302
  };
@@ -2178,10 +2326,11 @@ class TurnkeySDKClientBase {
2178
2326
  return undefined;
2179
2327
  }
2180
2328
  const { organizationId, timestampMs, ...parameters } = input;
2329
+ const session = await this.storageManager?.getActiveSession();
2181
2330
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallet_accounts";
2182
2331
  const bodyWithType = {
2183
2332
  parameters,
2184
- organizationId,
2333
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2185
2334
  timestampMs: timestampMs ?? String(Date.now()),
2186
2335
  type: "ACTIVITY_TYPE_DELETE_WALLET_ACCOUNTS",
2187
2336
  };
@@ -2211,10 +2360,11 @@ class TurnkeySDKClientBase {
2211
2360
  return undefined;
2212
2361
  }
2213
2362
  const { organizationId, timestampMs, ...parameters } = input;
2363
+ const session = await this.storageManager?.getActiveSession();
2214
2364
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallets";
2215
2365
  const bodyWithType = {
2216
2366
  parameters,
2217
- organizationId,
2367
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2218
2368
  timestampMs: timestampMs ?? String(Date.now()),
2219
2369
  type: "ACTIVITY_TYPE_DELETE_WALLETS",
2220
2370
  };
@@ -2235,7 +2385,7 @@ class TurnkeySDKClientBase {
2235
2385
  session?.organizationId ??
2236
2386
  this.config.organizationId,
2237
2387
  timestampMs: timestampMs ?? String(Date.now()),
2238
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2388
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2239
2389
  }, "emailAuthResult", stampWith);
2240
2390
  };
2241
2391
  this.stampEmailAuth = async (input, stampWith) => {
@@ -2244,12 +2394,13 @@ class TurnkeySDKClientBase {
2244
2394
  return undefined;
2245
2395
  }
2246
2396
  const { organizationId, timestampMs, ...parameters } = input;
2397
+ const session = await this.storageManager?.getActiveSession();
2247
2398
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/email_auth";
2248
2399
  const bodyWithType = {
2249
2400
  parameters,
2250
- organizationId,
2401
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2251
2402
  timestampMs: timestampMs ?? String(Date.now()),
2252
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2403
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2253
2404
  };
2254
2405
  const stringifiedBody = JSON.stringify(bodyWithType);
2255
2406
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2277,10 +2428,11 @@ class TurnkeySDKClientBase {
2277
2428
  return undefined;
2278
2429
  }
2279
2430
  const { organizationId, timestampMs, ...parameters } = input;
2431
+ const session = await this.storageManager?.getActiveSession();
2280
2432
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_raw_transaction";
2281
2433
  const bodyWithType = {
2282
2434
  parameters,
2283
- organizationId,
2435
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2284
2436
  timestampMs: timestampMs ?? String(Date.now()),
2285
2437
  type: "ACTIVITY_TYPE_ETH_SEND_RAW_TRANSACTION",
2286
2438
  };
@@ -2310,10 +2462,11 @@ class TurnkeySDKClientBase {
2310
2462
  return undefined;
2311
2463
  }
2312
2464
  const { organizationId, timestampMs, ...parameters } = input;
2465
+ const session = await this.storageManager?.getActiveSession();
2313
2466
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_transaction";
2314
2467
  const bodyWithType = {
2315
2468
  parameters,
2316
- organizationId,
2469
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2317
2470
  timestampMs: timestampMs ?? String(Date.now()),
2318
2471
  type: "ACTIVITY_TYPE_ETH_SEND_TRANSACTION",
2319
2472
  };
@@ -2343,10 +2496,11 @@ class TurnkeySDKClientBase {
2343
2496
  return undefined;
2344
2497
  }
2345
2498
  const { organizationId, timestampMs, ...parameters } = input;
2499
+ const session = await this.storageManager?.getActiveSession();
2346
2500
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_private_key";
2347
2501
  const bodyWithType = {
2348
2502
  parameters,
2349
- organizationId,
2503
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2350
2504
  timestampMs: timestampMs ?? String(Date.now()),
2351
2505
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
2352
2506
  };
@@ -2376,10 +2530,11 @@ class TurnkeySDKClientBase {
2376
2530
  return undefined;
2377
2531
  }
2378
2532
  const { organizationId, timestampMs, ...parameters } = input;
2533
+ const session = await this.storageManager?.getActiveSession();
2379
2534
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet";
2380
2535
  const bodyWithType = {
2381
2536
  parameters,
2382
- organizationId,
2537
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2383
2538
  timestampMs: timestampMs ?? String(Date.now()),
2384
2539
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
2385
2540
  };
@@ -2409,10 +2564,11 @@ class TurnkeySDKClientBase {
2409
2564
  return undefined;
2410
2565
  }
2411
2566
  const { organizationId, timestampMs, ...parameters } = input;
2567
+ const session = await this.storageManager?.getActiveSession();
2412
2568
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet_account";
2413
2569
  const bodyWithType = {
2414
2570
  parameters,
2415
- organizationId,
2571
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2416
2572
  timestampMs: timestampMs ?? String(Date.now()),
2417
2573
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
2418
2574
  };
@@ -2442,10 +2598,11 @@ class TurnkeySDKClientBase {
2442
2598
  return undefined;
2443
2599
  }
2444
2600
  const { organizationId, timestampMs, ...parameters } = input;
2601
+ const session = await this.storageManager?.getActiveSession();
2445
2602
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_private_key";
2446
2603
  const bodyWithType = {
2447
2604
  parameters,
2448
- organizationId,
2605
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2449
2606
  timestampMs: timestampMs ?? String(Date.now()),
2450
2607
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
2451
2608
  };
@@ -2475,10 +2632,11 @@ class TurnkeySDKClientBase {
2475
2632
  return undefined;
2476
2633
  }
2477
2634
  const { organizationId, timestampMs, ...parameters } = input;
2635
+ const session = await this.storageManager?.getActiveSession();
2478
2636
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_wallet";
2479
2637
  const bodyWithType = {
2480
2638
  parameters,
2481
- organizationId,
2639
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2482
2640
  timestampMs: timestampMs ?? String(Date.now()),
2483
2641
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
2484
2642
  };
@@ -2508,10 +2666,11 @@ class TurnkeySDKClientBase {
2508
2666
  return undefined;
2509
2667
  }
2510
2668
  const { organizationId, timestampMs, ...parameters } = input;
2669
+ const session = await this.storageManager?.getActiveSession();
2511
2670
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_fiat_on_ramp";
2512
2671
  const bodyWithType = {
2513
2672
  parameters,
2514
- organizationId,
2673
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2515
2674
  timestampMs: timestampMs ?? String(Date.now()),
2516
2675
  type: "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
2517
2676
  };
@@ -2541,10 +2700,11 @@ class TurnkeySDKClientBase {
2541
2700
  return undefined;
2542
2701
  }
2543
2702
  const { organizationId, timestampMs, ...parameters } = input;
2703
+ const session = await this.storageManager?.getActiveSession();
2544
2704
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_private_key";
2545
2705
  const bodyWithType = {
2546
2706
  parameters,
2547
- organizationId,
2707
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2548
2708
  timestampMs: timestampMs ?? String(Date.now()),
2549
2709
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
2550
2710
  };
@@ -2574,10 +2734,11 @@ class TurnkeySDKClientBase {
2574
2734
  return undefined;
2575
2735
  }
2576
2736
  const { organizationId, timestampMs, ...parameters } = input;
2737
+ const session = await this.storageManager?.getActiveSession();
2577
2738
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_wallet";
2578
2739
  const bodyWithType = {
2579
2740
  parameters,
2580
- organizationId,
2741
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2581
2742
  timestampMs: timestampMs ?? String(Date.now()),
2582
2743
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
2583
2744
  };
@@ -2598,7 +2759,7 @@ class TurnkeySDKClientBase {
2598
2759
  session?.organizationId ??
2599
2760
  this.config.organizationId,
2600
2761
  timestampMs: timestampMs ?? String(Date.now()),
2601
- type: "ACTIVITY_TYPE_INIT_OTP",
2762
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2602
2763
  }, "initOtpResult", stampWith);
2603
2764
  };
2604
2765
  this.stampInitOtp = async (input, stampWith) => {
@@ -2607,12 +2768,13 @@ class TurnkeySDKClientBase {
2607
2768
  return undefined;
2608
2769
  }
2609
2770
  const { organizationId, timestampMs, ...parameters } = input;
2771
+ const session = await this.storageManager?.getActiveSession();
2610
2772
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
2611
2773
  const bodyWithType = {
2612
2774
  parameters,
2613
- organizationId,
2775
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2614
2776
  timestampMs: timestampMs ?? String(Date.now()),
2615
- type: "ACTIVITY_TYPE_INIT_OTP",
2777
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2616
2778
  };
2617
2779
  const stringifiedBody = JSON.stringify(bodyWithType);
2618
2780
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2631,7 +2793,7 @@ class TurnkeySDKClientBase {
2631
2793
  session?.organizationId ??
2632
2794
  this.config.organizationId,
2633
2795
  timestampMs: timestampMs ?? String(Date.now()),
2634
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2796
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2635
2797
  }, "initOtpAuthResult", stampWith);
2636
2798
  };
2637
2799
  this.stampInitOtpAuth = async (input, stampWith) => {
@@ -2640,12 +2802,13 @@ class TurnkeySDKClientBase {
2640
2802
  return undefined;
2641
2803
  }
2642
2804
  const { organizationId, timestampMs, ...parameters } = input;
2805
+ const session = await this.storageManager?.getActiveSession();
2643
2806
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp_auth";
2644
2807
  const bodyWithType = {
2645
2808
  parameters,
2646
- organizationId,
2809
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2647
2810
  timestampMs: timestampMs ?? String(Date.now()),
2648
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2811
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2649
2812
  };
2650
2813
  const stringifiedBody = JSON.stringify(bodyWithType);
2651
2814
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2664,7 +2827,7 @@ class TurnkeySDKClientBase {
2664
2827
  session?.organizationId ??
2665
2828
  this.config.organizationId,
2666
2829
  timestampMs: timestampMs ?? String(Date.now()),
2667
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2830
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2668
2831
  }, "initUserEmailRecoveryResult", stampWith);
2669
2832
  };
2670
2833
  this.stampInitUserEmailRecovery = async (input, stampWith) => {
@@ -2673,12 +2836,13 @@ class TurnkeySDKClientBase {
2673
2836
  return undefined;
2674
2837
  }
2675
2838
  const { organizationId, timestampMs, ...parameters } = input;
2839
+ const session = await this.storageManager?.getActiveSession();
2676
2840
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_user_email_recovery";
2677
2841
  const bodyWithType = {
2678
2842
  parameters,
2679
- organizationId,
2843
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2680
2844
  timestampMs: timestampMs ?? String(Date.now()),
2681
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2845
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2682
2846
  };
2683
2847
  const stringifiedBody = JSON.stringify(bodyWithType);
2684
2848
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2706,10 +2870,11 @@ class TurnkeySDKClientBase {
2706
2870
  return undefined;
2707
2871
  }
2708
2872
  const { organizationId, timestampMs, ...parameters } = input;
2873
+ const session = await this.storageManager?.getActiveSession();
2709
2874
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth";
2710
2875
  const bodyWithType = {
2711
2876
  parameters,
2712
- organizationId,
2877
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2713
2878
  timestampMs: timestampMs ?? String(Date.now()),
2714
2879
  type: "ACTIVITY_TYPE_OAUTH",
2715
2880
  };
@@ -2739,10 +2904,11 @@ class TurnkeySDKClientBase {
2739
2904
  return undefined;
2740
2905
  }
2741
2906
  const { organizationId, timestampMs, ...parameters } = input;
2907
+ const session = await this.storageManager?.getActiveSession();
2742
2908
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth2_authenticate";
2743
2909
  const bodyWithType = {
2744
2910
  parameters,
2745
- organizationId,
2911
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2746
2912
  timestampMs: timestampMs ?? String(Date.now()),
2747
2913
  type: "ACTIVITY_TYPE_OAUTH2AUTHENTICATE",
2748
2914
  };
@@ -2772,10 +2938,11 @@ class TurnkeySDKClientBase {
2772
2938
  return undefined;
2773
2939
  }
2774
2940
  const { organizationId, timestampMs, ...parameters } = input;
2941
+ const session = await this.storageManager?.getActiveSession();
2775
2942
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
2776
2943
  const bodyWithType = {
2777
2944
  parameters,
2778
- organizationId,
2945
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2779
2946
  timestampMs: timestampMs ?? String(Date.now()),
2780
2947
  type: "ACTIVITY_TYPE_OAUTH_LOGIN",
2781
2948
  };
@@ -2805,10 +2972,11 @@ class TurnkeySDKClientBase {
2805
2972
  return undefined;
2806
2973
  }
2807
2974
  const { organizationId, timestampMs, ...parameters } = input;
2975
+ const session = await this.storageManager?.getActiveSession();
2808
2976
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_auth";
2809
2977
  const bodyWithType = {
2810
2978
  parameters,
2811
- organizationId,
2979
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2812
2980
  timestampMs: timestampMs ?? String(Date.now()),
2813
2981
  type: "ACTIVITY_TYPE_OTP_AUTH",
2814
2982
  };
@@ -2838,10 +3006,11 @@ class TurnkeySDKClientBase {
2838
3006
  return undefined;
2839
3007
  }
2840
3008
  const { organizationId, timestampMs, ...parameters } = input;
3009
+ const session = await this.storageManager?.getActiveSession();
2841
3010
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
2842
3011
  const bodyWithType = {
2843
3012
  parameters,
2844
- organizationId,
3013
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2845
3014
  timestampMs: timestampMs ?? String(Date.now()),
2846
3015
  type: "ACTIVITY_TYPE_OTP_LOGIN",
2847
3016
  };
@@ -2871,10 +3040,11 @@ class TurnkeySDKClientBase {
2871
3040
  return undefined;
2872
3041
  }
2873
3042
  const { organizationId, timestampMs, ...parameters } = input;
3043
+ const session = await this.storageManager?.getActiveSession();
2874
3044
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/recover_user";
2875
3045
  const bodyWithType = {
2876
3046
  parameters,
2877
- organizationId,
3047
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2878
3048
  timestampMs: timestampMs ?? String(Date.now()),
2879
3049
  type: "ACTIVITY_TYPE_RECOVER_USER",
2880
3050
  };
@@ -2904,10 +3074,11 @@ class TurnkeySDKClientBase {
2904
3074
  return undefined;
2905
3075
  }
2906
3076
  const { organizationId, timestampMs, ...parameters } = input;
3077
+ const session = await this.storageManager?.getActiveSession();
2907
3078
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/reject_activity";
2908
3079
  const bodyWithType = {
2909
3080
  parameters,
2910
- organizationId,
3081
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2911
3082
  timestampMs: timestampMs ?? String(Date.now()),
2912
3083
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
2913
3084
  };
@@ -2937,10 +3108,11 @@ class TurnkeySDKClientBase {
2937
3108
  return undefined;
2938
3109
  }
2939
3110
  const { organizationId, timestampMs, ...parameters } = input;
3111
+ const session = await this.storageManager?.getActiveSession();
2940
3112
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/remove_organization_feature";
2941
3113
  const bodyWithType = {
2942
3114
  parameters,
2943
- organizationId,
3115
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2944
3116
  timestampMs: timestampMs ?? String(Date.now()),
2945
3117
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
2946
3118
  };
@@ -2970,10 +3142,11 @@ class TurnkeySDKClientBase {
2970
3142
  return undefined;
2971
3143
  }
2972
3144
  const { organizationId, timestampMs, ...parameters } = input;
3145
+ const session = await this.storageManager?.getActiveSession();
2973
3146
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/set_organization_feature";
2974
3147
  const bodyWithType = {
2975
3148
  parameters,
2976
- organizationId,
3149
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2977
3150
  timestampMs: timestampMs ?? String(Date.now()),
2978
3151
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
2979
3152
  };
@@ -3003,10 +3176,11 @@ class TurnkeySDKClientBase {
3003
3176
  return undefined;
3004
3177
  }
3005
3178
  const { organizationId, timestampMs, ...parameters } = input;
3179
+ const session = await this.storageManager?.getActiveSession();
3006
3180
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payload";
3007
3181
  const bodyWithType = {
3008
3182
  parameters,
3009
- organizationId,
3183
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3010
3184
  timestampMs: timestampMs ?? String(Date.now()),
3011
3185
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
3012
3186
  };
@@ -3036,10 +3210,11 @@ class TurnkeySDKClientBase {
3036
3210
  return undefined;
3037
3211
  }
3038
3212
  const { organizationId, timestampMs, ...parameters } = input;
3213
+ const session = await this.storageManager?.getActiveSession();
3039
3214
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payloads";
3040
3215
  const bodyWithType = {
3041
3216
  parameters,
3042
- organizationId,
3217
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3043
3218
  timestampMs: timestampMs ?? String(Date.now()),
3044
3219
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
3045
3220
  };
@@ -3069,10 +3244,11 @@ class TurnkeySDKClientBase {
3069
3244
  return undefined;
3070
3245
  }
3071
3246
  const { organizationId, timestampMs, ...parameters } = input;
3247
+ const session = await this.storageManager?.getActiveSession();
3072
3248
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_transaction";
3073
3249
  const bodyWithType = {
3074
3250
  parameters,
3075
- organizationId,
3251
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3076
3252
  timestampMs: timestampMs ?? String(Date.now()),
3077
3253
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
3078
3254
  };
@@ -3102,10 +3278,11 @@ class TurnkeySDKClientBase {
3102
3278
  return undefined;
3103
3279
  }
3104
3280
  const { organizationId, timestampMs, ...parameters } = input;
3281
+ const session = await this.storageManager?.getActiveSession();
3105
3282
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
3106
3283
  const bodyWithType = {
3107
3284
  parameters,
3108
- organizationId,
3285
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3109
3286
  timestampMs: timestampMs ?? String(Date.now()),
3110
3287
  type: "ACTIVITY_TYPE_STAMP_LOGIN",
3111
3288
  };
@@ -3135,11 +3312,12 @@ class TurnkeySDKClientBase {
3135
3312
  return undefined;
3136
3313
  }
3137
3314
  const { organizationId, timestampMs, ...parameters } = input;
3315
+ const session = await this.storageManager?.getActiveSession();
3138
3316
  const fullUrl = this.config.apiBaseUrl +
3139
3317
  "/public/v1/submit/update_fiat_on_ramp_credential";
3140
3318
  const bodyWithType = {
3141
3319
  parameters,
3142
- organizationId,
3320
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3143
3321
  timestampMs: timestampMs ?? String(Date.now()),
3144
3322
  type: "ACTIVITY_TYPE_UPDATE_FIAT_ON_RAMP_CREDENTIAL",
3145
3323
  };
@@ -3169,10 +3347,11 @@ class TurnkeySDKClientBase {
3169
3347
  return undefined;
3170
3348
  }
3171
3349
  const { organizationId, timestampMs, ...parameters } = input;
3350
+ const session = await this.storageManager?.getActiveSession();
3172
3351
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_oauth2_credential";
3173
3352
  const bodyWithType = {
3174
3353
  parameters,
3175
- organizationId,
3354
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3176
3355
  timestampMs: timestampMs ?? String(Date.now()),
3177
3356
  type: "ACTIVITY_TYPE_UPDATE_OAUTH2CREDENTIAL",
3178
3357
  };
@@ -3202,10 +3381,11 @@ class TurnkeySDKClientBase {
3202
3381
  return undefined;
3203
3382
  }
3204
3383
  const { organizationId, timestampMs, ...parameters } = input;
3384
+ const session = await this.storageManager?.getActiveSession();
3205
3385
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_policy";
3206
3386
  const bodyWithType = {
3207
3387
  parameters,
3208
- organizationId,
3388
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3209
3389
  timestampMs: timestampMs ?? String(Date.now()),
3210
3390
  type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
3211
3391
  };
@@ -3235,10 +3415,11 @@ class TurnkeySDKClientBase {
3235
3415
  return undefined;
3236
3416
  }
3237
3417
  const { organizationId, timestampMs, ...parameters } = input;
3418
+ const session = await this.storageManager?.getActiveSession();
3238
3419
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_private_key_tag";
3239
3420
  const bodyWithType = {
3240
3421
  parameters,
3241
- organizationId,
3422
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3242
3423
  timestampMs: timestampMs ?? String(Date.now()),
3243
3424
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
3244
3425
  };
@@ -3268,10 +3449,11 @@ class TurnkeySDKClientBase {
3268
3449
  return undefined;
3269
3450
  }
3270
3451
  const { organizationId, timestampMs, ...parameters } = input;
3452
+ const session = await this.storageManager?.getActiveSession();
3271
3453
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_root_quorum";
3272
3454
  const bodyWithType = {
3273
3455
  parameters,
3274
- organizationId,
3456
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3275
3457
  timestampMs: timestampMs ?? String(Date.now()),
3276
3458
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
3277
3459
  };
@@ -3301,10 +3483,11 @@ class TurnkeySDKClientBase {
3301
3483
  return undefined;
3302
3484
  }
3303
3485
  const { organizationId, timestampMs, ...parameters } = input;
3486
+ const session = await this.storageManager?.getActiveSession();
3304
3487
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user";
3305
3488
  const bodyWithType = {
3306
3489
  parameters,
3307
- organizationId,
3490
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3308
3491
  timestampMs: timestampMs ?? String(Date.now()),
3309
3492
  type: "ACTIVITY_TYPE_UPDATE_USER",
3310
3493
  };
@@ -3334,10 +3517,11 @@ class TurnkeySDKClientBase {
3334
3517
  return undefined;
3335
3518
  }
3336
3519
  const { organizationId, timestampMs, ...parameters } = input;
3520
+ const session = await this.storageManager?.getActiveSession();
3337
3521
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_email";
3338
3522
  const bodyWithType = {
3339
3523
  parameters,
3340
- organizationId,
3524
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3341
3525
  timestampMs: timestampMs ?? String(Date.now()),
3342
3526
  type: "ACTIVITY_TYPE_UPDATE_USER_EMAIL",
3343
3527
  };
@@ -3367,10 +3551,11 @@ class TurnkeySDKClientBase {
3367
3551
  return undefined;
3368
3552
  }
3369
3553
  const { organizationId, timestampMs, ...parameters } = input;
3554
+ const session = await this.storageManager?.getActiveSession();
3370
3555
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_name";
3371
3556
  const bodyWithType = {
3372
3557
  parameters,
3373
- organizationId,
3558
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3374
3559
  timestampMs: timestampMs ?? String(Date.now()),
3375
3560
  type: "ACTIVITY_TYPE_UPDATE_USER_NAME",
3376
3561
  };
@@ -3400,10 +3585,11 @@ class TurnkeySDKClientBase {
3400
3585
  return undefined;
3401
3586
  }
3402
3587
  const { organizationId, timestampMs, ...parameters } = input;
3588
+ const session = await this.storageManager?.getActiveSession();
3403
3589
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_phone_number";
3404
3590
  const bodyWithType = {
3405
3591
  parameters,
3406
- organizationId,
3592
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3407
3593
  timestampMs: timestampMs ?? String(Date.now()),
3408
3594
  type: "ACTIVITY_TYPE_UPDATE_USER_PHONE_NUMBER",
3409
3595
  };
@@ -3433,10 +3619,11 @@ class TurnkeySDKClientBase {
3433
3619
  return undefined;
3434
3620
  }
3435
3621
  const { organizationId, timestampMs, ...parameters } = input;
3622
+ const session = await this.storageManager?.getActiveSession();
3436
3623
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_tag";
3437
3624
  const bodyWithType = {
3438
3625
  parameters,
3439
- organizationId,
3626
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3440
3627
  timestampMs: timestampMs ?? String(Date.now()),
3441
3628
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
3442
3629
  };
@@ -3466,10 +3653,11 @@ class TurnkeySDKClientBase {
3466
3653
  return undefined;
3467
3654
  }
3468
3655
  const { organizationId, timestampMs, ...parameters } = input;
3656
+ const session = await this.storageManager?.getActiveSession();
3469
3657
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_wallet";
3470
3658
  const bodyWithType = {
3471
3659
  parameters,
3472
- organizationId,
3660
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3473
3661
  timestampMs: timestampMs ?? String(Date.now()),
3474
3662
  type: "ACTIVITY_TYPE_UPDATE_WALLET",
3475
3663
  };
@@ -3499,10 +3687,11 @@ class TurnkeySDKClientBase {
3499
3687
  return undefined;
3500
3688
  }
3501
3689
  const { organizationId, timestampMs, ...parameters } = input;
3690
+ const session = await this.storageManager?.getActiveSession();
3502
3691
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
3503
3692
  const bodyWithType = {
3504
3693
  parameters,
3505
- organizationId,
3694
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3506
3695
  timestampMs: timestampMs ?? String(Date.now()),
3507
3696
  type: "ACTIVITY_TYPE_VERIFY_OTP",
3508
3697
  };
@@ -3528,10 +3717,13 @@ class TurnkeySDKClientBase {
3528
3717
  if (!activeStamper) {
3529
3718
  return undefined;
3530
3719
  }
3720
+ const session = await this.storageManager?.getActiveSession();
3531
3721
  const fullUrl = this.config.apiBaseUrl + "/tkhq/api/v1/test_rate_limits";
3532
3722
  const body = {
3533
3723
  ...input,
3534
- organizationId: input.organizationId,
3724
+ organizationId: input.organizationId ??
3725
+ session?.organizationId ??
3726
+ this.config.organizationId,
3535
3727
  };
3536
3728
  const stringifiedBody = JSON.stringify(body);
3537
3729
  const stamp = await activeStamper.stamp(stringifiedBody);