# \[SNIP\] Check Support for Starknet Provider JavaScript API

**URL:** <https://community.starknet.io/t/snip-check-support-for-starknet-provider-javascript-api/1474>\
**Category:** SNIPs\
**Tags:** conventions\
**Created:** [June 7, 2022, 12:55pm UTC](https://community.starknet.io/t/snip-check-support-for-starknet-provider-javascript-api/1474 "2022-06-07T12:55:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ltoussaint](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/ltoussaint/32/628_2.png) [@ltoussaint](https://community.starknet.io/u/ltoussaint)\
**Post date:** [June 7, 2022, 12:55pm UTC](https://community.starknet.io/t/snip-check-support-for-starknet-provider-javascript-api/1474/1 "2022-06-07T12:55:38Z")

</div>

## Simple Summary

Two methods of the JavaScript API to ensure support of specific RPC methods and events.

## Abstract

Dapps want to use a single JavaScript API to interact with different wallet providers.

A “Starknet Provider JavaScript API” was proposed to define a common API that wallet providers could use.  
Nevertheless, those providers may have a different level of development, and may not support all the RPC methods and events defined in the different SIMPs.

Two methods may be implemented to ensure a RPC method is supported by the current wallet provider (`supportRequest`) and to ensure an event is supported (`supportEvent`).

## Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC-2119](https://www.ietf.org/rfc/rfc2119.txt).

### supportRequest

This method `supportRequest` take the name of the RPC method as a parameter and returns true if the RPC method is supported by the current wallet provider.

- The method MUST return a boolean.
- If no parameters are given or if it is not a string, the method MUST simply return false.
- If the RPC method is not supported by the current wallet provider, the method MUST return false.

Here is an example of how to use the method:

```typescript
const isWatchAssetSupported: boolean = Provider.supportRequest("wallet_watchAsset");

```

### supportEvent

This method take the name of an event as a parameter and returns true if the event is supported by the current wallet provider.

- The method MUST return a boolean.
- If no parameters are given or if it is not a string, the method MUST simply return false.
- If the event is not supported by the current wallet provider, the method MUST return false.

Here is an example of how to use the method:

```typescript
const isDisconnectEventSupported: boolean = Provider.supportEvent("chainChanged");

```

## Appendix

### Appendix I

New methods to add to WalletProviderInterface

```typescript
interface WalletProviderInterface {
  ...
  supportRequest: (request: string) => boolean;
  supportEvent: (event: string) => boolean;
}

```
