@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.
@@ -1,6 +1,6 @@
1
1
  import { TurnkeySDKClientBase } from "../__generated__/sdk-client-base";
2
- import { type TDeleteSubOrganizationResponse, type Session, type TStampLoginResponse, type v1SignRawPayloadResult, type v1User, type ProxyTGetWalletKitConfigResponse, type v1PrivateKey, type WalletAuthResult, type BaseAuthResult, AuthAction, type PasskeyAuthResult, type v1BootProof } from "@turnkey/sdk-types";
3
- import { Chain, type ExportBundle, type TurnkeySDKClientConfig, type WalletAccount, type Wallet, type WalletManagerBase, type WalletProvider, type CreatePasskeyParams, type CreatePasskeyResult, type LogoutParams, type LoginWithPasskeyParams, type SignUpWithPasskeyParams, type SwitchWalletAccountChainParams, type LoginWithWalletParams, type SignUpWithWalletParams, type LoginOrSignupWithWalletParams, type InitOtpParams, type VerifyOtpParams, type VerifyOtpResult, type LoginWithOtpParams, type SignUpWithOtpParams, type CompleteOtpParams, type CompleteOauthParams, type LoginWithOauthParams, type SignUpWithOauthParams, type FetchWalletsParams, type FetchWalletAccountsParams, type FetchPrivateKeysParams, type SignMessageParams, type SignTransactionParams, type SignAndSendTransactionParams, type FetchUserParams, type FetchOrCreateP256ApiKeyUserParams, type FetchOrCreatePoliciesParams, type FetchOrCreatePoliciesResult, type UpdateUserEmailParams, type RemoveUserEmailParams, type UpdateUserPhoneNumberParams, type RemoveUserPhoneNumberParams, type UpdateUserNameParams, type AddOauthProviderParams, type RemoveOauthProvidersParams, type AddPasskeyParams, type RemovePasskeyParams, type CreateWalletParams, type CreateWalletAccountsParams, type ExportWalletParams, type ExportPrivateKeyParams, type ExportWalletAccountParams, type ImportWalletParams, type ImportPrivateKeyParams, type DeleteSubOrganizationParams, type StoreSessionParams, type ClearSessionParams, type RefreshSessionParams, type GetSessionParams, type SetActiveSessionParams, type CreateApiKeyPairParams, type FetchBootProofForAppProofParams, type CreateHttpClientParams, type BuildWalletLoginRequestResult, type BuildWalletLoginRequestParams, type VerifyAppProofsParams } from "../__types__";
2
+ import { type TDeleteSubOrganizationResponse, type Session, type TStampLoginResponse, type v1SignRawPayloadResult, type v1User, type ProxyTGetWalletKitConfigResponse, type v1PrivateKey, type WalletAuthResult, type BaseAuthResult, AuthAction, type PasskeyAuthResult, type v1BootProof, type TGetSendTransactionStatusResponse } from "@turnkey/sdk-types";
3
+ import { Chain, type ExportBundle, type TurnkeySDKClientConfig, type WalletAccount, type Wallet, type WalletManagerBase, type WalletProvider, type CreatePasskeyParams, type CreatePasskeyResult, type LogoutParams, type LoginWithPasskeyParams, type SignUpWithPasskeyParams, type SwitchWalletAccountChainParams, type LoginWithWalletParams, type SignUpWithWalletParams, type LoginOrSignupWithWalletParams, type InitOtpParams, type VerifyOtpParams, type VerifyOtpResult, type LoginWithOtpParams, type SignUpWithOtpParams, type CompleteOtpParams, type CompleteOauthParams, type LoginWithOauthParams, type SignUpWithOauthParams, type FetchWalletsParams, type FetchWalletAccountsParams, type FetchPrivateKeysParams, type SignMessageParams, type SignTransactionParams, type SignAndSendTransactionParams, type EthSendTransactionParams, type FetchUserParams, type FetchOrCreateP256ApiKeyUserParams, type FetchOrCreatePoliciesParams, type FetchOrCreatePoliciesResult, type UpdateUserEmailParams, type RemoveUserEmailParams, type UpdateUserPhoneNumberParams, type RemoveUserPhoneNumberParams, type UpdateUserNameParams, type AddOauthProviderParams, type RemoveOauthProvidersParams, type AddPasskeyParams, type RemovePasskeyParams, type CreateWalletParams, type CreateWalletAccountsParams, type ExportWalletParams, type ExportPrivateKeyParams, type ExportWalletAccountParams, type ImportWalletParams, type ImportPrivateKeyParams, type DeleteSubOrganizationParams, type StoreSessionParams, type ClearSessionParams, type RefreshSessionParams, type GetSessionParams, type SetActiveSessionParams, type CreateApiKeyPairParams, type FetchBootProofForAppProofParams, type CreateHttpClientParams, type BuildWalletLoginRequestResult, type BuildWalletLoginRequestParams, type VerifyAppProofsParams, type PollTransactionStatusParams } from "../__types__";
4
4
  import { CrossPlatformApiKeyStamper } from "../__stampers__/api/base";
5
5
  import { CrossPlatformPasskeyStamper } from "../__stampers__/passkey/base";
6
6
  /**
@@ -547,6 +547,68 @@ export declare class TurnkeyClient {
547
547
  * @throws {TurnkeyError} If the wallet type is unsupported, or if signing/broadcasting fails.
548
548
  */
549
549
  signAndSendTransaction: (params: SignAndSendTransactionParams) => Promise<string>;
550
+ /**
551
+ * @beta
552
+ * * **API subject to change**
553
+ *
554
+ * Signs and submits an Ethereum transaction using a Turnkey-managed (embedded) wallet.
555
+ *
556
+ * This method performs **authorization and signing**, and submits the transaction
557
+ * to Turnkey’s coordinator. It **does not perform any polling** — callers must use
558
+ * `pollTransactionStatus` to obtain the final on-chain result.
559
+ *
560
+ * Behavior:
561
+ *
562
+ * - **Connected wallets**
563
+ * - Connected wallets are **not supported** by this method.
564
+ * - They must instead use `signAndSendTransaction`.
565
+ *
566
+ * - **Embedded wallets**
567
+ * - Constructs the payload for Turnkey's `eth_send_transaction` endpoint.
568
+ * - Fetches nonces automatically when needed (normal nonce or Gas Station nonce).
569
+ * - Signs and submits the transaction through Turnkey.
570
+ * - Returns a `sendTransactionStatusId`, which the caller must pass to
571
+ * `pollTransactionStatus` to obtain the final result (tx hash + status).
572
+ *
573
+ * @param params.organizationId - Organization ID to execute the transaction under.
574
+ * Defaults to the active session's organization.
575
+ *
576
+ * @param params.stampWith - Optional stamper to authorize signing (e.g., passkey).
577
+ *
578
+ * @param params.transaction - The Ethereum transaction details.
579
+ * @returns A promise resolving to the `sendTransactionStatusId`.
580
+ * This ID must be passed to `pollTransactionStatus`.
581
+ *
582
+ * @throws {TurnkeyError} If the transaction is invalid or Turnkey rejects it.
583
+ */
584
+ ethSendTransaction: (params: EthSendTransactionParams) => Promise<string>;
585
+ /**
586
+ * @beta
587
+ * **API subject to change**
588
+ *
589
+ * Polls Turnkey for the final result of a previously submitted Ethereum transaction.
590
+ *
591
+ * This function repeatedly calls `getSendTransactionStatus` until the transaction
592
+ * reaches a terminal state.
593
+ *
594
+ * Terminal states:
595
+ * - **COMPLETED** or **INCLUDED** → resolves with `{ txHash }`
596
+ * - **FAILED** rejects with an error
597
+ *
598
+ * Behavior:
599
+ *
600
+ * - Queries Turnkey every 500ms.
601
+ * - Stops polling automatically when a terminal state is reached.
602
+ * - Extracts the canonical on-chain hash via `resp.eth.txHash` when available.
603
+ *
604
+ * @param organizationId - Organization ID under which the transaction was submitted.
605
+ * @param sendTransactionStatusId - Status ID returned by `ethSendTransaction.
606
+ * @param pollingIntervalMs - Optional polling interval in milliseconds (default: 500ms).
607
+ *
608
+ * @returns A promise resolving to `{ txHash?: string }` if successful.
609
+ * @throws {Error | string} If the transaction fails or is cancelled.
610
+ */
611
+ pollTransactionStatus(params: PollTransactionStatusParams): Promise<TGetSendTransactionStatusResponse>;
550
612
  /**
551
613
  * Fetches the user details for the current session or a specified user.
552
614
  *
@@ -1036,7 +1098,7 @@ export declare class TurnkeyClient {
1036
1098
  *
1037
1099
  * @param params.externalKeyPair - An externally generated key pair (either a CryptoKeyPair or an object with publicKey/privateKey strings) to use instead of generating a new one.
1038
1100
  * @param params.storeOverride - If true, sets the generated or provided public key as the override key in the API key stamper (defaults to false).
1039
- * @returnparams.s A promise that resolves to the public key of the created or provided API key pair as a string.
1101
+ * @return A promise that resolves to the public key of the created or provided API key pair as a string.
1040
1102
  * @throws {TurnkeyError} If the API key stamper is not initialized or if there is an error during key pair creation or storage.
1041
1103
  */
1042
1104
  createApiKeyPair: (params?: CreateApiKeyPairParams) => Promise<string>;
@@ -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,EAGX,KAAK,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9B,QAAQ,MAAM,CAAC,CA2BhB;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"}
@@ -581,8 +581,6 @@ class TurnkeyClient {
581
581
  errorCode: sdkTypes.TurnkeyErrorCodes.WALLET_LOGIN_AUTH_ERROR,
582
582
  }, {
583
583
  finallyFn: async () => {
584
- // Clean up the generated key pair if it wasn't successfully used
585
- this.apiKeyStamper?.clearTemporaryPublicKey();
586
584
  if (generatedPublicKey) {
587
585
  try {
588
586
  await this.apiKeyStamper?.deleteKeyPair(generatedPublicKey);
@@ -675,7 +673,6 @@ class TurnkeyClient {
675
673
  errorCode: sdkTypes.TurnkeyErrorCodes.WALLET_SIGNUP_AUTH_ERROR,
676
674
  }, {
677
675
  finallyFn: async () => {
678
- // Clean up the generated key pair if it wasn't successfully used
679
676
  this.apiKeyStamper?.clearTemporaryPublicKey();
680
677
  if (generatedPublicKey) {
681
678
  try {
@@ -1735,6 +1732,110 @@ class TurnkeyClient {
1735
1732
  errorCode: sdkTypes.TurnkeyErrorCodes.SIGN_AND_SEND_TRANSACTION_ERROR,
1736
1733
  });
1737
1734
  };
1735
+ /**
1736
+ * @beta
1737
+ * * **API subject to change**
1738
+ *
1739
+ * Signs and submits an Ethereum transaction using a Turnkey-managed (embedded) wallet.
1740
+ *
1741
+ * This method performs **authorization and signing**, and submits the transaction
1742
+ * to Turnkey’s coordinator. It **does not perform any polling** — callers must use
1743
+ * `pollTransactionStatus` to obtain the final on-chain result.
1744
+ *
1745
+ * Behavior:
1746
+ *
1747
+ * - **Connected wallets**
1748
+ * - Connected wallets are **not supported** by this method.
1749
+ * - They must instead use `signAndSendTransaction`.
1750
+ *
1751
+ * - **Embedded wallets**
1752
+ * - Constructs the payload for Turnkey's `eth_send_transaction` endpoint.
1753
+ * - Fetches nonces automatically when needed (normal nonce or Gas Station nonce).
1754
+ * - Signs and submits the transaction through Turnkey.
1755
+ * - Returns a `sendTransactionStatusId`, which the caller must pass to
1756
+ * `pollTransactionStatus` to obtain the final result (tx hash + status).
1757
+ *
1758
+ * @param params.organizationId - Organization ID to execute the transaction under.
1759
+ * Defaults to the active session's organization.
1760
+ *
1761
+ * @param params.stampWith - Optional stamper to authorize signing (e.g., passkey).
1762
+ *
1763
+ * @param params.transaction - The Ethereum transaction details.
1764
+ * @returns A promise resolving to the `sendTransactionStatusId`.
1765
+ * This ID must be passed to `pollTransactionStatus`.
1766
+ *
1767
+ * @throws {TurnkeyError} If the transaction is invalid or Turnkey rejects it.
1768
+ */
1769
+ this.ethSendTransaction = async (params) => {
1770
+ const { organizationId: organizationIdFromParams, stampWith = this.config.defaultStamperType, transaction, } = params;
1771
+ const { from, to, caip2, value, data, nonce, gasLimit, maxFeePerGas, maxPriorityFeePerGas, sponsor, } = transaction;
1772
+ const session = await utils.getActiveSessionOrThrowIfRequired(stampWith, this.storageManager.getActiveSession);
1773
+ const organizationId = organizationIdFromParams || session?.organizationId;
1774
+ if (!organizationId) {
1775
+ throw new sdkTypes.TurnkeyError("Organization ID must be provided to send a transaction", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
1776
+ }
1777
+ return utils.withTurnkeyErrorHandling(async () => {
1778
+ let gasStationNonce;
1779
+ let fetchedNonce;
1780
+ //
1781
+ // Fetch nonce(s) when needed:
1782
+ // - sponsored: Gas Station nonce
1783
+ // - non-sponsored: regular EIP-1559 nonce
1784
+ //
1785
+ if (!nonce || sponsor) {
1786
+ const nonceResp = await this.httpClient.getNonces({
1787
+ organizationId,
1788
+ address: from,
1789
+ caip2,
1790
+ nonce: sponsor ? false : true,
1791
+ gasStationNonce: sponsor ? true : false,
1792
+ });
1793
+ gasStationNonce = nonceResp.gasStationNonce;
1794
+ fetchedNonce = nonceResp.nonce;
1795
+ }
1796
+ const finalNonce = nonce ?? fetchedNonce;
1797
+ //
1798
+ // Build Turnkey intent
1799
+ //
1800
+ const intent = {
1801
+ from,
1802
+ to,
1803
+ caip2,
1804
+ ...(value ? { value } : {}),
1805
+ ...(data ? { data } : {}),
1806
+ };
1807
+ if (sponsor) {
1808
+ intent.sponsor = true;
1809
+ if (gasStationNonce)
1810
+ intent.gasStationNonce = gasStationNonce;
1811
+ }
1812
+ else {
1813
+ if (finalNonce !== undefined)
1814
+ intent.nonce = finalNonce;
1815
+ if (gasLimit)
1816
+ intent.gasLimit = gasLimit;
1817
+ if (maxFeePerGas)
1818
+ intent.maxFeePerGas = maxFeePerGas;
1819
+ if (maxPriorityFeePerGas)
1820
+ intent.maxPriorityFeePerGas = maxPriorityFeePerGas;
1821
+ }
1822
+ //
1823
+ // Submit to Turnkey
1824
+ //
1825
+ const resp = await this.httpClient.ethSendTransaction({
1826
+ ...intent,
1827
+ organizationId,
1828
+ });
1829
+ const id = resp.sendTransactionStatusId;
1830
+ if (!id) {
1831
+ throw new sdkTypes.TurnkeyError("Missing sendTransactionStatusId", sdkTypes.TurnkeyErrorCodes.ETH_SEND_TRANSACTION_ERROR);
1832
+ }
1833
+ return id;
1834
+ }, {
1835
+ errorMessage: "Failed to sign and send Ethereum transaction",
1836
+ errorCode: sdkTypes.TurnkeyErrorCodes.ETH_SEND_TRANSACTION_ERROR,
1837
+ });
1838
+ };
1738
1839
  /**
1739
1840
  * Fetches the user details for the current session or a specified user.
1740
1841
  *
@@ -2977,7 +3078,7 @@ class TurnkeyClient {
2977
3078
  *
2978
3079
  * @param params.externalKeyPair - An externally generated key pair (either a CryptoKeyPair or an object with publicKey/privateKey strings) to use instead of generating a new one.
2979
3080
  * @param params.storeOverride - If true, sets the generated or provided public key as the override key in the API key stamper (defaults to false).
2980
- * @returnparams.s A promise that resolves to the public key of the created or provided API key pair as a string.
3081
+ * @return A promise that resolves to the public key of the created or provided API key pair as a string.
2981
3082
  * @throws {TurnkeyError} If the API key stamper is not initialized or if there is an error during key pair creation or storage.
2982
3083
  */
2983
3084
  this.createApiKeyPair = async (params) => {
@@ -2989,7 +3090,7 @@ class TurnkeyClient {
2989
3090
  }
2990
3091
  const publicKey = await this.apiKeyStamper.createKeyPair(externalKeyPair ? externalKeyPair : undefined);
2991
3092
  if (storeOverride && publicKey) {
2992
- await this.apiKeyStamper.setTemporaryPublicKey(publicKey);
3093
+ this.apiKeyStamper.setTemporaryPublicKey(publicKey);
2993
3094
  }
2994
3095
  return publicKey;
2995
3096
  }, {
@@ -3143,6 +3244,76 @@ class TurnkeyClient {
3143
3244
  // Note: not passing anything here since we want to use the configured stampers and this.config
3144
3245
  this.httpClient = this.createHttpClient();
3145
3246
  }
3247
+ /**
3248
+ * @beta
3249
+ * **API subject to change**
3250
+ *
3251
+ * Polls Turnkey for the final result of a previously submitted Ethereum transaction.
3252
+ *
3253
+ * This function repeatedly calls `getSendTransactionStatus` until the transaction
3254
+ * reaches a terminal state.
3255
+ *
3256
+ * Terminal states:
3257
+ * - **COMPLETED** or **INCLUDED** → resolves with `{ txHash }`
3258
+ * - **FAILED** rejects with an error
3259
+ *
3260
+ * Behavior:
3261
+ *
3262
+ * - Queries Turnkey every 500ms.
3263
+ * - Stops polling automatically when a terminal state is reached.
3264
+ * - Extracts the canonical on-chain hash via `resp.eth.txHash` when available.
3265
+ *
3266
+ * @param organizationId - Organization ID under which the transaction was submitted.
3267
+ * @param sendTransactionStatusId - Status ID returned by `ethSendTransaction.
3268
+ * @param pollingIntervalMs - Optional polling interval in milliseconds (default: 500ms).
3269
+ *
3270
+ * @returns A promise resolving to `{ txHash?: string }` if successful.
3271
+ * @throws {Error | string} If the transaction fails or is cancelled.
3272
+ */
3273
+ async pollTransactionStatus(params) {
3274
+ const { organizationId: organizationIdFromParams, stampWith = this.config.defaultStamperType, sendTransactionStatusId, pollingIntervalMs, } = params;
3275
+ const session = await utils.getActiveSessionOrThrowIfRequired(stampWith, this.storageManager.getActiveSession);
3276
+ const organizationId = organizationIdFromParams || session?.organizationId;
3277
+ if (!organizationId) {
3278
+ throw new sdkTypes.TurnkeyError("Organization ID must be provided to fetch user", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
3279
+ }
3280
+ return utils.withTurnkeyErrorHandling(async () => {
3281
+ return new Promise((resolve, reject) => {
3282
+ const interval = pollingIntervalMs ?? 500;
3283
+ const timeoutMs = 60_000; // 1 minute
3284
+ const ref = setInterval(async () => {
3285
+ const resp = await this.httpClient.getSendTransactionStatus({
3286
+ organizationId,
3287
+ sendTransactionStatusId,
3288
+ });
3289
+ const txStatus = resp?.txStatus;
3290
+ const txError = resp?.txError;
3291
+ if (!txStatus)
3292
+ return;
3293
+ if (txError || txStatus === "FAILED" || txStatus === "CANCELLED") {
3294
+ // TODO: use API enum in the future
3295
+ clearInterval(ref);
3296
+ clearTimeout(timeoutRef);
3297
+ reject(txError || `Transaction ${txStatus}`);
3298
+ return;
3299
+ }
3300
+ if (txStatus === "COMPLETED" || txStatus === "INCLUDED") {
3301
+ // TODO: use API enum in the future
3302
+ clearInterval(ref);
3303
+ clearTimeout(timeoutRef);
3304
+ resolve(resp);
3305
+ }
3306
+ }, interval);
3307
+ const timeoutRef = setTimeout(() => {
3308
+ clearInterval(ref);
3309
+ reject(new Error("Polling timed out after 1 minute"));
3310
+ }, timeoutMs);
3311
+ });
3312
+ }, {
3313
+ errorMessage: "Failed to poll transaction status",
3314
+ errorCode: sdkTypes.TurnkeyErrorCodes.POLL_TRANSACTION_STATUS_ERROR,
3315
+ });
3316
+ }
3146
3317
  }
3147
3318
 
3148
3319
  exports.TurnkeyClient = TurnkeyClient;