# 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 %}


---

# 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://solpay-docs.solblaze.org/reference/sdk-reference/sign-transaction.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.
