@turnkey/core 2.2.0 → 2.4.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.
- package/dist/__clients__/core.d.ts +7 -6
- package/dist/__clients__/core.d.ts.map +1 -1
- package/dist/__clients__/core.js +46 -64
- package/dist/__clients__/core.js.map +1 -1
- package/dist/__clients__/core.mjs +46 -64
- package/dist/__clients__/core.mjs.map +1 -1
- package/dist/__generated__/sdk-client-base.d.ts +62 -9
- package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
- package/dist/__generated__/sdk-client-base.js +947 -84
- package/dist/__generated__/sdk-client-base.js.map +1 -1
- package/dist/__generated__/sdk-client-base.mjs +947 -84
- package/dist/__generated__/sdk-client-base.mjs.map +1 -1
- package/dist/__generated__/version.d.ts +1 -1
- package/dist/__generated__/version.js +1 -1
- package/dist/__generated__/version.mjs +1 -1
- package/dist/__tests__/sol-send-transaction-helper-test.d.ts +2 -0
- package/dist/__tests__/sol-send-transaction-helper-test.d.ts.map +1 -0
- package/dist/__tests__/sol-send-transaction-test.d.ts +2 -0
- package/dist/__tests__/sol-send-transaction-test.d.ts.map +1 -0
- package/dist/__types__/method-types/shared.d.ts +11 -22
- package/dist/__types__/method-types/shared.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/utils.d.ts +3 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +26 -1
- package/dist/utils.mjs.map +1 -1
- package/package.json +8 -8
|
@@ -125,6 +125,7 @@ export declare class TurnkeyClient {
|
|
|
125
125
|
* @param params.expirationSeconds - session expiration time in seconds (defaults to the configured default).
|
|
126
126
|
* @param params.createSubOrgParams - parameters for creating a sub-organization (e.g., authenticators, user metadata).
|
|
127
127
|
* @param params.sessionKey - session key to use for storing the session (defaults to the default session key).
|
|
128
|
+
* @param params.captchaToken - optional captcha token for bot prevention (must be enabled in the auth proxy config to take effect).
|
|
128
129
|
* @returns A promise that resolves to a {@link PasskeyAuthResult}, which includes:
|
|
129
130
|
* - `sessionToken`: the signed JWT session token.
|
|
130
131
|
* - `credentialId`: the credential ID associated with the passkey created.
|
|
@@ -257,6 +258,7 @@ export declare class TurnkeyClient {
|
|
|
257
258
|
* @param params.sessionKey - session key to use for storing the session (defaults to the default session key).
|
|
258
259
|
* @param params.expirationSeconds - session expiration time in seconds (defaults to the configured default).
|
|
259
260
|
* @param params.organizationId - organization ID to target (defaults to the session's organization ID or the parent organization ID).
|
|
261
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
260
262
|
* @returns A promise that resolves to an object containing:
|
|
261
263
|
* - `sessionToken`: the signed JWT session token.
|
|
262
264
|
* - `address`: the authenticated wallet address.
|
|
@@ -277,6 +279,7 @@ export declare class TurnkeyClient {
|
|
|
277
279
|
* @param params.otpType - type of OTP to initialize (OtpType.Email or OtpType.Sms).
|
|
278
280
|
* @param params.contact - contact information for the user (e.g., email address or phone number).
|
|
279
281
|
* @param params.organizationId - optional organization ID to target (defaults to the session's organization ID or the parent organization ID).
|
|
282
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
280
283
|
* @returns A promise that resolves to an {@link InitOtpResult}, which includes:
|
|
281
284
|
* - `otpId`: the ID of the initiated OTP.
|
|
282
285
|
* - `otpEncryptionTargetBundle`: the signed encryption target bundle for encrypting the OTP code.
|
|
@@ -333,6 +336,7 @@ export declare class TurnkeyClient {
|
|
|
333
336
|
* @param params.createSubOrgParams - parameters for creating a sub-organization (e.g., authenticators, user metadata).
|
|
334
337
|
* @param params.invalidateExisting - flag to invalidate existing session for the user.
|
|
335
338
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
339
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
336
340
|
* @returns A promise that resolves to a {@link BaseAuthResult}, which includes:
|
|
337
341
|
* - `sessionToken`: the signed JWT session token.
|
|
338
342
|
* @throws {TurnkeyError} If there is an error during the OTP sign-up process or session storage.
|
|
@@ -357,6 +361,7 @@ export declare class TurnkeyClient {
|
|
|
357
361
|
* @param params.invalidateExisting - flag to invalidate existing sessions for the user.
|
|
358
362
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
359
363
|
* @param params.createSubOrgParams - parameters for sub-organization creation (e.g., authenticators, user metadata).
|
|
364
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
360
365
|
* @returns A promise that resolves to an object containing:
|
|
361
366
|
* - `sessionToken`: the signed JWT session token.
|
|
362
367
|
* - `verificationToken`: the OTP verification token.
|
|
@@ -382,6 +387,7 @@ export declare class TurnkeyClient {
|
|
|
382
387
|
* @param params.createSubOrgParams - parameters for sub-organization creation (e.g., authenticators, user metadata).
|
|
383
388
|
* @param params.invalidateExisting - flag to invalidate existing sessions for the user.
|
|
384
389
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
390
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OAuth completion (must be enabled in the auth proxy config to take effect).
|
|
385
391
|
*
|
|
386
392
|
* @returns A promise that resolves to an object containing:
|
|
387
393
|
* - `sessionToken`: the signed JWT session token.
|
|
@@ -424,6 +430,7 @@ export declare class TurnkeyClient {
|
|
|
424
430
|
* @param params.providerName - name of the OAuth provider (e.g., "Google", "Apple").
|
|
425
431
|
* @param params.createSubOrgParams - parameters for sub-organization creation (e.g., authenticators, user metadata).
|
|
426
432
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
433
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
427
434
|
* @returns A promise that resolves to a {@link BaseAuthResult}, which includes:
|
|
428
435
|
* - `sessionToken`: the signed JWT session token.
|
|
429
436
|
* @throws {TurnkeyError} If there is an error during the OAuth sign-up or login process.
|
|
@@ -596,9 +603,6 @@ export declare class TurnkeyClient {
|
|
|
596
603
|
*/
|
|
597
604
|
ethSendErc20Transfer: (params: EthSendErc20TransferParams) => Promise<string>;
|
|
598
605
|
/**
|
|
599
|
-
* @beta
|
|
600
|
-
* * **API subject to change**
|
|
601
|
-
*
|
|
602
606
|
* Signs and submits an Ethereum transaction using a Turnkey-managed (embedded) wallet.
|
|
603
607
|
*
|
|
604
608
|
* This method performs **authorization and signing**, and submits the transaction
|
|
@@ -631,9 +635,6 @@ export declare class TurnkeyClient {
|
|
|
631
635
|
*/
|
|
632
636
|
ethSendTransaction: (params: EthSendTransactionParams) => Promise<string>;
|
|
633
637
|
/**
|
|
634
|
-
* @beta
|
|
635
|
-
* * **API subject to change**
|
|
636
|
-
*
|
|
637
638
|
* Signs and submits a Solana transaction using a Turnkey-managed (embedded) wallet.
|
|
638
639
|
*
|
|
639
640
|
* This method performs **authorization and signing**, and submits the transaction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/__clients__/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,OAAO,EACZ,KAAK,mBAAmB,EAExB,KAAK,sBAAsB,EAC3B,KAAK,MAAM,EACX,KAAK,gCAAgC,EAErC,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEtB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/__clients__/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EACL,KAAK,8BAA8B,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;;;;;;;;;;OAYG;IACH,cAAc,WAAkB,oBAAoB,KAAG,QAAQ,MAAM,CAAC,CA6BpE;IAEF;;;;;;;;;;OAUG;IACH,kBAAkB,QAAa,QAAQ,gCAAgC,CAAC,CAmBtE;IAEF;;;;;;;;;;;;;OAaG;IACH,yBAAyB,WACf,+BAA+B,KACtC,QAAQ,WAAW,CAAC,CAoDrB;IAEF;;;;;;;;;;OAUG;IACH,eAAe,WAAkB,qBAAqB,KAAG,QAAQ,IAAI,CAAC,CA+DpE;CACH"}
|
package/dist/__clients__/core.js
CHANGED
|
@@ -314,13 +314,14 @@ class TurnkeyClient {
|
|
|
314
314
|
* @param params.expirationSeconds - session expiration time in seconds (defaults to the configured default).
|
|
315
315
|
* @param params.createSubOrgParams - parameters for creating a sub-organization (e.g., authenticators, user metadata).
|
|
316
316
|
* @param params.sessionKey - session key to use for storing the session (defaults to the default session key).
|
|
317
|
+
* @param params.captchaToken - optional captcha token for bot prevention (must be enabled in the auth proxy config to take effect).
|
|
317
318
|
* @returns A promise that resolves to a {@link PasskeyAuthResult}, which includes:
|
|
318
319
|
* - `sessionToken`: the signed JWT session token.
|
|
319
320
|
* - `credentialId`: the credential ID associated with the passkey created.
|
|
320
321
|
* @throws {TurnkeyError} If there is an error during passkey creation, sub-organization creation, or session storage.
|
|
321
322
|
*/
|
|
322
323
|
this.signUpWithPasskey = async (params) => {
|
|
323
|
-
const { passkeyDisplayName, challenge, expirationSeconds = auth.DEFAULT_SESSION_EXPIRATION_IN_SECONDS, createSubOrgParams, sessionKey = enums.SessionKey.DefaultSessionkey, } = params || {};
|
|
324
|
+
const { passkeyDisplayName, challenge, expirationSeconds = auth.DEFAULT_SESSION_EXPIRATION_IN_SECONDS, createSubOrgParams, sessionKey = enums.SessionKey.DefaultSessionkey, captchaToken, } = params || {};
|
|
324
325
|
const generatedPublicKey = await this.createApiKeyPair();
|
|
325
326
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
326
327
|
if (!this.passkeyStamper) {
|
|
@@ -357,7 +358,7 @@ class TurnkeyClient {
|
|
|
357
358
|
],
|
|
358
359
|
},
|
|
359
360
|
});
|
|
360
|
-
const res = await this.httpClient.proxySignupV2(signUpBody);
|
|
361
|
+
const res = await this.httpClient.proxySignupV2(signUpBody, captchaToken);
|
|
361
362
|
if (!res) {
|
|
362
363
|
throw new sdkTypes.TurnkeyError(`Sign up failed`, sdkTypes.TurnkeyErrorCodes.PASSKEY_SIGNUP_AUTH_ERROR);
|
|
363
364
|
}
|
|
@@ -705,6 +706,7 @@ class TurnkeyClient {
|
|
|
705
706
|
* @param params.sessionKey - session key to use for storing the session (defaults to the default session key).
|
|
706
707
|
* @param params.expirationSeconds - session expiration time in seconds (defaults to the configured default).
|
|
707
708
|
* @param params.organizationId - organization ID to target (defaults to the session's organization ID or the parent organization ID).
|
|
709
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
708
710
|
* @returns A promise that resolves to an object containing:
|
|
709
711
|
* - `sessionToken`: the signed JWT session token.
|
|
710
712
|
* - `address`: the authenticated wallet address.
|
|
@@ -712,7 +714,7 @@ class TurnkeyClient {
|
|
|
712
714
|
* @throws {TurnkeyError} If there is an error during wallet authentication, sub-organization creation, or session storage.
|
|
713
715
|
*/
|
|
714
716
|
this.loginOrSignupWithWallet = async (params) => {
|
|
715
|
-
const { walletProvider, createSubOrgParams, sessionKey = enums.SessionKey.DefaultSessionkey, } = params;
|
|
717
|
+
const { walletProvider, createSubOrgParams, sessionKey = enums.SessionKey.DefaultSessionkey, captchaToken, } = params;
|
|
716
718
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
717
719
|
const { signedRequest, publicKey } = await this.buildWalletLoginRequest(params);
|
|
718
720
|
// here we check if the subOrg exists and create one
|
|
@@ -740,7 +742,7 @@ class TurnkeyClient {
|
|
|
740
742
|
],
|
|
741
743
|
},
|
|
742
744
|
});
|
|
743
|
-
signupRes = await this.httpClient.proxySignupV2(signUpBody);
|
|
745
|
+
signupRes = await this.httpClient.proxySignupV2(signUpBody, captchaToken);
|
|
744
746
|
if (!signupRes) {
|
|
745
747
|
throw new sdkTypes.TurnkeyError(`Sign up failed`, sdkTypes.TurnkeyErrorCodes.WALLET_SIGNUP_AUTH_ERROR);
|
|
746
748
|
}
|
|
@@ -778,6 +780,7 @@ class TurnkeyClient {
|
|
|
778
780
|
* @param params.otpType - type of OTP to initialize (OtpType.Email or OtpType.Sms).
|
|
779
781
|
* @param params.contact - contact information for the user (e.g., email address or phone number).
|
|
780
782
|
* @param params.organizationId - optional organization ID to target (defaults to the session's organization ID or the parent organization ID).
|
|
783
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
781
784
|
* @returns A promise that resolves to an {@link InitOtpResult}, which includes:
|
|
782
785
|
* - `otpId`: the ID of the initiated OTP.
|
|
783
786
|
* - `otpEncryptionTargetBundle`: the signed encryption target bundle for encrypting the OTP code.
|
|
@@ -785,7 +788,11 @@ class TurnkeyClient {
|
|
|
785
788
|
*/
|
|
786
789
|
this.initOtp = async (params) => {
|
|
787
790
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
788
|
-
const
|
|
791
|
+
const { otpType, contact, captchaToken } = params;
|
|
792
|
+
const initOtpRes = await this.httpClient.proxyInitOtpV2({
|
|
793
|
+
otpType,
|
|
794
|
+
contact,
|
|
795
|
+
}, captchaToken);
|
|
789
796
|
if (!initOtpRes ||
|
|
790
797
|
!initOtpRes.otpId ||
|
|
791
798
|
!initOtpRes.otpEncryptionTargetBundle) {
|
|
@@ -941,12 +948,13 @@ class TurnkeyClient {
|
|
|
941
948
|
* @param params.createSubOrgParams - parameters for creating a sub-organization (e.g., authenticators, user metadata).
|
|
942
949
|
* @param params.invalidateExisting - flag to invalidate existing session for the user.
|
|
943
950
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
951
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
944
952
|
* @returns A promise that resolves to a {@link BaseAuthResult}, which includes:
|
|
945
953
|
* - `sessionToken`: the signed JWT session token.
|
|
946
954
|
* @throws {TurnkeyError} If there is an error during the OTP sign-up process or session storage.
|
|
947
955
|
*/
|
|
948
956
|
this.signUpWithOtp = async (params) => {
|
|
949
|
-
const { verificationToken, contact, otpType, createSubOrgParams, invalidateExisting, sessionKey, } = params;
|
|
957
|
+
const { verificationToken, contact, otpType, createSubOrgParams, invalidateExisting, sessionKey, captchaToken, } = params;
|
|
950
958
|
// build sign up body without client signature first
|
|
951
959
|
const signUpBody = utils.buildSignUpBody({
|
|
952
960
|
createSubOrgParams: {
|
|
@@ -986,7 +994,7 @@ class TurnkeyClient {
|
|
|
986
994
|
const signupRes = await this.httpClient.proxySignupV2({
|
|
987
995
|
...signUpBody,
|
|
988
996
|
clientSignature,
|
|
989
|
-
});
|
|
997
|
+
}, captchaToken);
|
|
990
998
|
if (!signupRes) {
|
|
991
999
|
throw new sdkTypes.TurnkeyError(`Auth proxy OTP sign up failed`, sdkTypes.TurnkeyErrorCodes.OTP_SIGNUP_ERROR);
|
|
992
1000
|
}
|
|
@@ -1023,6 +1031,7 @@ class TurnkeyClient {
|
|
|
1023
1031
|
* @param params.invalidateExisting - flag to invalidate existing sessions for the user.
|
|
1024
1032
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
1025
1033
|
* @param params.createSubOrgParams - parameters for sub-organization creation (e.g., authenticators, user metadata).
|
|
1034
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
1026
1035
|
* @returns A promise that resolves to an object containing:
|
|
1027
1036
|
* - `sessionToken`: the signed JWT session token.
|
|
1028
1037
|
* - `verificationToken`: the OTP verification token.
|
|
@@ -1030,7 +1039,7 @@ class TurnkeyClient {
|
|
|
1030
1039
|
* @throws {TurnkeyError} If there is an error during OTP verification, sign-up, or login.
|
|
1031
1040
|
*/
|
|
1032
1041
|
this.completeOtp = async (params) => {
|
|
1033
|
-
const { otpId, otpCode, otpEncryptionTargetBundle, contact, otpType, invalidateExisting = false, sessionKey, createSubOrgParams, } = params;
|
|
1042
|
+
const { otpId, otpCode, otpEncryptionTargetBundle, contact, otpType, invalidateExisting = false, sessionKey, createSubOrgParams, captchaToken, } = params;
|
|
1034
1043
|
const publicKey = params.publicKey ?? (await this.createApiKeyPair());
|
|
1035
1044
|
if (!publicKey) {
|
|
1036
1045
|
throw new sdkTypes.TurnkeyError("No public key available. Either pass a publicKey or ensure apiKeyStamper is configured.", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
|
|
@@ -1062,6 +1071,7 @@ class TurnkeyClient {
|
|
|
1062
1071
|
...(createSubOrgParams && { createSubOrgParams }),
|
|
1063
1072
|
...(invalidateExisting && { invalidateExisting }),
|
|
1064
1073
|
...(sessionKey && { sessionKey }),
|
|
1074
|
+
...(captchaToken && { captchaToken }),
|
|
1065
1075
|
});
|
|
1066
1076
|
return {
|
|
1067
1077
|
...signUpRes,
|
|
@@ -1111,6 +1121,7 @@ class TurnkeyClient {
|
|
|
1111
1121
|
* @param params.createSubOrgParams - parameters for sub-organization creation (e.g., authenticators, user metadata).
|
|
1112
1122
|
* @param params.invalidateExisting - flag to invalidate existing sessions for the user.
|
|
1113
1123
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
1124
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OAuth completion (must be enabled in the auth proxy config to take effect).
|
|
1114
1125
|
*
|
|
1115
1126
|
* @returns A promise that resolves to an object containing:
|
|
1116
1127
|
* - `sessionToken`: the signed JWT session token.
|
|
@@ -1118,7 +1129,7 @@ class TurnkeyClient {
|
|
|
1118
1129
|
* @throws {TurnkeyError} If there is an error during the OAuth completion process, such as account lookup, sign-up, or login.
|
|
1119
1130
|
*/
|
|
1120
1131
|
this.completeOauth = async (params) => {
|
|
1121
|
-
const { oidcToken, publicKey, providerName, createSubOrgParams, invalidateExisting, sessionKey, } = params;
|
|
1132
|
+
const { oidcToken, publicKey, providerName, createSubOrgParams, invalidateExisting, sessionKey, captchaToken, } = params;
|
|
1122
1133
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
1123
1134
|
const accountRes = await this.httpClient.proxyGetAccount({
|
|
1124
1135
|
filterType: "OIDC_TOKEN",
|
|
@@ -1152,6 +1163,7 @@ class TurnkeyClient {
|
|
|
1152
1163
|
}),
|
|
1153
1164
|
...(invalidateExisting && { invalidateExisting }),
|
|
1154
1165
|
...(sessionKey && { sessionKey }),
|
|
1166
|
+
...(captchaToken && { captchaToken }),
|
|
1155
1167
|
});
|
|
1156
1168
|
return {
|
|
1157
1169
|
...signUpRes,
|
|
@@ -1240,12 +1252,13 @@ class TurnkeyClient {
|
|
|
1240
1252
|
* @param params.providerName - name of the OAuth provider (e.g., "Google", "Apple").
|
|
1241
1253
|
* @param params.createSubOrgParams - parameters for sub-organization creation (e.g., authenticators, user metadata).
|
|
1242
1254
|
* @param params.sessionKey - session key to use for session creation (defaults to the default session key).
|
|
1255
|
+
* @param params.captchaToken - optional captcha token for bot prevention during OTP initialization (must be enabled in the auth proxy config to take effect).
|
|
1243
1256
|
* @returns A promise that resolves to a {@link BaseAuthResult}, which includes:
|
|
1244
1257
|
* - `sessionToken`: the signed JWT session token.
|
|
1245
1258
|
* @throws {TurnkeyError} If there is an error during the OAuth sign-up or login process.
|
|
1246
1259
|
*/
|
|
1247
1260
|
this.signUpWithOauth = async (params) => {
|
|
1248
|
-
const { oidcToken, publicKey, providerName = "OpenID Connect Provider" + " " + Date.now(), createSubOrgParams, sessionKey, } = params;
|
|
1261
|
+
const { oidcToken, publicKey, providerName = "OpenID Connect Provider" + " " + Date.now(), createSubOrgParams, sessionKey, captchaToken, } = params;
|
|
1249
1262
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
1250
1263
|
const signUpBody = utils.buildSignUpBody({
|
|
1251
1264
|
createSubOrgParams: {
|
|
@@ -1259,7 +1272,7 @@ class TurnkeyClient {
|
|
|
1259
1272
|
],
|
|
1260
1273
|
},
|
|
1261
1274
|
});
|
|
1262
|
-
const signupRes = await this.httpClient.proxySignupV2(signUpBody);
|
|
1275
|
+
const signupRes = await this.httpClient.proxySignupV2(signUpBody, captchaToken);
|
|
1263
1276
|
if (!signupRes) {
|
|
1264
1277
|
throw new sdkTypes.TurnkeyError(`Auth proxy OAuth signup failed`, sdkTypes.TurnkeyErrorCodes.OAUTH_SIGNUP_ERROR);
|
|
1265
1278
|
}
|
|
@@ -1863,9 +1876,6 @@ class TurnkeyClient {
|
|
|
1863
1876
|
});
|
|
1864
1877
|
};
|
|
1865
1878
|
/**
|
|
1866
|
-
* @beta
|
|
1867
|
-
* * **API subject to change**
|
|
1868
|
-
*
|
|
1869
1879
|
* Signs and submits an Ethereum transaction using a Turnkey-managed (embedded) wallet.
|
|
1870
1880
|
*
|
|
1871
1881
|
* This method performs **authorization and signing**, and submits the transaction
|
|
@@ -1898,44 +1908,23 @@ class TurnkeyClient {
|
|
|
1898
1908
|
*/
|
|
1899
1909
|
this.ethSendTransaction = async (params) => {
|
|
1900
1910
|
const { organizationId: organizationIdFromParams, stampWith = this.config.defaultStamperType, transaction, } = params;
|
|
1901
|
-
const { from, to, caip2, value, data, nonce, gasLimit, maxFeePerGas, maxPriorityFeePerGas, sponsor, gasStationNonce, } = transaction;
|
|
1902
1911
|
const session = await utils.getActiveSessionOrThrowIfRequired(stampWith, this.storageManager.getActiveSession);
|
|
1903
1912
|
const organizationId = organizationIdFromParams || session?.organizationId;
|
|
1904
1913
|
if (!organizationId) {
|
|
1905
1914
|
throw new sdkTypes.TurnkeyError("Organization ID must be provided to send a transaction", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
|
|
1906
1915
|
}
|
|
1907
1916
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
1908
|
-
//
|
|
1909
|
-
//
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
if (sponsor) {
|
|
1920
|
-
intent.sponsor = true;
|
|
1921
|
-
if (gasStationNonce !== undefined)
|
|
1922
|
-
intent.gasStationNonce = gasStationNonce;
|
|
1923
|
-
}
|
|
1924
|
-
else {
|
|
1925
|
-
if (gasLimit)
|
|
1926
|
-
intent.gasLimit = gasLimit;
|
|
1927
|
-
if (maxFeePerGas)
|
|
1928
|
-
intent.maxFeePerGas = maxFeePerGas;
|
|
1929
|
-
if (maxPriorityFeePerGas)
|
|
1930
|
-
intent.maxPriorityFeePerGas = maxPriorityFeePerGas;
|
|
1931
|
-
}
|
|
1932
|
-
//
|
|
1933
|
-
// Submit to Turnkey
|
|
1934
|
-
//
|
|
1935
|
-
const resp = await this.httpClient.ethSendTransaction({
|
|
1936
|
-
...intent,
|
|
1937
|
-
organizationId,
|
|
1938
|
-
});
|
|
1917
|
+
// Conditionally call v2 activity if calls array exists.
|
|
1918
|
+
// TODO (breaking change): eventually, we wont generate the v1 activity at all, remove this check and update the intent.
|
|
1919
|
+
const resp = "calls" in transaction
|
|
1920
|
+
? await this.httpClient.ethSendTransactionV2({
|
|
1921
|
+
...transaction,
|
|
1922
|
+
organizationId,
|
|
1923
|
+
})
|
|
1924
|
+
: await this.httpClient.ethSendTransaction({
|
|
1925
|
+
...transaction,
|
|
1926
|
+
organizationId,
|
|
1927
|
+
});
|
|
1939
1928
|
const id = resp.sendTransactionStatusId;
|
|
1940
1929
|
if (!id) {
|
|
1941
1930
|
throw new sdkTypes.TurnkeyError("Missing sendTransactionStatusId", sdkTypes.TurnkeyErrorCodes.ETH_SEND_TRANSACTION_ERROR);
|
|
@@ -1947,9 +1936,6 @@ class TurnkeyClient {
|
|
|
1947
1936
|
});
|
|
1948
1937
|
};
|
|
1949
1938
|
/**
|
|
1950
|
-
* @beta
|
|
1951
|
-
* * **API subject to change**
|
|
1952
|
-
*
|
|
1953
1939
|
* Signs and submits a Solana transaction using a Turnkey-managed (embedded) wallet.
|
|
1954
1940
|
*
|
|
1955
1941
|
* This method performs **authorization and signing**, and submits the transaction
|
|
@@ -1984,21 +1970,17 @@ class TurnkeyClient {
|
|
|
1984
1970
|
throw new sdkTypes.TurnkeyError("Organization ID must be provided to send a transaction", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
|
|
1985
1971
|
}
|
|
1986
1972
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
const resp = await this.httpClient.solSendTransaction({
|
|
1999
|
-
...intent,
|
|
2000
|
-
organizationId,
|
|
2001
|
-
}, stampWith);
|
|
1973
|
+
// Conditionally call the v2 activity if the signWiths array exists.
|
|
1974
|
+
// TODO (breaking change): eventually, we wont generate the v1 activity at all, remove this check and update the intent.
|
|
1975
|
+
const resp = "signWiths" in transaction
|
|
1976
|
+
? await this.httpClient.solSendTransactionV2({
|
|
1977
|
+
...transaction,
|
|
1978
|
+
organizationId,
|
|
1979
|
+
}, stampWith)
|
|
1980
|
+
: await this.httpClient.solSendTransaction({
|
|
1981
|
+
...transaction,
|
|
1982
|
+
organizationId,
|
|
1983
|
+
}, stampWith);
|
|
2002
1984
|
const id = resp.sendTransactionStatusId;
|
|
2003
1985
|
if (!id) {
|
|
2004
1986
|
throw new sdkTypes.TurnkeyError("Missing sendTransactionStatusId", sdkTypes.TurnkeyErrorCodes.SOL_SEND_TRANSACTION_ERROR);
|