
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
stacks-turnkey-main
Advanced tools
A small TypeScript SDK that wires the Stacks toolchain to Turnkey-managed keys. It exposes a single default class `StacksTurnkey` that mixes in auth utilities and transaction helpers for Node environments.
A small TypeScript SDK that wires the Stacks toolchain to Turnkey-managed keys. It exposes a single default class StacksTurnkey that mixes in auth utilities and transaction helpers for Node environments.
dist/cjs/turnkey-stacks.jsdist/esm/turnkey-stacks.m.jsdist/index.d.tsThe package name is turnkey-stacks and the default export is StacksTurnkey.
pnpm add turnkey-stacks @stacks/transactions jsonwebtoken @turnkey/wallet-stamper
# If using this repo locally during development
pnpm add file:/absolute/path/to/stacks-embed-sdk
"mainnet" or "testnet" (default is "testnet")import StacksTurnkey from "turnkey-stacks";
const sdk = new StacksTurnkey({
apiBaseUrl: process.env.TURNKEY_API_BASE_URL!,
apiPrivateKey: process.env.TURNKEY_API_PRIVATE_KEY!,
apiPublicKey: process.env.TURNKEY_API_PUBLIC_KEY!,
defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID!,
// network?: "mainnet" | "testnet" (default: "testnet")
});
async function main() {
const res = await sdk.createStacksWallet({
userName: "alice",
walletName: "alice",
});
console.log(res.stacksAddress);
}
main();
Constructor config (see src/types.ts):
apiBaseUrl: stringapiPrivateKey: stringapiPublicKey: stringdefaultOrganizationId: stringname?: stringdescription?: stringnetwork?: "mainnet" | "testnet"Helpers on the base class (src/base.ts):
getClient() returns the Turnkey server SDK client used under the hoodgetNetwork() returns the configured networkinvoke(url, options?) small fetch wrapper used by the helperssrc/transactions/index.ts)generateStacksWallet({ userName, walletName }) → creates a Turnkey sub-org, key, wallet; returns { subOrganization, wallet, stacksAddress }deriveStacksAddressFromTurnkeyAddress(turnkeyWalletAddress) → Stacks addressgetCurrentNonce(address) → nonce as stringgetStacksTransactions(address) → recent transactions (array)getStacksBalance(address) → STX balance as stringtransferSTX({ turnkeyWalletAddress, to, amount }) → builds, signs via Turnkey, broadcasts STX transferexecuteFunctionCall({ turnkeyWalletAddress, contractCallOptions }) → builds, signs via Turnkey, broadcasts contract calltransferSBTC({ turnkeyWalletAddress, to, amount }) → convenience helper for the sbtc-token contractMinimal example (read-only helpers):
const address = await sdk.deriveStacksAddressFromTurnkeyAddress(
"04...uncompressed-public-key-hex"
);
const balance = await sdk.getStacksBalance(address);
const txs = await sdk.getStacksTransactions(address);
Sending STX (simplified):
await sdk.transferSTX({
turnkeyWalletAddress: "04...uncompressed-public-key-hex",
to: "ST...receiver",
amount: 10n, // in microSTX
});
src/auth/index.ts)createUserSubOrg({ email?, passkey?, oauth?, wallet? }) → creates a sub-org and default walletoauth({ credential, publicKey, subOrgId }) → OAuth login via TurnkeyinitEmailAuth({ email, targetPublicKey, baseUrl }) → initiate OTPverifyOtp({ otpId, otpCode, publicKey }) → verify OTPotpLogin({ publicKey, verificationToken, email }) → complete OTP logingetSubOrgId(...), getSubOrgIdByEmail(email), getSubOrgIdByPublicKey(key), getSubOrgIdByUsername(name)getUser(userId, subOrgId)getWallet({ walletId, subOrgId })getAuthenticators({ userId, subOrgId }), getAuthenticator({ authenticatorId, subOrgId })Example: create a user and derive their Stacks address
const { subOrg, user } = await sdk.createUserSubOrg({
email: "user@example.com",
});
// get wallet info
const { wallet, accounts } = await sdk.getWallet({
walletId: "<wallet-id>",
subOrgId: subOrg.subOrganizationId,
});
import StacksTurnkey from "turnkey-stacks";const StacksTurnkey = require("turnkey-stacks").default;pnpm install
pnpm build
Build outputs go to dist/ with both CJS and ESM bundles.
@turnkey/sdk-server. Do not expose your Turnkey API keys in browsers.turnkey-stacks resolves to the Node-friendly build.@stacks/transactions may log circular dependency warnings; these are known and benign.MIT
FAQs
A small TypeScript SDK that wires the Stacks toolchain to Turnkey-managed keys. It exposes a single default class `StacksTurnkey` that mixes in auth utilities and transaction helpers for Node environments.
The npm package stacks-turnkey-main receives a total of 0 weekly downloads. As such, stacks-turnkey-main popularity was classified as not popular.
We found that stacks-turnkey-main demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.