@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.
@@ -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,43 @@ 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,
211
+ };
212
+ const stringifiedBody = JSON.stringify(body);
213
+ const stamp = await activeStamper.stamp(stringifiedBody);
214
+ return {
215
+ body: stringifiedBody,
216
+ stamp: stamp,
217
+ url: fullUrl,
218
+ };
219
+ };
220
+ this.getGasUsage = async (input, stampWith) => {
221
+ const session = await this.storageManager?.getActiveSession();
222
+ return this.request("/public/v1/query/get_gas_usage", {
223
+ ...input,
224
+ organizationId: input.organizationId ??
225
+ session?.organizationId ??
226
+ this.config.organizationId,
227
+ }, stampWith);
228
+ };
229
+ this.stampGetGasUsage = async (input, stampWith) => {
230
+ const activeStamper = this.getStamper(stampWith);
231
+ if (!activeStamper) {
232
+ return undefined;
233
+ }
234
+ const session = await this.storageManager?.getActiveSession();
235
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_gas_usage";
236
+ const body = {
237
+ ...input,
238
+ organizationId: input.organizationId ??
239
+ session?.organizationId ??
240
+ this.config.organizationId,
190
241
  };
191
242
  const stringifiedBody = JSON.stringify(body);
192
243
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -210,10 +261,43 @@ class TurnkeySDKClientBase {
210
261
  if (!activeStamper) {
211
262
  return undefined;
212
263
  }
264
+ const session = await this.storageManager?.getActiveSession();
213
265
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_latest_boot_proof";
214
266
  const body = {
215
267
  ...input,
216
- organizationId: input.organizationId,
268
+ organizationId: input.organizationId ??
269
+ session?.organizationId ??
270
+ this.config.organizationId,
271
+ };
272
+ const stringifiedBody = JSON.stringify(body);
273
+ const stamp = await activeStamper.stamp(stringifiedBody);
274
+ return {
275
+ body: stringifiedBody,
276
+ stamp: stamp,
277
+ url: fullUrl,
278
+ };
279
+ };
280
+ this.getNonces = async (input, stampWith) => {
281
+ const session = await this.storageManager?.getActiveSession();
282
+ return this.request("/public/v1/query/get_nonces", {
283
+ ...input,
284
+ organizationId: input.organizationId ??
285
+ session?.organizationId ??
286
+ this.config.organizationId,
287
+ }, stampWith);
288
+ };
289
+ this.stampGetNonces = async (input, stampWith) => {
290
+ const activeStamper = this.getStamper(stampWith);
291
+ if (!activeStamper) {
292
+ return undefined;
293
+ }
294
+ const session = await this.storageManager?.getActiveSession();
295
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_nonces";
296
+ const body = {
297
+ ...input,
298
+ organizationId: input.organizationId ??
299
+ session?.organizationId ??
300
+ this.config.organizationId,
217
301
  };
218
302
  const stringifiedBody = JSON.stringify(body);
219
303
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -237,10 +321,13 @@ class TurnkeySDKClientBase {
237
321
  if (!activeStamper) {
238
322
  return undefined;
239
323
  }
324
+ const session = await this.storageManager?.getActiveSession();
240
325
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth2_credential";
241
326
  const body = {
242
327
  ...input,
243
- organizationId: input.organizationId,
328
+ organizationId: input.organizationId ??
329
+ session?.organizationId ??
330
+ this.config.organizationId,
244
331
  };
245
332
  const stringifiedBody = JSON.stringify(body);
246
333
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -264,10 +351,13 @@ class TurnkeySDKClientBase {
264
351
  if (!activeStamper) {
265
352
  return undefined;
266
353
  }
354
+ const session = await this.storageManager?.getActiveSession();
267
355
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth_providers";
268
356
  const body = {
269
357
  ...input,
270
- organizationId: input.organizationId,
358
+ organizationId: input.organizationId ??
359
+ session?.organizationId ??
360
+ this.config.organizationId,
271
361
  };
272
362
  const stringifiedBody = JSON.stringify(body);
273
363
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -291,10 +381,13 @@ class TurnkeySDKClientBase {
291
381
  if (!activeStamper) {
292
382
  return undefined;
293
383
  }
384
+ const session = await this.storageManager?.getActiveSession();
294
385
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_onramp_transaction_status";
295
386
  const body = {
296
387
  ...input,
297
- organizationId: input.organizationId,
388
+ organizationId: input.organizationId ??
389
+ session?.organizationId ??
390
+ this.config.organizationId,
298
391
  };
299
392
  const stringifiedBody = JSON.stringify(body);
300
393
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -318,10 +411,13 @@ class TurnkeySDKClientBase {
318
411
  if (!activeStamper) {
319
412
  return undefined;
320
413
  }
414
+ const session = await this.storageManager?.getActiveSession();
321
415
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization";
322
416
  const body = {
323
417
  ...input,
324
- organizationId: input.organizationId,
418
+ organizationId: input.organizationId ??
419
+ session?.organizationId ??
420
+ this.config.organizationId,
325
421
  };
326
422
  const stringifiedBody = JSON.stringify(body);
327
423
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -345,10 +441,13 @@ class TurnkeySDKClientBase {
345
441
  if (!activeStamper) {
346
442
  return undefined;
347
443
  }
444
+ const session = await this.storageManager?.getActiveSession();
348
445
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization_configs";
349
446
  const body = {
350
447
  ...input,
351
- organizationId: input.organizationId,
448
+ organizationId: input.organizationId ??
449
+ session?.organizationId ??
450
+ this.config.organizationId,
352
451
  };
353
452
  const stringifiedBody = JSON.stringify(body);
354
453
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -372,10 +471,13 @@ class TurnkeySDKClientBase {
372
471
  if (!activeStamper) {
373
472
  return undefined;
374
473
  }
474
+ const session = await this.storageManager?.getActiveSession();
375
475
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy";
376
476
  const body = {
377
477
  ...input,
378
- organizationId: input.organizationId,
478
+ organizationId: input.organizationId ??
479
+ session?.organizationId ??
480
+ this.config.organizationId,
379
481
  };
380
482
  const stringifiedBody = JSON.stringify(body);
381
483
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -399,10 +501,13 @@ class TurnkeySDKClientBase {
399
501
  if (!activeStamper) {
400
502
  return undefined;
401
503
  }
504
+ const session = await this.storageManager?.getActiveSession();
402
505
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy_evaluations";
403
506
  const body = {
404
507
  ...input,
405
- organizationId: input.organizationId,
508
+ organizationId: input.organizationId ??
509
+ session?.organizationId ??
510
+ this.config.organizationId,
406
511
  };
407
512
  const stringifiedBody = JSON.stringify(body);
408
513
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -426,10 +531,43 @@ class TurnkeySDKClientBase {
426
531
  if (!activeStamper) {
427
532
  return undefined;
428
533
  }
534
+ const session = await this.storageManager?.getActiveSession();
429
535
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_private_key";
430
536
  const body = {
431
537
  ...input,
432
- organizationId: input.organizationId,
538
+ organizationId: input.organizationId ??
539
+ session?.organizationId ??
540
+ this.config.organizationId,
541
+ };
542
+ const stringifiedBody = JSON.stringify(body);
543
+ const stamp = await activeStamper.stamp(stringifiedBody);
544
+ return {
545
+ body: stringifiedBody,
546
+ stamp: stamp,
547
+ url: fullUrl,
548
+ };
549
+ };
550
+ this.getSendTransactionStatus = async (input, stampWith) => {
551
+ const session = await this.storageManager?.getActiveSession();
552
+ return this.request("/public/v1/query/get_send_transaction_status", {
553
+ ...input,
554
+ organizationId: input.organizationId ??
555
+ session?.organizationId ??
556
+ this.config.organizationId,
557
+ }, stampWith);
558
+ };
559
+ this.stampGetSendTransactionStatus = async (input, stampWith) => {
560
+ const activeStamper = this.getStamper(stampWith);
561
+ if (!activeStamper) {
562
+ return undefined;
563
+ }
564
+ const session = await this.storageManager?.getActiveSession();
565
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_send_transaction_status";
566
+ const body = {
567
+ ...input,
568
+ organizationId: input.organizationId ??
569
+ session?.organizationId ??
570
+ this.config.organizationId,
433
571
  };
434
572
  const stringifiedBody = JSON.stringify(body);
435
573
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -453,10 +591,13 @@ class TurnkeySDKClientBase {
453
591
  if (!activeStamper) {
454
592
  return undefined;
455
593
  }
594
+ const session = await this.storageManager?.getActiveSession();
456
595
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_smart_contract_interface";
457
596
  const body = {
458
597
  ...input,
459
- organizationId: input.organizationId,
598
+ organizationId: input.organizationId ??
599
+ session?.organizationId ??
600
+ this.config.organizationId,
460
601
  };
461
602
  const stringifiedBody = JSON.stringify(body);
462
603
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -480,10 +621,13 @@ class TurnkeySDKClientBase {
480
621
  if (!activeStamper) {
481
622
  return undefined;
482
623
  }
624
+ const session = await this.storageManager?.getActiveSession();
483
625
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_user";
484
626
  const body = {
485
627
  ...input,
486
- organizationId: input.organizationId,
628
+ organizationId: input.organizationId ??
629
+ session?.organizationId ??
630
+ this.config.organizationId,
487
631
  };
488
632
  const stringifiedBody = JSON.stringify(body);
489
633
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -507,10 +651,13 @@ class TurnkeySDKClientBase {
507
651
  if (!activeStamper) {
508
652
  return undefined;
509
653
  }
654
+ const session = await this.storageManager?.getActiveSession();
510
655
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet";
511
656
  const body = {
512
657
  ...input,
513
- organizationId: input.organizationId,
658
+ organizationId: input.organizationId ??
659
+ session?.organizationId ??
660
+ this.config.organizationId,
514
661
  };
515
662
  const stringifiedBody = JSON.stringify(body);
516
663
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -534,10 +681,13 @@ class TurnkeySDKClientBase {
534
681
  if (!activeStamper) {
535
682
  return undefined;
536
683
  }
684
+ const session = await this.storageManager?.getActiveSession();
537
685
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet_account";
538
686
  const body = {
539
687
  ...input,
540
- organizationId: input.organizationId,
688
+ organizationId: input.organizationId ??
689
+ session?.organizationId ??
690
+ this.config.organizationId,
541
691
  };
542
692
  const stringifiedBody = JSON.stringify(body);
543
693
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -561,10 +711,13 @@ class TurnkeySDKClientBase {
561
711
  if (!activeStamper) {
562
712
  return undefined;
563
713
  }
714
+ const session = await this.storageManager?.getActiveSession();
564
715
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_activities";
565
716
  const body = {
566
717
  ...input,
567
- organizationId: input.organizationId,
718
+ organizationId: input.organizationId ??
719
+ session?.organizationId ??
720
+ this.config.organizationId,
568
721
  };
569
722
  const stringifiedBody = JSON.stringify(body);
570
723
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -588,10 +741,13 @@ class TurnkeySDKClientBase {
588
741
  if (!activeStamper) {
589
742
  return undefined;
590
743
  }
744
+ const session = await this.storageManager?.getActiveSession();
591
745
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_app_proofs";
592
746
  const body = {
593
747
  ...input,
594
- organizationId: input.organizationId,
748
+ organizationId: input.organizationId ??
749
+ session?.organizationId ??
750
+ this.config.organizationId,
595
751
  };
596
752
  const stringifiedBody = JSON.stringify(body);
597
753
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -615,10 +771,13 @@ class TurnkeySDKClientBase {
615
771
  if (!activeStamper) {
616
772
  return undefined;
617
773
  }
774
+ const session = await this.storageManager?.getActiveSession();
618
775
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_fiat_on_ramp_credentials";
619
776
  const body = {
620
777
  ...input,
621
- organizationId: input.organizationId,
778
+ organizationId: input.organizationId ??
779
+ session?.organizationId ??
780
+ this.config.organizationId,
622
781
  };
623
782
  const stringifiedBody = JSON.stringify(body);
624
783
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -642,10 +801,13 @@ class TurnkeySDKClientBase {
642
801
  if (!activeStamper) {
643
802
  return undefined;
644
803
  }
804
+ const session = await this.storageManager?.getActiveSession();
645
805
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_oauth2_credentials";
646
806
  const body = {
647
807
  ...input,
648
- organizationId: input.organizationId,
808
+ organizationId: input.organizationId ??
809
+ session?.organizationId ??
810
+ this.config.organizationId,
649
811
  };
650
812
  const stringifiedBody = JSON.stringify(body);
651
813
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -669,10 +831,13 @@ class TurnkeySDKClientBase {
669
831
  if (!activeStamper) {
670
832
  return undefined;
671
833
  }
834
+ const session = await this.storageManager?.getActiveSession();
672
835
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_policies";
673
836
  const body = {
674
837
  ...input,
675
- organizationId: input.organizationId,
838
+ organizationId: input.organizationId ??
839
+ session?.organizationId ??
840
+ this.config.organizationId,
676
841
  };
677
842
  const stringifiedBody = JSON.stringify(body);
678
843
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -696,10 +861,13 @@ class TurnkeySDKClientBase {
696
861
  if (!activeStamper) {
697
862
  return undefined;
698
863
  }
864
+ const session = await this.storageManager?.getActiveSession();
699
865
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_key_tags";
700
866
  const body = {
701
867
  ...input,
702
- organizationId: input.organizationId,
868
+ organizationId: input.organizationId ??
869
+ session?.organizationId ??
870
+ this.config.organizationId,
703
871
  };
704
872
  const stringifiedBody = JSON.stringify(body);
705
873
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -723,10 +891,13 @@ class TurnkeySDKClientBase {
723
891
  if (!activeStamper) {
724
892
  return undefined;
725
893
  }
894
+ const session = await this.storageManager?.getActiveSession();
726
895
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_keys";
727
896
  const body = {
728
897
  ...input,
729
- organizationId: input.organizationId,
898
+ organizationId: input.organizationId ??
899
+ session?.organizationId ??
900
+ this.config.organizationId,
730
901
  };
731
902
  const stringifiedBody = JSON.stringify(body);
732
903
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -750,11 +921,14 @@ class TurnkeySDKClientBase {
750
921
  if (!activeStamper) {
751
922
  return undefined;
752
923
  }
924
+ const session = await this.storageManager?.getActiveSession();
753
925
  const fullUrl = this.config.apiBaseUrl +
754
926
  "/public/v1/query/list_smart_contract_interfaces";
755
927
  const body = {
756
928
  ...input,
757
- organizationId: input.organizationId,
929
+ organizationId: input.organizationId ??
930
+ session?.organizationId ??
931
+ this.config.organizationId,
758
932
  };
759
933
  const stringifiedBody = JSON.stringify(body);
760
934
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -778,10 +952,13 @@ class TurnkeySDKClientBase {
778
952
  if (!activeStamper) {
779
953
  return undefined;
780
954
  }
955
+ const session = await this.storageManager?.getActiveSession();
781
956
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_suborgs";
782
957
  const body = {
783
958
  ...input,
784
- organizationId: input.organizationId,
959
+ organizationId: input.organizationId ??
960
+ session?.organizationId ??
961
+ this.config.organizationId,
785
962
  };
786
963
  const stringifiedBody = JSON.stringify(body);
787
964
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -805,10 +982,13 @@ class TurnkeySDKClientBase {
805
982
  if (!activeStamper) {
806
983
  return undefined;
807
984
  }
985
+ const session = await this.storageManager?.getActiveSession();
808
986
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_user_tags";
809
987
  const body = {
810
988
  ...input,
811
- organizationId: input.organizationId,
989
+ organizationId: input.organizationId ??
990
+ session?.organizationId ??
991
+ this.config.organizationId,
812
992
  };
813
993
  const stringifiedBody = JSON.stringify(body);
814
994
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -832,10 +1012,13 @@ class TurnkeySDKClientBase {
832
1012
  if (!activeStamper) {
833
1013
  return undefined;
834
1014
  }
1015
+ const session = await this.storageManager?.getActiveSession();
835
1016
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_users";
836
1017
  const body = {
837
1018
  ...input,
838
- organizationId: input.organizationId,
1019
+ organizationId: input.organizationId ??
1020
+ session?.organizationId ??
1021
+ this.config.organizationId,
839
1022
  };
840
1023
  const stringifiedBody = JSON.stringify(body);
841
1024
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -859,10 +1042,13 @@ class TurnkeySDKClientBase {
859
1042
  if (!activeStamper) {
860
1043
  return undefined;
861
1044
  }
1045
+ const session = await this.storageManager?.getActiveSession();
862
1046
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_verified_suborgs";
863
1047
  const body = {
864
1048
  ...input,
865
- organizationId: input.organizationId,
1049
+ organizationId: input.organizationId ??
1050
+ session?.organizationId ??
1051
+ this.config.organizationId,
866
1052
  };
867
1053
  const stringifiedBody = JSON.stringify(body);
868
1054
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -886,10 +1072,13 @@ class TurnkeySDKClientBase {
886
1072
  if (!activeStamper) {
887
1073
  return undefined;
888
1074
  }
1075
+ const session = await this.storageManager?.getActiveSession();
889
1076
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallet_accounts";
890
1077
  const body = {
891
1078
  ...input,
892
- organizationId: input.organizationId,
1079
+ organizationId: input.organizationId ??
1080
+ session?.organizationId ??
1081
+ this.config.organizationId,
893
1082
  };
894
1083
  const stringifiedBody = JSON.stringify(body);
895
1084
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -913,10 +1102,13 @@ class TurnkeySDKClientBase {
913
1102
  if (!activeStamper) {
914
1103
  return undefined;
915
1104
  }
1105
+ const session = await this.storageManager?.getActiveSession();
916
1106
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallets";
917
1107
  const body = {
918
1108
  ...input,
919
- organizationId: input.organizationId,
1109
+ organizationId: input.organizationId ??
1110
+ session?.organizationId ??
1111
+ this.config.organizationId,
920
1112
  };
921
1113
  const stringifiedBody = JSON.stringify(body);
922
1114
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -940,10 +1132,13 @@ class TurnkeySDKClientBase {
940
1132
  if (!activeStamper) {
941
1133
  return undefined;
942
1134
  }
1135
+ const session = await this.storageManager?.getActiveSession();
943
1136
  const fullUrl = this.config.apiBaseUrl + "/public/v1/query/whoami";
944
1137
  const body = {
945
1138
  ...input,
946
- organizationId: input.organizationId,
1139
+ organizationId: input.organizationId ??
1140
+ session?.organizationId ??
1141
+ this.config.organizationId,
947
1142
  };
948
1143
  const stringifiedBody = JSON.stringify(body);
949
1144
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -971,10 +1166,11 @@ class TurnkeySDKClientBase {
971
1166
  return undefined;
972
1167
  }
973
1168
  const { organizationId, timestampMs, ...parameters } = input;
1169
+ const session = await this.storageManager?.getActiveSession();
974
1170
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/approve_activity";
975
1171
  const bodyWithType = {
976
1172
  parameters,
977
- organizationId,
1173
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
978
1174
  timestampMs: timestampMs ?? String(Date.now()),
979
1175
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
980
1176
  };
@@ -1004,10 +1200,11 @@ class TurnkeySDKClientBase {
1004
1200
  return undefined;
1005
1201
  }
1006
1202
  const { organizationId, timestampMs, ...parameters } = input;
1203
+ const session = await this.storageManager?.getActiveSession();
1007
1204
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_keys";
1008
1205
  const bodyWithType = {
1009
1206
  parameters,
1010
- organizationId,
1207
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1011
1208
  timestampMs: timestampMs ?? String(Date.now()),
1012
1209
  type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
1013
1210
  };
@@ -1037,10 +1234,11 @@ class TurnkeySDKClientBase {
1037
1234
  return undefined;
1038
1235
  }
1039
1236
  const { organizationId, timestampMs, ...parameters } = input;
1237
+ const session = await this.storageManager?.getActiveSession();
1040
1238
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_only_users";
1041
1239
  const bodyWithType = {
1042
1240
  parameters,
1043
- organizationId,
1241
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1044
1242
  timestampMs: timestampMs ?? String(Date.now()),
1045
1243
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
1046
1244
  };
@@ -1070,10 +1268,11 @@ class TurnkeySDKClientBase {
1070
1268
  return undefined;
1071
1269
  }
1072
1270
  const { organizationId, timestampMs, ...parameters } = input;
1271
+ const session = await this.storageManager?.getActiveSession();
1073
1272
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_authenticators";
1074
1273
  const bodyWithType = {
1075
1274
  parameters,
1076
- organizationId,
1275
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1077
1276
  timestampMs: timestampMs ?? String(Date.now()),
1078
1277
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
1079
1278
  };
@@ -1103,11 +1302,12 @@ class TurnkeySDKClientBase {
1103
1302
  return undefined;
1104
1303
  }
1105
1304
  const { organizationId, timestampMs, ...parameters } = input;
1305
+ const session = await this.storageManager?.getActiveSession();
1106
1306
  const fullUrl = this.config.apiBaseUrl +
1107
1307
  "/public/v1/submit/create_fiat_on_ramp_credential";
1108
1308
  const bodyWithType = {
1109
1309
  parameters,
1110
- organizationId,
1310
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1111
1311
  timestampMs: timestampMs ?? String(Date.now()),
1112
1312
  type: "ACTIVITY_TYPE_CREATE_FIAT_ON_RAMP_CREDENTIAL",
1113
1313
  };
@@ -1137,10 +1337,11 @@ class TurnkeySDKClientBase {
1137
1337
  return undefined;
1138
1338
  }
1139
1339
  const { organizationId, timestampMs, ...parameters } = input;
1340
+ const session = await this.storageManager?.getActiveSession();
1140
1341
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_invitations";
1141
1342
  const bodyWithType = {
1142
1343
  parameters,
1143
- organizationId,
1344
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1144
1345
  timestampMs: timestampMs ?? String(Date.now()),
1145
1346
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
1146
1347
  };
@@ -1170,10 +1371,11 @@ class TurnkeySDKClientBase {
1170
1371
  return undefined;
1171
1372
  }
1172
1373
  const { organizationId, timestampMs, ...parameters } = input;
1374
+ const session = await this.storageManager?.getActiveSession();
1173
1375
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth2_credential";
1174
1376
  const bodyWithType = {
1175
1377
  parameters,
1176
- organizationId,
1378
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1177
1379
  timestampMs: timestampMs ?? String(Date.now()),
1178
1380
  type: "ACTIVITY_TYPE_CREATE_OAUTH2CREDENTIAL",
1179
1381
  };
@@ -1203,10 +1405,11 @@ class TurnkeySDKClientBase {
1203
1405
  return undefined;
1204
1406
  }
1205
1407
  const { organizationId, timestampMs, ...parameters } = input;
1408
+ const session = await this.storageManager?.getActiveSession();
1206
1409
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth_providers";
1207
1410
  const bodyWithType = {
1208
1411
  parameters,
1209
- organizationId,
1412
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1210
1413
  timestampMs: timestampMs ?? String(Date.now()),
1211
1414
  type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
1212
1415
  };
@@ -1236,10 +1439,11 @@ class TurnkeySDKClientBase {
1236
1439
  return undefined;
1237
1440
  }
1238
1441
  const { organizationId, timestampMs, ...parameters } = input;
1442
+ const session = await this.storageManager?.getActiveSession();
1239
1443
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policies";
1240
1444
  const bodyWithType = {
1241
1445
  parameters,
1242
- organizationId,
1446
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1243
1447
  timestampMs: timestampMs ?? String(Date.now()),
1244
1448
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
1245
1449
  };
@@ -1269,10 +1473,11 @@ class TurnkeySDKClientBase {
1269
1473
  return undefined;
1270
1474
  }
1271
1475
  const { organizationId, timestampMs, ...parameters } = input;
1476
+ const session = await this.storageManager?.getActiveSession();
1272
1477
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policy";
1273
1478
  const bodyWithType = {
1274
1479
  parameters,
1275
- organizationId,
1480
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1276
1481
  timestampMs: timestampMs ?? String(Date.now()),
1277
1482
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
1278
1483
  };
@@ -1302,10 +1507,11 @@ class TurnkeySDKClientBase {
1302
1507
  return undefined;
1303
1508
  }
1304
1509
  const { organizationId, timestampMs, ...parameters } = input;
1510
+ const session = await this.storageManager?.getActiveSession();
1305
1511
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_key_tag";
1306
1512
  const bodyWithType = {
1307
1513
  parameters,
1308
- organizationId,
1514
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1309
1515
  timestampMs: timestampMs ?? String(Date.now()),
1310
1516
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
1311
1517
  };
@@ -1335,10 +1541,11 @@ class TurnkeySDKClientBase {
1335
1541
  return undefined;
1336
1542
  }
1337
1543
  const { organizationId, timestampMs, ...parameters } = input;
1544
+ const session = await this.storageManager?.getActiveSession();
1338
1545
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_keys";
1339
1546
  const bodyWithType = {
1340
1547
  parameters,
1341
- organizationId,
1548
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1342
1549
  timestampMs: timestampMs ?? String(Date.now()),
1343
1550
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
1344
1551
  };
@@ -1368,10 +1575,11 @@ class TurnkeySDKClientBase {
1368
1575
  return undefined;
1369
1576
  }
1370
1577
  const { organizationId, timestampMs, ...parameters } = input;
1578
+ const session = await this.storageManager?.getActiveSession();
1371
1579
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_only_session";
1372
1580
  const bodyWithType = {
1373
1581
  parameters,
1374
- organizationId,
1582
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1375
1583
  timestampMs: timestampMs ?? String(Date.now()),
1376
1584
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
1377
1585
  };
@@ -1401,10 +1609,11 @@ class TurnkeySDKClientBase {
1401
1609
  return undefined;
1402
1610
  }
1403
1611
  const { organizationId, timestampMs, ...parameters } = input;
1612
+ const session = await this.storageManager?.getActiveSession();
1404
1613
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_write_session";
1405
1614
  const bodyWithType = {
1406
1615
  parameters,
1407
- organizationId,
1616
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1408
1617
  timestampMs: timestampMs ?? String(Date.now()),
1409
1618
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
1410
1619
  };
@@ -1434,11 +1643,12 @@ class TurnkeySDKClientBase {
1434
1643
  return undefined;
1435
1644
  }
1436
1645
  const { organizationId, timestampMs, ...parameters } = input;
1646
+ const session = await this.storageManager?.getActiveSession();
1437
1647
  const fullUrl = this.config.apiBaseUrl +
1438
1648
  "/public/v1/submit/create_smart_contract_interface";
1439
1649
  const bodyWithType = {
1440
1650
  parameters,
1441
- organizationId,
1651
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1442
1652
  timestampMs: timestampMs ?? String(Date.now()),
1443
1653
  type: "ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE",
1444
1654
  };
@@ -1468,10 +1678,11 @@ class TurnkeySDKClientBase {
1468
1678
  return undefined;
1469
1679
  }
1470
1680
  const { organizationId, timestampMs, ...parameters } = input;
1681
+ const session = await this.storageManager?.getActiveSession();
1471
1682
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_sub_organization";
1472
1683
  const bodyWithType = {
1473
1684
  parameters,
1474
- organizationId,
1685
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1475
1686
  timestampMs: timestampMs ?? String(Date.now()),
1476
1687
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1477
1688
  };
@@ -1501,10 +1712,11 @@ class TurnkeySDKClientBase {
1501
1712
  return undefined;
1502
1713
  }
1503
1714
  const { organizationId, timestampMs, ...parameters } = input;
1715
+ const session = await this.storageManager?.getActiveSession();
1504
1716
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_user_tag";
1505
1717
  const bodyWithType = {
1506
1718
  parameters,
1507
- organizationId,
1719
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1508
1720
  timestampMs: timestampMs ?? String(Date.now()),
1509
1721
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
1510
1722
  };
@@ -1534,10 +1746,11 @@ class TurnkeySDKClientBase {
1534
1746
  return undefined;
1535
1747
  }
1536
1748
  const { organizationId, timestampMs, ...parameters } = input;
1749
+ const session = await this.storageManager?.getActiveSession();
1537
1750
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_users";
1538
1751
  const bodyWithType = {
1539
1752
  parameters,
1540
- organizationId,
1753
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1541
1754
  timestampMs: timestampMs ?? String(Date.now()),
1542
1755
  type: "ACTIVITY_TYPE_CREATE_USERS_V3",
1543
1756
  };
@@ -1567,10 +1780,11 @@ class TurnkeySDKClientBase {
1567
1780
  return undefined;
1568
1781
  }
1569
1782
  const { organizationId, timestampMs, ...parameters } = input;
1783
+ const session = await this.storageManager?.getActiveSession();
1570
1784
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet";
1571
1785
  const bodyWithType = {
1572
1786
  parameters,
1573
- organizationId,
1787
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1574
1788
  timestampMs: timestampMs ?? String(Date.now()),
1575
1789
  type: "ACTIVITY_TYPE_CREATE_WALLET",
1576
1790
  };
@@ -1600,10 +1814,11 @@ class TurnkeySDKClientBase {
1600
1814
  return undefined;
1601
1815
  }
1602
1816
  const { organizationId, timestampMs, ...parameters } = input;
1817
+ const session = await this.storageManager?.getActiveSession();
1603
1818
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet_accounts";
1604
1819
  const bodyWithType = {
1605
1820
  parameters,
1606
- organizationId,
1821
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1607
1822
  timestampMs: timestampMs ?? String(Date.now()),
1608
1823
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
1609
1824
  };
@@ -1633,10 +1848,11 @@ class TurnkeySDKClientBase {
1633
1848
  return undefined;
1634
1849
  }
1635
1850
  const { organizationId, timestampMs, ...parameters } = input;
1851
+ const session = await this.storageManager?.getActiveSession();
1636
1852
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_api_keys";
1637
1853
  const bodyWithType = {
1638
1854
  parameters,
1639
- organizationId,
1855
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1640
1856
  timestampMs: timestampMs ?? String(Date.now()),
1641
1857
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
1642
1858
  };
@@ -1666,10 +1882,11 @@ class TurnkeySDKClientBase {
1666
1882
  return undefined;
1667
1883
  }
1668
1884
  const { organizationId, timestampMs, ...parameters } = input;
1885
+ const session = await this.storageManager?.getActiveSession();
1669
1886
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_authenticators";
1670
1887
  const bodyWithType = {
1671
1888
  parameters,
1672
- organizationId,
1889
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1673
1890
  timestampMs: timestampMs ?? String(Date.now()),
1674
1891
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
1675
1892
  };
@@ -1699,11 +1916,12 @@ class TurnkeySDKClientBase {
1699
1916
  return undefined;
1700
1917
  }
1701
1918
  const { organizationId, timestampMs, ...parameters } = input;
1919
+ const session = await this.storageManager?.getActiveSession();
1702
1920
  const fullUrl = this.config.apiBaseUrl +
1703
1921
  "/public/v1/submit/delete_fiat_on_ramp_credential";
1704
1922
  const bodyWithType = {
1705
1923
  parameters,
1706
- organizationId,
1924
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1707
1925
  timestampMs: timestampMs ?? String(Date.now()),
1708
1926
  type: "ACTIVITY_TYPE_DELETE_FIAT_ON_RAMP_CREDENTIAL",
1709
1927
  };
@@ -1733,10 +1951,11 @@ class TurnkeySDKClientBase {
1733
1951
  return undefined;
1734
1952
  }
1735
1953
  const { organizationId, timestampMs, ...parameters } = input;
1954
+ const session = await this.storageManager?.getActiveSession();
1736
1955
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_invitation";
1737
1956
  const bodyWithType = {
1738
1957
  parameters,
1739
- organizationId,
1958
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1740
1959
  timestampMs: timestampMs ?? String(Date.now()),
1741
1960
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
1742
1961
  };
@@ -1766,10 +1985,11 @@ class TurnkeySDKClientBase {
1766
1985
  return undefined;
1767
1986
  }
1768
1987
  const { organizationId, timestampMs, ...parameters } = input;
1988
+ const session = await this.storageManager?.getActiveSession();
1769
1989
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth2_credential";
1770
1990
  const bodyWithType = {
1771
1991
  parameters,
1772
- organizationId,
1992
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1773
1993
  timestampMs: timestampMs ?? String(Date.now()),
1774
1994
  type: "ACTIVITY_TYPE_DELETE_OAUTH2CREDENTIAL",
1775
1995
  };
@@ -1799,10 +2019,11 @@ class TurnkeySDKClientBase {
1799
2019
  return undefined;
1800
2020
  }
1801
2021
  const { organizationId, timestampMs, ...parameters } = input;
2022
+ const session = await this.storageManager?.getActiveSession();
1802
2023
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth_providers";
1803
2024
  const bodyWithType = {
1804
2025
  parameters,
1805
- organizationId,
2026
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1806
2027
  timestampMs: timestampMs ?? String(Date.now()),
1807
2028
  type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
1808
2029
  };
@@ -1832,10 +2053,11 @@ class TurnkeySDKClientBase {
1832
2053
  return undefined;
1833
2054
  }
1834
2055
  const { organizationId, timestampMs, ...parameters } = input;
2056
+ const session = await this.storageManager?.getActiveSession();
1835
2057
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policies";
1836
2058
  const bodyWithType = {
1837
2059
  parameters,
1838
- organizationId,
2060
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1839
2061
  timestampMs: timestampMs ?? String(Date.now()),
1840
2062
  type: "ACTIVITY_TYPE_DELETE_POLICIES",
1841
2063
  };
@@ -1865,10 +2087,11 @@ class TurnkeySDKClientBase {
1865
2087
  return undefined;
1866
2088
  }
1867
2089
  const { organizationId, timestampMs, ...parameters } = input;
2090
+ const session = await this.storageManager?.getActiveSession();
1868
2091
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policy";
1869
2092
  const bodyWithType = {
1870
2093
  parameters,
1871
- organizationId,
2094
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1872
2095
  timestampMs: timestampMs ?? String(Date.now()),
1873
2096
  type: "ACTIVITY_TYPE_DELETE_POLICY",
1874
2097
  };
@@ -1898,10 +2121,11 @@ class TurnkeySDKClientBase {
1898
2121
  return undefined;
1899
2122
  }
1900
2123
  const { organizationId, timestampMs, ...parameters } = input;
2124
+ const session = await this.storageManager?.getActiveSession();
1901
2125
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_key_tags";
1902
2126
  const bodyWithType = {
1903
2127
  parameters,
1904
- organizationId,
2128
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1905
2129
  timestampMs: timestampMs ?? String(Date.now()),
1906
2130
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
1907
2131
  };
@@ -1931,10 +2155,11 @@ class TurnkeySDKClientBase {
1931
2155
  return undefined;
1932
2156
  }
1933
2157
  const { organizationId, timestampMs, ...parameters } = input;
2158
+ const session = await this.storageManager?.getActiveSession();
1934
2159
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_keys";
1935
2160
  const bodyWithType = {
1936
2161
  parameters,
1937
- organizationId,
2162
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1938
2163
  timestampMs: timestampMs ?? String(Date.now()),
1939
2164
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
1940
2165
  };
@@ -1964,11 +2189,12 @@ class TurnkeySDKClientBase {
1964
2189
  return undefined;
1965
2190
  }
1966
2191
  const { organizationId, timestampMs, ...parameters } = input;
2192
+ const session = await this.storageManager?.getActiveSession();
1967
2193
  const fullUrl = this.config.apiBaseUrl +
1968
2194
  "/public/v1/submit/delete_smart_contract_interface";
1969
2195
  const bodyWithType = {
1970
2196
  parameters,
1971
- organizationId,
2197
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1972
2198
  timestampMs: timestampMs ?? String(Date.now()),
1973
2199
  type: "ACTIVITY_TYPE_DELETE_SMART_CONTRACT_INTERFACE",
1974
2200
  };
@@ -1998,10 +2224,11 @@ class TurnkeySDKClientBase {
1998
2224
  return undefined;
1999
2225
  }
2000
2226
  const { organizationId, timestampMs, ...parameters } = input;
2227
+ const session = await this.storageManager?.getActiveSession();
2001
2228
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_sub_organization";
2002
2229
  const bodyWithType = {
2003
2230
  parameters,
2004
- organizationId,
2231
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2005
2232
  timestampMs: timestampMs ?? String(Date.now()),
2006
2233
  type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
2007
2234
  };
@@ -2031,10 +2258,11 @@ class TurnkeySDKClientBase {
2031
2258
  return undefined;
2032
2259
  }
2033
2260
  const { organizationId, timestampMs, ...parameters } = input;
2261
+ const session = await this.storageManager?.getActiveSession();
2034
2262
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_user_tags";
2035
2263
  const bodyWithType = {
2036
2264
  parameters,
2037
- organizationId,
2265
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2038
2266
  timestampMs: timestampMs ?? String(Date.now()),
2039
2267
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
2040
2268
  };
@@ -2064,10 +2292,11 @@ class TurnkeySDKClientBase {
2064
2292
  return undefined;
2065
2293
  }
2066
2294
  const { organizationId, timestampMs, ...parameters } = input;
2295
+ const session = await this.storageManager?.getActiveSession();
2067
2296
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_users";
2068
2297
  const bodyWithType = {
2069
2298
  parameters,
2070
- organizationId,
2299
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2071
2300
  timestampMs: timestampMs ?? String(Date.now()),
2072
2301
  type: "ACTIVITY_TYPE_DELETE_USERS",
2073
2302
  };
@@ -2097,10 +2326,11 @@ class TurnkeySDKClientBase {
2097
2326
  return undefined;
2098
2327
  }
2099
2328
  const { organizationId, timestampMs, ...parameters } = input;
2329
+ const session = await this.storageManager?.getActiveSession();
2100
2330
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallet_accounts";
2101
2331
  const bodyWithType = {
2102
2332
  parameters,
2103
- organizationId,
2333
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2104
2334
  timestampMs: timestampMs ?? String(Date.now()),
2105
2335
  type: "ACTIVITY_TYPE_DELETE_WALLET_ACCOUNTS",
2106
2336
  };
@@ -2130,10 +2360,11 @@ class TurnkeySDKClientBase {
2130
2360
  return undefined;
2131
2361
  }
2132
2362
  const { organizationId, timestampMs, ...parameters } = input;
2363
+ const session = await this.storageManager?.getActiveSession();
2133
2364
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallets";
2134
2365
  const bodyWithType = {
2135
2366
  parameters,
2136
- organizationId,
2367
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2137
2368
  timestampMs: timestampMs ?? String(Date.now()),
2138
2369
  type: "ACTIVITY_TYPE_DELETE_WALLETS",
2139
2370
  };
@@ -2154,7 +2385,7 @@ class TurnkeySDKClientBase {
2154
2385
  session?.organizationId ??
2155
2386
  this.config.organizationId,
2156
2387
  timestampMs: timestampMs ?? String(Date.now()),
2157
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2388
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2158
2389
  }, "emailAuthResult", stampWith);
2159
2390
  };
2160
2391
  this.stampEmailAuth = async (input, stampWith) => {
@@ -2163,12 +2394,13 @@ class TurnkeySDKClientBase {
2163
2394
  return undefined;
2164
2395
  }
2165
2396
  const { organizationId, timestampMs, ...parameters } = input;
2397
+ const session = await this.storageManager?.getActiveSession();
2166
2398
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/email_auth";
2167
2399
  const bodyWithType = {
2168
2400
  parameters,
2169
- organizationId,
2401
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2170
2402
  timestampMs: timestampMs ?? String(Date.now()),
2171
- type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
2403
+ type: "ACTIVITY_TYPE_EMAIL_AUTH_V3",
2172
2404
  };
2173
2405
  const stringifiedBody = JSON.stringify(bodyWithType);
2174
2406
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2196,10 +2428,11 @@ class TurnkeySDKClientBase {
2196
2428
  return undefined;
2197
2429
  }
2198
2430
  const { organizationId, timestampMs, ...parameters } = input;
2431
+ const session = await this.storageManager?.getActiveSession();
2199
2432
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_raw_transaction";
2200
2433
  const bodyWithType = {
2201
2434
  parameters,
2202
- organizationId,
2435
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2203
2436
  timestampMs: timestampMs ?? String(Date.now()),
2204
2437
  type: "ACTIVITY_TYPE_ETH_SEND_RAW_TRANSACTION",
2205
2438
  };
@@ -2229,10 +2462,11 @@ class TurnkeySDKClientBase {
2229
2462
  return undefined;
2230
2463
  }
2231
2464
  const { organizationId, timestampMs, ...parameters } = input;
2465
+ const session = await this.storageManager?.getActiveSession();
2232
2466
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/eth_send_transaction";
2233
2467
  const bodyWithType = {
2234
2468
  parameters,
2235
- organizationId,
2469
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2236
2470
  timestampMs: timestampMs ?? String(Date.now()),
2237
2471
  type: "ACTIVITY_TYPE_ETH_SEND_TRANSACTION",
2238
2472
  };
@@ -2262,10 +2496,11 @@ class TurnkeySDKClientBase {
2262
2496
  return undefined;
2263
2497
  }
2264
2498
  const { organizationId, timestampMs, ...parameters } = input;
2499
+ const session = await this.storageManager?.getActiveSession();
2265
2500
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_private_key";
2266
2501
  const bodyWithType = {
2267
2502
  parameters,
2268
- organizationId,
2503
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2269
2504
  timestampMs: timestampMs ?? String(Date.now()),
2270
2505
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
2271
2506
  };
@@ -2295,10 +2530,11 @@ class TurnkeySDKClientBase {
2295
2530
  return undefined;
2296
2531
  }
2297
2532
  const { organizationId, timestampMs, ...parameters } = input;
2533
+ const session = await this.storageManager?.getActiveSession();
2298
2534
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet";
2299
2535
  const bodyWithType = {
2300
2536
  parameters,
2301
- organizationId,
2537
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2302
2538
  timestampMs: timestampMs ?? String(Date.now()),
2303
2539
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
2304
2540
  };
@@ -2328,10 +2564,11 @@ class TurnkeySDKClientBase {
2328
2564
  return undefined;
2329
2565
  }
2330
2566
  const { organizationId, timestampMs, ...parameters } = input;
2567
+ const session = await this.storageManager?.getActiveSession();
2331
2568
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet_account";
2332
2569
  const bodyWithType = {
2333
2570
  parameters,
2334
- organizationId,
2571
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2335
2572
  timestampMs: timestampMs ?? String(Date.now()),
2336
2573
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
2337
2574
  };
@@ -2361,10 +2598,11 @@ class TurnkeySDKClientBase {
2361
2598
  return undefined;
2362
2599
  }
2363
2600
  const { organizationId, timestampMs, ...parameters } = input;
2601
+ const session = await this.storageManager?.getActiveSession();
2364
2602
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_private_key";
2365
2603
  const bodyWithType = {
2366
2604
  parameters,
2367
- organizationId,
2605
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2368
2606
  timestampMs: timestampMs ?? String(Date.now()),
2369
2607
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
2370
2608
  };
@@ -2394,10 +2632,11 @@ class TurnkeySDKClientBase {
2394
2632
  return undefined;
2395
2633
  }
2396
2634
  const { organizationId, timestampMs, ...parameters } = input;
2635
+ const session = await this.storageManager?.getActiveSession();
2397
2636
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_wallet";
2398
2637
  const bodyWithType = {
2399
2638
  parameters,
2400
- organizationId,
2639
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2401
2640
  timestampMs: timestampMs ?? String(Date.now()),
2402
2641
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
2403
2642
  };
@@ -2427,10 +2666,11 @@ class TurnkeySDKClientBase {
2427
2666
  return undefined;
2428
2667
  }
2429
2668
  const { organizationId, timestampMs, ...parameters } = input;
2669
+ const session = await this.storageManager?.getActiveSession();
2430
2670
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_fiat_on_ramp";
2431
2671
  const bodyWithType = {
2432
2672
  parameters,
2433
- organizationId,
2673
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2434
2674
  timestampMs: timestampMs ?? String(Date.now()),
2435
2675
  type: "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
2436
2676
  };
@@ -2460,10 +2700,11 @@ class TurnkeySDKClientBase {
2460
2700
  return undefined;
2461
2701
  }
2462
2702
  const { organizationId, timestampMs, ...parameters } = input;
2703
+ const session = await this.storageManager?.getActiveSession();
2463
2704
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_private_key";
2464
2705
  const bodyWithType = {
2465
2706
  parameters,
2466
- organizationId,
2707
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2467
2708
  timestampMs: timestampMs ?? String(Date.now()),
2468
2709
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
2469
2710
  };
@@ -2493,10 +2734,11 @@ class TurnkeySDKClientBase {
2493
2734
  return undefined;
2494
2735
  }
2495
2736
  const { organizationId, timestampMs, ...parameters } = input;
2737
+ const session = await this.storageManager?.getActiveSession();
2496
2738
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_wallet";
2497
2739
  const bodyWithType = {
2498
2740
  parameters,
2499
- organizationId,
2741
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2500
2742
  timestampMs: timestampMs ?? String(Date.now()),
2501
2743
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
2502
2744
  };
@@ -2517,7 +2759,7 @@ class TurnkeySDKClientBase {
2517
2759
  session?.organizationId ??
2518
2760
  this.config.organizationId,
2519
2761
  timestampMs: timestampMs ?? String(Date.now()),
2520
- type: "ACTIVITY_TYPE_INIT_OTP",
2762
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2521
2763
  }, "initOtpResult", stampWith);
2522
2764
  };
2523
2765
  this.stampInitOtp = async (input, stampWith) => {
@@ -2526,12 +2768,13 @@ class TurnkeySDKClientBase {
2526
2768
  return undefined;
2527
2769
  }
2528
2770
  const { organizationId, timestampMs, ...parameters } = input;
2771
+ const session = await this.storageManager?.getActiveSession();
2529
2772
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
2530
2773
  const bodyWithType = {
2531
2774
  parameters,
2532
- organizationId,
2775
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2533
2776
  timestampMs: timestampMs ?? String(Date.now()),
2534
- type: "ACTIVITY_TYPE_INIT_OTP",
2777
+ type: "ACTIVITY_TYPE_INIT_OTP_V2",
2535
2778
  };
2536
2779
  const stringifiedBody = JSON.stringify(bodyWithType);
2537
2780
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2550,7 +2793,7 @@ class TurnkeySDKClientBase {
2550
2793
  session?.organizationId ??
2551
2794
  this.config.organizationId,
2552
2795
  timestampMs: timestampMs ?? String(Date.now()),
2553
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2796
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2554
2797
  }, "initOtpAuthResult", stampWith);
2555
2798
  };
2556
2799
  this.stampInitOtpAuth = async (input, stampWith) => {
@@ -2559,12 +2802,13 @@ class TurnkeySDKClientBase {
2559
2802
  return undefined;
2560
2803
  }
2561
2804
  const { organizationId, timestampMs, ...parameters } = input;
2805
+ const session = await this.storageManager?.getActiveSession();
2562
2806
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp_auth";
2563
2807
  const bodyWithType = {
2564
2808
  parameters,
2565
- organizationId,
2809
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2566
2810
  timestampMs: timestampMs ?? String(Date.now()),
2567
- type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2811
+ type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V3",
2568
2812
  };
2569
2813
  const stringifiedBody = JSON.stringify(bodyWithType);
2570
2814
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2583,7 +2827,7 @@ class TurnkeySDKClientBase {
2583
2827
  session?.organizationId ??
2584
2828
  this.config.organizationId,
2585
2829
  timestampMs: timestampMs ?? String(Date.now()),
2586
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2830
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2587
2831
  }, "initUserEmailRecoveryResult", stampWith);
2588
2832
  };
2589
2833
  this.stampInitUserEmailRecovery = async (input, stampWith) => {
@@ -2592,12 +2836,13 @@ class TurnkeySDKClientBase {
2592
2836
  return undefined;
2593
2837
  }
2594
2838
  const { organizationId, timestampMs, ...parameters } = input;
2839
+ const session = await this.storageManager?.getActiveSession();
2595
2840
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_user_email_recovery";
2596
2841
  const bodyWithType = {
2597
2842
  parameters,
2598
- organizationId,
2843
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2599
2844
  timestampMs: timestampMs ?? String(Date.now()),
2600
- type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
2845
+ type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY_V2",
2601
2846
  };
2602
2847
  const stringifiedBody = JSON.stringify(bodyWithType);
2603
2848
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2625,10 +2870,11 @@ class TurnkeySDKClientBase {
2625
2870
  return undefined;
2626
2871
  }
2627
2872
  const { organizationId, timestampMs, ...parameters } = input;
2873
+ const session = await this.storageManager?.getActiveSession();
2628
2874
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth";
2629
2875
  const bodyWithType = {
2630
2876
  parameters,
2631
- organizationId,
2877
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2632
2878
  timestampMs: timestampMs ?? String(Date.now()),
2633
2879
  type: "ACTIVITY_TYPE_OAUTH",
2634
2880
  };
@@ -2658,10 +2904,11 @@ class TurnkeySDKClientBase {
2658
2904
  return undefined;
2659
2905
  }
2660
2906
  const { organizationId, timestampMs, ...parameters } = input;
2907
+ const session = await this.storageManager?.getActiveSession();
2661
2908
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth2_authenticate";
2662
2909
  const bodyWithType = {
2663
2910
  parameters,
2664
- organizationId,
2911
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2665
2912
  timestampMs: timestampMs ?? String(Date.now()),
2666
2913
  type: "ACTIVITY_TYPE_OAUTH2AUTHENTICATE",
2667
2914
  };
@@ -2691,10 +2938,11 @@ class TurnkeySDKClientBase {
2691
2938
  return undefined;
2692
2939
  }
2693
2940
  const { organizationId, timestampMs, ...parameters } = input;
2941
+ const session = await this.storageManager?.getActiveSession();
2694
2942
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
2695
2943
  const bodyWithType = {
2696
2944
  parameters,
2697
- organizationId,
2945
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2698
2946
  timestampMs: timestampMs ?? String(Date.now()),
2699
2947
  type: "ACTIVITY_TYPE_OAUTH_LOGIN",
2700
2948
  };
@@ -2724,10 +2972,11 @@ class TurnkeySDKClientBase {
2724
2972
  return undefined;
2725
2973
  }
2726
2974
  const { organizationId, timestampMs, ...parameters } = input;
2975
+ const session = await this.storageManager?.getActiveSession();
2727
2976
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_auth";
2728
2977
  const bodyWithType = {
2729
2978
  parameters,
2730
- organizationId,
2979
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2731
2980
  timestampMs: timestampMs ?? String(Date.now()),
2732
2981
  type: "ACTIVITY_TYPE_OTP_AUTH",
2733
2982
  };
@@ -2757,10 +3006,11 @@ class TurnkeySDKClientBase {
2757
3006
  return undefined;
2758
3007
  }
2759
3008
  const { organizationId, timestampMs, ...parameters } = input;
3009
+ const session = await this.storageManager?.getActiveSession();
2760
3010
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
2761
3011
  const bodyWithType = {
2762
3012
  parameters,
2763
- organizationId,
3013
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2764
3014
  timestampMs: timestampMs ?? String(Date.now()),
2765
3015
  type: "ACTIVITY_TYPE_OTP_LOGIN",
2766
3016
  };
@@ -2790,10 +3040,11 @@ class TurnkeySDKClientBase {
2790
3040
  return undefined;
2791
3041
  }
2792
3042
  const { organizationId, timestampMs, ...parameters } = input;
3043
+ const session = await this.storageManager?.getActiveSession();
2793
3044
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/recover_user";
2794
3045
  const bodyWithType = {
2795
3046
  parameters,
2796
- organizationId,
3047
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2797
3048
  timestampMs: timestampMs ?? String(Date.now()),
2798
3049
  type: "ACTIVITY_TYPE_RECOVER_USER",
2799
3050
  };
@@ -2823,10 +3074,11 @@ class TurnkeySDKClientBase {
2823
3074
  return undefined;
2824
3075
  }
2825
3076
  const { organizationId, timestampMs, ...parameters } = input;
3077
+ const session = await this.storageManager?.getActiveSession();
2826
3078
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/reject_activity";
2827
3079
  const bodyWithType = {
2828
3080
  parameters,
2829
- organizationId,
3081
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2830
3082
  timestampMs: timestampMs ?? String(Date.now()),
2831
3083
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
2832
3084
  };
@@ -2856,10 +3108,11 @@ class TurnkeySDKClientBase {
2856
3108
  return undefined;
2857
3109
  }
2858
3110
  const { organizationId, timestampMs, ...parameters } = input;
3111
+ const session = await this.storageManager?.getActiveSession();
2859
3112
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/remove_organization_feature";
2860
3113
  const bodyWithType = {
2861
3114
  parameters,
2862
- organizationId,
3115
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2863
3116
  timestampMs: timestampMs ?? String(Date.now()),
2864
3117
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
2865
3118
  };
@@ -2889,10 +3142,11 @@ class TurnkeySDKClientBase {
2889
3142
  return undefined;
2890
3143
  }
2891
3144
  const { organizationId, timestampMs, ...parameters } = input;
3145
+ const session = await this.storageManager?.getActiveSession();
2892
3146
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/set_organization_feature";
2893
3147
  const bodyWithType = {
2894
3148
  parameters,
2895
- organizationId,
3149
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2896
3150
  timestampMs: timestampMs ?? String(Date.now()),
2897
3151
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
2898
3152
  };
@@ -2922,10 +3176,11 @@ class TurnkeySDKClientBase {
2922
3176
  return undefined;
2923
3177
  }
2924
3178
  const { organizationId, timestampMs, ...parameters } = input;
3179
+ const session = await this.storageManager?.getActiveSession();
2925
3180
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payload";
2926
3181
  const bodyWithType = {
2927
3182
  parameters,
2928
- organizationId,
3183
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2929
3184
  timestampMs: timestampMs ?? String(Date.now()),
2930
3185
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
2931
3186
  };
@@ -2955,10 +3210,11 @@ class TurnkeySDKClientBase {
2955
3210
  return undefined;
2956
3211
  }
2957
3212
  const { organizationId, timestampMs, ...parameters } = input;
3213
+ const session = await this.storageManager?.getActiveSession();
2958
3214
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payloads";
2959
3215
  const bodyWithType = {
2960
3216
  parameters,
2961
- organizationId,
3217
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2962
3218
  timestampMs: timestampMs ?? String(Date.now()),
2963
3219
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
2964
3220
  };
@@ -2988,10 +3244,11 @@ class TurnkeySDKClientBase {
2988
3244
  return undefined;
2989
3245
  }
2990
3246
  const { organizationId, timestampMs, ...parameters } = input;
3247
+ const session = await this.storageManager?.getActiveSession();
2991
3248
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_transaction";
2992
3249
  const bodyWithType = {
2993
3250
  parameters,
2994
- organizationId,
3251
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2995
3252
  timestampMs: timestampMs ?? String(Date.now()),
2996
3253
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
2997
3254
  };
@@ -3021,10 +3278,11 @@ class TurnkeySDKClientBase {
3021
3278
  return undefined;
3022
3279
  }
3023
3280
  const { organizationId, timestampMs, ...parameters } = input;
3281
+ const session = await this.storageManager?.getActiveSession();
3024
3282
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
3025
3283
  const bodyWithType = {
3026
3284
  parameters,
3027
- organizationId,
3285
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3028
3286
  timestampMs: timestampMs ?? String(Date.now()),
3029
3287
  type: "ACTIVITY_TYPE_STAMP_LOGIN",
3030
3288
  };
@@ -3054,11 +3312,12 @@ class TurnkeySDKClientBase {
3054
3312
  return undefined;
3055
3313
  }
3056
3314
  const { organizationId, timestampMs, ...parameters } = input;
3315
+ const session = await this.storageManager?.getActiveSession();
3057
3316
  const fullUrl = this.config.apiBaseUrl +
3058
3317
  "/public/v1/submit/update_fiat_on_ramp_credential";
3059
3318
  const bodyWithType = {
3060
3319
  parameters,
3061
- organizationId,
3320
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3062
3321
  timestampMs: timestampMs ?? String(Date.now()),
3063
3322
  type: "ACTIVITY_TYPE_UPDATE_FIAT_ON_RAMP_CREDENTIAL",
3064
3323
  };
@@ -3088,10 +3347,11 @@ class TurnkeySDKClientBase {
3088
3347
  return undefined;
3089
3348
  }
3090
3349
  const { organizationId, timestampMs, ...parameters } = input;
3350
+ const session = await this.storageManager?.getActiveSession();
3091
3351
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_oauth2_credential";
3092
3352
  const bodyWithType = {
3093
3353
  parameters,
3094
- organizationId,
3354
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3095
3355
  timestampMs: timestampMs ?? String(Date.now()),
3096
3356
  type: "ACTIVITY_TYPE_UPDATE_OAUTH2CREDENTIAL",
3097
3357
  };
@@ -3121,10 +3381,11 @@ class TurnkeySDKClientBase {
3121
3381
  return undefined;
3122
3382
  }
3123
3383
  const { organizationId, timestampMs, ...parameters } = input;
3384
+ const session = await this.storageManager?.getActiveSession();
3124
3385
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_policy";
3125
3386
  const bodyWithType = {
3126
3387
  parameters,
3127
- organizationId,
3388
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3128
3389
  timestampMs: timestampMs ?? String(Date.now()),
3129
3390
  type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
3130
3391
  };
@@ -3154,10 +3415,11 @@ class TurnkeySDKClientBase {
3154
3415
  return undefined;
3155
3416
  }
3156
3417
  const { organizationId, timestampMs, ...parameters } = input;
3418
+ const session = await this.storageManager?.getActiveSession();
3157
3419
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_private_key_tag";
3158
3420
  const bodyWithType = {
3159
3421
  parameters,
3160
- organizationId,
3422
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3161
3423
  timestampMs: timestampMs ?? String(Date.now()),
3162
3424
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
3163
3425
  };
@@ -3187,10 +3449,11 @@ class TurnkeySDKClientBase {
3187
3449
  return undefined;
3188
3450
  }
3189
3451
  const { organizationId, timestampMs, ...parameters } = input;
3452
+ const session = await this.storageManager?.getActiveSession();
3190
3453
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_root_quorum";
3191
3454
  const bodyWithType = {
3192
3455
  parameters,
3193
- organizationId,
3456
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3194
3457
  timestampMs: timestampMs ?? String(Date.now()),
3195
3458
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
3196
3459
  };
@@ -3220,10 +3483,11 @@ class TurnkeySDKClientBase {
3220
3483
  return undefined;
3221
3484
  }
3222
3485
  const { organizationId, timestampMs, ...parameters } = input;
3486
+ const session = await this.storageManager?.getActiveSession();
3223
3487
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user";
3224
3488
  const bodyWithType = {
3225
3489
  parameters,
3226
- organizationId,
3490
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3227
3491
  timestampMs: timestampMs ?? String(Date.now()),
3228
3492
  type: "ACTIVITY_TYPE_UPDATE_USER",
3229
3493
  };
@@ -3253,10 +3517,11 @@ class TurnkeySDKClientBase {
3253
3517
  return undefined;
3254
3518
  }
3255
3519
  const { organizationId, timestampMs, ...parameters } = input;
3520
+ const session = await this.storageManager?.getActiveSession();
3256
3521
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_email";
3257
3522
  const bodyWithType = {
3258
3523
  parameters,
3259
- organizationId,
3524
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3260
3525
  timestampMs: timestampMs ?? String(Date.now()),
3261
3526
  type: "ACTIVITY_TYPE_UPDATE_USER_EMAIL",
3262
3527
  };
@@ -3286,10 +3551,11 @@ class TurnkeySDKClientBase {
3286
3551
  return undefined;
3287
3552
  }
3288
3553
  const { organizationId, timestampMs, ...parameters } = input;
3554
+ const session = await this.storageManager?.getActiveSession();
3289
3555
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_name";
3290
3556
  const bodyWithType = {
3291
3557
  parameters,
3292
- organizationId,
3558
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3293
3559
  timestampMs: timestampMs ?? String(Date.now()),
3294
3560
  type: "ACTIVITY_TYPE_UPDATE_USER_NAME",
3295
3561
  };
@@ -3319,10 +3585,11 @@ class TurnkeySDKClientBase {
3319
3585
  return undefined;
3320
3586
  }
3321
3587
  const { organizationId, timestampMs, ...parameters } = input;
3588
+ const session = await this.storageManager?.getActiveSession();
3322
3589
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_phone_number";
3323
3590
  const bodyWithType = {
3324
3591
  parameters,
3325
- organizationId,
3592
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3326
3593
  timestampMs: timestampMs ?? String(Date.now()),
3327
3594
  type: "ACTIVITY_TYPE_UPDATE_USER_PHONE_NUMBER",
3328
3595
  };
@@ -3352,10 +3619,11 @@ class TurnkeySDKClientBase {
3352
3619
  return undefined;
3353
3620
  }
3354
3621
  const { organizationId, timestampMs, ...parameters } = input;
3622
+ const session = await this.storageManager?.getActiveSession();
3355
3623
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_tag";
3356
3624
  const bodyWithType = {
3357
3625
  parameters,
3358
- organizationId,
3626
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3359
3627
  timestampMs: timestampMs ?? String(Date.now()),
3360
3628
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
3361
3629
  };
@@ -3385,10 +3653,11 @@ class TurnkeySDKClientBase {
3385
3653
  return undefined;
3386
3654
  }
3387
3655
  const { organizationId, timestampMs, ...parameters } = input;
3656
+ const session = await this.storageManager?.getActiveSession();
3388
3657
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_wallet";
3389
3658
  const bodyWithType = {
3390
3659
  parameters,
3391
- organizationId,
3660
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3392
3661
  timestampMs: timestampMs ?? String(Date.now()),
3393
3662
  type: "ACTIVITY_TYPE_UPDATE_WALLET",
3394
3663
  };
@@ -3418,10 +3687,11 @@ class TurnkeySDKClientBase {
3418
3687
  return undefined;
3419
3688
  }
3420
3689
  const { organizationId, timestampMs, ...parameters } = input;
3690
+ const session = await this.storageManager?.getActiveSession();
3421
3691
  const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
3422
3692
  const bodyWithType = {
3423
3693
  parameters,
3424
- organizationId,
3694
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3425
3695
  timestampMs: timestampMs ?? String(Date.now()),
3426
3696
  type: "ACTIVITY_TYPE_VERIFY_OTP",
3427
3697
  };
@@ -3447,10 +3717,13 @@ class TurnkeySDKClientBase {
3447
3717
  if (!activeStamper) {
3448
3718
  return undefined;
3449
3719
  }
3720
+ const session = await this.storageManager?.getActiveSession();
3450
3721
  const fullUrl = this.config.apiBaseUrl + "/tkhq/api/v1/test_rate_limits";
3451
3722
  const body = {
3452
3723
  ...input,
3453
- organizationId: input.organizationId,
3724
+ organizationId: input.organizationId ??
3725
+ session?.organizationId ??
3726
+ this.config.organizationId,
3454
3727
  };
3455
3728
  const stringifiedBody = JSON.stringify(body);
3456
3729
  const stamp = await activeStamper.stamp(stringifiedBody);