# Welcome to ioPay Docs

#### Product overview

ioPay is a crypto wallet that allows users to store and send crypto assets, including IOTX, ETH, BNB and other crypto assets. Users can explore DApps here ——DeFi, different games, NFTs, marketplaces. IoTeX has greatly enhanced the security and usability of the wallet, ioPay is decentralized wallet for all crypto investors.

[ioPay](https://iopay.me/) is a multi-chain crypto wallet. It supports the following networks by default.&#x20;

1. IoTeX
2. Ethereum
3. BNB Chain (formerly Binance Smart Chain)
4. Polygon
5. Solana
6. Bitcoin

More chains will be added. Vote for the chains you would like ioPay to add here: <https://feedback.iopay.me/>

Users can add their networks by using a MetaMask compatible API:

{% embed url="<https://docs.metamask.io/wallet/reference/json-rpc-api/#unrestricted-methods>" %}

On IoTeX network, both Web3 and Antenna (the native blockchain API) are supported. IoTeX Staking is via Antenna and the other blockchain interactions are via Web3 interface.&#x20;

> To learn more about IoTeX Web3 support, please [read here](https://docs.iotex.io/web3-development).
>
> To learn more about IoTeX Antenna support, please [read here](https://docs.iotex.io/native-development).


# IoTeX & Ethereum & Polygon & BNB

We integrate Web3js as standard in our inject wallet:&#x20;

To learn more about Web3 support, please [read here](https://docs.metamask.io/wallet/reference/json-rpc-api/).


# Solana

## Wallet Connect Supported

Reffer to  [Wallect Connect Solana doc](https://docs.walletconnect.com/advanced/multichain/rpc-reference/solana-rpc)

## Detecting the Provider

ioPay's mobile in-app browser will both inject a ioPay object into the window of any web application the user visits. ioPay will not inject the provider into iframes or sites using http\://.

If a `ioPay` object exists, Bitcoin & Ordinals dApps can interact with ioPay via the API found at `window.ioPay.solana`. To detect if ioPay is installed, an application should check for an additional `isIoPay` flag like so:

&#x20; *`const isIoPayInstalled = window?.ioPay?.bitcoin?.isIoPay`*&#x20;

## Sending a Legacy Transaction

### Method

***signAndSendTransaction***

#### Returns:

* `Promise` - `{'signature': obj, ...}` : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for an object containing the `signature`

#### Example:

<pre><code>const provider = getProvider(); // see "Detecting the Provider"
const transaction = new Transaction();
const { signature } = await provider.signAndSendTransaction(transaction);
<strong>
</strong>// check transaction status
const network = "&#x3C;NETWORK_URL>";
const connection = new Connection(network);
await connection.getSignatureStatus(signature);
</code></pre>

### Method

***signTransaction -*** Signing a transaction without sending

#### Returns:

* `Promise`  : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for the signed transaction

#### Example:

```
const provider = getProvider();
const transaction = new Transaction();
const signedTransaction = await provider.signTransaction(transaction);

// After the transaction has been signed, an application may submit the transaction itself via web3js
const network = "<NETWORK_URL>";
const connection = new Connection(network);
const signature = await connection.sendRawTransaction(signedTransaction.serialize());
```

## Sending a Versioned Transaction

### Method

***signAndSendTransaction***

#### Returns:

* `Promise`  : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for the signed transaction

#### Example:

```
// The following example show how to build a simple transfer instruction.
const instructions = [
  SystemProgram.transfer({
    fromPubkey: publicKey,
    toPubkey: publicKey,
    lamports: 10,
  }),
];

// create v0 compatible message
const messageV0 = new TransactionMessage({
  payerKey: publicKey,
  recentBlockhash: blockhash,
  instructions,
}).compileToV0Message();
```

```
const provider = getProvider();

// make a versioned transaction
const transactionV0 = new VersionedTransaction(messageV0);
const { signature } = await provider.signAndSendTransaction(transactionV0);

// check transaction status
const network = "<NETWORK_URL>";
const connection = new Connection(network);
await connection.getSignatureStatus(signature);
```

### Signing a Message

### Method

***signMessage -*** Send a message for the user to sign, request that the encoded message is signed via the user's ioPay wallet

#### Returns:

* `Promise`  - String&#x20;

#### Example:

```
const provider = getProvider(); // see "Detecting the Provider"
const message = `Welcome to XXXXX`;
const encodedMessage = new TextEncoder().encode(message);
const signedMessage = await provider.signMessage(encodedMessage, "utf8")
```


# BitCoin

### Detecting the Provider

Once ioPay Wallet is installed and running, you should find that ioPay's mobile in-app browser have a `window.ioPay` object available in the developer console.&#x20;

### Method

***requestAccounts()***:  Connect the current account.

#### Returns:

* `Promise` - `string`: address of current account

#### Example:

```
try {
  let accounts = await window.ioPay.requestAccounts();
  console.log('connect success', accounts);
} catch (e) {
  console.log('connect failed');
}
> connect success ['mfaCeWXkqRTPG85mLXMbBZEJRS8b7bw4Kb']
```

### Method

***getPublicKey()***

#### Returns:

* `Promise` - `string`: publicKey

#### Example:

```
try {
  let res = await window.ioPay.getPublicKey();
  console.log(res)
} catch (e) {
  console.log(e);
}
> 0668e8db9f4a2bc19219058467bb12d4c07952da52e71b8d409684c918b4fd1f
```

### Method

#### signMessage <a href="#signmessage" id="signmessage"></a>

```
ioPay.signMessage(msg)
```

**Parameters**

* `msg` - `string`: a string to sign

**Returns**

* `Promise` - `string`: the signature.

**Example:**

```
// sign by ecdsa
try {
  let res = await window.ioPay.signMessage("welcome to ioPay");
  console.log(res)
} catch (e) {}
```

### Method

#### signPsbt <a href="#signpsbt" id="signpsbt"></a>

```
ioPay.signPsbt(psbtHex[, options])
```

This method will traverse all inputs that match the current address to sign.

**Parameters**

* `psbtHex` - `string`: the hex string of psbt to sign
* options
  * `autoFinalized` - `boolean`: whether finalize psbt after signing, default is true
  * `toSignInputs` - `array`:
    * `index` - `number`: which input to sign
    * `address` - `string`: (at least specify either an address or a publicKey) Which corresponding private key to use for signing
    * `publicKey` - `string`: (at least specify either an address or a publicKey) Which corresponding private key to use for signing
    * `sighashTypes` - `number[]`: (optionals) sighashTypes
    * `disableTweakSigner` - `boolean` :(optionals) When signing and unlocking Taproot addresses, the `tweakSigner` is used by default for signature generation. Enabling this allows for signing with the original private key.

**Returns:**

* `Promise` - `string`: the hex string of signed psbt

**Example:**

```
try {
  let res = await window.ioPay.signPsbt(
    "87543231ff53337a....",
    {
        autoFinalized:false,
        toSignInputs:[
          {
            index: 0,
            address: "tb1qtmjmeglfdqphtqq3yq3t6ruq3tvkfx2u6f7n83",
          },
          {
            index: 1,
            publicKey: "76382...83846262f",
            sighashTypes: [1]
          },
          {
            index: 2,
            publicKey: "76382...83846262f",
          }
        ]
    }
  );
  console.log(res)
} catch (e) {
  console.log(e);
}
```


# Web Dapps Development

{% hint style="info" %}
**Good to know:** It is mostly the same for you to develop a web based Dapp with ioPay as with Metamask, because ioPay has done as much compatible with Metamask as possible.
{% endhint %}

## Web Dapp for IoTeX

You can refer the official IoTeX development docs here:

{% embed url="<https://docs.iotex.io/web3-development>" %}

## Web Dapps for other chains

Please find Dapp development guides for different chains as needed. ioPay supports most Web3 interfaces so your Dapps should be able to run with ioPay directly if it works with metamask.


# Deep linking

### What is deep linking?

Deep linking does this by specifying a custom URL scheme (iOS Universal Links) or an intent URL (on Android devices) that opens your app if it’s already installed. Deep links can also be set to direct users to specific events or pages, which could tie into campaigns that you may want to run.

IoPay supports deep link below to open your pages in ioPay dapp browser :

```
iopay://io.iotex.iopay/open?action=web&url={{URL}}
```

### How to open your dapp in ioPay with deep link?

```
export const helper = {
  isPc() {
    const userAgentInfo = global?.navigator?.userAgent;
    const Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
    let flag = true;
    for (let v = 0; v < Agents.length; v++) {
      if (userAgentInfo.indexOf(Agents[v]) > 0) {
        flag = false;
        break;
      }
    }
    return flag;
  },
  // check the dapp is in a mobile system browser
  checkEnv() {
    const isPc = this.isPc()
    const isBrower =  typeof window === 'undefined' ? false : true
    const isIopayMobile = window?.navigator?.userAgent && (window?.navigator?.userAgent.includes('IoPayAndroid') || window?.navigator?.userAgent.includes('IoPayiOs'))
    console.log('isBrower', isBrower, 'isIopayMobile' , isIopayMobile)
    if (!isPc) {
      if(isBrower && isIopayMobile) {
        return true
      } else if (isBrower && !isIopayMobile) {
        this.openDeepLink()
        return false
      }
    }
    return true;
  },
  //open the dapp with ioPay deep linking
  openDeepLink() {
    const a = document.createElement("a");
    const tagId = "startIoPay";
    a.setAttribute("href", `iopay://io.iotex.iopay/open?action=web&url=${window.location.href}`);
    a.setAttribute("id", tagId);
    if (document.getElementById(tagId)) {
      // @ts-ignore
      document.body.removeChild(document.getElementById(tagId));
    }
    document.body.appendChild(a);
    a.click();
    setTimeout(() => {
      window.location.href = 'https://iopay.me/'
    }, 4000)
  }
}
```


# Native Mobile Web3 Apps

{% hint style="info" %}
**Good to know: You can use WalletConnect interfaces to connect with ioPay from your native mobile app.**&#x20;
{% endhint %}

### WalletConnect

ioPay uses WalletConnect protocol to connect with native mobile apps. WalletConnect is a protocol that connects dapps with wallet directly. To learn more about WalletConnect, please visit <https://walletconnect.com/>.&#x20;

### Mobile Development SDKs

[iOS](/developer-guides/native-mobile-web3-apps/ios)

[Android](/developer-guides/native-mobile-web3-apps/android)

### Deep Linking

Details coming soon.


# iOS

For iOS development, you can use this SDK provided by WalletConnect team

{% embed url="<https://github.com/WalletConnect/WalletConnectSwift>" %}

A good sample code is provided here

{% embed url="<https://github.com/WalletConnect/WalletConnectSwift-Example>" %}


# Android

There are a few SDK and samples available. One good example is&#x20;

{% embed url="<https://github.com/WalletConnect/kotlin-walletconnect-lib>" %}

There is a step-by-step instruction of using this library

{% embed url="<https://medium.com/pink-room-club/building-a-decentralized-android-app-part-i-walletconnect-abb2428192d5>" %}


# Abstract Account Wallet

### About Account Abstraction Using Alt Mempool

An account abstraction proposal which completely avoids the need for consensus-layer protocol changes. Instead of adding new protocol features and changing the bottom-layer transaction type, this proposal instead introduces a higher-layer pseudo-transaction object called a UserOperation. Users send UserOperation objects into a separate mempool. A special class of actor called bundlers package up a set of these objects into a transaction making a handleOps call to a special contract, and that transaction then gets included in a block.

[ERC-4337: Account Abstraction Using Alt Mempool](https://eips.ethereum.org/EIPS/eip-4337)

### Advanced Supported P256 Account for Trusted Environment

On the basis of [userop.js](https://github.com/stackup-wallet/userop.js) signature, we advanced supported secp256r1-based signature.

The "secp256r1" elliptic curve is a standardized curve by NIST which has the same calculations by different input parameters with""secp256k1” elliptic curve used by the "ecrecover" precompiled contract. The cost of combined attacks and the security conditions are almost the same for both curves. Adding a precompiled contract which is similar to "ecrecover" can provide signature verifications using the "secp256r1" elliptic curve in the smart contracts and multi-faceted benefits can occur. One important factor is that this curve is widely used and supported in many modern devices such as Apple’s Secure Enclave, Webauthn, Android Keychain which proves the user adoption. Additionally, the introduction of this precompile could enable valuable features in the account abstraction which allows more efficient and flexible management of accounts by transaction signs in mobile devices. Most of the modern devices and applications rely on the "secp256r1" elliptic curve. The addition of this precompiled contract enables the verification of device native transaction signing mechanisms. For example:

* **Apple’s Secure Enclave** : There is a separate "Trusted Execution Environment" in Apple hardware which can sign arbitrary messages and can only be accessed by biometric identification. Webauthn: Web Authentication (WebAuthn) is a web standard published by the World Wide Web Consortium (W3C). WebAuthn aims to standardize an interface for authenticating users to web-based applications and services using public-key cryptography. It is being used by almost all of the modern web browsers.
* **Android Keystore**: Android Keystore is an API that manages the private keys and signing methods. The private keys are not processed while using Keystore as the applications’ signing method. Also, it can be done in the "Trusted Execution Environment" in the microchip.

[Reffer to EIP-7212](https://eips.ethereum.org/EIPS/eip-7212)

We support SDKs for both Android and iOS platfroms.


# userop-swift (iOS)

#### Github:

{% embed url="<https://github.com/iotexproject/userop-swift>" %}

#### Usage

```
.package(url: "https://github.com/iotexproject/userop-swift.git", from: "x.y.z")
```


# userop-kotlin (Android)

#### Github

{% embed url="<https://github.com/iotexproject/userop-kt>" %}

#### Usage

```
implementation 'io.iotex:userop-kt:1.0.1'
```


# ioPay x dApps Co-promotions Program

The program provides an exclusive exposure channel for all participating dApps, through the display of exclusive banners and promotion links, etc., to drive traffic to dApps from ioPay and vice versa.&#x20;

The following download link is an example of how the co-promotions version of ioPay appears for one of our ecosystem projects called StarCrazy: <https://play.google.com/store/apps/details?id=io.iotex.iopay.gp&referrer=utm_source%3Dgoogle%26utm_campaign%3DStarCrazy-26%26anid%3Dadmob><br>

***Note: Currently only Android is supported for the co-promotions download links.***

### **Demonstration**

We will provide an exclusive promotion link for co-promotion projects.

Promotion link - Co-promotion projects can provide/show this link to users. Users who download ioPay via this link will see the exclusive UI of your dApps in ioPay (explained further below):

<figure><img src="https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FUIyqhMXO2blacb1a5ZGl%2F1280X1280.jpeg?alt=media&amp;token=076d27c3-abfe-4cb7-86fd-4e4c7dc35617" alt=""><figcaption></figcaption></figure>

* Exclusive entrance at the top of the ioPay home page. Users can quickly enter the dApp through this banner.

<figure><img src="https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FFVhvkP7snfvH8GLuQuxI%2F2.png?alt=media&amp;token=3df13a13-2950-43a9-a037-f65cb41e2e11" alt=""><figcaption></figcaption></figure>

* Set the co-promotion dApp as the first dApp in the Hot dApps section of the browser page

<figure><img src="https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FxBODimEkViXWKjRHHTI9%2F3.png?alt=media&amp;token=7cef8ee0-a3eb-4f88-abb2-8149c2494ece" alt=""><figcaption></figcaption></figure>

* Default to display the co-promotion dApp’s tokens on the wallet homepage after users download ioPay via the link. (Coming soon)

<figure><img src="https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FJoVq1phqXdIkwmjiO8w7%2F4.png?alt=media&amp;token=5191ae13-8b43-4423-8165-547f3c8f7cb3" alt=""><figcaption></figcaption></figure>

### **Data Kanban**

We support the co-promotion projects inquiry link clicks and downloads, and the number of visits of users entering the dApp via the homepage banner.<br>

<figure><img src="https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FTkleBsKiyf3IBLRoSwPg%2F5.jpeg?alt=media&amp;token=623efc39-7a2e-42ba-9f46-f16bf2efd94d" alt=""><figcaption></figcaption></figure>

### **How do dApps join the ioPay co-promotion program?**

If your dApp is not listed on ioPay yet, please:

* Submit dApp to IoTeX:
  * <https://ecosystem.iotex.io/>
  * (Optional) Submit dApp to[ dAppRadar Dashboard](https://dappradar.com/dashboard/) - showcase your dApp data easily

\
If your dApp is listed on ioPay,

* Please submit dApp information here: <https://forms.gle/ZXREy4fWAspwqJGM9>

And we will provide an exclusive download link (Google Play) to your team.


# Crypto Handle & Custom Domain Setup

Crypto Handles and Custom Domains are single identifiers that eliminate the need to see, or even know about, blockchain public wallet addresses.

{% embed url="<https://www.youtube.com/watch?v=RPpAk51letA>" %}

1. Click wallet icon (top right)\
   ![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FigO5MN2dnQdtfIl35x7C%2F311436957_3422739651275320_8832712651465595576_n.jpg?alt=media\&token=dcab1f7b-8a7c-454b-aafd-2a71d4160225)

2\. Click FIO Name \
![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2Fa3wo2beTpyLv3tStqcpc%2F1%20pic.png?alt=media\&token=8eed988c-085d-428a-ab02-676ecc92cfdf)

3\. FIO Dashboard

* Input the username and get your crypto handle.
* Add your @ioPay handle to the cart and check out, it's free for ioPay members!
* Create FIO Account with email, and create the PIN for your FIO account.
* Set up your password recovery for your FIO account.
* Complete transaction for your FIO crypto handle.  &#x20;

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FPRcUuQ2t0XrKDbU9k4QK%2F1..png?alt=media\&token=da2d37ce-9d99-4119-9acd-376be2ae40fb)

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FZ0FRtOyJJgqjGIB5YmMS%2F2...png?alt=media\&token=fe772926-4b2a-4d06-affc-49d1d9985ff8)

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2Fe6DDn5ONlz4Un5RwI08b%2F3..jpeg?alt=media\&token=9865d8dd-cc98-463e-a2e4-10692d407520)

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FJRoW0cc7WmvVkdVIwdlM%2F4..png?alt=media\&token=1b27c060-82c8-49d0-8416-3c44bb74307c)

### How to connect Fio name with IOTX address?

1. Hit FIO Crypto Handles and go to Manage the handle you have created.

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FcRVjoxHwNjhxRiRTtAMX%2Ffio%20crypto.jpeg?alt=media\&token=402cdca1-c793-4a8e-9532-efb77692e917)

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FgdqrxZkwZfHH2rhcomEa%2Fdio%20crypto%202.jpeg?alt=media\&token=68838dad-6be9-4bff-a3d1-e55532d56554)

2\. Hit Link&#x20;

&#x20; ![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FmSdnenCQf2CQIdZCnHQF%2Fhit%20link.png?alt=media\&token=31113641-f03d-4882-8df5-8121e0b8ea34)

&#x20;  &#x20;

3\. Now type in chain code and token code exactly as it appears below (DO NOT USE AUTOCOMPLETE - there is a known bug). And enter your associated wallet address from the wallet you would like to connect to this crypto handle.

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2F3KAEZAlnO4LXz4tFS68T%2Fautocompelte.png?alt=media\&token=4b494f09-560c-4bda-bdbc-0929963127b8)

### Use FIO Crypto Handle as the receipt address

After you have successfully created your FIO crypto handle, then you can send your unique FIO crypto handle to your friends, and your friends can send you IOTX through your crypto handle rather than providing them your wallet address.

Upon entering a crypto handle you should see the wallet address it is tied to.&#x20;

![](https://3866828072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F080l6CBXDdgw6aYdnxuo%2Fuploads%2FJ4PuiqrfJDYWtufsQddH%2Faaron%40iopay.png?alt=media\&token=31b3e7ad-d299-48f1-b529-63ec82f8063d)

<br>


# How to withdraw IOTX from centralized exchanges （Binance）?

To facilitate a seamless transfer of your IOTX from Binance to your IoTeX address, please follow the step-by-step guide provided below:&#x20;

1.Navigate to the IOTX details page on your Binance account and select the 'Withdraw' option.

![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=NGM2ZTY2MmJhNWRhY2EwYjBkNTk5NWFmMjc5NTU4MjFfdnFIZ0MxbEJ2cllZNW1XNVoyQzhiU2VnU3VGdTBwSExfVG9rZW46TUtCeGJoRUhkbzMwbzB4SlNKQXVKR2xPc0VmXzE3MDI1NDI1MzY6MTcwMjU0NjEzNl9WNA)

2.Select 'Send via Crypto Network' as the withdraw method.

![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=OTFiMGNkNWI5YTA2YTU3MmZmMzg2ZTBjYjFiYzk2MzhfSmdreVlsdEhDRnFrcUlFd25zZHhxVG9sSzV2MmQ0R2FfVG9rZW46WmdUd2JmOHE0b2FiYjJ4eW5tRXV6NG1Vc2NmXzE3MDI1NDM1NDA6MTcwMjU0NzE0MF9WNA)

3.Select the **'IoTeX'** as the withdraw network.

![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=NzQ0NmI0OTE1NTQzMjliODE1NzllMTZmNGU2ZmJkMmRfMjEwMUJlT0R1emtsMXdLeXV5MjFJNThkbmZUWEtHUHNfVG9rZW46UVdjcWJkYXZ5bzNKUkd4MEdXeHVoUjVzc2hkXzE3MDI1NDM1Njc6MTcwMjU0NzE2N19WNA)

4.Proceed to copy your IoTeX address from ioPay and paste it into the designated field on Binance. Please note that both '0X...' and 'io...' addresses are acceptable for withdrawal purposes.

![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=MmJjNWZiN2IyMmI5ZDcwYjRlYjM0MmQ3Nzg5ZWU1YTNfdURtVjA2QTcyaUdTUmJOVUtEQVlNY1hvb3Z6UnN4TjVfVG9rZW46SVF4SmJONDFJb0d2Z0t4cXJtN3U3c1hnc0ZjXzE3MDI1NDM2MTA6MTcwMjU0NzIxMF9WNA)

![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=NTkwZmY3MGJiZTg5M2JhNjBhYjNjYjUxNDJmZjAyNzVfQWtEZHkyZnZ6WU45Vm90eUIxdnZqWTFSM3VxS1R3bVFfVG9rZW46UXh2cWJPUkczb2hPRnR4SnE4OHVqUXdic3pnXzE3MDI1NDM2NTg6MTcwMjU0NzI1OF9WNA)

5.Click 'Withdraw' to finalize the process. Please exercise patience as the blockchain confirmation may take between 1 to 3 minutes.

![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=MWE3ZGZiMWZmYmEzNDNiZTBhNzE5OTJmYTkwZGUxMzBfSGRzSjBHdXlpckxPNFVaZFBtSkJDcEUwamRGRTFXWWRfVG9rZW46V3MxVGJLbEFHb0N6ckh4UVdzV3VJamJkc21nXzE3MDI1NDM3MDg6MTcwMjU0NzMwOF9WNA)

6.Please check your IOTX balance in your ioPay wallet, and enjoy the IoTeX ecosystem. \
IOTX is now officially accessible on several prominent exchanges, including **Binance, Coinbase, Kucoin, Gate, and HTX.** This comprehensive guide is applicable to most centralized exchanges for your convenience. It is imperative to be mindful of the network during the withdrawal process.&#x20;

**Download ioPay**：<https://iopay.me/>


# Walletconnect - iOS

We recommend downloading the demo client app and follow the usage

## 1. Initial the configuration

* ### Install the packages required

Use Cocoapods

`pod 'WalletConnectSwift'`

Or add the <https://github.com/WalletConnect/WalletConnectSwift.git> by SPM

* ### Add scheme

Open the info.plist, add the scheme "io.iotex.iopay" to LSApplicationQueriesSchemes![](https://iotex.larksuite.com/space/api/box/stream/download/asynccode/?code=MjQ0OTcxMWQ5OTY5YTJhZWRlNjVjNWE4ZjNmNDZjMjRfaG8xSVFJU2x6UzIyOXlCbW5RREV2RUx3UEdjb1JiTWRfVG9rZW46Ym94dXM1QldFblczWThwdjRFWjBnaWd5eGNjXzE2NTM1Mjc2ODQ6MTY1MzUzMTI4NF9WNA)

* ### Add WalletConnect.swift

Drag the WalletConnect.swift located in the Demo to your project, the copy option must be selected

## 2. Build the connection

initialize the `WalletConnect` instance first and conform all the delegate, then build the connection with ioPay app

```
var walletConnect: WalletConnect!
// initialize the WalletConnect instance
walletConnect = WalletConnect(delegate: self)
walletConnect.reconnectIfNeeded()
        
//open the ioPay and ask for the connect
let connectionUrl = walletConnect.connect()
let deepLinkUrl = "io.iotex.iopay://wc?uri=\(connectionUrl)"
if let url = URL(string: deepLinkUrl), UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
 }
```

## 3. Send the common action

Now the ioPay supports these actions:`personal_sign`, `eth_signTypedData` ,`eth_signTransaction`,`eth_sendTransaction` and custom contract action.You can read the relative codes in "ActionsViewController.swift"

```
    //eth_signTypedData
    @IBAction func eth_signTypedData(_ sender: Any) {
        try? client.eth_signTypedData(url: session.url,
                                      account: session.walletInfo!.accounts[0],
                                      message: Stub.typedData) {
            [weak self] response in
            self?.handleReponse(response, expecting: "Signature") }
    }
    //eth_signTransaction
    @IBAction func eth_signTransaction(_ sender: Any) {
        let transaction = Stub.transaction(from: self.walletAccount, nonce: "0x0")
        try? self.client.eth_signTransaction(url: session.url, transaction: transaction) { [weak self] response in
            self?.handleReponse(response, expecting: "Signature")
        }
    }
```

## 4. Send the custom action

```
//send the custom contract action
try? client.send(.customContract(url: session.url,
                                     wcMethod: wcMethod,
                                     requirement:[abi, method, contractAddress],
                                     params: params)) { [weak self] response in
        self?.handleReponse(response)
 }
    
    
extension Request {

    ///
    /// - Parameters:
    ///   - url: the walletconnect url
    ///   - wcMethod: the method communicating between client and ioPay, you can customize the name
    ///   - requirement:[abi, method, contractAddress]. this method is a contract method needs to be called
    ///   - params: the params passed into the contract method
    /// - Returns: 
    static func customContract(url: WCURL, wcMethod: String, requirement: [String], params: [String]) -> Request {
        return try! Request(url: url, method: wcMethod, params: [requirement, params])
    }
}
    
```

## 5. Tip

Because of the restriction of iOS background, some behaviors just like presenting viewcontroller won't work perhaps, so you need to jump the iOPay after sending actions.

```
        let deepLinkUrl = "io.iotex.iopay://wc"
        if let url = URL(string: deepLinkUrl), UIApplication.shared.canOpenURL(url) {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        }
```


# Rainbow Kit

RainbowKit is a [React](https://reactjs.org/) library that makes it easy to add wallet connection to your dapp. It's intuitive, responsive and customizable.

Developers can follow the Rainbow Kit docs to learn how to add ioPay to the supported wallets:

{% embed url="<https://www.rainbowkit.com/docs/custom-wallet-list#iopay-wallet>" %}


