@turnkey/core 1.8.3 → 1.10.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.
@@ -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,43 @@ 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,
213
+ };
214
+ const stringifiedBody = JSON.stringify(body);
215
+ const stamp = await activeStamper.stamp(stringifiedBody);
216
+ return {
217
+ body: stringifiedBody,
218
+ stamp: stamp,
219
+ url: fullUrl,
220
+ };
221
+ };
222
+ this.getGasUsage = async (input, stampWith) => {
223
+ const session = await this.storageManager?.getActiveSession();
224
+ return this.request("/public/v1/query/get_gas_usage", {
225
+ ...input,
226
+ organizationId: input.organizationId ??
227
+ session?.organizationId ??
228
+ this.config.organizationId,
229
+ }, stampWith);
230
+ };
231
+ this.stampGetGasUsage = async (input, stampWith) => {
232
+ const activeStamper = this.getStamper(stampWith);
233
+ if (!activeStamper) {
234
+ return undefined;
235
+ }
236
+ const session = await this.storageManager?.getActiveSession();
237
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_gas_usage";
238
+ const body = {
239
+ ...input,
240
+ organizationId: input.organizationId ??
241
+ session?.organizationId ??
242
+ this.config.organizationId,
192
243
  };
193
244
  const stringifiedBody = JSON.stringify(body);
194
245
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -212,10 +263,43 @@ class TurnkeySDKClientBase {
212
263
  if (!activeStamper) {
213
264
  return undefined;
214
265
  }
266
+ const session = await this.storageManager?.getActiveSession();
215
267
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_latest_boot_proof";
216
268
  const body = {
217
269
  ...input,
218
- organizationId: input.organizationId,
270
+ organizationId: input.organizationId ??
271
+ session?.organizationId ??
272
+ this.config.organizationId,
273
+ };
274
+ const stringifiedBody = JSON.stringify(body);
275
+ const stamp = await activeStamper.stamp(stringifiedBody);
276
+ return {
277
+ body: stringifiedBody,
278
+ stamp: stamp,
279
+ url: fullUrl,
280
+ };
281
+ };
282
+ this.getNonces = async (input, stampWith) => {
283
+ const session = await this.storageManager?.getActiveSession();
284
+ return this.request("/public/v1/query/get_nonces", {
285
+ ...input,
286
+ organizationId: input.organizationId ??
287
+ session?.organizationId ??
288
+ this.config.organizationId,
289
+ }, stampWith);
290
+ };
291
+ this.stampGetNonces = async (input, stampWith) => {
292
+ const activeStamper = this.getStamper(stampWith);
293
+ if (!activeStamper) {
294
+ return undefined;
295
+ }
296
+ const session = await this.storageManager?.getActiveSession();
297
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_nonces";
298
+ const body = {
299
+ ...input,
300
+ organizationId: input.organizationId ??
301
+ session?.organizationId ??
302
+ this.config.organizationId,
219
303
  };
220
304
  const stringifiedBody = JSON.stringify(body);
221
305
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -239,10 +323,13 @@ class TurnkeySDKClientBase {
239
323
  if (!activeStamper) {
240
324
  return undefined;
241
325
  }
326
+ const session = await this.storageManager?.getActiveSession();
242
327
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth2_credential";
243
328
  const body = {
244
329
  ...input,
245
- organizationId: input.organizationId,
330
+ organizationId: input.organizationId ??
331
+ session?.organizationId ??
332
+ this.config.organizationId,
246
333
  };
247
334
  const stringifiedBody = JSON.stringify(body);
248
335
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -266,10 +353,13 @@ class TurnkeySDKClientBase {
266
353
  if (!activeStamper) {
267
354
  return undefined;
268
355
  }
356
+ const session = await this.storageManager?.getActiveSession();
269
357
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth_providers";
270
358
  const body = {
271
359
  ...input,
272
- organizationId: input.organizationId,
360
+ organizationId: input.organizationId ??
361
+ session?.organizationId ??
362
+ this.config.organizationId,
273
363
  };
274
364
  const stringifiedBody = JSON.stringify(body);
275
365
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -293,10 +383,13 @@ class TurnkeySDKClientBase {
293
383
  if (!activeStamper) {
294
384
  return undefined;
295
385
  }
386
+ const session = await this.storageManager?.getActiveSession();
296
387
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_onramp_transaction_status";
297
388
  const body = {
298
389
  ...input,
299
- organizationId: input.organizationId,
390
+ organizationId: input.organizationId ??
391
+ session?.organizationId ??
392
+ this.config.organizationId,
300
393
  };
301
394
  const stringifiedBody = JSON.stringify(body);
302
395
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -320,10 +413,13 @@ class TurnkeySDKClientBase {
320
413
  if (!activeStamper) {
321
414
  return undefined;
322
415
  }
416
+ const session = await this.storageManager?.getActiveSession();
323
417
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization";
324
418
  const body = {
325
419
  ...input,
326
- organizationId: input.organizationId,
420
+ organizationId: input.organizationId ??
421
+ session?.organizationId ??
422
+ this.config.organizationId,
327
423
  };
328
424
  const stringifiedBody = JSON.stringify(body);
329
425
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -347,10 +443,13 @@ class TurnkeySDKClientBase {
347
443
  if (!activeStamper) {
348
444
  return undefined;
349
445
  }
446
+ const session = await this.storageManager?.getActiveSession();
350
447
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization_configs";
351
448
  const body = {
352
449
  ...input,
353
- organizationId: input.organizationId,
450
+ organizationId: input.organizationId ??
451
+ session?.organizationId ??
452
+ this.config.organizationId,
354
453
  };
355
454
  const stringifiedBody = JSON.stringify(body);
356
455
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -374,10 +473,13 @@ class TurnkeySDKClientBase {
374
473
  if (!activeStamper) {
375
474
  return undefined;
376
475
  }
476
+ const session = await this.storageManager?.getActiveSession();
377
477
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy";
378
478
  const body = {
379
479
  ...input,
380
- organizationId: input.organizationId,
480
+ organizationId: input.organizationId ??
481
+ session?.organizationId ??
482
+ this.config.organizationId,
381
483
  };
382
484
  const stringifiedBody = JSON.stringify(body);
383
485
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -401,10 +503,13 @@ class TurnkeySDKClientBase {
401
503
  if (!activeStamper) {
402
504
  return undefined;
403
505
  }
506
+ const session = await this.storageManager?.getActiveSession();
404
507
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy_evaluations";
405
508
  const body = {
406
509
  ...input,
407
- organizationId: input.organizationId,
510
+ organizationId: input.organizationId ??
511
+ session?.organizationId ??
512
+ this.config.organizationId,
408
513
  };
409
514
  const stringifiedBody = JSON.stringify(body);
410
515
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -428,10 +533,43 @@ class TurnkeySDKClientBase {
428
533
  if (!activeStamper) {
429
534
  return undefined;
430
535
  }
536
+ const session = await this.storageManager?.getActiveSession();
431
537
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_private_key";
432
538
  const body = {
433
539
  ...input,
434
- organizationId: input.organizationId,
540
+ organizationId: input.organizationId ??
541
+ session?.organizationId ??
542
+ this.config.organizationId,
543
+ };
544
+ const stringifiedBody = JSON.stringify(body);
545
+ const stamp = await activeStamper.stamp(stringifiedBody);
546
+ return {
547
+ body: stringifiedBody,
548
+ stamp: stamp,
549
+ url: fullUrl,
550
+ };
551
+ };
552
+ this.getSendTransactionStatus = async (input, stampWith) => {
553
+ const session = await this.storageManager?.getActiveSession();
554
+ return this.request("/public/v1/query/get_send_transaction_status", {
555
+ ...input,
556
+ organizationId: input.organizationId ??
557
+ session?.organizationId ??
558
+ this.config.organizationId,
559
+ }, stampWith);
560
+ };
561
+ this.stampGetSendTransactionStatus = async (input, stampWith) => {
562
+ const activeStamper = this.getStamper(stampWith);
563
+ if (!activeStamper) {
564
+ return undefined;
565
+ }
566
+ const session = await this.storageManager?.getActiveSession();
567
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_send_transaction_status";
568
+ const body = {
569
+ ...input,
570
+ organizationId: input.organizationId ??
571
+ session?.organizationId ??
572
+ this.config.organizationId,
435
573
  };
436
574
  const stringifiedBody = JSON.stringify(body);
437
575
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -455,10 +593,13 @@ class TurnkeySDKClientBase {
455
593
  if (!activeStamper) {
456
594
  return undefined;
457
595
  }
596
+ const session = await this.storageManager?.getActiveSession();
458
597
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_smart_contract_interface";
459
598
  const body = {
460
599
  ...input,
461
- organizationId: input.organizationId,
600
+ organizationId: input.organizationId ??
601
+ session?.organizationId ??
602
+ this.config.organizationId,
462
603
  };
463
604
  const stringifiedBody = JSON.stringify(body);
464
605
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -482,10 +623,13 @@ class TurnkeySDKClientBase {
482
623
  if (!activeStamper) {
483
624
  return undefined;
484
625
  }
626
+ const session = await this.storageManager?.getActiveSession();
485
627
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_user";
486
628
  const body = {
487
629
  ...input,
488
- organizationId: input.organizationId,
630
+ organizationId: input.organizationId ??
631
+ session?.organizationId ??
632
+ this.config.organizationId,
489
633
  };
490
634
  const stringifiedBody = JSON.stringify(body);
491
635
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -509,10 +653,13 @@ class TurnkeySDKClientBase {
509
653
  if (!activeStamper) {
510
654
  return undefined;
511
655
  }
656
+ const session = await this.storageManager?.getActiveSession();
512
657
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet";
513
658
  const body = {
514
659
  ...input,
515
- organizationId: input.organizationId,
660
+ organizationId: input.organizationId ??
661
+ session?.organizationId ??
662
+ this.config.organizationId,
516
663
  };
517
664
  const stringifiedBody = JSON.stringify(body);
518
665
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -536,10 +683,13 @@ class TurnkeySDKClientBase {
536
683
  if (!activeStamper) {
537
684
  return undefined;
538
685
  }
686
+ const session = await this.storageManager?.getActiveSession();
539
687
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet_account";
540
688
  const body = {
541
689
  ...input,
542
- organizationId: input.organizationId,
690
+ organizationId: input.organizationId ??
691
+ session?.organizationId ??
692
+ this.config.organizationId,
543
693
  };
544
694
  const stringifiedBody = JSON.stringify(body);
545
695
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -563,10 +713,13 @@ class TurnkeySDKClientBase {
563
713
  if (!activeStamper) {
564
714
  return undefined;
565
715
  }
716
+ const session = await this.storageManager?.getActiveSession();
566
717
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_activities";
567
718
  const body = {
568
719
  ...input,
569
- organizationId: input.organizationId,
720
+ organizationId: input.organizationId ??
721
+ session?.organizationId ??
722
+ this.config.organizationId,
570
723
  };
571
724
  const stringifiedBody = JSON.stringify(body);
572
725
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -590,10 +743,13 @@ class TurnkeySDKClientBase {
590
743
  if (!activeStamper) {
591
744
  return undefined;
592
745
  }
746
+ const session = await this.storageManager?.getActiveSession();
593
747
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_app_proofs";
594
748
  const body = {
595
749
  ...input,
596
- organizationId: input.organizationId,
750
+ organizationId: input.organizationId ??
751
+ session?.organizationId ??
752
+ this.config.organizationId,
597
753
  };
598
754
  const stringifiedBody = JSON.stringify(body);
599
755
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -617,10 +773,13 @@ class TurnkeySDKClientBase {
617
773
  if (!activeStamper) {
618
774
  return undefined;
619
775
  }
776
+ const session = await this.storageManager?.getActiveSession();
620
777
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_fiat_on_ramp_credentials";
621
778
  const body = {
622
779
  ...input,
623
- organizationId: input.organizationId,
780
+ organizationId: input.organizationId ??
781
+ session?.organizationId ??
782
+ this.config.organizationId,
624
783
  };
625
784
  const stringifiedBody = JSON.stringify(body);
626
785
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -644,10 +803,13 @@ class TurnkeySDKClientBase {
644
803
  if (!activeStamper) {
645
804
  return undefined;
646
805
  }
806
+ const session = await this.storageManager?.getActiveSession();
647
807
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_oauth2_credentials";
648
808
  const body = {
649
809
  ...input,
650
- organizationId: input.organizationId,
810
+ organizationId: input.organizationId ??
811
+ session?.organizationId ??
812
+ this.config.organizationId,
651
813
  };
652
814
  const stringifiedBody = JSON.stringify(body);
653
815
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -671,10 +833,13 @@ class TurnkeySDKClientBase {
671
833
  if (!activeStamper) {
672
834
  return undefined;
673
835
  }
836
+ const session = await this.storageManager?.getActiveSession();
674
837
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_policies";
675
838
  const body = {
676
839
  ...input,
677
- organizationId: input.organizationId,
840
+ organizationId: input.organizationId ??
841
+ session?.organizationId ??
842
+ this.config.organizationId,
678
843
  };
679
844
  const stringifiedBody = JSON.stringify(body);
680
845
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -698,10 +863,13 @@ class TurnkeySDKClientBase {
698
863
  if (!activeStamper) {
699
864
  return undefined;
700
865
  }
866
+ const session = await this.storageManager?.getActiveSession();
701
867
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_key_tags";
702
868
  const body = {
703
869
  ...input,
704
- organizationId: input.organizationId,
870
+ organizationId: input.organizationId ??
871
+ session?.organizationId ??
872
+ this.config.organizationId,
705
873
  };
706
874
  const stringifiedBody = JSON.stringify(body);
707
875
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -725,10 +893,13 @@ class TurnkeySDKClientBase {
725
893
  if (!activeStamper) {
726
894
  return undefined;
727
895
  }
896
+ const session = await this.storageManager?.getActiveSession();
728
897
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_keys";
729
898
  const body = {
730
899
  ...input,
731
- organizationId: input.organizationId,
900
+ organizationId: input.organizationId ??
901
+ session?.organizationId ??
902
+ this.config.organizationId,
732
903
  };
733
904
  const stringifiedBody = JSON.stringify(body);
734
905
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -752,11 +923,14 @@ class TurnkeySDKClientBase {
752
923
  if (!activeStamper) {
753
924
  return undefined;
754
925
  }
926
+ const session = await this.storageManager?.getActiveSession();
755
927
  const fullUrl = this.config.apiBaseUrl +
756
928
  "/public/v1/query/list_smart_contract_interfaces";
757
929
  const body = {
758
930
  ...input,
759
- organizationId: input.organizationId,
931
+ organizationId: input.organizationId ??
932
+ session?.organizationId ??
933
+ this.config.organizationId,
760
934
  };
761
935
  const stringifiedBody = JSON.stringify(body);
762
936
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -780,10 +954,13 @@ class TurnkeySDKClientBase {
780
954
  if (!activeStamper) {
781
955
  return undefined;
782
956
  }
957
+ const session = await this.storageManager?.getActiveSession();
783
958
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_suborgs";
784
959
  const body = {
785
960
  ...input,
786
- organizationId: input.organizationId,
961
+ organizationId: input.organizationId ??
962
+ session?.organizationId ??
963
+ this.config.organizationId,
787
964
  };
788
965
  const stringifiedBody = JSON.stringify(body);
789
966
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -807,10 +984,13 @@ class TurnkeySDKClientBase {
807
984
  if (!activeStamper) {
808
985
  return undefined;
809
986
  }
987
+ const session = await this.storageManager?.getActiveSession();
810
988
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_user_tags";
811
989
  const body = {
812
990
  ...input,
813
- organizationId: input.organizationId,
991
+ organizationId: input.organizationId ??
992
+ session?.organizationId ??
993
+ this.config.organizationId,
814
994
  };
815
995
  const stringifiedBody = JSON.stringify(body);
816
996
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -834,10 +1014,13 @@ class TurnkeySDKClientBase {
834
1014
  if (!activeStamper) {
835
1015
  return undefined;
836
1016
  }
1017
+ const session = await this.storageManager?.getActiveSession();
837
1018
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_users";
838
1019
  const body = {
839
1020
  ...input,
840
- organizationId: input.organizationId,
1021
+ organizationId: input.organizationId ??
1022
+ session?.organizationId ??
1023
+ this.config.organizationId,
841
1024
  };
842
1025
  const stringifiedBody = JSON.stringify(body);
843
1026
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -861,10 +1044,13 @@ class TurnkeySDKClientBase {
861
1044
  if (!activeStamper) {
862
1045
  return undefined;
863
1046
  }
1047
+ const session = await this.storageManager?.getActiveSession();
864
1048
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_verified_suborgs";
865
1049
  const body = {
866
1050
  ...input,
867
- organizationId: input.organizationId,
1051
+ organizationId: input.organizationId ??
1052
+ session?.organizationId ??
1053
+ this.config.organizationId,
868
1054
  };
869
1055
  const stringifiedBody = JSON.stringify(body);
870
1056
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -888,10 +1074,13 @@ class TurnkeySDKClientBase {
888
1074
  if (!activeStamper) {
889
1075
  return undefined;
890
1076
  }
1077
+ const session = await this.storageManager?.getActiveSession();
891
1078
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallet_accounts";
892
1079
  const body = {
893
1080
  ...input,
894
- organizationId: input.organizationId,
1081
+ organizationId: input.organizationId ??
1082
+ session?.organizationId ??
1083
+ this.config.organizationId,
895
1084
  };
896
1085
  const stringifiedBody = JSON.stringify(body);
897
1086
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -915,10 +1104,13 @@ class TurnkeySDKClientBase {
915
1104
  if (!activeStamper) {
916
1105
  return undefined;
917
1106
  }
1107
+ const session = await this.storageManager?.getActiveSession();
918
1108
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallets";
919
1109
  const body = {
920
1110
  ...input,
921
- organizationId: input.organizationId,
1111
+ organizationId: input.organizationId ??
1112
+ session?.organizationId ??
1113
+ this.config.organizationId,
922
1114
  };
923
1115
  const stringifiedBody = JSON.stringify(body);
924
1116
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -942,10 +1134,13 @@ class TurnkeySDKClientBase {
942
1134
  if (!activeStamper) {
943
1135
  return undefined;
944
1136
  }
1137
+ const session = await this.storageManager?.getActiveSession();
945
1138
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/whoami";
946
1139
  const body = {
947
1140
  ...input,
948
- organizationId: input.organizationId,
1141
+ organizationId: input.organizationId ??
1142
+ session?.organizationId ??
1143
+ this.config.organizationId,
949
1144
  };
950
1145
  const stringifiedBody = JSON.stringify(body);
951
1146
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -973,10 +1168,11 @@ class TurnkeySDKClientBase {
973
1168
  return undefined;
974
1169
  }
975
1170
  const { organizationId, timestampMs, ...parameters } = input;
1171
+ const session = await this.storageManager?.getActiveSession();
976
1172
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/approve_activity";
977
1173
  const bodyWithType = {
978
1174
  parameters,
979
- organizationId,
1175
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
980
1176
  timestampMs: timestampMs ?? String(Date.now()),
981
1177
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
982
1178
  };
@@ -1006,10 +1202,11 @@ class TurnkeySDKClientBase {
1006
1202
  return undefined;
1007
1203
  }
1008
1204
  const { organizationId, timestampMs, ...parameters } = input;
1205
+ const session = await this.storageManager?.getActiveSession();
1009
1206
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_keys";
1010
1207
  const bodyWithType = {
1011
1208
  parameters,
1012
- organizationId,
1209
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1013
1210
  timestampMs: timestampMs ?? String(Date.now()),
1014
1211
  type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
1015
1212
  };
@@ -1039,10 +1236,11 @@ class TurnkeySDKClientBase {
1039
1236
  return undefined;
1040
1237
  }
1041
1238
  const { organizationId, timestampMs, ...parameters } = input;
1239
+ const session = await this.storageManager?.getActiveSession();
1042
1240
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_only_users";
1043
1241
  const bodyWithType = {
1044
1242
  parameters,
1045
- organizationId,
1243
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1046
1244
  timestampMs: timestampMs ?? String(Date.now()),
1047
1245
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
1048
1246
  };
@@ -1072,10 +1270,11 @@ class TurnkeySDKClientBase {
1072
1270
  return undefined;
1073
1271
  }
1074
1272
  const { organizationId, timestampMs, ...parameters } = input;
1273
+ const session = await this.storageManager?.getActiveSession();
1075
1274
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_authenticators";
1076
1275
  const bodyWithType = {
1077
1276
  parameters,
1078
- organizationId,
1277
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1079
1278
  timestampMs: timestampMs ?? String(Date.now()),
1080
1279
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
1081
1280
  };
@@ -1105,11 +1304,12 @@ class TurnkeySDKClientBase {
1105
1304
  return undefined;
1106
1305
  }
1107
1306
  const { organizationId, timestampMs, ...parameters } = input;
1307
+ const session = await this.storageManager?.getActiveSession();
1108
1308
  const fullUrl = this.config.apiBaseUrl +
1109
1309
  "/public/v1/submit/create_fiat_on_ramp_credential";
1110
1310
  const bodyWithType = {
1111
1311
  parameters,
1112
- organizationId,
1312
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1113
1313
  timestampMs: timestampMs ?? String(Date.now()),
1114
1314
  type: "ACTIVITY_TYPE_CREATE_FIAT_ON_RAMP_CREDENTIAL",
1115
1315
  };
@@ -1139,10 +1339,11 @@ class TurnkeySDKClientBase {
1139
1339
  return undefined;
1140
1340
  }
1141
1341
  const { organizationId, timestampMs, ...parameters } = input;
1342
+ const session = await this.storageManager?.getActiveSession();
1142
1343
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_invitations";
1143
1344
  const bodyWithType = {
1144
1345
  parameters,
1145
- organizationId,
1346
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1146
1347
  timestampMs: timestampMs ?? String(Date.now()),
1147
1348
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
1148
1349
  };
@@ -1172,10 +1373,11 @@ class TurnkeySDKClientBase {
1172
1373
  return undefined;
1173
1374
  }
1174
1375
  const { organizationId, timestampMs, ...parameters } = input;
1376
+ const session = await this.storageManager?.getActiveSession();
1175
1377
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth2_credential";
1176
1378
  const bodyWithType = {
1177
1379
  parameters,
1178
- organizationId,
1380
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1179
1381
  timestampMs: timestampMs ?? String(Date.now()),
1180
1382
  type: "ACTIVITY_TYPE_CREATE_OAUTH2CREDENTIAL",
1181
1383
  };
@@ -1205,10 +1407,11 @@ class TurnkeySDKClientBase {
1205
1407
  return undefined;
1206
1408
  }
1207
1409
  const { organizationId, timestampMs, ...parameters } = input;
1410
+ const session = await this.storageManager?.getActiveSession();
1208
1411
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth_providers";
1209
1412
  const bodyWithType = {
1210
1413
  parameters,
1211
- organizationId,
1414
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1212
1415
  timestampMs: timestampMs ?? String(Date.now()),
1213
1416
  type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
1214
1417
  };
@@ -1238,10 +1441,11 @@ class TurnkeySDKClientBase {
1238
1441
  return undefined;
1239
1442
  }
1240
1443
  const { organizationId, timestampMs, ...parameters } = input;
1444
+ const session = await this.storageManager?.getActiveSession();
1241
1445
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policies";
1242
1446
  const bodyWithType = {
1243
1447
  parameters,
1244
- organizationId,
1448
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1245
1449
  timestampMs: timestampMs ?? String(Date.now()),
1246
1450
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
1247
1451
  };
@@ -1271,10 +1475,11 @@ class TurnkeySDKClientBase {
1271
1475
  return undefined;
1272
1476
  }
1273
1477
  const { organizationId, timestampMs, ...parameters } = input;
1478
+ const session = await this.storageManager?.getActiveSession();
1274
1479
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policy";
1275
1480
  const bodyWithType = {
1276
1481
  parameters,
1277
- organizationId,
1482
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1278
1483
  timestampMs: timestampMs ?? String(Date.now()),
1279
1484
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
1280
1485
  };
@@ -1304,10 +1509,11 @@ class TurnkeySDKClientBase {
1304
1509
  return undefined;
1305
1510
  }
1306
1511
  const { organizationId, timestampMs, ...parameters } = input;
1512
+ const session = await this.storageManager?.getActiveSession();
1307
1513
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_key_tag";
1308
1514
  const bodyWithType = {
1309
1515
  parameters,
1310
- organizationId,
1516
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1311
1517
  timestampMs: timestampMs ?? String(Date.now()),
1312
1518
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
1313
1519
  };
@@ -1337,10 +1543,11 @@ class TurnkeySDKClientBase {
1337
1543
  return undefined;
1338
1544
  }
1339
1545
  const { organizationId, timestampMs, ...parameters } = input;
1546
+ const session = await this.storageManager?.getActiveSession();
1340
1547
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_keys";
1341
1548
  const bodyWithType = {
1342
1549
  parameters,
1343
- organizationId,
1550
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1344
1551
  timestampMs: timestampMs ?? String(Date.now()),
1345
1552
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
1346
1553
  };
@@ -1370,10 +1577,11 @@ class TurnkeySDKClientBase {
1370
1577
  return undefined;
1371
1578
  }
1372
1579
  const { organizationId, timestampMs, ...parameters } = input;
1580
+ const session = await this.storageManager?.getActiveSession();
1373
1581
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_only_session";
1374
1582
  const bodyWithType = {
1375
1583
  parameters,
1376
- organizationId,
1584
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1377
1585
  timestampMs: timestampMs ?? String(Date.now()),
1378
1586
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
1379
1587
  };
@@ -1403,10 +1611,11 @@ class TurnkeySDKClientBase {
1403
1611
  return undefined;
1404
1612
  }
1405
1613
  const { organizationId, timestampMs, ...parameters } = input;
1614
+ const session = await this.storageManager?.getActiveSession();
1406
1615
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_write_session";
1407
1616
  const bodyWithType = {
1408
1617
  parameters,
1409
- organizationId,
1618
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1410
1619
  timestampMs: timestampMs ?? String(Date.now()),
1411
1620
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
1412
1621
  };
@@ -1436,11 +1645,12 @@ class TurnkeySDKClientBase {
1436
1645
  return undefined;
1437
1646
  }
1438
1647
  const { organizationId, timestampMs, ...parameters } = input;
1648
+ const session = await this.storageManager?.getActiveSession();
1439
1649
  const fullUrl = this.config.apiBaseUrl +
1440
1650
  "/public/v1/submit/create_smart_contract_interface";
1441
1651
  const bodyWithType = {
1442
1652
  parameters,
1443
- organizationId,
1653
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1444
1654
  timestampMs: timestampMs ?? String(Date.now()),
1445
1655
  type: "ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE",
1446
1656
  };
@@ -1470,10 +1680,11 @@ class TurnkeySDKClientBase {
1470
1680
  return undefined;
1471
1681
  }
1472
1682
  const { organizationId, timestampMs, ...parameters } = input;
1683
+ const session = await this.storageManager?.getActiveSession();
1473
1684
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_sub_organization";
1474
1685
  const bodyWithType = {
1475
1686
  parameters,
1476
- organizationId,
1687
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1477
1688
  timestampMs: timestampMs ?? String(Date.now()),
1478
1689
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1479
1690
  };
@@ -1503,10 +1714,11 @@ class TurnkeySDKClientBase {
1503
1714
  return undefined;
1504
1715
  }
1505
1716
  const { organizationId, timestampMs, ...parameters } = input;
1717
+ const session = await this.storageManager?.getActiveSession();
1506
1718
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_user_tag";
1507
1719
  const bodyWithType = {
1508
1720
  parameters,
1509
- organizationId,
1721
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1510
1722
  timestampMs: timestampMs ?? String(Date.now()),
1511
1723
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
1512
1724
  };
@@ -1536,10 +1748,11 @@ class TurnkeySDKClientBase {
1536
1748
  return undefined;
1537
1749
  }
1538
1750
  const { organizationId, timestampMs, ...parameters } = input;
1751
+ const session = await this.storageManager?.getActiveSession();
1539
1752
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_users";
1540
1753
  const bodyWithType = {
1541
1754
  parameters,
1542
- organizationId,
1755
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1543
1756
  timestampMs: timestampMs ?? String(Date.now()),
1544
1757
  type: "ACTIVITY_TYPE_CREATE_USERS_V3",
1545
1758
  };
@@ -1569,10 +1782,11 @@ class TurnkeySDKClientBase {
1569
1782
  return undefined;
1570
1783
  }
1571
1784
  const { organizationId, timestampMs, ...parameters } = input;
1785
+ const session = await this.storageManager?.getActiveSession();
1572
1786
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet";
1573
1787
  const bodyWithType = {
1574
1788
  parameters,
1575
- organizationId,
1789
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1576
1790
  timestampMs: timestampMs ?? String(Date.now()),
1577
1791
  type: "ACTIVITY_TYPE_CREATE_WALLET",
1578
1792
  };
@@ -1602,10 +1816,11 @@ class TurnkeySDKClientBase {
1602
1816
  return undefined;
1603
1817
  }
1604
1818
  const { organizationId, timestampMs, ...parameters } = input;
1819
+ const session = await this.storageManager?.getActiveSession();
1605
1820
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet_accounts";
1606
1821
  const bodyWithType = {
1607
1822
  parameters,
1608
- organizationId,
1823
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1609
1824
  timestampMs: timestampMs ?? String(Date.now()),
1610
1825
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
1611
1826
  };
@@ -1635,10 +1850,11 @@ class TurnkeySDKClientBase {
1635
1850
  return undefined;
1636
1851
  }
1637
1852
  const { organizationId, timestampMs, ...parameters } = input;
1853
+ const session = await this.storageManager?.getActiveSession();
1638
1854
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_api_keys";
1639
1855
  const bodyWithType = {
1640
1856
  parameters,
1641
- organizationId,
1857
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1642
1858
  timestampMs: timestampMs ?? String(Date.now()),
1643
1859
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
1644
1860
  };
@@ -1668,10 +1884,11 @@ class TurnkeySDKClientBase {
1668
1884
  return undefined;
1669
1885
  }
1670
1886
  const { organizationId, timestampMs, ...parameters } = input;
1887
+ const session = await this.storageManager?.getActiveSession();
1671
1888
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_authenticators";
1672
1889
  const bodyWithType = {
1673
1890
  parameters,
1674
- organizationId,
1891
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1675
1892
  timestampMs: timestampMs ?? String(Date.now()),
1676
1893
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
1677
1894
  };
@@ -1701,11 +1918,12 @@ class TurnkeySDKClientBase {
1701
1918
  return undefined;
1702
1919
  }
1703
1920
  const { organizationId, timestampMs, ...parameters } = input;
1921
+ const session = await this.storageManager?.getActiveSession();
1704
1922
  const fullUrl = this.config.apiBaseUrl +
1705
1923
  "/public/v1/submit/delete_fiat_on_ramp_credential";
1706
1924
  const bodyWithType = {
1707
1925
  parameters,
1708
- organizationId,
1926
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1709
1927
  timestampMs: timestampMs ?? String(Date.now()),
1710
1928
  type: "ACTIVITY_TYPE_DELETE_FIAT_ON_RAMP_CREDENTIAL",
1711
1929
  };
@@ -1735,10 +1953,11 @@ class TurnkeySDKClientBase {
1735
1953
  return undefined;
1736
1954
  }
1737
1955
  const { organizationId, timestampMs, ...parameters } = input;
1956
+ const session = await this.storageManager?.getActiveSession();
1738
1957
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_invitation";
1739
1958
  const bodyWithType = {
1740
1959
  parameters,
1741
- organizationId,
1960
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1742
1961
  timestampMs: timestampMs ?? String(Date.now()),
1743
1962
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
1744
1963
  };
@@ -1768,10 +1987,11 @@ class TurnkeySDKClientBase {
1768
1987
  return undefined;
1769
1988
  }
1770
1989
  const { organizationId, timestampMs, ...parameters } = input;
1990
+ const session = await this.storageManager?.getActiveSession();
1771
1991
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth2_credential";
1772
1992
  const bodyWithType = {
1773
1993
  parameters,
1774
- organizationId,
1994
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1775
1995
  timestampMs: timestampMs ?? String(Date.now()),
1776
1996
  type: "ACTIVITY_TYPE_DELETE_OAUTH2CREDENTIAL",
1777
1997
  };
@@ -1801,10 +2021,11 @@ class TurnkeySDKClientBase {
1801
2021
  return undefined;
1802
2022
  }
1803
2023
  const { organizationId, timestampMs, ...parameters } = input;
2024
+ const session = await this.storageManager?.getActiveSession();
1804
2025
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth_providers";
1805
2026
  const bodyWithType = {
1806
2027
  parameters,
1807
- organizationId,
2028
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1808
2029
  timestampMs: timestampMs ?? String(Date.now()),
1809
2030
  type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
1810
2031
  };
@@ -1834,10 +2055,11 @@ class TurnkeySDKClientBase {
1834
2055
  return undefined;
1835
2056
  }
1836
2057
  const { organizationId, timestampMs, ...parameters } = input;
2058
+ const session = await this.storageManager?.getActiveSession();
1837
2059
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policies";
1838
2060
  const bodyWithType = {
1839
2061
  parameters,
1840
- organizationId,
2062
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1841
2063
  timestampMs: timestampMs ?? String(Date.now()),
1842
2064
  type: "ACTIVITY_TYPE_DELETE_POLICIES",
1843
2065
  };
@@ -1867,10 +2089,11 @@ class TurnkeySDKClientBase {
1867
2089
  return undefined;
1868
2090
  }
1869
2091
  const { organizationId, timestampMs, ...parameters } = input;
2092
+ const session = await this.storageManager?.getActiveSession();
1870
2093
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policy";
1871
2094
  const bodyWithType = {
1872
2095
  parameters,
1873
- organizationId,
2096
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1874
2097
  timestampMs: timestampMs ?? String(Date.now()),
1875
2098
  type: "ACTIVITY_TYPE_DELETE_POLICY",
1876
2099
  };
@@ -1900,10 +2123,11 @@ class TurnkeySDKClientBase {
1900
2123
  return undefined;
1901
2124
  }
1902
2125
  const { organizationId, timestampMs, ...parameters } = input;
2126
+ const session = await this.storageManager?.getActiveSession();
1903
2127
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_key_tags";
1904
2128
  const bodyWithType = {
1905
2129
  parameters,
1906
- organizationId,
2130
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1907
2131
  timestampMs: timestampMs ?? String(Date.now()),
1908
2132
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
1909
2133
  };
@@ -1933,10 +2157,11 @@ class TurnkeySDKClientBase {
1933
2157
  return undefined;
1934
2158
  }
1935
2159
  const { organizationId, timestampMs, ...parameters } = input;
2160
+ const session = await this.storageManager?.getActiveSession();
1936
2161
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_keys";
1937
2162
  const bodyWithType = {
1938
2163
  parameters,
1939
- organizationId,
2164
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1940
2165
  timestampMs: timestampMs ?? String(Date.now()),
1941
2166
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
1942
2167
  };
@@ -1966,11 +2191,12 @@ class TurnkeySDKClientBase {
1966
2191
  return undefined;
1967
2192
  }
1968
2193
  const { organizationId, timestampMs, ...parameters } = input;
2194
+ const session = await this.storageManager?.getActiveSession();
1969
2195
  const fullUrl = this.config.apiBaseUrl +
1970
2196
  "/public/v1/submit/delete_smart_contract_interface";
1971
2197
  const bodyWithType = {
1972
2198
  parameters,
1973
- organizationId,
2199
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1974
2200
  timestampMs: timestampMs ?? String(Date.now()),
1975
2201
  type: "ACTIVITY_TYPE_DELETE_SMART_CONTRACT_INTERFACE",
1976
2202
  };
@@ -2000,10 +2226,11 @@ class TurnkeySDKClientBase {
2000
2226
  return undefined;
2001
2227
  }
2002
2228
  const { organizationId, timestampMs, ...parameters } = input;
2229
+ const session = await this.storageManager?.getActiveSession();
2003
2230
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_sub_organization";
2004
2231
  const bodyWithType = {
2005
2232
  parameters,
2006
- organizationId,
2233
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2007
2234
  timestampMs: timestampMs ?? String(Date.now()),
2008
2235
  type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
2009
2236
  };
@@ -2033,10 +2260,11 @@ class TurnkeySDKClientBase {
2033
2260
  return undefined;
2034
2261
  }
2035
2262
  const { organizationId, timestampMs, ...parameters } = input;
2263
+ const session = await this.storageManager?.getActiveSession();
2036
2264
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_user_tags";
2037
2265
  const bodyWithType = {
2038
2266
  parameters,
2039
- organizationId,
2267
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2040
2268
  timestampMs: timestampMs ?? String(Date.now()),
2041
2269
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
2042
2270
  };
@@ -2066,10 +2294,11 @@ class TurnkeySDKClientBase {
2066
2294
  return undefined;
2067
2295
  }
2068
2296
  const { organizationId, timestampMs, ...parameters } = input;
2297
+ const session = await this.storageManager?.getActiveSession();
2069
2298
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_users";
2070
2299
  const bodyWithType = {
2071
2300
  parameters,
2072
- organizationId,
2301
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2073
2302
  timestampMs: timestampMs ?? String(Date.now()),
2074
2303
  type: "ACTIVITY_TYPE_DELETE_USERS",
2075
2304
  };
@@ -2099,10 +2328,11 @@ class TurnkeySDKClientBase {
2099
2328
  return undefined;
2100
2329
  }
2101
2330
  const { organizationId, timestampMs, ...parameters } = input;
2331
+ const session = await this.storageManager?.getActiveSession();
2102
2332
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallet_accounts";
2103
2333
  const bodyWithType = {
2104
2334
  parameters,
2105
- organizationId,
2335
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2106
2336
  timestampMs: timestampMs ?? String(Date.now()),
2107
2337
  type: "ACTIVITY_TYPE_DELETE_WALLET_ACCOUNTS",
2108
2338
  };
@@ -2132,10 +2362,11 @@ class TurnkeySDKClientBase {
2132
2362
  return undefined;
2133
2363
  }
2134
2364
  const { organizationId, timestampMs, ...parameters } = input;
2365
+ const session = await this.storageManager?.getActiveSession();
2135
2366
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallets";
2136
2367
  const bodyWithType = {
2137
2368
  parameters,
2138
- organizationId,
2369
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2139
2370
  timestampMs: timestampMs ?? String(Date.now()),
2140
2371
  type: "ACTIVITY_TYPE_DELETE_WALLETS",
2141
2372
  };
@@ -2156,7 +2387,7 @@ class TurnkeySDKClientBase {
2156
2387
  session?.organizationId ??
2157
2388
  this.config.organizationId,
2158
2389
  timestampMs: timestampMs ?? String(Date.now()),
2159
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2390
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2160
2391
  }, "emailAuthResult", stampWith);
2161
2392
  };
2162
2393
  this.stampEmailAuth = async (input, stampWith) => {
@@ -2165,12 +2396,13 @@ class TurnkeySDKClientBase {
2165
2396
  return undefined;
2166
2397
  }
2167
2398
  const { organizationId, timestampMs, ...parameters } = input;
2399
+ const session = await this.storageManager?.getActiveSession();
2168
2400
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/email_auth";
2169
2401
  const bodyWithType = {
2170
2402
  parameters,
2171
- organizationId,
2403
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2172
2404
  timestampMs: timestampMs ?? String(Date.now()),
2173
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2405
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2174
2406
  };
2175
2407
  const stringifiedBody = JSON.stringify(bodyWithType);
2176
2408
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2198,10 +2430,11 @@ class TurnkeySDKClientBase {
2198
2430
  return undefined;
2199
2431
  }
2200
2432
  const { organizationId, timestampMs, ...parameters } = input;
2433
+ const session = await this.storageManager?.getActiveSession();
2201
2434
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_raw_transaction";
2202
2435
  const bodyWithType = {
2203
2436
  parameters,
2204
- organizationId,
2437
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2205
2438
  timestampMs: timestampMs ?? String(Date.now()),
2206
2439
  type: "ACTIVITY_TYPE_ETH_SEND_RAW_TRANSACTION",
2207
2440
  };
@@ -2231,10 +2464,11 @@ class TurnkeySDKClientBase {
2231
2464
  return undefined;
2232
2465
  }
2233
2466
  const { organizationId, timestampMs, ...parameters } = input;
2467
+ const session = await this.storageManager?.getActiveSession();
2234
2468
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_transaction";
2235
2469
  const bodyWithType = {
2236
2470
  parameters,
2237
- organizationId,
2471
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2238
2472
  timestampMs: timestampMs ?? String(Date.now()),
2239
2473
  type: "ACTIVITY_TYPE_ETH_SEND_TRANSACTION",
2240
2474
  };
@@ -2264,10 +2498,11 @@ class TurnkeySDKClientBase {
2264
2498
  return undefined;
2265
2499
  }
2266
2500
  const { organizationId, timestampMs, ...parameters } = input;
2501
+ const session = await this.storageManager?.getActiveSession();
2267
2502
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_private_key";
2268
2503
  const bodyWithType = {
2269
2504
  parameters,
2270
- organizationId,
2505
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2271
2506
  timestampMs: timestampMs ?? String(Date.now()),
2272
2507
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
2273
2508
  };
@@ -2297,10 +2532,11 @@ class TurnkeySDKClientBase {
2297
2532
  return undefined;
2298
2533
  }
2299
2534
  const { organizationId, timestampMs, ...parameters } = input;
2535
+ const session = await this.storageManager?.getActiveSession();
2300
2536
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet";
2301
2537
  const bodyWithType = {
2302
2538
  parameters,
2303
- organizationId,
2539
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2304
2540
  timestampMs: timestampMs ?? String(Date.now()),
2305
2541
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
2306
2542
  };
@@ -2330,10 +2566,11 @@ class TurnkeySDKClientBase {
2330
2566
  return undefined;
2331
2567
  }
2332
2568
  const { organizationId, timestampMs, ...parameters } = input;
2569
+ const session = await this.storageManager?.getActiveSession();
2333
2570
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet_account";
2334
2571
  const bodyWithType = {
2335
2572
  parameters,
2336
- organizationId,
2573
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2337
2574
  timestampMs: timestampMs ?? String(Date.now()),
2338
2575
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
2339
2576
  };
@@ -2363,10 +2600,11 @@ class TurnkeySDKClientBase {
2363
2600
  return undefined;
2364
2601
  }
2365
2602
  const { organizationId, timestampMs, ...parameters } = input;
2603
+ const session = await this.storageManager?.getActiveSession();
2366
2604
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_private_key";
2367
2605
  const bodyWithType = {
2368
2606
  parameters,
2369
- organizationId,
2607
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2370
2608
  timestampMs: timestampMs ?? String(Date.now()),
2371
2609
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
2372
2610
  };
@@ -2396,10 +2634,11 @@ class TurnkeySDKClientBase {
2396
2634
  return undefined;
2397
2635
  }
2398
2636
  const { organizationId, timestampMs, ...parameters } = input;
2637
+ const session = await this.storageManager?.getActiveSession();
2399
2638
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_wallet";
2400
2639
  const bodyWithType = {
2401
2640
  parameters,
2402
- organizationId,
2641
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2403
2642
  timestampMs: timestampMs ?? String(Date.now()),
2404
2643
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
2405
2644
  };
@@ -2429,10 +2668,11 @@ class TurnkeySDKClientBase {
2429
2668
  return undefined;
2430
2669
  }
2431
2670
  const { organizationId, timestampMs, ...parameters } = input;
2671
+ const session = await this.storageManager?.getActiveSession();
2432
2672
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_fiat_on_ramp";
2433
2673
  const bodyWithType = {
2434
2674
  parameters,
2435
- organizationId,
2675
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2436
2676
  timestampMs: timestampMs ?? String(Date.now()),
2437
2677
  type: "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
2438
2678
  };
@@ -2462,10 +2702,11 @@ class TurnkeySDKClientBase {
2462
2702
  return undefined;
2463
2703
  }
2464
2704
  const { organizationId, timestampMs, ...parameters } = input;
2705
+ const session = await this.storageManager?.getActiveSession();
2465
2706
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_private_key";
2466
2707
  const bodyWithType = {
2467
2708
  parameters,
2468
- organizationId,
2709
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2469
2710
  timestampMs: timestampMs ?? String(Date.now()),
2470
2711
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
2471
2712
  };
@@ -2495,10 +2736,11 @@ class TurnkeySDKClientBase {
2495
2736
  return undefined;
2496
2737
  }
2497
2738
  const { organizationId, timestampMs, ...parameters } = input;
2739
+ const session = await this.storageManager?.getActiveSession();
2498
2740
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_wallet";
2499
2741
  const bodyWithType = {
2500
2742
  parameters,
2501
- organizationId,
2743
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2502
2744
  timestampMs: timestampMs ?? String(Date.now()),
2503
2745
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
2504
2746
  };
@@ -2519,7 +2761,7 @@ class TurnkeySDKClientBase {
2519
2761
  session?.organizationId ??
2520
2762
  this.config.organizationId,
2521
2763
  timestampMs: timestampMs ?? String(Date.now()),
2522
- type: "ACTIVITY_TYPE_INIT_OTP",
2764
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2523
2765
  }, "initOtpResult", stampWith);
2524
2766
  };
2525
2767
  this.stampInitOtp = async (input, stampWith) => {
@@ -2528,12 +2770,13 @@ class TurnkeySDKClientBase {
2528
2770
  return undefined;
2529
2771
  }
2530
2772
  const { organizationId, timestampMs, ...parameters } = input;
2773
+ const session = await this.storageManager?.getActiveSession();
2531
2774
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
2532
2775
  const bodyWithType = {
2533
2776
  parameters,
2534
- organizationId,
2777
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2535
2778
  timestampMs: timestampMs ?? String(Date.now()),
2536
- type: "ACTIVITY_TYPE_INIT_OTP",
2779
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2537
2780
  };
2538
2781
  const stringifiedBody = JSON.stringify(bodyWithType);
2539
2782
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2552,7 +2795,7 @@ class TurnkeySDKClientBase {
2552
2795
  session?.organizationId ??
2553
2796
  this.config.organizationId,
2554
2797
  timestampMs: timestampMs ?? String(Date.now()),
2555
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2798
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2556
2799
  }, "initOtpAuthResult", stampWith);
2557
2800
  };
2558
2801
  this.stampInitOtpAuth = async (input, stampWith) => {
@@ -2561,12 +2804,13 @@ class TurnkeySDKClientBase {
2561
2804
  return undefined;
2562
2805
  }
2563
2806
  const { organizationId, timestampMs, ...parameters } = input;
2807
+ const session = await this.storageManager?.getActiveSession();
2564
2808
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp_auth";
2565
2809
  const bodyWithType = {
2566
2810
  parameters,
2567
- organizationId,
2811
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2568
2812
  timestampMs: timestampMs ?? String(Date.now()),
2569
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2813
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2570
2814
  };
2571
2815
  const stringifiedBody = JSON.stringify(bodyWithType);
2572
2816
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2585,7 +2829,7 @@ class TurnkeySDKClientBase {
2585
2829
  session?.organizationId ??
2586
2830
  this.config.organizationId,
2587
2831
  timestampMs: timestampMs ?? String(Date.now()),
2588
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2832
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2589
2833
  }, "initUserEmailRecoveryResult", stampWith);
2590
2834
  };
2591
2835
  this.stampInitUserEmailRecovery = async (input, stampWith) => {
@@ -2594,12 +2838,13 @@ class TurnkeySDKClientBase {
2594
2838
  return undefined;
2595
2839
  }
2596
2840
  const { organizationId, timestampMs, ...parameters } = input;
2841
+ const session = await this.storageManager?.getActiveSession();
2597
2842
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_user_email_recovery";
2598
2843
  const bodyWithType = {
2599
2844
  parameters,
2600
- organizationId,
2845
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2601
2846
  timestampMs: timestampMs ?? String(Date.now()),
2602
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2847
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2603
2848
  };
2604
2849
  const stringifiedBody = JSON.stringify(bodyWithType);
2605
2850
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2627,10 +2872,11 @@ class TurnkeySDKClientBase {
2627
2872
  return undefined;
2628
2873
  }
2629
2874
  const { organizationId, timestampMs, ...parameters } = input;
2875
+ const session = await this.storageManager?.getActiveSession();
2630
2876
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth";
2631
2877
  const bodyWithType = {
2632
2878
  parameters,
2633
- organizationId,
2879
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2634
2880
  timestampMs: timestampMs ?? String(Date.now()),
2635
2881
  type: "ACTIVITY_TYPE_OAUTH",
2636
2882
  };
@@ -2660,10 +2906,11 @@ class TurnkeySDKClientBase {
2660
2906
  return undefined;
2661
2907
  }
2662
2908
  const { organizationId, timestampMs, ...parameters } = input;
2909
+ const session = await this.storageManager?.getActiveSession();
2663
2910
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth2_authenticate";
2664
2911
  const bodyWithType = {
2665
2912
  parameters,
2666
- organizationId,
2913
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2667
2914
  timestampMs: timestampMs ?? String(Date.now()),
2668
2915
  type: "ACTIVITY_TYPE_OAUTH2AUTHENTICATE",
2669
2916
  };
@@ -2693,10 +2940,11 @@ class TurnkeySDKClientBase {
2693
2940
  return undefined;
2694
2941
  }
2695
2942
  const { organizationId, timestampMs, ...parameters } = input;
2943
+ const session = await this.storageManager?.getActiveSession();
2696
2944
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
2697
2945
  const bodyWithType = {
2698
2946
  parameters,
2699
- organizationId,
2947
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2700
2948
  timestampMs: timestampMs ?? String(Date.now()),
2701
2949
  type: "ACTIVITY_TYPE_OAUTH_LOGIN",
2702
2950
  };
@@ -2726,10 +2974,11 @@ class TurnkeySDKClientBase {
2726
2974
  return undefined;
2727
2975
  }
2728
2976
  const { organizationId, timestampMs, ...parameters } = input;
2977
+ const session = await this.storageManager?.getActiveSession();
2729
2978
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_auth";
2730
2979
  const bodyWithType = {
2731
2980
  parameters,
2732
- organizationId,
2981
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2733
2982
  timestampMs: timestampMs ?? String(Date.now()),
2734
2983
  type: "ACTIVITY_TYPE_OTP_AUTH",
2735
2984
  };
@@ -2759,10 +3008,11 @@ class TurnkeySDKClientBase {
2759
3008
  return undefined;
2760
3009
  }
2761
3010
  const { organizationId, timestampMs, ...parameters } = input;
3011
+ const session = await this.storageManager?.getActiveSession();
2762
3012
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
2763
3013
  const bodyWithType = {
2764
3014
  parameters,
2765
- organizationId,
3015
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2766
3016
  timestampMs: timestampMs ?? String(Date.now()),
2767
3017
  type: "ACTIVITY_TYPE_OTP_LOGIN",
2768
3018
  };
@@ -2792,10 +3042,11 @@ class TurnkeySDKClientBase {
2792
3042
  return undefined;
2793
3043
  }
2794
3044
  const { organizationId, timestampMs, ...parameters } = input;
3045
+ const session = await this.storageManager?.getActiveSession();
2795
3046
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/recover_user";
2796
3047
  const bodyWithType = {
2797
3048
  parameters,
2798
- organizationId,
3049
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2799
3050
  timestampMs: timestampMs ?? String(Date.now()),
2800
3051
  type: "ACTIVITY_TYPE_RECOVER_USER",
2801
3052
  };
@@ -2825,10 +3076,11 @@ class TurnkeySDKClientBase {
2825
3076
  return undefined;
2826
3077
  }
2827
3078
  const { organizationId, timestampMs, ...parameters } = input;
3079
+ const session = await this.storageManager?.getActiveSession();
2828
3080
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/reject_activity";
2829
3081
  const bodyWithType = {
2830
3082
  parameters,
2831
- organizationId,
3083
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2832
3084
  timestampMs: timestampMs ?? String(Date.now()),
2833
3085
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
2834
3086
  };
@@ -2858,10 +3110,11 @@ class TurnkeySDKClientBase {
2858
3110
  return undefined;
2859
3111
  }
2860
3112
  const { organizationId, timestampMs, ...parameters } = input;
3113
+ const session = await this.storageManager?.getActiveSession();
2861
3114
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/remove_organization_feature";
2862
3115
  const bodyWithType = {
2863
3116
  parameters,
2864
- organizationId,
3117
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2865
3118
  timestampMs: timestampMs ?? String(Date.now()),
2866
3119
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
2867
3120
  };
@@ -2891,10 +3144,11 @@ class TurnkeySDKClientBase {
2891
3144
  return undefined;
2892
3145
  }
2893
3146
  const { organizationId, timestampMs, ...parameters } = input;
3147
+ const session = await this.storageManager?.getActiveSession();
2894
3148
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/set_organization_feature";
2895
3149
  const bodyWithType = {
2896
3150
  parameters,
2897
- organizationId,
3151
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2898
3152
  timestampMs: timestampMs ?? String(Date.now()),
2899
3153
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
2900
3154
  };
@@ -2924,10 +3178,11 @@ class TurnkeySDKClientBase {
2924
3178
  return undefined;
2925
3179
  }
2926
3180
  const { organizationId, timestampMs, ...parameters } = input;
3181
+ const session = await this.storageManager?.getActiveSession();
2927
3182
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payload";
2928
3183
  const bodyWithType = {
2929
3184
  parameters,
2930
- organizationId,
3185
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2931
3186
  timestampMs: timestampMs ?? String(Date.now()),
2932
3187
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
2933
3188
  };
@@ -2957,10 +3212,11 @@ class TurnkeySDKClientBase {
2957
3212
  return undefined;
2958
3213
  }
2959
3214
  const { organizationId, timestampMs, ...parameters } = input;
3215
+ const session = await this.storageManager?.getActiveSession();
2960
3216
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payloads";
2961
3217
  const bodyWithType = {
2962
3218
  parameters,
2963
- organizationId,
3219
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2964
3220
  timestampMs: timestampMs ?? String(Date.now()),
2965
3221
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
2966
3222
  };
@@ -2990,10 +3246,11 @@ class TurnkeySDKClientBase {
2990
3246
  return undefined;
2991
3247
  }
2992
3248
  const { organizationId, timestampMs, ...parameters } = input;
3249
+ const session = await this.storageManager?.getActiveSession();
2993
3250
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_transaction";
2994
3251
  const bodyWithType = {
2995
3252
  parameters,
2996
- organizationId,
3253
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2997
3254
  timestampMs: timestampMs ?? String(Date.now()),
2998
3255
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
2999
3256
  };
@@ -3023,10 +3280,11 @@ class TurnkeySDKClientBase {
3023
3280
  return undefined;
3024
3281
  }
3025
3282
  const { organizationId, timestampMs, ...parameters } = input;
3283
+ const session = await this.storageManager?.getActiveSession();
3026
3284
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
3027
3285
  const bodyWithType = {
3028
3286
  parameters,
3029
- organizationId,
3287
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3030
3288
  timestampMs: timestampMs ?? String(Date.now()),
3031
3289
  type: "ACTIVITY_TYPE_STAMP_LOGIN",
3032
3290
  };
@@ -3056,11 +3314,12 @@ class TurnkeySDKClientBase {
3056
3314
  return undefined;
3057
3315
  }
3058
3316
  const { organizationId, timestampMs, ...parameters } = input;
3317
+ const session = await this.storageManager?.getActiveSession();
3059
3318
  const fullUrl = this.config.apiBaseUrl +
3060
3319
  "/public/v1/submit/update_fiat_on_ramp_credential";
3061
3320
  const bodyWithType = {
3062
3321
  parameters,
3063
- organizationId,
3322
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3064
3323
  timestampMs: timestampMs ?? String(Date.now()),
3065
3324
  type: "ACTIVITY_TYPE_UPDATE_FIAT_ON_RAMP_CREDENTIAL",
3066
3325
  };
@@ -3090,10 +3349,11 @@ class TurnkeySDKClientBase {
3090
3349
  return undefined;
3091
3350
  }
3092
3351
  const { organizationId, timestampMs, ...parameters } = input;
3352
+ const session = await this.storageManager?.getActiveSession();
3093
3353
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_oauth2_credential";
3094
3354
  const bodyWithType = {
3095
3355
  parameters,
3096
- organizationId,
3356
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3097
3357
  timestampMs: timestampMs ?? String(Date.now()),
3098
3358
  type: "ACTIVITY_TYPE_UPDATE_OAUTH2CREDENTIAL",
3099
3359
  };
@@ -3123,10 +3383,11 @@ class TurnkeySDKClientBase {
3123
3383
  return undefined;
3124
3384
  }
3125
3385
  const { organizationId, timestampMs, ...parameters } = input;
3386
+ const session = await this.storageManager?.getActiveSession();
3126
3387
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_policy";
3127
3388
  const bodyWithType = {
3128
3389
  parameters,
3129
- organizationId,
3390
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3130
3391
  timestampMs: timestampMs ?? String(Date.now()),
3131
3392
  type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
3132
3393
  };
@@ -3156,10 +3417,11 @@ class TurnkeySDKClientBase {
3156
3417
  return undefined;
3157
3418
  }
3158
3419
  const { organizationId, timestampMs, ...parameters } = input;
3420
+ const session = await this.storageManager?.getActiveSession();
3159
3421
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_private_key_tag";
3160
3422
  const bodyWithType = {
3161
3423
  parameters,
3162
- organizationId,
3424
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3163
3425
  timestampMs: timestampMs ?? String(Date.now()),
3164
3426
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
3165
3427
  };
@@ -3189,10 +3451,11 @@ class TurnkeySDKClientBase {
3189
3451
  return undefined;
3190
3452
  }
3191
3453
  const { organizationId, timestampMs, ...parameters } = input;
3454
+ const session = await this.storageManager?.getActiveSession();
3192
3455
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_root_quorum";
3193
3456
  const bodyWithType = {
3194
3457
  parameters,
3195
- organizationId,
3458
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3196
3459
  timestampMs: timestampMs ?? String(Date.now()),
3197
3460
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
3198
3461
  };
@@ -3222,10 +3485,11 @@ class TurnkeySDKClientBase {
3222
3485
  return undefined;
3223
3486
  }
3224
3487
  const { organizationId, timestampMs, ...parameters } = input;
3488
+ const session = await this.storageManager?.getActiveSession();
3225
3489
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user";
3226
3490
  const bodyWithType = {
3227
3491
  parameters,
3228
- organizationId,
3492
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3229
3493
  timestampMs: timestampMs ?? String(Date.now()),
3230
3494
  type: "ACTIVITY_TYPE_UPDATE_USER",
3231
3495
  };
@@ -3255,10 +3519,11 @@ class TurnkeySDKClientBase {
3255
3519
  return undefined;
3256
3520
  }
3257
3521
  const { organizationId, timestampMs, ...parameters } = input;
3522
+ const session = await this.storageManager?.getActiveSession();
3258
3523
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_email";
3259
3524
  const bodyWithType = {
3260
3525
  parameters,
3261
- organizationId,
3526
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3262
3527
  timestampMs: timestampMs ?? String(Date.now()),
3263
3528
  type: "ACTIVITY_TYPE_UPDATE_USER_EMAIL",
3264
3529
  };
@@ -3288,10 +3553,11 @@ class TurnkeySDKClientBase {
3288
3553
  return undefined;
3289
3554
  }
3290
3555
  const { organizationId, timestampMs, ...parameters } = input;
3556
+ const session = await this.storageManager?.getActiveSession();
3291
3557
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_name";
3292
3558
  const bodyWithType = {
3293
3559
  parameters,
3294
- organizationId,
3560
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3295
3561
  timestampMs: timestampMs ?? String(Date.now()),
3296
3562
  type: "ACTIVITY_TYPE_UPDATE_USER_NAME",
3297
3563
  };
@@ -3321,10 +3587,11 @@ class TurnkeySDKClientBase {
3321
3587
  return undefined;
3322
3588
  }
3323
3589
  const { organizationId, timestampMs, ...parameters } = input;
3590
+ const session = await this.storageManager?.getActiveSession();
3324
3591
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_phone_number";
3325
3592
  const bodyWithType = {
3326
3593
  parameters,
3327
- organizationId,
3594
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3328
3595
  timestampMs: timestampMs ?? String(Date.now()),
3329
3596
  type: "ACTIVITY_TYPE_UPDATE_USER_PHONE_NUMBER",
3330
3597
  };
@@ -3354,10 +3621,11 @@ class TurnkeySDKClientBase {
3354
3621
  return undefined;
3355
3622
  }
3356
3623
  const { organizationId, timestampMs, ...parameters } = input;
3624
+ const session = await this.storageManager?.getActiveSession();
3357
3625
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_tag";
3358
3626
  const bodyWithType = {
3359
3627
  parameters,
3360
- organizationId,
3628
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3361
3629
  timestampMs: timestampMs ?? String(Date.now()),
3362
3630
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
3363
3631
  };
@@ -3387,10 +3655,11 @@ class TurnkeySDKClientBase {
3387
3655
  return undefined;
3388
3656
  }
3389
3657
  const { organizationId, timestampMs, ...parameters } = input;
3658
+ const session = await this.storageManager?.getActiveSession();
3390
3659
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_wallet";
3391
3660
  const bodyWithType = {
3392
3661
  parameters,
3393
- organizationId,
3662
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3394
3663
  timestampMs: timestampMs ?? String(Date.now()),
3395
3664
  type: "ACTIVITY_TYPE_UPDATE_WALLET",
3396
3665
  };
@@ -3420,10 +3689,11 @@ class TurnkeySDKClientBase {
3420
3689
  return undefined;
3421
3690
  }
3422
3691
  const { organizationId, timestampMs, ...parameters } = input;
3692
+ const session = await this.storageManager?.getActiveSession();
3423
3693
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
3424
3694
  const bodyWithType = {
3425
3695
  parameters,
3426
- organizationId,
3696
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3427
3697
  timestampMs: timestampMs ?? String(Date.now()),
3428
3698
  type: "ACTIVITY_TYPE_VERIFY_OTP",
3429
3699
  };
@@ -3449,10 +3719,13 @@ class TurnkeySDKClientBase {
3449
3719
  if (!activeStamper) {
3450
3720
  return undefined;
3451
3721
  }
3722
+ const session = await this.storageManager?.getActiveSession();
3452
3723
  const fullUrl = this.config.apiBaseUrl + "/tkhq/api/v1/test_rate_limits";
3453
3724
  const body = {
3454
3725
  ...input,
3455
- organizationId: input.organizationId,
3726
+ organizationId: input.organizationId ??
3727
+ session?.organizationId ??
3728
+ this.config.organizationId,
3456
3729
  };
3457
3730
  const stringifiedBody = JSON.stringify(body);
3458
3731
  const stamp = await activeStamper.stamp(stringifiedBody);