Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turnkey/viem

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turnkey/viem

Turnkey Helpers to work with Viem

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-6.61%
Maintainers
4
Weekly downloads
 
Created
Source

@turnkey/viem

npm

This package contains helpers to work with Turnkey. Currently:

  • a Turnkey Custom Account (signer)

If you need a lower-level, fully typed HTTP client for interacting with Turnkey API, check out @turnkey/http.

Getting started

$ npm install viem @turnkey/viem
import { createWalletClient, http } from "viem";
import { createAccount } from "@turnkey/viem";

async function main() {
  const turnkeyAccount = createAccount({
    organizationId: "...",
    privateKeyId: "...",
    apiPublicKey: "...",
    apiPrivateKey: "...",
    baseUrl: "https://api.turnkey.com",
  });

  const client = createWalletClient({
    account: turnkeyAccount,
    chain: sepolia,
    transport: http(`https://sepolia.infura.io/v3/$(YOUR_INFURA_API_KEY)`),
  });

  const transactionRequest = {
    to: "0x08d2b0a37F869FF76BACB5Bab3278E26ab7067B7" as `0x${string}`,
    value: 1000000000000000n, // 0.001 ETH
  };

  const txHash = await client.sendTransaction(transactionRequest);
  console.log(`Success! Transaction broadcast with hash ${txHash}`);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});

See also

  • @turnkey/example-with-viem: example using this package to create, sign, and broadcast a transaction on Sepolia (Ethereum testnet)
  • @turnkey/http: lower-level fully typed HTTP client for interacting with Turnkey API

Keywords

FAQs

Package last updated on 10 Aug 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc