
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@ton-api/ton-adapter
Advanced tools
@ton-api/ton-adapter
is an adapter that enables integration between
TonApi client and the
@ton/ton and
@ton/core libraries. This adapter allows developers to
use TonApi's functionality while maintaining compatibility with existing TON blockchain development
tools.
@ton-api/client
@ton/ton
and @ton/core
contract wrappersInstall the package and its peer dependency using npm, yarn, or pnpm:
npm install @ton-api/client @ton-api/ton-adapter
# or
yarn add @ton-api/client @ton-api/ton-adapter
# or
pnpm add @ton-api/client @ton-api/ton-adapter
Here's a basic example to get you started:
import { SendMode, WalletContractV5R1, internal } from '@ton/ton';
import { mnemonicNew, mnemonicToPrivateKey } from '@ton/crypto';
import { TonApiClient } from '@ton-api/client';
import { ContractAdapter } from '@ton-api/ton-adapter';
// Initialize TonApi client
const ta = new TonApiClient({
baseUrl: 'https://tonapi.io',
apiKey: 'YOUR_API_KEY'
});
// Create an adapter
const adapter = new ContractAdapter(ta);
// Create and use a wallet contract
async function main() {
const mnemonics = await mnemonicNew();
const keyPair = await mnemonicToPrivateKey(mnemonics);
const wallet = WalletContractV5R1.create({ workchain: 0, publicKey: keyPair.publicKey });
// Open the contract using the adapter
const contract = adapter.open(wallet);
// Get balance
const balance = await contract.getBalance();
console.log('Balance:', balance.toString());
// Send a transfer
const seqno = await contract.getSeqno();
await contract.sendTransfer({
seqno,
secretKey: keyPair.secretKey,
sendMode: SendMode.PAY_GAS_SEPARATELY + SendMode.IGNORE_ERRORS,
messages: [
internal({
value: '0.001',
to: 'EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N',
body: 'Hello world'
})
]
});
}
main().catch(console.error);
ContractAdapter
with the TonApi client.open
method of the adapter to work with any @ton/ton or @ton/core compatible smart
contract wrapper.MIT
[0.4.1] - 2025-04-23
@ton-api/ton-adapter
where prepublishOnly script was incorrectly placed in peerDependencies sectionFAQs
TonApi adapter for @ton/ton
The npm package @ton-api/ton-adapter receives a total of 4,032 weekly downloads. As such, @ton-api/ton-adapter popularity was classified as popular.
We found that @ton-api/ton-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.