Skip to content

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()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const addresses = await Turing.connect();
console.log(addresses);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

isConnected

Live Example

Turing.isConnected()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const connected = await Turing.isConnected();
console.log(connected);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

getAddress

Live Example

Turing.getAddress()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const addresses = await Turing.getAddress();
console.log(addresses);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

getInfo

Live Example

Turing.getInfo()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const info = await Turing.getInfo();
console.log(info);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

getNetwork

Live Example

Turing.getNetwork()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const network = await Turing.getNetwork();
console.log(network);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

getPubKey

Live Example

Turing.getPubKey()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const { tbcPubKey } = await Turing.getPubKey();
console.log(tbcPubKey);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

disconnect

Live Example

Turing.disconnect()

Unknown
Use the wallet control in the top navigation before running this example.

This method does not require parameters.

Code Preview
const disconnected = await Turing.disconnect();
console.log(disconnected);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

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()

Unknown
Use the wallet control in the top navigation before running this example.
Code Preview
const result = await Turing.signMessage({
  "message": "",
  "encoding": "utf-8"
});
console.log(result);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

encrypt

Live Example

Turing.encrypt()

Unknown
Use the wallet control in the top navigation before running this example.
Code Preview
const { encryptedMessage } = await Turing.encrypt({
  "message": ""
});
console.log(encryptedMessage);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

decrypt

Live Example

Turing.decrypt()

Unknown
Use the wallet control in the top navigation before running this example.
Code Preview
const { decryptedMessage } = await Turing.decrypt({
  "message": ""
});
console.log(decryptedMessage);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

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

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

Switch the wallet to TBC or All networks first.

Switch the wallet to TBC or All networks first.

Code Preview
const params = [{
  "flag": "P2PKH",
  "address": "1BitcoinEaterAddressDontSendf59kuE",
  "satoshis": "10000",
  "broadcastEnabled": false
}];

const result = await Turing.sendTransaction(params);
console.log(result);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

NFT

Covers collection creation, NFT creation, and NFT transfers.

Live Example

Turing.sendTransaction() / NFT

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

FT

Covers FT minting, transfers, and UTXO merging.

Live Example

Turing.sendTransaction() / FT

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

PoolNFT

Management examples cover PoolNFT minting, initialization, liquidity increases or burns, and UTXO merging.

Live Example

Turing.sendTransaction() / POOLNFT

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

Swap and liquidity consumption examples cover POOLNFT_LP_CONSUME, POOLNFT_SWAP_TO_TOKEN, and POOLNFT_SWAP_TO_TBC.

Live Example

Turing.sendTransaction() / PoolNFT

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

Stablecoin

Covers stablecoin transfers and UTXO merging.

Live Example

Turing.sendTransaction() / Stablecoin

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

EVM

Live Example

Turing.evm.sendTransaction()

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

Switch the wallet to the matching EVM network or All networks first.

Switch the wallet to the matching EVM network or All networks first.

Code Preview
const result = await Turing.evm.sendTransaction({
  "chainId": 1,
  "toAddress": "0x000000000000000000000000000000000000dead",
  "amount": "1000000000000000",
  "broadcastEnabled": false
});
console.log(result);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

BTC

Live Example

Turing.btc.sendTransaction()

Unknown
Use the wallet control in the top navigation before running this example.
Active Wallet NetworkUnknown

Switch the wallet to BTC or All networks first.

Switch the wallet to BTC or All networks first.

Code Preview
const result = await Turing.btc.sendTransaction({
  "toAddress": "1BitcoinEaterAddressDontSendf59kuE",
  "amount": "100000",
  "broadcastEnabled": false
});
console.log(result);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

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()

Unknown
Use the wallet control in the top navigation before running this example.

Includes an offline signing sample that references a synthetic UTXO, so it cannot be broadcast or spend assets.

Code Preview
const params = {
  "txraws": [
    "0a0000000111111111111111111111111111111111111111111111111111111111111111110000000000ffffffff02c0d40100000000001976a9141cfef3571aad5bf16174e9d39928ad1a5716769388ac08380100000000001976a914a3c6b1ee4a49d9f2af3b3802974744fba924164a88ac00000000"
  ],
  "utxos_satoshis": [
    [
      200000
    ]
  ],
  "script_pubkeys": [
    [
      "76a914a3c6b1ee4a49d9f2af3b3802974744fba924164a88ac"
    ]
  ]
};

const result = await Turing.signTransaction(params);
console.log(result);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

signAssociatedTransaction

Live Example

Turing.signAssociatedTransaction()

Unknown
Use the wallet control in the top navigation before running this example.

Includes sample data for preview. Clear it to use your own transaction data.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

sendBatchRequest

Live Example

Turing.sendBatchRequest()

Unknown
Use the wallet control in the top navigation before running this example.

Includes sample data for preview. Clear it to use your own transaction data.

Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

btc.signTransaction

Live Example

Turing.btc.signTransaction()

Unknown
Use the wallet control in the top navigation before running this example.

Includes sample data for preview. Clear it to use your own transaction data.

Code Preview
const params = {
  "txHex": "020000000133333333333333333333333333333333333333333333333333333333333333330000000000ffffffff01a0860100000000001976a914444444444444444444444444444444444444444488ac00000000",
  "type": "legacy",
  "prevOutScriptsHex": [
    "76a914555555555555555555555555555555555555555588ac"
  ]
};

const result = await Turing.btc.signTransaction(params);
console.log(result);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.

btc.sendBatchRequest

Live Example

Turing.btc.sendBatchRequest()

Unknown
Use the wallet control in the top navigation before running this example.

Includes sample data for preview. Clear it to use your own transaction data.

Active Wallet NetworkUnknown

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.

Code Preview
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);
Make sure the browser extension is enabled, or open this page inside Turing Wallet on mobile.