# signTransaction

```javascript
(async() => {
    let signed_tx = await SOLPay.signTransaction([{
        type: "solana_transfer",
        data: {
            address: "RECIPIENT_ADDRESS",
            lamports: 1
        }
    }, {
        type: "spl_token_transfer",
        data: {
            token_address: "TOKEN_ADDRESS",
            address: "RECIPIENT_ADDRESS",
            amount: 1
        }
    }, {
        type: "spl_token_transfer",
        data: {
            token_address: "TOKEN_ADDRESS",
            address: "RECIPIENT_ADDRESS",
            amount_decimal: 0.00001
        }
    }]); // {"from": "...", "transfers": [...], "signature": "...", "serialized_transaction": Uint8Array [...]}
})();
```

### Parameters:

* transfers: Array - the list of transfers to sign
  * type: string - the type of transfer to make (`solana_transfer` for a Solana transfer, `spl_token_transfer` for an SPL token transfer)
  * data: object - the transfer details
    * address: string - the address where the funds should be sent
    * \[`solana_transfer`] lamports: number - the number of lamports to send (one billion lamports are in 1 SOL)
    * \[`spl_token_transfer`] token\_address: string - the mint address of the token
    * EITHER amount: number - the amount of tokens to send with the smallest denomination of tokens being represented by amount 1 (recommended)
    * OR amount\_decimal: number - the decimal amount of tokens to send (not recommended)

### Returns:

object (`{"from": "...", "transfers": [...], "signature": "...", "serialized_transaction": Uint8Array [...]}`) - the transaction details

* from: string (`"..."`) - the address from which Solana is sent
* transfers: Array (`[...]`) - the transfers of the transaction
* signature: string (`"..."`) - the signature of the transaction
* serialized\_transaction: Uint8Array (`Uint8Array [...]`) - the serialized transaction (which can be broadcasted to the network)

### Throws:

* `SOL Pay SDK Fatal Error: Invalid transfers ${transfers}.` - invalid transfers were used
* `SOL Pay SDK Fatal Error: No connection found. Use SOLPay.connectNetwork() to connect to the Solana network.` - could not find a connection to the Solana network
* `SOL Pay SDK Fatal Error: No wallet connection found. Use SOLPay.connectWallet() to connect to a Solana wallet.` - no wallet was connected
* `SOL Pay SDK Fatal Error: Unable to get recent blockhash.` - was not able to get a recent blockhash

{% hint style="info" %}
**Note:**

Sending a transaction includes a fee of at least 0.000005 SOL.
{% endhint %}
