SDK / CLI

@smartdev/sdk

A comprehensive SDK for integrating with Smart Dev’s platform, available as a JavaScript/TypeScript library and a CLI tool.

Installation

Node.js Library

To install the SDK, use the following command:

npm install @smartdev/sdk

CLI

npm install -g @smartdev/sdk

Usage examples

Interact with a smart contract (Node.js)

import { config } from "dotenv"
import getSmartDev from "src"
config()
 
const executeOnContractMethod = async () => {
  const smartDev = await getSmartDev({
    apiKeyId: process.env.SMART_DEV_API_KEY_ID as string,
    apiKeySecret: process.env.SMART_DEV_API_KEY_SECRET as string,
  })
 
  try {
    //! Attention hash can differ from the initial hash if the transaction is replaced
    // We recommend waiting for the transaction to be mined in order to get the final hash
    const tx = await smartDev.smartContracts.callContractMethod({
      // Either walletId
      walletId: "<wallet-id>",
      // Or poolId
      // poolId: "<pool-id>",
      encryptionKey: process.env.SMART_DEV_ENCRYPTION_KEY as string,
      smartContractId: "<smart-contract-id>",
      method: "<method-name>",
    })
 
    if (tx.data.status === "error") {
      console.error(tx.data.error)
      return
    }
 
    // Wait for the transaction to be mined
    const res = await tx.wait()
 
    console.log(res)
  } catch (e) {
    console.error(e)
  }
}
 
executeOnContractMethod()

Get a transaction (CLI)

smart-dev smart-contracts get-transaction <transaction-id>

Security

  • Encrypted Storage: We store only the encrypted version of your wallets. Your private keys are never stored in plain text.

  • No Encryption Secret Stored: The encryption secret is not stored by us. You must securely store your encryption key, as it is required to decrypt and access your wallets.

⚠️

Important: If you lose your encryption key, you will not be able to retrieve your wallets. Ensure you store your encryption key in a safe and accessible location.