# Polkadot Parachain

## Sign Transaction

The D'CENT Web SDK provides functions for signing transaction of coins.

### getParachainSignedTransactio&#x6E;**()**

#### Supported Coin Type

* Parachain - Astar(ASTR)
* Parachain Asset- Astar Asset(XC20)

#### Parameters&#x20;

* unsignedTx: unsigned hexadecimal tx [Polkadot Docs](https://wiki.polkadot.network/docs/build-transaction-construction)
* path: key path, wallet sign with that private key with a given key path (BIP32 ex) "m/44'/810'/0'/0/0").
* fee: fee, It is fee that wallet displays on the screen.
* symbol: symbol, It is a symbol that the wallet displays on the screen.
* decimals: Parachain's decimals.
* RPCUrl: Network RPC endpoints.
* fee symbol: fee's symbol, It is a symbol that the wallet displays on the screen.
* fee decimals: fee's decimals.

#### Requirements

* `D'CENT Bridge` version 1.5.3 or higher is required.
* D'CENT Biometric Wallet version 2.30.1 or higher is required.

#### Useage&#x20;

```javascript
import { ApiPromise, HttpProvider } from '@polkadot/api'

const httpProvider = new HttpProvider('https://evm.astar.network');
const api = await ApiPromise({ provider: httpProvider });
// Wait until we are ready and connected
await api.isReady;

const blockNumber = await api.rpc.chain.getHeader();
const blockHash = await api.rpc.chain.getBlockHash(blockNumber.number.toHex());
// create SignerPayload
const signerPayload = api.createType('SignerPayload', {
  genesisHash: api.genesisHash,
  runtimeVersion: api.runtimeVersion,
  version: api.extrinsicVersion,
  blockHash: blockHash,
  blockNumber: blockNumber.number,
  era: api.createType('ExtrinsicEra', {
    current: blockNumber.number,
    period: 50
  }),
  nonce,
  address: to,
  method: api.tx.balances.transfer(to, amount).method, // For tokens, method: api.tx.assets.transfer(contract, to, amount).method,
});

const sigHash = signerPayload.toRaw().data;

const transactionJson = {
  coinType: DcentWebConnector.coinType.PARA,
  sigHash: sigHash,
  path: `m/44'/810'/0'/0/0`,
  decimals, // 18
  fee,
  symbol: 'ASTR',
  RPCUrl: 'https://evm.astar.network',
  feeSymbol: 'ASTR',
  feeDecimals, // 18
};

var result;
try {
  result = await DcentWebConnector.getParachainSignedTransaction(transactionJson);
} catch (e) {
  console.log(e);
  result = e;
}
```

#### Returned response object

```json
{
    "header": {
      "version": "1.0",
      "response_from": "para",
      "status": "success"
    },
    "body": {
      "command": "transaction",
      "parameter": {
        "signed_tx": "0x00263b3ed036c74d15d875c7246abe73404c82763f3300316eb782cafdf5bd93f4f47f0fe34d823f9d07f8db7b2cb81051e58a1e58993c70888916c0ef6c3c910f"
      }
    }
  }
```

Please note that for `Astar EVM` transactions, you can use the getEthereumSignedTransaction() and getTokenSignedTransaction() methods with the chain ID set to 592.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev-docs.dcentwallet.com/dcent-biometric-wallet-for-pc/dcent-web-connector/polkadot-parachain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
