@turnkey/core 1.11.2 → 1.13.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 +62 -9
- package/dist/__clients__/core.d.ts.map +1 -1
- package/dist/__clients__/core.js +149 -36
- package/dist/__clients__/core.js.map +1 -1
- package/dist/__clients__/core.mjs +149 -36
- package/dist/__clients__/core.mjs.map +1 -1
- package/dist/__generated__/sdk-client-base.d.ts +8 -8
- package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
- package/dist/__generated__/sdk-client-base.js +128 -124
- package/dist/__generated__/sdk-client-base.js.map +1 -1
- package/dist/__generated__/sdk-client-base.mjs +128 -124
- 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/__types__/method-types/shared.d.ts +29 -0
- package/dist/__types__/method-types/shared.d.ts.map +1 -1
- package/dist/__wallet__/web/native/solana.js +1 -1
- package/dist/__wallet__/web/native/solana.js.map +1 -1
- package/dist/__wallet__/web/native/solana.mjs +1 -1
- package/dist/__wallet__/web/native/solana.mjs.map +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +11 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TurnkeySDKClientBase } from "../__generated__/sdk-client-base";
|
|
2
2
|
import { type TDeleteSubOrganizationResponse, type Session, type TStampLoginResponse, type v1SignRawPayloadResult, type v1User, type ProxyTGetWalletKitConfigResponse, type v1PrivateKey, type WalletAuthResult, type BaseAuthResult, type PasskeyAuthResult, type v1BootProof, type TGetSendTransactionStatusResponse, AuthAction } 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__";
|
|
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 EthSendErc20TransferParams, type EthSendTransactionParams, type SolSendTransactionParams, 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
|
/**
|
|
@@ -548,6 +548,26 @@ export declare class TurnkeyClient {
|
|
|
548
548
|
* @throws {TurnkeyError} If the wallet type is unsupported, or if signing/broadcasting fails.
|
|
549
549
|
*/
|
|
550
550
|
signAndSendTransaction: (params: SignAndSendTransactionParams) => Promise<string>;
|
|
551
|
+
/**
|
|
552
|
+
* @beta
|
|
553
|
+
* * **API subject to change**
|
|
554
|
+
*
|
|
555
|
+
* Signs and submits an ERC20 `transfer(address,uint256)` as an Ethereum transaction
|
|
556
|
+
* using a Turnkey-managed (embedded) wallet.
|
|
557
|
+
*
|
|
558
|
+
* This is a convenience wrapper around `ethSendTransaction`:
|
|
559
|
+
* - Encodes ERC20 transfer calldata.
|
|
560
|
+
* - Sends a transaction to the token contract.
|
|
561
|
+
* - Returns a `sendTransactionStatusId` for polling with `pollTransactionStatus`.
|
|
562
|
+
*
|
|
563
|
+
* @param params.organizationId - Organization ID to execute the transaction under.
|
|
564
|
+
* Defaults to the active session's organization.
|
|
565
|
+
* @param params.stampWith - Optional stamper to authorize signing (e.g., passkey).
|
|
566
|
+
* @param params.transfer - ERC20 transfer parameters.
|
|
567
|
+
* @returns A promise resolving to the `sendTransactionStatusId`.
|
|
568
|
+
* @throws {TurnkeyError} If amount encoding fails or Turnkey rejects the transaction.
|
|
569
|
+
*/
|
|
570
|
+
ethSendErc20Transfer: (params: EthSendErc20TransferParams) => Promise<string>;
|
|
551
571
|
/**
|
|
552
572
|
* @beta
|
|
553
573
|
* * **API subject to change**
|
|
@@ -566,7 +586,7 @@ export declare class TurnkeyClient {
|
|
|
566
586
|
*
|
|
567
587
|
* - **Embedded wallets**
|
|
568
588
|
* - Constructs the payload for Turnkey's `eth_send_transaction` endpoint.
|
|
569
|
-
* -
|
|
589
|
+
* - Forwards transaction fields directly to Turnkey's coordinator.
|
|
570
590
|
* - Signs and submits the transaction through Turnkey.
|
|
571
591
|
* - Returns a `sendTransactionStatusId`, which the caller must pass to
|
|
572
592
|
* `pollTransactionStatus` to obtain the final result (tx hash + status).
|
|
@@ -583,30 +603,63 @@ export declare class TurnkeyClient {
|
|
|
583
603
|
* @throws {TurnkeyError} If the transaction is invalid or Turnkey rejects it.
|
|
584
604
|
*/
|
|
585
605
|
ethSendTransaction: (params: EthSendTransactionParams) => Promise<string>;
|
|
606
|
+
/**
|
|
607
|
+
* @beta
|
|
608
|
+
* * **API subject to change**
|
|
609
|
+
*
|
|
610
|
+
* Signs and submits a Solana transaction using a Turnkey-managed (embedded) wallet.
|
|
611
|
+
*
|
|
612
|
+
* This method performs **authorization and signing**, and submits the transaction
|
|
613
|
+
* to Turnkey’s coordinator. It **does not perform any polling** — callers must use
|
|
614
|
+
* `pollTransactionStatus` to obtain the final on-chain result.
|
|
615
|
+
*
|
|
616
|
+
* Behavior:
|
|
617
|
+
*
|
|
618
|
+
* - **Connected wallets**
|
|
619
|
+
* - Connected wallets are **not supported** by this method.
|
|
620
|
+
* - They must instead use `signAndSendTransaction`.
|
|
621
|
+
*
|
|
622
|
+
* - **Embedded wallets**
|
|
623
|
+
* - Constructs the payload for Turnkey's `sol_send_transaction` endpoint.
|
|
624
|
+
* - Signs and submits the transaction through Turnkey.
|
|
625
|
+
* - Returns a `sendTransactionStatusId`, which the caller must pass to
|
|
626
|
+
* `pollTransactionStatus` to obtain the final result (signature + status).
|
|
627
|
+
*
|
|
628
|
+
* @param params.organizationId - Organization ID to execute the transaction under.
|
|
629
|
+
* Defaults to the active session's organization.
|
|
630
|
+
* @param params.stampWith - Optional stamper to authorize signing (e.g., passkey).
|
|
631
|
+
* @param params.transaction - The Solana transaction details.
|
|
632
|
+
* @returns A promise resolving to the `sendTransactionStatusId`.
|
|
633
|
+
* This ID must be passed to `pollTransactionStatus`.
|
|
634
|
+
* @throws {TurnkeyError} If the transaction is invalid or Turnkey rejects it.
|
|
635
|
+
*/
|
|
636
|
+
solSendTransaction: (params: SolSendTransactionParams) => Promise<string>;
|
|
586
637
|
/**
|
|
587
638
|
* @beta
|
|
588
639
|
* **API subject to change**
|
|
589
640
|
*
|
|
590
|
-
* Polls Turnkey for the final result of a previously submitted
|
|
641
|
+
* Polls Turnkey for the final result of a previously submitted transaction.
|
|
591
642
|
*
|
|
592
643
|
* This function repeatedly calls `getSendTransactionStatus` until the transaction
|
|
593
644
|
* reaches a terminal state.
|
|
594
645
|
*
|
|
595
646
|
* Terminal states:
|
|
596
|
-
* - **COMPLETED** or **INCLUDED** → resolves with
|
|
647
|
+
* - **COMPLETED** or **INCLUDED** → resolves with chain-specific transaction details
|
|
597
648
|
* - **FAILED** rejects with an error
|
|
598
649
|
*
|
|
599
650
|
* Behavior:
|
|
600
651
|
*
|
|
601
652
|
* - Queries Turnkey every 500ms.
|
|
602
653
|
* - Stops polling automatically when a terminal state is reached.
|
|
603
|
-
* -
|
|
654
|
+
* - Returns the full status payload from Turnkey.
|
|
655
|
+
* - When available, Ethereum transaction details are exposed at `resp.eth.txHash`.
|
|
604
656
|
*
|
|
605
|
-
* @param organizationId - Organization ID under which the transaction was submitted.
|
|
606
|
-
* @param sendTransactionStatusId - Status ID returned by `ethSendTransaction
|
|
607
|
-
* @param pollingIntervalMs - Optional polling interval in milliseconds (default: 500ms).
|
|
657
|
+
* @param params.organizationId - Organization ID under which the transaction was submitted.
|
|
658
|
+
* @param params.sendTransactionStatusId - Status ID returned by `ethSendTransaction` or `solSendTransaction`.
|
|
659
|
+
* @param params.pollingIntervalMs - Optional polling interval in milliseconds (default: 500ms).
|
|
660
|
+
* @param params.stampWith - Optional stamper to use for polling.
|
|
608
661
|
*
|
|
609
|
-
* @returns A promise resolving to
|
|
662
|
+
* @returns A promise resolving to the transaction status payload if successful.
|
|
610
663
|
* @throws {Error | string} If the transaction fails or is cancelled.
|
|
611
664
|
*/
|
|
612
665
|
pollTransactionStatus(params: PollTransactionStatusParams): Promise<TGetSendTransactionStatusResponse>;
|
|
@@ -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,EACnC,KAAK,OAAO,EACZ,KAAK,mBAAmB,EAExB,KAAK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,kBAAkB,KAAG,QAAQ,IAAI,CAAC,CAgB9D;IAEF;;;;;;;;;;;OAWG;IACH,YAAY,YAAmB,kBAAkB,KAAG,QAAQ,IAAI,CAAC,CAsB/D;IAEF;;;;;;;;;;OAUG;IACH,gBAAgB,QAAa,QAAQ,IAAI,CAAC,CAcxC;IAEF;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,YACH,oBAAoB,KAC5B,QAAQ,mBAAmB,GAAG,SAAS,CAAC,CAoEzC;IAEF;;;;;;;;;;OAUG;IACH,UAAU,YACC,gBAAgB,KACxB,QAAQ,OAAO,GAAG,SAAS,CAAC,CAY7B;IAEF;;;;;;;;;;OAUG;IACH,cAAc,QAAa,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAqBrE;IAEF;;;;;;;;;;;OAWG;IACH,gBAAgB,WAAkB,sBAAsB,KAAG,QAAQ,IAAI,CAAC,CAWtE;IAEF;;;;;;;;;;OAUG;IACH,mBAAmB,QAAa,QAAQ,MAAM,GAAG,SAAS,CAAC,CAUzD;IAEF;;;;;;;;;;OAUG;IACH,mBAAmB,QAAa,QAAQ,IAAI,CAAC,CAoC3C;IAEF;;;;;;;;;;;;;OAaG;IACH,gBAAgB,YACL,sBAAsB,KAC9B,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"}
|
package/dist/__clients__/core.js
CHANGED
|
@@ -14,7 +14,20 @@ var base$3 = require('../__wallet__/base.js');
|
|
|
14
14
|
var ethers = require('ethers');
|
|
15
15
|
var crypto = require('@turnkey/crypto');
|
|
16
16
|
var apiKeyStamper = require('@turnkey/api-key-stamper');
|
|
17
|
+
var viem = require('viem');
|
|
17
18
|
|
|
19
|
+
const ERC20_TRANSFER_ABI = [
|
|
20
|
+
{
|
|
21
|
+
type: "function",
|
|
22
|
+
name: "transfer",
|
|
23
|
+
stateMutability: "nonpayable",
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: "to", type: "address" },
|
|
26
|
+
{ name: "amount", type: "uint256" },
|
|
27
|
+
],
|
|
28
|
+
outputs: [{ name: "success", type: "bool" }],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
18
31
|
class TurnkeyClient {
|
|
19
32
|
constructor(config,
|
|
20
33
|
// Users can pass in their own stampers, or we will create them. Should we remove this?
|
|
@@ -132,7 +145,7 @@ class TurnkeyClient {
|
|
|
132
145
|
* @throws {TurnkeyError} If there is no active session or if there is an error during the logout process.
|
|
133
146
|
*/
|
|
134
147
|
this.logout = async (params) => {
|
|
135
|
-
utils.withTurnkeyErrorHandling(async () => {
|
|
148
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
136
149
|
if (params?.sessionKey) {
|
|
137
150
|
const session = await this.storageManager.getSession(params.sessionKey);
|
|
138
151
|
this.storageManager.clearSession(params.sessionKey);
|
|
@@ -1722,6 +1735,61 @@ class TurnkeyClient {
|
|
|
1722
1735
|
errorCode: sdkTypes.TurnkeyErrorCodes.SIGN_AND_SEND_TRANSACTION_ERROR,
|
|
1723
1736
|
});
|
|
1724
1737
|
};
|
|
1738
|
+
/**
|
|
1739
|
+
* @beta
|
|
1740
|
+
* * **API subject to change**
|
|
1741
|
+
*
|
|
1742
|
+
* Signs and submits an ERC20 `transfer(address,uint256)` as an Ethereum transaction
|
|
1743
|
+
* using a Turnkey-managed (embedded) wallet.
|
|
1744
|
+
*
|
|
1745
|
+
* This is a convenience wrapper around `ethSendTransaction`:
|
|
1746
|
+
* - Encodes ERC20 transfer calldata.
|
|
1747
|
+
* - Sends a transaction to the token contract.
|
|
1748
|
+
* - Returns a `sendTransactionStatusId` for polling with `pollTransactionStatus`.
|
|
1749
|
+
*
|
|
1750
|
+
* @param params.organizationId - Organization ID to execute the transaction under.
|
|
1751
|
+
* Defaults to the active session's organization.
|
|
1752
|
+
* @param params.stampWith - Optional stamper to authorize signing (e.g., passkey).
|
|
1753
|
+
* @param params.transfer - ERC20 transfer parameters.
|
|
1754
|
+
* @returns A promise resolving to the `sendTransactionStatusId`.
|
|
1755
|
+
* @throws {TurnkeyError} If amount encoding fails or Turnkey rejects the transaction.
|
|
1756
|
+
*/
|
|
1757
|
+
this.ethSendErc20Transfer = async (params) => {
|
|
1758
|
+
const { organizationId, stampWith = this.config.defaultStamperType, transfer, } = params;
|
|
1759
|
+
const { from, to, tokenAddress, amount, caip2, nonce, gasLimit, maxFeePerGas, maxPriorityFeePerGas, sponsor, } = transfer;
|
|
1760
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
1761
|
+
let parsedAmount;
|
|
1762
|
+
try {
|
|
1763
|
+
parsedAmount = BigInt(amount);
|
|
1764
|
+
}
|
|
1765
|
+
catch {
|
|
1766
|
+
throw new sdkTypes.TurnkeyError("Invalid ERC20 amount. Use a base-unit integer string.", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
|
|
1767
|
+
}
|
|
1768
|
+
const data = viem.encodeFunctionData({
|
|
1769
|
+
abi: ERC20_TRANSFER_ABI,
|
|
1770
|
+
functionName: "transfer",
|
|
1771
|
+
args: [to, parsedAmount],
|
|
1772
|
+
});
|
|
1773
|
+
return this.ethSendTransaction({
|
|
1774
|
+
...(organizationId !== undefined ? { organizationId } : {}),
|
|
1775
|
+
...(stampWith !== undefined ? { stampWith } : {}),
|
|
1776
|
+
transaction: {
|
|
1777
|
+
from,
|
|
1778
|
+
to: tokenAddress,
|
|
1779
|
+
caip2,
|
|
1780
|
+
data,
|
|
1781
|
+
...(sponsor !== undefined ? { sponsor } : {}),
|
|
1782
|
+
...(nonce ? { nonce } : {}),
|
|
1783
|
+
...(gasLimit ? { gasLimit } : {}),
|
|
1784
|
+
...(maxFeePerGas ? { maxFeePerGas } : {}),
|
|
1785
|
+
...(maxPriorityFeePerGas ? { maxPriorityFeePerGas } : {}),
|
|
1786
|
+
},
|
|
1787
|
+
});
|
|
1788
|
+
}, {
|
|
1789
|
+
errorMessage: "Failed to sign and send ERC20 transfer",
|
|
1790
|
+
errorCode: sdkTypes.TurnkeyErrorCodes.ETH_SEND_TRANSACTION_ERROR,
|
|
1791
|
+
});
|
|
1792
|
+
};
|
|
1725
1793
|
/**
|
|
1726
1794
|
* @beta
|
|
1727
1795
|
* * **API subject to change**
|
|
@@ -1740,7 +1808,7 @@ class TurnkeyClient {
|
|
|
1740
1808
|
*
|
|
1741
1809
|
* - **Embedded wallets**
|
|
1742
1810
|
* - Constructs the payload for Turnkey's `eth_send_transaction` endpoint.
|
|
1743
|
-
* -
|
|
1811
|
+
* - Forwards transaction fields directly to Turnkey's coordinator.
|
|
1744
1812
|
* - Signs and submits the transaction through Turnkey.
|
|
1745
1813
|
* - Returns a `sendTransactionStatusId`, which the caller must pass to
|
|
1746
1814
|
* `pollTransactionStatus` to obtain the final result (tx hash + status).
|
|
@@ -1758,32 +1826,13 @@ class TurnkeyClient {
|
|
|
1758
1826
|
*/
|
|
1759
1827
|
this.ethSendTransaction = async (params) => {
|
|
1760
1828
|
const { organizationId: organizationIdFromParams, stampWith = this.config.defaultStamperType, transaction, } = params;
|
|
1761
|
-
const { from, to, caip2, value, data, nonce, gasLimit, maxFeePerGas, maxPriorityFeePerGas, sponsor, } = transaction;
|
|
1829
|
+
const { from, to, caip2, value, data, nonce, gasLimit, maxFeePerGas, maxPriorityFeePerGas, sponsor, gasStationNonce, } = transaction;
|
|
1762
1830
|
const session = await utils.getActiveSessionOrThrowIfRequired(stampWith, this.storageManager.getActiveSession);
|
|
1763
1831
|
const organizationId = organizationIdFromParams || session?.organizationId;
|
|
1764
1832
|
if (!organizationId) {
|
|
1765
1833
|
throw new sdkTypes.TurnkeyError("Organization ID must be provided to send a transaction", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
|
|
1766
1834
|
}
|
|
1767
1835
|
return utils.withTurnkeyErrorHandling(async () => {
|
|
1768
|
-
let gasStationNonce;
|
|
1769
|
-
let fetchedNonce;
|
|
1770
|
-
//
|
|
1771
|
-
// Fetch nonce(s) when needed:
|
|
1772
|
-
// - sponsored: Gas Station nonce
|
|
1773
|
-
// - non-sponsored: regular EIP-1559 nonce
|
|
1774
|
-
//
|
|
1775
|
-
if (!nonce || sponsor) {
|
|
1776
|
-
const nonceResp = await this.httpClient.getNonces({
|
|
1777
|
-
organizationId,
|
|
1778
|
-
address: from,
|
|
1779
|
-
caip2,
|
|
1780
|
-
nonce: sponsor ? false : true,
|
|
1781
|
-
gasStationNonce: sponsor ? true : false,
|
|
1782
|
-
});
|
|
1783
|
-
gasStationNonce = nonceResp.gasStationNonce;
|
|
1784
|
-
fetchedNonce = nonceResp.nonce;
|
|
1785
|
-
}
|
|
1786
|
-
const finalNonce = nonce ?? fetchedNonce;
|
|
1787
1836
|
//
|
|
1788
1837
|
// Build Turnkey intent
|
|
1789
1838
|
//
|
|
@@ -1793,15 +1842,14 @@ class TurnkeyClient {
|
|
|
1793
1842
|
caip2,
|
|
1794
1843
|
...(value ? { value } : {}),
|
|
1795
1844
|
...(data ? { data } : {}),
|
|
1845
|
+
...(nonce !== undefined ? { nonce } : {}),
|
|
1796
1846
|
};
|
|
1797
1847
|
if (sponsor) {
|
|
1798
1848
|
intent.sponsor = true;
|
|
1799
|
-
if (gasStationNonce)
|
|
1849
|
+
if (gasStationNonce !== undefined)
|
|
1800
1850
|
intent.gasStationNonce = gasStationNonce;
|
|
1801
1851
|
}
|
|
1802
1852
|
else {
|
|
1803
|
-
if (finalNonce !== undefined)
|
|
1804
|
-
intent.nonce = finalNonce;
|
|
1805
1853
|
if (gasLimit)
|
|
1806
1854
|
intent.gasLimit = gasLimit;
|
|
1807
1855
|
if (maxFeePerGas)
|
|
@@ -1826,6 +1874,69 @@ class TurnkeyClient {
|
|
|
1826
1874
|
errorCode: sdkTypes.TurnkeyErrorCodes.ETH_SEND_TRANSACTION_ERROR,
|
|
1827
1875
|
});
|
|
1828
1876
|
};
|
|
1877
|
+
/**
|
|
1878
|
+
* @beta
|
|
1879
|
+
* * **API subject to change**
|
|
1880
|
+
*
|
|
1881
|
+
* Signs and submits a Solana transaction using a Turnkey-managed (embedded) wallet.
|
|
1882
|
+
*
|
|
1883
|
+
* This method performs **authorization and signing**, and submits the transaction
|
|
1884
|
+
* to Turnkey’s coordinator. It **does not perform any polling** — callers must use
|
|
1885
|
+
* `pollTransactionStatus` to obtain the final on-chain result.
|
|
1886
|
+
*
|
|
1887
|
+
* Behavior:
|
|
1888
|
+
*
|
|
1889
|
+
* - **Connected wallets**
|
|
1890
|
+
* - Connected wallets are **not supported** by this method.
|
|
1891
|
+
* - They must instead use `signAndSendTransaction`.
|
|
1892
|
+
*
|
|
1893
|
+
* - **Embedded wallets**
|
|
1894
|
+
* - Constructs the payload for Turnkey's `sol_send_transaction` endpoint.
|
|
1895
|
+
* - Signs and submits the transaction through Turnkey.
|
|
1896
|
+
* - Returns a `sendTransactionStatusId`, which the caller must pass to
|
|
1897
|
+
* `pollTransactionStatus` to obtain the final result (signature + status).
|
|
1898
|
+
*
|
|
1899
|
+
* @param params.organizationId - Organization ID to execute the transaction under.
|
|
1900
|
+
* Defaults to the active session's organization.
|
|
1901
|
+
* @param params.stampWith - Optional stamper to authorize signing (e.g., passkey).
|
|
1902
|
+
* @param params.transaction - The Solana transaction details.
|
|
1903
|
+
* @returns A promise resolving to the `sendTransactionStatusId`.
|
|
1904
|
+
* This ID must be passed to `pollTransactionStatus`.
|
|
1905
|
+
* @throws {TurnkeyError} If the transaction is invalid or Turnkey rejects it.
|
|
1906
|
+
*/
|
|
1907
|
+
this.solSendTransaction = async (params) => {
|
|
1908
|
+
const { organizationId: organizationIdFromParams, stampWith = this.config.defaultStamperType, transaction, } = params;
|
|
1909
|
+
const session = await utils.getActiveSessionOrThrowIfRequired(stampWith, this.storageManager.getActiveSession);
|
|
1910
|
+
const organizationId = organizationIdFromParams || session?.organizationId;
|
|
1911
|
+
if (!organizationId) {
|
|
1912
|
+
throw new sdkTypes.TurnkeyError("Organization ID must be provided to send a transaction", sdkTypes.TurnkeyErrorCodes.INVALID_REQUEST);
|
|
1913
|
+
}
|
|
1914
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
1915
|
+
const intent = {
|
|
1916
|
+
unsignedTransaction: transaction.unsignedTransaction,
|
|
1917
|
+
signWith: transaction.signWith,
|
|
1918
|
+
caip2: transaction.caip2,
|
|
1919
|
+
...(transaction.sponsor !== undefined
|
|
1920
|
+
? { sponsor: transaction.sponsor }
|
|
1921
|
+
: {}),
|
|
1922
|
+
...(transaction.recentBlockhash
|
|
1923
|
+
? { recentBlockhash: transaction.recentBlockhash }
|
|
1924
|
+
: {}),
|
|
1925
|
+
};
|
|
1926
|
+
const resp = await this.httpClient.solSendTransaction({
|
|
1927
|
+
...intent,
|
|
1928
|
+
organizationId,
|
|
1929
|
+
}, stampWith);
|
|
1930
|
+
const id = resp.sendTransactionStatusId;
|
|
1931
|
+
if (!id) {
|
|
1932
|
+
throw new sdkTypes.TurnkeyError("Missing sendTransactionStatusId", sdkTypes.TurnkeyErrorCodes.SOL_SEND_TRANSACTION_ERROR);
|
|
1933
|
+
}
|
|
1934
|
+
return id;
|
|
1935
|
+
}, {
|
|
1936
|
+
errorMessage: "Failed to sign and send Solana transaction",
|
|
1937
|
+
errorCode: sdkTypes.TurnkeyErrorCodes.SOL_SEND_TRANSACTION_ERROR,
|
|
1938
|
+
});
|
|
1939
|
+
};
|
|
1829
1940
|
/**
|
|
1830
1941
|
* Fetches the user details for the current session or a specified user.
|
|
1831
1942
|
*
|
|
@@ -2837,7 +2948,7 @@ class TurnkeyClient {
|
|
|
2837
2948
|
const { sessionToken, sessionKey = enums.SessionKey.DefaultSessionkey } = params;
|
|
2838
2949
|
if (!sessionToken)
|
|
2839
2950
|
return;
|
|
2840
|
-
utils.withTurnkeyErrorHandling(async () => {
|
|
2951
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
2841
2952
|
await this.storageManager.storeSession(sessionToken, sessionKey);
|
|
2842
2953
|
}, {
|
|
2843
2954
|
errorMessage: "Failed to store session",
|
|
@@ -2860,7 +2971,7 @@ class TurnkeyClient {
|
|
|
2860
2971
|
*/
|
|
2861
2972
|
this.clearSession = async (params) => {
|
|
2862
2973
|
const { sessionKey = enums.SessionKey.DefaultSessionkey } = params || {};
|
|
2863
|
-
utils.withTurnkeyErrorHandling(async () => {
|
|
2974
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
2864
2975
|
const session = await this.storageManager.getSession(sessionKey);
|
|
2865
2976
|
if (session) {
|
|
2866
2977
|
await Promise.all([
|
|
@@ -2888,7 +2999,7 @@ class TurnkeyClient {
|
|
|
2888
2999
|
* @throws {TurnkeyError} If no sessions exist or if there is an error clearing all sessions.
|
|
2889
3000
|
*/
|
|
2890
3001
|
this.clearAllSessions = async () => {
|
|
2891
|
-
utils.withTurnkeyErrorHandling(async () => {
|
|
3002
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
2892
3003
|
const sessionKeys = await this.storageManager.listSessionKeys();
|
|
2893
3004
|
if (sessionKeys.length === 0)
|
|
2894
3005
|
return;
|
|
@@ -3058,7 +3169,7 @@ class TurnkeyClient {
|
|
|
3058
3169
|
* @throws {TurnkeyError} If there is an error listing, checking, or deleting unused key pairs.
|
|
3059
3170
|
*/
|
|
3060
3171
|
this.clearUnusedKeyPairs = async () => {
|
|
3061
|
-
utils.withTurnkeyErrorHandling(async () => {
|
|
3172
|
+
return utils.withTurnkeyErrorHandling(async () => {
|
|
3062
3173
|
const publicKeys = await this.apiKeyStamper?.listKeyPairs();
|
|
3063
3174
|
if (!publicKeys || publicKeys.length === 0) {
|
|
3064
3175
|
return;
|
|
@@ -3267,26 +3378,28 @@ class TurnkeyClient {
|
|
|
3267
3378
|
* @beta
|
|
3268
3379
|
* **API subject to change**
|
|
3269
3380
|
*
|
|
3270
|
-
* Polls Turnkey for the final result of a previously submitted
|
|
3381
|
+
* Polls Turnkey for the final result of a previously submitted transaction.
|
|
3271
3382
|
*
|
|
3272
3383
|
* This function repeatedly calls `getSendTransactionStatus` until the transaction
|
|
3273
3384
|
* reaches a terminal state.
|
|
3274
3385
|
*
|
|
3275
3386
|
* Terminal states:
|
|
3276
|
-
* - **COMPLETED** or **INCLUDED** → resolves with
|
|
3387
|
+
* - **COMPLETED** or **INCLUDED** → resolves with chain-specific transaction details
|
|
3277
3388
|
* - **FAILED** rejects with an error
|
|
3278
3389
|
*
|
|
3279
3390
|
* Behavior:
|
|
3280
3391
|
*
|
|
3281
3392
|
* - Queries Turnkey every 500ms.
|
|
3282
3393
|
* - Stops polling automatically when a terminal state is reached.
|
|
3283
|
-
* -
|
|
3394
|
+
* - Returns the full status payload from Turnkey.
|
|
3395
|
+
* - When available, Ethereum transaction details are exposed at `resp.eth.txHash`.
|
|
3284
3396
|
*
|
|
3285
|
-
* @param organizationId - Organization ID under which the transaction was submitted.
|
|
3286
|
-
* @param sendTransactionStatusId - Status ID returned by `ethSendTransaction
|
|
3287
|
-
* @param pollingIntervalMs - Optional polling interval in milliseconds (default: 500ms).
|
|
3397
|
+
* @param params.organizationId - Organization ID under which the transaction was submitted.
|
|
3398
|
+
* @param params.sendTransactionStatusId - Status ID returned by `ethSendTransaction` or `solSendTransaction`.
|
|
3399
|
+
* @param params.pollingIntervalMs - Optional polling interval in milliseconds (default: 500ms).
|
|
3400
|
+
* @param params.stampWith - Optional stamper to use for polling.
|
|
3288
3401
|
*
|
|
3289
|
-
* @returns A promise resolving to
|
|
3402
|
+
* @returns A promise resolving to the transaction status payload if successful.
|
|
3290
3403
|
* @throws {Error | string} If the transaction fails or is cancelled.
|
|
3291
3404
|
*/
|
|
3292
3405
|
async pollTransactionStatus(params) {
|