# Integrate Gosuto Mobile into your app

## Check whether Gosuto wallet provider is enabled or loaded

<pre class="language-javascript"><code class="lang-javascript"><strong>if (window.gosuto &#x26;&#x26; window.gosuto.isGosuto) {
</strong>    // gosuto provider is enabled
} else {
    // gosuto provider not loaded yet
}
</code></pre>

## &#x20;Request to connect to Gosuto Wallet user account

```javascript
if (window.gosuto && window.gosuto.isGosuto) {
    window.gosuto.requestConnection();
}
```

## Disconnect from the wallet

<pre class="language-javascript"><code class="lang-javascript"><strong>window.gosuto.disconnectFromSite();
</strong></code></pre>

## Get connected account information

```javascript
const isConnected = await window.gosuto.isConnected()
if (isConnected){
    const accountHex = await window.gosuto.getActivePublicKey();
    // do something with user account hex
}
```

## Listen to wallet connection

```javascript
window.addEventListener(
  "signer:connected",
  (eventInfo) => {
    const { activeKey, isConnected, isUnlocked } = eventInfo.detail
    // do something with information
  },
        false
);
```

## Sign and send a deploy

```javascript
const to = "" // recipient address
const amount = "" // amount in motes to send
// For native-transfers the payment price is fixed.
const paymentAmount = 10000000000;

// transfer_id field in the request to tag the transaction and to correlate it to your back-end storage.
const id = 1;

// gasPrice for native transfers can be set to 1.
const gasPrice = 1;

// Time that the deploy will remain valid for, in milliseconds
// The default value is 1800000 ms (30 minutes).
const ttl = 1800000;
const publicKeyHex = await window.gosuto.getActivePublicKey();
const publicKey = CLPublicKey.fromHex(publicKeyHex)

let deployParams = new DeployUtil.DeployParams(publicKey,"casper-test", gasPrice, ttl);

// We create a public key from account-address (it is the hex representation of the public-key with an added prefix).
const toPublicKey = CLPublicKey.fromHex(to);

const session = DeployUtil.ExecutableDeployItem.newTransfer( amount,toPublicKey,null,id);

const payment = DeployUtil.standardPayment(paymentAmount);
const deploy = DeployUtil.makeDeploy(deployParams, session, payment);

// Turn your transaction data to format JSON
const json = DeployUtil.deployToJson(deploy)

// Sign transcation using casper-signer.
const signature = await window.gosuto.sign(json,publicKeyHex,to)
const deployObject = DeployUtil.deployFromJson(signature)

// Here we are sending the signed deploy.
const signed = await casperClient.putDeploy(deployObject.val);
```

## Sign a message

<pre class="language-javascript"><code class="lang-javascript"><strong>await window.gosuto.signMessage(message, signingPublicKeyHex)
</strong></code></pre>


---

# 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://the-arcadia-group.gitbook.io/gosuto/integrate-gosuto-mobile-into-your-app.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.
