# Expo SDK

When adding support make sure you have a native android codebase. You can have one created by running `npx expo run:android` in your codebase.

After that, install the expo-walletsdk using `npm install --save expo-walletsdk`

Right after installing you might need to do a rebuild, because it has some native code that needs to be compiled.

In the code you need to first import all the necessary functions by adding `import * as ExpoWalletsdk from 'expo-walletsdk';`

### **Sending a transaction**

Then, let’s say you have a function where you send a tx, you can simply add an if which checks if the system-wallet is present, and if yes then run it through the walletsdk. Something like this:

```jsx
if (ExpoWalletsdk.hasSystemWallet()){
  const transaction = {
    to: '0x3a4e6eD8B0F02BFBfaA3C6506Af2DB939eA5798c', // Receipient
    value: '10', // Value in wei
		chainId: 10, 
    chainRPCUrl: 'https://mainnet.optimism.io'
  };
  var txHash = ExpoWalletsdk.sendTransaction(transaction);
  console.log(txHash)
} else {
  console.log("No system wallet found")
}
```

Essentially, `to` and `value` is all you need to make a transaction, though it’s recommended to add a specific `chainId` and `chainRPCUrl` to make sure you are on the correct network. The sdk will automatically change chain to the one you specific and will broadcast the tx to the node that you specified. If you are making a tx to a contract, make sure to add a `data` field.

### Signing a message

Same principle with sending a tx also applies to signing a message, you first check if the system-wallet is present and then make the request.

```jsx
if (ExpoWalletsdk.hasSystemWallet()){
  const message = {
    message: "Hello World",
		type: "personal_sign" // Default is personal_sign
  };
  var signature = ExpoWalletsdk.signMessage(message);
  console.log(signature)
} else {
  console.log("No system wallet found")
}
```

By default the signMessage function will use personal\_sign to sign a given message in this format. If your message is in hex format, you can define a type `personal_sign_hex`. And if you are signing typed data, you need to provide the json string in the `message` field and as type you need to write `eth_signTypedData`.

***

If there are any other questions please feel free to reach out in our discord, or message me on telegram at @mhaas\_eth


---

# 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://docs.freedomfactory.io/build/expo-sdk.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.
