# App2App Dev. Guidelines

## Introduction

* [![](https://static.npmjs.com/da3ab40fb0861d15c83854c29f5f2962.png)npm: favorlet.js](https://www.npmjs.com/package/favorlet.js)
* **favorlet.js Web SDK** is for easy and convenient use when you want to request the following functions through FAVORLET app.

> A Request to bring user's FAVORLET account
>
> A Signature request to verify possession of FAVORLET wallet address
>
> A request to transfer platform coins on the chain set up in the FAVORLET wallet&#x20;
>
> A Contract execution request through FAVORLET wallet

## Install

* use `npm install favorlet.js yarn` or `add favorlet.js` and write as below.

```javascript
import { Request, createDeepLink, receipt } from "favorlet.js";
```

## Summary

<figure><img src="https://1971795026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj5aTd2uJmNjHSmwmQF91%2Fuploads%2FJg91aRXEKacgwt3jHadK%2Fimage.png?alt=media&#x26;token=c508ca25-be4b-4bb1-8d49-8403021ee048" alt=""><figcaption></figcaption></figure>

API request is proceed in the order of`Request`, `createDeepLink`, `receipt`.&#x20;

when`Request`, a unique Request ID is issued to distinguish it from other requests, and each step

communicates with this Request ID.&#x20;

Please refer to below information for more detailed explanation of each step.

## Request

There are four steps to request an action or transaction through the FAVORLET app.

{% hint style="info" %}

* `connectWallet`: A request to bring user's FAVORLET account
* `signMessage`: A signature request to verify possession of FAVORLET account
* `sendCoin`: A request to transfer platform coins on the chain set up in the FAVORLET
* `executeContract`: A Contract execution request through FAVORLET wallet
  {% endhint %}

## createDeepLink

Create an address (DeepLink) that meets the communication standard to deliver the requestId that is received when requesting from BApp to FAVORLET app.

{% hint style="info" %}
During development, the method of passing the generated DeepLink to the FAVORLET app must be handled differently depending on the BApp execution environment.&#x20;

* PC
  * Create a QR code using the DeepLink library and scan it with your smartphone.
  * For QR generation, refer to the library below
  * [![](https://static.npmjs.com/da3ab40fb0861d15c83854c29f5f2962.png)npm: qrcode](https://www.npmjs.com/package/qrcode)
* Mobile
  * Use window\.location.href and move to DeepLink
    {% endhint %}

{% hint style="info" %}
When running DeepLink, the corresponding branch will automatically activate depending on whether FAVORLET app is installed or not.&#x20;

* If installed: Run the FAVORLET app&#x20;
* If not installed: Go to the app store of your OS
  {% endhint %}

## receipt

Check the result of the action performed by the FAVORLET app with the requestId issued upon request.

{% hint style="info" %}
Response

* action: Request kind
* status
  * `requested`: requested status
  * `executed`: the status of executing the request
  * `canceled`: canceled request
  * `failed`: request executed but failed
  * `succeed`: request executed and succeed
    {% endhint %}

## Style Guide

Please refer to the page below for the service logo and terminology regulations.

{% embed url="<https://docs.favorlet.io/about/style>" %}
