Playground
This page collects runnable wallet method examples. Connect Turing Wallet from the wallet control in the top navigation first. Transaction examples do not broadcast by default and return signed txraw.
Basic Methods
connect
Live Example
Turing.connect()
This method does not require parameters.
const addresses = await Turing.connect();
console.log(addresses);isConnected
Live Example
Turing.isConnected()
This method does not require parameters.
const connected = await Turing.isConnected();
console.log(connected);getAddress
Live Example
Turing.getAddress()
This method does not require parameters.
const addresses = await Turing.getAddress();
console.log(addresses);getInfo
Live Example
Turing.getInfo()
This method does not require parameters.
const info = await Turing.getInfo();
console.log(info);getNetwork
Live Example
Turing.getNetwork()
This method does not require parameters.
const network = await Turing.getNetwork();
console.log(network);getPubKey
Live Example
Turing.getPubKey()
This method does not require parameters.
const { tbcPubKey } = await Turing.getPubKey();
console.log(tbcPubKey);disconnect
Live Example
Turing.disconnect()
This method does not require parameters.
const disconnected = await Turing.disconnect();
console.log(disconnected);Messages and Encryption
Signing and encryption methods do not broadcast transactions, but they still request wallet approval. Never enter private keys, seed phrases, or other sensitive credentials in these examples.
signMessage
Live Example
Turing.signMessage()
const result = await Turing.signMessage({
"message": "",
"encoding": "utf-8"
});
console.log(result);encrypt
Live Example
Turing.encrypt()
const { encryptedMessage } = await Turing.encrypt({
"message": ""
});
console.log(encryptedMessage);decrypt
Live Example
Turing.decrypt()
const { decryptedMessage } = await Turing.decrypt({
"message": ""
});
console.log(decryptedMessage);Transactions
These examples do not broadcast by default; they only ask the wallet to build and sign a transaction. Before enabling broadcast, switch to the matching network and confirm the asset-change risk. All amounts use the chain or token's smallest unit.
TBC P2PKH
Live Example
Turing.sendTransaction() / P2PKH
Switch the wallet to TBC or All networks first.
Switch the wallet to TBC or All networks first.
const params = [{
"flag": "P2PKH",
"address": "1BitcoinEaterAddressDontSendf59kuE",
"satoshis": "10000",
"broadcastEnabled": false
}];
const result = await Turing.sendTransaction(params);
console.log(result);NFT
Covers collection creation, NFT creation, and NFT transfers.
Live Example
Turing.sendTransaction() / NFT
Mainnet uses api.turingbitchain.io. Fill domain for testnet or custom nodes.
Includes sample data. External controls manage flag, domain, and broadcastEnabled.
Switch the wallet to TBC or All networks first.
const params = [{
"flag": "COLLECTION_CREATE",
"collection_data": "{\"collectionName\":\"Docs Collection\",\"description\":\"Created from the wallet playground\",\"supply\":1,\"file\":\"R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=\"}",
"broadcastEnabled": false
}];
const result = await Turing.sendTransaction(params);
console.log(result);FT
Covers FT minting, transfers, and UTXO merging.
Live Example
Turing.sendTransaction() / FT
Mainnet uses api.turingbitchain.io. Fill domain for testnet or custom nodes.
Includes sample data. External controls manage flag, domain, and broadcastEnabled.
Switch the wallet to TBC or All networks first.
const params = [{
"flag": "FT_MINT",
"ft_data": "{\"name\":\"Docs Token\",\"symbol\":\"DOCS\",\"decimal\":8,\"amount\":100000000}",
"broadcastEnabled": false
}];
const result = await Turing.sendTransaction(params);
console.log(result);PoolNFT
Management examples cover PoolNFT minting, initialization, liquidity increases or burns, and UTXO merging.
Live Example
Turing.sendTransaction() / POOLNFT
Mainnet uses api.turingbitchain.io. Fill domain for testnet or custom nodes.
Includes sample data. External controls manage flag, domain, and broadcastEnabled.
Switch the wallet to TBC or All networks first.
const params = [{
"flag": "POOLNFT_MINT",
"ft_contract_address": "2222222222222222222222222222222222222222222222222222222222222222",
"serverProvider_tag": "docs-playground",
"poolNFT_version": 2,
"serviceFeeRate": 25,
"with_lock": false,
"lpPlan": 1,
"isLockTime": false,
"broadcastEnabled": false
}];
const result = await Turing.sendTransaction(params);
console.log(result);Swap and liquidity consumption examples cover POOLNFT_LP_CONSUME, POOLNFT_SWAP_TO_TOKEN, and POOLNFT_SWAP_TO_TBC.
Live Example
Turing.sendTransaction() / PoolNFT
The wallet network is not confirmed. Refresh it and switch to TBC or All networks before broadcasting.
The wallet network is not confirmed. Refresh it and switch to TBC or All networks before broadcasting.
const params = [{
"flag": "POOLNFT_LP_CONSUME",
"nft_contract_address": "2222222222222222222222222222222222222222222222222222222222222222",
"address": "1BitcoinEaterAddressDontSendf59kuE",
"poolNFT_version": 2,
"broadcastEnabled": false,
"ft_amount": "1",
"lockTime": "0"
}];
const result = await Turing.sendTransaction(params);
console.log(result);Stablecoin
Covers stablecoin transfers and UTXO merging.
Live Example
Turing.sendTransaction() / Stablecoin
Mainnet uses api.turingbitchain.io. Fill domain for testnet or custom nodes.
Includes sample data. External controls manage flag, domain, and broadcastEnabled.
Switch the wallet to TBC or All networks first.
const params = [{
"flag": "STABLECOIN_TRANSFER",
"ft_contract_address": "2222222222222222222222222222222222222222222222222222222222222222",
"address": "1BitcoinEaterAddressDontSendf59kuE",
"ft_amount": "1",
"tbc_amount": "0",
"broadcastEnabled": false
}];
const result = await Turing.sendTransaction(params);
console.log(result);EVM
Live Example
Turing.evm.sendTransaction()
Switch the wallet to the matching EVM network or All networks first.
Switch the wallet to the matching EVM network or All networks first.
const result = await Turing.evm.sendTransaction({
"chainId": 1,
"toAddress": "0x000000000000000000000000000000000000dead",
"amount": "1000000000000000",
"broadcastEnabled": false
});
console.log(result);BTC
Live Example
Turing.btc.sendTransaction()
Switch the wallet to BTC or All networks first.
Switch the wallet to BTC or All networks first.
const result = await Turing.btc.sendTransaction({
"toAddress": "1BitcoinEaterAddressDontSendf59kuE",
"amount": "100000",
"broadcastEnabled": false
});
console.log(result);Advanced Signing and Batch Requests
Advanced examples use a JSON editor so you can paste transaction and UTXO data built by your application. Every transaction example includes sample data for an immediate request and code preview. Use Clear Input for your own data and Reset Template to reload the preset sample. The signTransaction offline sample references a synthetic UTXO, so it cannot be broadcast or spend assets.
Batch requests also have a master broadcasting gate. By default, controllable transaction items are forced to sign only. Once enabled, each item follows its own broadcastEnabled setting; broadcasting cannot be disabled for Merge operations.
signTransaction
Live Example
Turing.signTransaction()
Includes an offline signing sample that references a synthetic UTXO, so it cannot be broadcast or spend assets.
const params = {
"txraws": [
"0a0000000111111111111111111111111111111111111111111111111111111111111111110000000000ffffffff02c0d40100000000001976a9141cfef3571aad5bf16174e9d39928ad1a5716769388ac08380100000000001976a914a3c6b1ee4a49d9f2af3b3802974744fba924164a88ac00000000"
],
"utxos_satoshis": [
[
200000
]
],
"script_pubkeys": [
[
"76a914a3c6b1ee4a49d9f2af3b3802974744fba924164a88ac"
]
]
};
const result = await Turing.signTransaction(params);
console.log(result);signAssociatedTransaction
Live Example
Turing.signAssociatedTransaction()
Includes sample data for preview. Clear it to use your own transaction data.
const params = {
"sourceTxraw": "0a0000000111111111111111111111111111111111111111111111111111111111111111110000000000ffffffff02c0d40100000000001976a9141cfef3571aad5bf16174e9d39928ad1a5716769388ac08380100000000001976a914a3c6b1ee4a49d9f2af3b3802974744fba924164a88ac00000000",
"sourceUtxos": [
{
"txId": "1111111111111111111111111111111111111111111111111111111111111111",
"outputIndex": 0,
"satoshis": 200000,
"script": "76a914a3c6b1ee4a49d9f2af3b3802974744fba924164a88ac",
"scriptSigType": "p2pkh"
}
],
"inputs": [],
"outputs": []
};
const result = await Turing.signAssociatedTransaction(params);
console.log(result);sendBatchRequest
Live Example
Turing.sendBatchRequest()
Includes sample data for preview. Clear it to use your own transaction data.
Controllable transactions in this run are signed without broadcasting.
Off by default, forcing controllable transaction requests to use broadcastEnabled: false. When enabled, each JSON item keeps its own setting.
const requests = [
{
"method": "sendTransaction",
"params": {
"flag": "P2PKH",
"address": "1BitcoinEaterAddressDontSendf59kuE",
"satoshis": "10000",
"broadcastEnabled": false
}
},
{
"method": "signMessage",
"params": {
"message": "Hello Turing Wallet",
"encoding": "utf-8"
}
}
];
const result = await Turing.sendBatchRequest(requests);
console.log(result);btc.signTransaction
Live Example
Turing.btc.signTransaction()
Includes sample data for preview. Clear it to use your own transaction data.
const params = {
"txHex": "020000000133333333333333333333333333333333333333333333333333333333333333330000000000ffffffff01a0860100000000001976a914444444444444444444444444444444444444444488ac00000000",
"type": "legacy",
"prevOutScriptsHex": [
"76a914555555555555555555555555555555555555555588ac"
]
};
const result = await Turing.btc.signTransaction(params);
console.log(result);btc.sendBatchRequest
Live Example
Turing.btc.sendBatchRequest()
Includes sample data for preview. Clear it to use your own transaction data.
Controllable transactions in this run are signed without broadcasting.
Off by default, forcing controllable transaction requests to use broadcastEnabled: false. When enabled, each JSON item keeps its own setting.
const requests = [
{
"method": "sendTransaction",
"params": {
"toAddress": "1BitcoinEaterAddressDontSendf59kuE",
"amount": "100000",
"broadcastEnabled": false
}
},
{
"method": "signTransaction",
"params": {
"txHex": "020000000133333333333333333333333333333333333333333333333333333333333333330000000000ffffffff01a0860100000000001976a914444444444444444444444444444444444444444488ac00000000",
"type": "legacy",
"prevOutScriptsHex": [
"76a914555555555555555555555555555555555555555588ac"
]
}
}
];
const result = await Turing.btc.sendBatchRequest(requests);
console.log(result);