Use Ts Sdk

v1.0.0

Orchestrates TypeScript SDK integration for Aptos dApps. Routes to granular skills for specific tasks (client setup, accounts, transactions, view functions,...

0· 143·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for iskysun96/use-ts-sdk.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Use Ts Sdk" (iskysun96/use-ts-sdk) from ClawHub.
Skill page: https://clawhub.ai/iskysun96/use-ts-sdk
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install use-ts-sdk

ClawHub CLI

Package manager switcher

npx clawhub@latest install use-ts-sdk
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description (TypeScript SDK orchestrator) match the SKILL.md: routing to granular SDK tasks, project file patterns, and best practices. Nothing requested (no env vars, binaries, or installs) is out of scope for an authoring/orchestration skill. One small note: SKILL.md metadata claims author 'aptos-labs' but the package source/homepage are unknown — this could be an attribution inconsistency (not functionality-related).
Instruction Scope
Instructions are limited to SDK setup, file organization, code patterns, and routing to other SDK skills. The skill references project files and local scaffolded paths (frontend/..., src/...), which is appropriate for a code-integration orchestrator. It does not instruct the agent to read unrelated system files, access arbitrary environment variables, exfiltrate data, or post to external endpoints.
Install Mechanism
No install spec and no code files are present, so nothing is written to disk or downloaded. Instruction-only skills are lowest-risk from an installation perspective.
Credentials
SKILL.md sensibly advises loading private keys from server-side environment variables and explicitly warns against exposing keys to the browser. The skill itself does not declare any required env vars, which is coherent for a guidance/orchestration role. However, the guidance implies use of process.env in server code; consumers should review any routed granular skills (e.g., ts-sdk-client, ts-sdk-account) because those may declare or require specific credentials or keys.
Persistence & Privilege
Skill is not always-enabled and allows normal model invocation. It does not request persistent system privileges or attempt to modify other skills' configurations.
Assessment
This is an instruction-only orchestrator for Aptos TypeScript SDK integrations and appears internally consistent. Before installing or using it, check: (1) the referenced granular skills (ts-sdk-client, ts-sdk-account, etc.) for any environment or credential requirements and install steps; (2) whether the 'aptos-labs' author claim matches the registry/package source (there's no homepage/source listed, so the attribution could be incorrect); and (3) that you follow the skill's own safety guidance (never hardcode private keys, keep keys server-side and out of browser bundles). If you plan to have the agent operate on your repo, ensure it has access only to the intended project files and not to unrelated secrets or system configs.

Like a lobster shell, security has layers — review code before you run it.

latestvk97596gadhxy9fr4eqy9bq9vkn837b3b
143downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

Use TypeScript SDK (Orchestrator)

Purpose

Orchestrates @aptos-labs/ts-sdk integration for Aptos dApps. For specific tasks, route to the appropriate granular skill. For composite tasks (e.g., "build me a fullstack dApp"), follow the workflow below.

Core Rules

  1. ALWAYS use @aptos-labs/ts-sdk (the current official SDK, NOT the deprecated aptos package)
  2. NEVER hardcode private keys in source code or frontend bundles
  3. NEVER expose private keys in client-side code or logs
  4. NEVER store private keys in environment variables accessible to the browser (use VITE_ prefix only for public config)
  5. ALWAYS load private keys from environment variables in server-side scripts only, using process.env

Important: Boilerplate Template

If the project was scaffolded with npx create-aptos-dapp (boilerplate template), wallet adapter and SDK setup are already done. Before writing new code, check what already exists:

  • frontend/components/WalletProvider.tsx — wallet adapter setup with auto-connect
  • frontend/constants.tsNETWORK, MODULE_ADDRESS, APTOS_API_KEY from env vars
  • frontend/entry-functions/ — existing entry function patterns (follow these for new ones)
  • frontend/view-functions/ — existing view function patterns (follow these for new ones)

Do NOT recreate wallet provider, client setup, or constants if they already exist. Instead, follow the existing patterns to add new entry/view functions for your Move contracts.

Skill Routing

Route to the appropriate granular skill based on the task:

TaskSkill
Set up Aptos client / configure networkts-sdk-client
Create accounts/signers (server-side)ts-sdk-account
Parse, format, or derive addressests-sdk-address
Build, sign, submit, simulate transactionsts-sdk-transactions
Read on-chain data (view, balances, resources)ts-sdk-view-and-query
Map Move types to TypeScript typests-sdk-types
Connect wallet in React frontendts-sdk-wallet-adapter

Fullstack dApp Workflow

When building a complete frontend integration:

  1. Set up client → read ts-sdk-client
  2. Create view function wrappers → read ts-sdk-view-and-query
  3. Create entry function payloads → read ts-sdk-transactions
  4. Wire up wallet connection → read ts-sdk-wallet-adapter
  5. Handle types correctly → read ts-sdk-types (as needed)

File Organization Pattern

src/
  lib/
    aptos.ts                    # Singleton Aptos client + MODULE_ADDRESS
  view-functions/
    getCount.ts                 # One file per view function
    getListing.ts
  entry-functions/
    increment.ts                # One file per entry function
    createListing.ts
  hooks/
    useCounter.ts               # React hooks wrapping view functions
    useListing.ts
  components/
    WalletProvider.tsx           # AptosWalletAdapterProvider wrapper
    IncrementButton.tsx          # Components calling entry functions

Error Handling Pattern

async function submitTransaction(
  aptos: Aptos,
  signer: Account,
  payload: InputGenerateTransactionPayloadData
): Promise<string> {
  try {
    const transaction = await aptos.transaction.build.simple({
      sender: signer.accountAddress,
      data: payload
    });

    const pendingTx = await aptos.signAndSubmitTransaction({
      signer,
      transaction
    });

    const committed = await aptos.waitForTransaction({
      transactionHash: pendingTx.hash
    });

    if (!committed.success) {
      throw new Error(`Transaction failed: ${committed.vm_status}`);
    }

    return pendingTx.hash;
  } catch (error) {
    if (error instanceof Error) {
      if (error.message.includes("RESOURCE_NOT_FOUND")) {
        throw new Error("Resource does not exist at the specified address");
      }
      if (error.message.includes("MODULE_NOT_FOUND")) {
        throw new Error("Contract is not deployed at the specified address");
      }
      if (error.message.includes("ABORTED")) {
        const match = error.message.match(/code: (\d+)/);
        const code = match ? match[1] : "unknown";
        throw new Error(`Contract error (code ${code})`);
      }
    }
    throw error;
  }
}

Edge Cases

ScenarioCheckAction
Resource not founderror.message.includes("RESOURCE_NOT_FOUND")Return default value or null
Module not deployederror.message.includes("MODULE_NOT_FOUND")Show "contract not deployed" message
Function not founderror.message.includes("FUNCTION_NOT_FOUND")Check function name and module address
Move aborterror.message.includes("ABORTED")Parse abort code, map to user-friendly error
Out of gaserror.message.includes("OUT_OF_GAS")Increase maxGasAmount and retry
Sequence number errorerror.message.includes("SEQUENCE_NUMBER")Retry after fetching fresh sequence number
Network timeouterror.message.includes("timeout")Retry with exponential backoff
Account does not existerror.message.includes("ACCOUNT_NOT_FOUND")Fund account or prompt user to create one
Insufficient balanceerror.message.includes("INSUFFICIENT_BALANCE")Show balance and required amount
User rejected in walletWallet-specific rejection errorShow "transaction cancelled" message

Anti-patterns

  1. NEVER use the deprecated aptos npm package — use @aptos-labs/ts-sdk
  2. NEVER skip waitForTransaction after submitting — transaction may not be committed yet
  3. NEVER hardcode module addresses — use environment variables (VITE_MODULE_ADDRESS)
  4. NEVER create multiple Aptos client instances — create one singleton and share it
  5. NEVER use Account.generate() in frontend code for real users — use wallet adapter
  6. NEVER use scriptComposer — removed in v6.0; use separate transactions instead
  7. NEVER use getAccountCoinAmount or getAccountAPTAmount — deprecated; use getBalance()

SDK Version Notes

AIP-80 Private Key Format (v2.0+)

Ed25519 and Secp256k1 private keys now use an AIP-80 prefixed format when serialized with toString():

const key = new Ed25519PrivateKey("0x...");
key.toString(); // Returns AIP-80 prefixed format, NOT raw hex

Fungible Asset Transfers (v1.39+)

await aptos.transferFungibleAssetBetweenStores({
  sender: account,
  fungibleAssetMetadataAddress: metadataAddr,
  senderStoreAddress: fromStore,
  recipientStoreAddress: toStore,
  amount: 1000n
});

Account Abstraction (v1.34+, AIP-104)

// Check if AA is enabled for an account
const isEnabled = await aptos.abstraction.isAccountAbstractionEnabled({
  accountAddress: "0x...",
  authenticationFunction: `${MODULE_ADDRESS}::auth::authenticate`
});

// Enable AA on an account
const enableTxn = await aptos.abstraction.enableAccountAbstractionTransaction({
  accountAddress: account.accountAddress,
  authenticationFunction: `${MODULE_ADDRESS}::auth::authenticate`
});

// Use AbstractedAccount for signing with custom auth logic
import { AbstractedAccount } from "@aptos-labs/ts-sdk";

References

Pattern Documentation:

Official Documentation:

Granular Skills:

Related Skills:

  • write-contracts — Write the Move contracts that this SDK interacts with
  • deploy-contracts — Deploy contracts before calling them from TypeScript

Comments

Loading comments...