Skip to content

Commit

Permalink
Merge pull request #137 from reown-com/feat/smart-session-npm
Browse files Browse the repository at this point in the history
Feat: add npm install experimental
  • Loading branch information
rohit-710 authored Nov 6, 2024
2 parents 4677695 + 0cefae2 commit 133efbd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions docs/appkit/shared/smart-sessions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ This guide will walk you through on how to use the `grantPermissions` method, in

The `grantPermissions` method provides an easy way to interact with the smart wallet to request permissions.

### Step 1 | Import the method
### Step 1 | Install the library

```bash npm2yarn
npm install @reown/appkit-experimental
```

### Step 2 | Import the method
First, import the grantPermissions method from the `@reown/appkit-experimental/smart-session` package.

```javascript
import { grantPermissions, type SmartSessionGrantPermissionsRequest } from '@reown/appkit-experimental/smart-session'
```

### Step 2 | Define the Permission Request
### Step 3 | Define the Permission Request

Create an object adhering to the `SmartSessionGrantPermissionsRequest` type. This object specifies details like the `address`, `chainID`, `signer`, `policies`, `permissions`, and `expiry` time.

Expand Down Expand Up @@ -64,15 +70,15 @@ const request: SmartSessionGrantPermissionsRequest = {
}
```

### Step 3 | Invoke the Method
### Step 4 | Invoke the Method

Call the `grantPermissions` function, passing the request object. This will trigger the permission request via the connected wallet.

```tsx
const response = await grantPermissions(request)
```

### Step 4 | Handle the Response
### Step 5 | Handle the Response

Upon successful execution, the response will include the granted permissions and the session context. So the response can be handled as needed.

Expand Down

0 comments on commit 133efbd

Please sign in to comment.