From 36ad94be79d32787b75f94d3d8703accf1486c0b Mon Sep 17 00:00:00 2001 From: Egor Miliukov Date: Fri, 5 Jul 2024 00:33:21 +0300 Subject: [PATCH] Add getUserWalletAddress SDK method --- CHANGELOG.md | 6 +++ README.md | 26 +++++++++++++ dist/classes/Rpc.d.ts | 7 +++- dist/classes/WalletSDK.d.ts | 9 +++++ dist/grindery-wallet-sdk.cjs.development.js | 38 +++++++++++++++++- ...grindery-wallet-sdk.cjs.development.js.map | 2 +- .../grindery-wallet-sdk.cjs.production.min.js | 2 +- ...ndery-wallet-sdk.cjs.production.min.js.map | 2 +- dist/grindery-wallet-sdk.esm.js | 38 +++++++++++++++++- dist/grindery-wallet-sdk.esm.js.map | 2 +- dist/grindery-wallet-sdk.umd.development.js | 38 +++++++++++++++++- ...grindery-wallet-sdk.umd.development.js.map | 2 +- .../grindery-wallet-sdk.umd.production.min.js | 2 +- ...ndery-wallet-sdk.umd.production.min.js.map | 2 +- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- .../classes_EventEmitter.EventEmitter.html | 14 +++---- docs/classes/classes_Provider.Provider.html | 30 +++++++------- .../classes_ProviderError.ProviderError.html | 8 ++-- docs/classes/classes_Rpc.Rpc.html | 12 +++--- .../classes_SdkStorage.SdkStorage.html | 14 +++---- docs/classes/classes_WalletSDK.WalletSDK.html | 39 +++++++++++-------- .../classes_EventEmitter.ProviderEvents.html | 6 +-- .../classes_Provider.ProviderMethodNames.html | 6 +-- docs/enums/classes_Rpc.RpcMethodNames.html | 7 ++-- .../classes_SdkStorage.SdkStorageKeys.html | 6 +-- docs/example/dist/classes/Rpc.d.ts | 7 +++- docs/example/dist/classes/WalletSDK.d.ts | 9 +++++ .../grindery-wallet-sdk.cjs.development.js | 38 +++++++++++++++++- ...grindery-wallet-sdk.cjs.development.js.map | 2 +- .../grindery-wallet-sdk.cjs.production.min.js | 2 +- ...ndery-wallet-sdk.cjs.production.min.js.map | 2 +- docs/example/dist/grindery-wallet-sdk.esm.js | 38 +++++++++++++++++- .../dist/grindery-wallet-sdk.esm.js.map | 2 +- .../grindery-wallet-sdk.umd.development.js | 38 +++++++++++++++++- ...grindery-wallet-sdk.umd.development.js.map | 2 +- .../grindery-wallet-sdk.umd.production.min.js | 2 +- ...ndery-wallet-sdk.umd.production.min.js.map | 2 +- docs/example/index.html | 1 + docs/example/main.js | 22 +++++++++++ ...lasses_ProviderError.newProviderError.html | 2 +- docs/functions/utils_chains.hexChainId.html | 2 +- docs/functions/utils_chains.unhexChainId.html | 2 +- docs/functions/utils_getAppId.getAppId.html | 4 +- docs/functions/utils_uuid.uuid.html | 4 +- docs/hierarchy.html | 2 +- docs/index.html | 12 +++++- ...ses_Provider.ProviderRequestArguments.html | 6 +-- ...tils_providerInfo.EIP6963ProviderInfo.html | 8 ++-- docs/modules/classes_EventEmitter.html | 4 +- ...asses_Provider.ProviderRequestResults.html | 4 +- docs/modules/classes_Provider.html | 4 +- docs/modules/classes_ProviderError.html | 4 +- .../classes_Rpc.RpcRequestResults.html | 7 ++-- docs/modules/classes_Rpc.html | 4 +- docs/modules/classes_SdkStorage.html | 4 +- docs/modules/classes_WalletSDK.html | 4 +- docs/modules/utils_chains.html | 4 +- docs/modules/utils_getAppId.html | 4 +- docs/modules/utils_providerInfo.html | 4 +- docs/modules/utils_uuid.html | 4 +- ...lasses_EventEmitter.ProviderEventName.html | 4 +- .../classes_Provider.ProviderMethodName.html | 4 +- .../classes_Provider.ProviderMethods.html | 4 +- ...ovider.ProviderRequestArgumentsParams.html | 4 +- ...der.ProviderRequestResults.disconnect.html | 2 +- ...r.ProviderRequestResults.eth_accounts.html | 2 +- ...er.ProviderRequestResults.eth_chainId.html | 2 +- ...derRequestResults.eth_requestAccounts.html | 2 +- ...derRequestResults.eth_sendTransaction.html | 2 +- ....ProviderRequestResults.personal_sign.html | 2 +- ...equestResults.wallet_addEthereumChain.html | 2 +- ...estResults.wallet_switchEthereumChain.html | 2 +- ...sses_Rpc.RpcRequestResults.disconnect.html | 4 +- ...pcRequestResults.getUserWalletAddress.html | 2 + ...classes_Rpc.RpcRequestResults.request.html | 4 +- ..._Rpc.RpcRequestResults.requestPairing.html | 4 +- ...pcRequestResults.waitForPairingResult.html | 4 +- ...pcRequestResults.waitForRequestResult.html | 4 +- .../classes_SdkStorage.SdkStorageKey.html | 4 +- ...classes_SdkStorage.SdkStorageSnapshot.html | 2 +- .../classes_WalletSDK.WalletSDKConfig.html | 2 +- .../classes_ProviderError.ProviderErrors.html | 2 +- docs/variables/utils_chains.CHAINS.html | 4 +- .../utils_providerInfo.providerInfo.html | 2 +- example/dist/classes/Rpc.d.ts | 7 +++- example/dist/classes/WalletSDK.d.ts | 9 +++++ .../grindery-wallet-sdk.cjs.development.js | 38 +++++++++++++++++- ...grindery-wallet-sdk.cjs.development.js.map | 2 +- .../grindery-wallet-sdk.cjs.production.min.js | 2 +- ...ndery-wallet-sdk.cjs.production.min.js.map | 2 +- example/dist/grindery-wallet-sdk.esm.js | 38 +++++++++++++++++- example/dist/grindery-wallet-sdk.esm.js.map | 2 +- .../grindery-wallet-sdk.umd.development.js | 38 +++++++++++++++++- ...grindery-wallet-sdk.umd.development.js.map | 2 +- .../grindery-wallet-sdk.umd.production.min.js | 2 +- ...ndery-wallet-sdk.umd.production.min.js.map | 2 +- example/index.html | 1 + example/main.js | 22 +++++++++++ package.json | 2 +- src/classes/Rpc.ts | 6 +++ src/classes/WalletSDK.ts | 20 +++++++++- 102 files changed, 666 insertions(+), 181 deletions(-) create mode 100644 docs/types/classes_Rpc.RpcRequestResults.getUserWalletAddress.html diff --git a/CHANGELOG.md b/CHANGELOG.md index c8b4978..73ec018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Grindery Wallet SDK Changelog +## v0.4.0 (2024-07-05) + +### Features + +- Added `getUserWalletAddress` SDK method, allowing to silently exchange Telegram user ID to EVM wallet address + ## v0.3.0 (2024-06-18) ### Added support for BNB and opBNB chains diff --git a/README.md b/README.md index d22bda9..ae31355 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The SDK enables your dapp to provide a seamless user experience for Grindery use - [Basic usage](#basic-usage) - [Server connection](#server-connection) - [Wallet connection](#wallet-connection) + - [Silently getting wallet address](#silently-getting-wallet-address) - [Sending transactions](#sending-transactions) - [Signing](#signing) - [Chain switching](#chain-switching) @@ -172,6 +173,31 @@ WalletSDK.on('disconnect', => { WalletSDK.disconnect(); ``` +## Silently getting wallet address + +The SDK allows dApps to exchange Telegram user ID to user's EVM wallet address. + +The method doesn't require user to go through the [wallet connection process](#wallet-connection), and can be executed silently in the background. However, without fully connected wallet a dApp has read-only access, and can't request message signing or transactions sending. To do this ask user to connect the wallet first. + +```typescript +WalletSDK.on('connect', async () => { + const userId = '123456'; + const telegramUserWallet = + await window.Grindery.WalletSDK.getUserWalletAddress(userId); +}); +``` + +This can be especially usefull for Telegram mini-apps, where user ID can be detected automatically. For example: + +```typescript +WalletSDK.on('connect', async () => { + const telegramUserWallet = + await window.Grindery.WalletSDK.getUserWalletAddress( + window.Telegram?.WebApp?.initDataUnsafe?.user?.id + ); +}); +``` + ## Sending transactions To request transaction sending use [`sendTransaction()`](https://grindery-io.github.io/grindery-wallet-sdk/classes/classes_WalletSDK.WalletSDK.html#sendTransaction) method, once the wallet is connected: diff --git a/dist/classes/Rpc.d.ts b/dist/classes/Rpc.d.ts index 67a6f5b..fcd1ee3 100644 --- a/dist/classes/Rpc.d.ts +++ b/dist/classes/Rpc.d.ts @@ -6,7 +6,8 @@ export declare enum RpcMethodNames { waitForPairingResult = "waitForPairingResult", request = "request", waitForRequestResult = "waitForRequestResult", - 'disconnect' = "disconnect" + 'disconnect' = "disconnect", + getUserWalletAddress = "getUserWalletAddress" } /** * @summary The Grindery RPC API request results @@ -53,6 +54,10 @@ export declare namespace RpcRequestResults { * @summary `disconnect` method result */ type disconnect = boolean; + /** + * @summary `getUserWalletAddress` method result + */ + type getUserWalletAddress = string; } /** * @summary The Grindery RPC API wrapper class diff --git a/dist/classes/WalletSDK.d.ts b/dist/classes/WalletSDK.d.ts index 12f8530..5b804be 100644 --- a/dist/classes/WalletSDK.d.ts +++ b/dist/classes/WalletSDK.d.ts @@ -1,5 +1,6 @@ import { ProviderEventName } from './EventEmitter'; import { Provider } from './Provider'; +import { RpcRequestResults } from './Rpc'; export type WalletSDKConfig = { appId?: string; }; @@ -81,6 +82,14 @@ export declare class WalletSDK { * @returns {string} Returns chain id in CAIP-2 format */ getChain(): string; + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */ + getUserWalletAddress(userId: string): Promise; /** * @summary Adds a listener to the event * @public diff --git a/dist/grindery-wallet-sdk.cjs.development.js b/dist/grindery-wallet-sdk.cjs.development.js index be0629b..d8e7da0 100644 --- a/dist/grindery-wallet-sdk.cjs.development.js +++ b/dist/grindery-wallet-sdk.cjs.development.js @@ -684,6 +684,7 @@ var RpcMethodNames; RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1614,13 +1615,48 @@ var WalletSDK = /*#__PURE__*/function () { _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/dist/grindery-wallet-sdk.cjs.development.js.map b/dist/grindery-wallet-sdk.cjs.development.js.map index f0df5b6..009c2ec 100644 --- a/dist/grindery-wallet-sdk.cjs.development.js.map +++ b/dist/grindery-wallet-sdk.cjs.development.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.cjs.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc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NyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,cAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC7BA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAPWA,cAAc,KAAdA,cAAc,GAOzB,EAAA,CAAA,CAAA,CAAA;AAQD;;;AAGG;AACH,IAAaC,YAAY,gBAAA,YAAA;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AAA;AAAA,EAAA,OAAAnB,SAAA,CAAA;AAAA,CAAA,EAAA;;AChNH;;AAEG;AACI,IAAMwB,iBAAiB,GAAGxB,UAAS;AAE1C,SAASyB,IAAIA,GAAA;AAAA,EAAA,IAAA1P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACAyB,IAAI,EAAE;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.cjs.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA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ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAA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A;IACtC,IAAME,WAAW,0DAAwDhG,UAAY,CAAA;AACrF,IAAA,IACE8F,MAAM,IACNA,MAAM,CAACG,gBAAgB,IACvBH,MAAM,CAACI,QAAQ,IACfJ,MAAM,CAACI,QAAQ,KAAK,SAAS,EAC7B;AACAJ,MAAAA,MAAM,CAACG,gBAAgB,CAAClG,iBAAiB,CAAC,CAAA;MAC1C,IAAI+F,MAAM,CAACK,KAAK,EAAE;AAChB9O,QAAAA,MAAM,CAAC0O,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;AAChC,OAAA;AACF,KAAC,MAAM;AACL9O,MAAAA,MAAM,CAAC+O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;AACpC,KAAA;GACD,CAAA;AAAA,EAAA,OAAAtB,SAAA,CAAA;AAAA,CAAA,EAAA;;AClOH;;AAEG;AACI,IAAM2B,iBAAiB,GAAG3B,UAAS;AAE1C,SAAS4B,IAAIA,GAAA;AAAA,EAAA,IAAA7P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACA4B,IAAI,EAAE;;;;"} \ No newline at end of file diff --git a/dist/grindery-wallet-sdk.cjs.production.min.js b/dist/grindery-wallet-sdk.cjs.production.min.js index e83b74b..abc1259 100644 --- a/dist/grindery-wallet-sdk.cjs.production.min.js +++ b/dist/grindery-wallet-sdk.cjs.production.min.js @@ -1,2 +1,2 @@ -"use strict";function e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(e=function(){return!!t})()}function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof y?t:y).prototype),a=new O(n||[]);return o(i,"_invoke",{value:k(e,r,a)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var d="suspendedStart",f="suspendedYield",g="executing",w="completed",v={};function y(){}function N(){}function m(){}var M={};p(M,s,(function(){return this}));var I=Object.getPrototypeOf,D=I&&I(I(z([])));D&&D!==n&&i.call(D,s)&&(M=D);var j=m.prototype=y.prototype=Object.create(M);function T(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,o,a,s){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(p).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var n;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(o,o):o()}})}function k(t,r,n){var i=d;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===w){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=b(s,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?w:f,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=w,n.method="throw",n.arg=u.arg)}}}function b(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,b(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},r}function r(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,c,"next",e)}function c(e){r(a,i,o,s,c,"throw",e)}s(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),l=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:U(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},r}function r(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var s=e.apply(t,n);function a(e){r(s,i,o,a,c,"next",e)}function c(e){r(s,i,o,a,c,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),l=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3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jMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"mkQAMA,IAAYA,yDAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OAAOO,IAAIF,IACnBN,KAAKC,OAAOQ,IAAIH,EAAO,IAEzBN,KAAKC,OAAOS,IAAIJ,GAAQK,KAAKJ,GACtBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAC9C,GAAIP,KAAKC,OAAOO,IAAIF,GAAQ,CAC1B,IAAMO,EAAYb,KAAKC,OAAOS,IAAIJ,GAAQQ,QAAO,SAACC,GAAE,OAAKA,IAAOR,KAChEP,KAAKC,OAAOQ,IAAIH,EAAOO,EACzB,CACA,OAAOb,IACT,EAEAG,EAOUa,KAAA,SAAKV,GAAwC,IAAAW,IAAAA,EAAAC,UAAAC,OAAXC,MAAWC,MAAAJ,EAAAA,EAAAA,OAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAXF,EAAWE,EAAAJ,GAAAA,UAAAI,GAOrD,OANItB,KAAKC,OAAOO,IAAIF,KAClBiB,QAAQC,IAAI,gCAAiClB,EAAOc,EAAK,IACzDpB,KAAK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,WAE5BnB,CAAA,CA/MmB,GDETwB,EAAoBxB,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.cjs.production.min.js","sources":["../src/classes/EventEmitter.ts","../src/classes/SdkStorage.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/index.ts","../src/classes/WalletSDK.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3NDggNjYuMTc2OCA2NS44MzUyIDY1LjYwNzkgNjQuOTc1NUM2NC43MDMzIDYzLjYwODYgNjIuODUyNCA2My4yMDgzIDYxLjQ0ODIgNjQuMDY1TDU1LjY2NDggNjcuOTQyOEw1MC41NTYyIDcxLjM3NDdDNTAuNTA3OSA3MS40MDU1IDUwLjQ1OTQgNzEuNDM1OCA1MC40MTA3IDcxLjQ2NTdMNTAuMDU1IDcxLjcwNDJDNDkuNzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"mkQAMA,IAAYA,yDAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OAAOO,IAAIF,IACnBN,KAAKC,OAAOQ,IAAIH,EAAO,IAEzBN,KAAKC,OAAOS,IAAIJ,GAAQK,KAAKJ,GACtBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAC9C,GAAIP,KAAKC,OAAOO,IAAIF,GAAQ,CAC1B,IAAMO,EAAYb,KAAKC,OAAOS,IAAIJ,GAAQQ,QAAO,SAACC,GAAE,OAAKA,IAAOR,KAChEP,KAAKC,OAAOQ,IAAIH,EAAOO,EACzB,CACA,OAAOb,IACT,EAEAG,EAOUa,KAAA,SAAKV,GAAwC,IAAAW,IAAAA,EAAAC,UAAAC,OAAXC,MAAWC,MAAAJ,EAAAA,EAAAA,OAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAXF,EAAWE,EAAAJ,GAAAA,UAAAI,GAOrD,OANItB,KAAKC,OAAOO,IAAIF,KAClBiB,QAAQC,IAAI,gCAAiClB,EAAOc,EAAK,IACzDpB,KAAKC,OAAOS,IAAIJ,GAAQmB,SAAQ,SAAClB,G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AACpB,GAA4B,OAC3BA,aAAoBvF,GAAYuF,EAAS7E,oBAY7C,OATG6E,GACDrM,OAAO6L,oBAAoB/E,GAC3B9G,OAAO6L,SAASrE,mBAEhB6E,EAAWrM,OAAO6L,UAEfQ,IACHA,EAAW,IAAIvF,GAEVuF,CACT,EAEA1O,EAMQgP,cAAA,SAAA/E,GAG2B,IAAA8F,EAC3BC,EAAwB,OAAlBD,EAAG1N,OAAO4N,eAAQ,EAAfF,EAAiBC,OAC1BE,uDAJIjG,EAAVe,WAMEgF,GACAA,EAAOG,kBACPH,EAAOI,UACa,YAApBJ,EAAOI,UAEPJ,EAAOG,iBAVQlG,EAAjBc,mBAWMiF,EAAOK,OACThO,OAAO4N,SAASD,OAAOK,SAGzBhO,OAAOiO,KAAKJ,EAAa,WAE5BtB,CAAA,CAhOmB,GDCT2B,EAAoB3B,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file diff --git a/dist/grindery-wallet-sdk.esm.js b/dist/grindery-wallet-sdk.esm.js index 7378f29..bc0e0ee 100644 --- a/dist/grindery-wallet-sdk.esm.js +++ b/dist/grindery-wallet-sdk.esm.js @@ -680,6 +680,7 @@ var RpcMethodNames; RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1610,13 +1611,48 @@ var WalletSDK = /*#__PURE__*/function () { _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/dist/grindery-wallet-sdk.esm.js.map b/dist/grindery-wallet-sdk.esm.js.map index 6ca2d36..1d0bed7 100644 --- a/dist/grindery-wallet-sdk.esm.js.map +++ b/dist/grindery-wallet-sdk.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.esm.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4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2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,C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AAA;MAC1C,IAAI4F,MAAM,CAACK,KAAK,EAAE;AAChB3O,QAAAA,MAAM,CAACuO,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;AAChC,OAAA;AACF,KAAC,MAAM;AACL3O,MAAAA,MAAM,CAAC4O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;AACpC,KAAA;GACD,CAAA;AAAA,EAAA,OAAAnB,SAAA,CAAA;AAAA,CAAA,EAAA;;AChNH;;AAEG;AACI,IAAMwB,iBAAiB,GAAGxB,UAAS;AAE1C,SAASyB,IAAIA,GAAA;AAAA,EAAA,IAAA1P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACAyB,IAAI,EAAE;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.esm.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMT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DcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;"} \ No newline at end of file diff --git a/dist/grindery-wallet-sdk.umd.development.js b/dist/grindery-wallet-sdk.umd.development.js index 9519afa..1f57f09 100644 --- a/dist/grindery-wallet-sdk.umd.development.js +++ b/dist/grindery-wallet-sdk.umd.development.js @@ -686,6 +686,7 @@ RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1616,13 +1617,48 @@ _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/dist/grindery-wallet-sdk.umd.development.js.map b/dist/grindery-wallet-sdk.umd.development.js.map index 2e3429a..450c933 100644 --- a/dist/grindery-wallet-sdk.umd.development.js.map +++ b/dist/grindery-wallet-sdk.umd.development.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.umd.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly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LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,QAAQ,IAAI,EAAE,EAAA;QACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;OAC3B,CAAA,CAAA;EACH,GAAA;EACF,CAAA;EAEA;EACAyB,IAAI,EAAE;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.umd.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n ic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NzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;EAKG;EACH,IAAYA,cAOX,CAAA;EAPD,CAAA,UAAYA,cAAc,EAAA;EACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;EACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;EACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;EACnBA,EAAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;EACzBA,EAAAA,cAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;EAC7BA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;EACrB,CAAC,EAPWA,cAAc,KAAdA,cAAc,GAOzB,EAAA,CAAA,CAA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AE,CAAA;EAChC,OAAA;EACF,KAAC,MAAM;EACL9O,MAAAA,MAAM,CAAC+O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;EACpC,KAAA;KACD,CAAA;EAAA,EAAA,OAAAtB,SAAA,CAAA;EAAA,CAAA,EAAA;;EClOH;;EAEG;AACI,MAAM2B,iBAAiB,GAAG3B,UAAS;EAE1C,SAAS4B,IAAIA,GAAA;EAAA,EAAA,IAAA7P,gBAAA,CAAA;IACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;MACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;QACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;OAC3B,CAAA,CAAA;EACH,GAAA;EACF,CAAA;EAEA;EACA4B,IAAI,EAAE;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/grindery-wallet-sdk.umd.production.min.js b/dist/grindery-wallet-sdk.umd.production.min.js index 268a771..7d2c924 100644 --- a/dist/grindery-wallet-sdk.umd.production.min.js +++ b/dist/grindery-wallet-sdk.umd.production.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["grindery-wallet-sdk"]={})}(this,(function(e){"use strict";function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}function r(){r=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof y?t:y).prototype),s=new O(n||[]);return o(i,"_invoke",{value:b(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",f="suspendedYield",g="executing",w="completed",v={};function y(){}function N(){}function m(){}var M={};p(M,a,(function(){return this}));var I=Object.getPrototypeOf,D=I&&I(I(z([])));D&&D!==n&&i.call(D,a)&&(M=D);var j=m.prototype=y.prototype=Object.create(M);function T(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,o,s,a){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,s,a)}),(function(e){r("throw",e,s,a)})):t.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,a)}))}a(c.arg)}var n;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(o,o):o()}})}function b(t,r,n){var i=d;return function(o,s){if(i===g)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?w:f,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=w,n.method="throw",n.arg=u.arg)}}}function k(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var s=o.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function n(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,c,"next",e)}function c(e){n(s,i,o,a,c,"throw",e)}a(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),d=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:U(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function n(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,c,"next",e)}function c(e){n(s,i,o,a,c,"throw",e)}a(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),d=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQg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Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Tel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IAAIA"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.umd.production.min.js","sources":["../src/classes/EventEmitter.ts","../src/classes/SdkStorage.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/index.ts","../src/classes/WalletSDK.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+x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DQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","Gr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,cAAA,SAAA/E,GAG2B,IAAA8F,EAC3BC,EAAwB,OAAlBD,EAAG1N,OAAO4N,eAAQ,EAAfF,EAAiBC,OAC1BE,uDAJIjG,EAAVe,WAMEgF,GACAA,EAAOG,kBACPH,EAAOI,UACa,YAApBJ,EAAOI,UAEPJ,EAAOG,iBAVQlG,EAAjBc,mBAWMiF,EAAOK,OACThO,OAAO4N,SAASD,OAAOK,SAGzBhO,OAAOiO,KAAKJ,EAAa,WAE5BtB,CAAA,CAhOmB,GDCT2B,EAAoB3B,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 84d792b..a679046 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62YXW/aMBSG/4uv0bZ+sZU7xJiGqlUIJu2iqpDrHIjVxM5spx+a+t8nQiC240Mc2ltyzvMev3bOcbj7Rwy8GDIiLKNagyYDwlKeJQoEGd0dnk6fQJhpzo0BRQakoCYlI5LLpMxAf65zV3bUp9TkGRmQRy4SMjoPY+dKPvEEVJWoGzCIMkewboqr8u1t0FFxjQyj8fLPzm20U8ItzaHhm9cCo7eyPIe+XH89uzp/uw8I4Y7vI3q5vYC/JWizAF1mtusoPJzoal6GNROumRQCmMFM6lJpCGHDGrvApCvKmCyds9RPzWbE6LGUcjFL3iNXI2LU1C57/AGL9FAx6hpE8ltRoSkzXIr3qHuoLvUClJaCZivNNyfrOpAuxWeaZWBWNEmmJgUFZT7ZbtOp2ggusgr9zA1LP7KQADG+Hf0Ck8pk28LQlt0qw8rBe3a73/n9usWN6dO1BWO1KXN3znBhQK0pizDwkO35dDU86lD0PjUpXYfCzYhvAnV8LN5f95wqmvduOV56/CGbKiUjBl8V1u+u4YKxE7YDH5FB7gTbQMulJ6o4fcArd/NchQt7WwQ8IytYl6JqopiEn+mKDC8d+xcFw01fFCzK6kXBYu8YW2Qr/INuFmF2/H2iHpH98HVSJHtOueJic5JEnds9Q7j5IVUdvWP00wsRIlUd0kmqzq/d7WNRsIjxVCtGDSXnjfC7RQ1qdwa7pmXyuDRS0Q3g70ETE/WGNeE38Iou04K6CfhqQ7X6iw5ijzVHRxw7BVixXSetCV4KWuhUoucsqLBP6j5af6qr0/L7Db6Lh5CoTQwAfasbIIJ2jT4ETaRYc7StBKi7BMwE24bS8Az7m6D6lAl0+ypn96HjXwHCoMnP8ex2GRqjDmoXdmRqpvAy8b/QmnnplnUIbQ1Ia/GiB9EOPjp0N2DGRWETXeP2z6Osa8P88g64MNcrrqjvDjOxlliBdkxUkdPZfHg9vJgH2datPIAPpB67kofL98+To4Cv5sLtCGXJ0T3bPouywoX4e1Vh2qxqj+7f7v8DJGclesATAAA=" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62Yb2/aMBDGv4tfo239x1beIcY0VK1CsGkvqgp5zkGsJk5mO6XVxHefSAKxHR9xaN+Su99zfuzcOTz8IxpeNBkRllClQJEBYTFPIgmCjB6OT6fPIPQ05VqDJAOSUx2TEUmzqEhAfaxzV2bUh1inCRmQJy4iMrr0Y+cye+YRyDJRNWAQRYpg7RRb5ctu0FFxjfSj8fIvLk20VcI9TaHh69cco7eyHIc+3X6+uLncPXqEcMcPEb3cXsDfApRegCoS03UU7k+0Na/9mhFXLBMCmMZM6lJpCH7DGrtAxyvKWFZYZ6mfmskI0WMx5WIWvUWuRoSoySp7/A6LdFAh6gpE9FNSoSjTPBNvUXdQXeo5SJUJmqwU35yta0G6FLc0SUCvaBRNdQwSinSy36ZztRFcYBVqyzWL37MQDzG8Hf0AHWfRvoWhLbtVhpGD9+x2v3P7dYsb0qdrC8ZyU6T2nOFCg1xTFmDgMdvx6WZ40qHgfWpSug6FnRHeBOr4ULy77jmVNO3dcpz08EM2lTILGHxlWL+7hg3GTlgFPiGD3An2gYZLz1Ry+gev3M6zFa7MbRGwRVawLkTZRDEJN9MWGV5b9i9yhpu+yFmQ1Yuchd4x9shW+DvdLPzs8PvEBvQvBfJ32TLHUSRBoeffr+UjdKnWg7mfUJ0UyJ5TLrnYnCVR53ZPLq6/ZbKOrhj99HyEQFWLdJaq9Wt301rkLGAo1opBo9B6D90eVYPa/cisaRk9LXUm6Qbwt6+JCXqvm/A7eEWXaUDtBHy1vlrdRXuxp1qyJY6dAqzYrpPWBC8FzVWcoefMq3BI6j5aVe9Yfr3Dd/EYErSJHqBrdQNE0LbRx6BJJtYcbSseapWAmWDaUGieYH9OlB9QnhlT5lSfV27X9YMm38ez+6VveFuoKuzErI7hZeJ+FzZT2i7rGNoay8biRQ+iGXxy1G9Aj/PcJNrGHZ4HWdeGueUdcX6uU1xe31hmYp1hBZoxQUVOZ/Ph7fBq7mUb3wIevCf11IeAv3z3PFkK+Gqu7I5QFBzds/2zICtsiLtXJabNKvfocff4H293H5A2FAAA" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index daf105b..e473902 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE81d25LbRg79F86roqh557x5HWfXtZtUys7lYco1RUttDWMNpSWpmWRd/vet7uYFaAISSVG2nyaxGuBpHACNBpvkJ6fYP5fO7d0n52OWb5xbd+Hk6aN0bp31Li1LWX7/6knm1avHrKpk4SycY7Fzbp3H/ea4k+X39aB7OGj5UD3unEWjwLl1nM+LRn/c6v+l2D9lG1lo0bLVLPPjI6MXSxCXWTiHtJB5xaHvYIiwxZGu1/tjXpUvH9J8KzcTgdz01QwHZimkcR7SrJgKrpadGdF6n+dyXU0F1YnPjGuTlRdCQxrmttpDmuUXOpulY2aEj7Is062cCq4TnwOXu0oiEbh02vhZ/VsDs/r7wGWkntB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IGWAlarvR3NT41BxDuwpugTMNi/t0s5HVgyzk8bEXaC6YnVsXTuwdyVqfiVleJZhj01/3eINRN12g67EFfyu6rt/LBRRAz6Gv/W7hHLKD3GW5dG7v3n3+/H/gqpQRgqAAAA=="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE81dbZPbthH+L7yvykXgO++b6zqtp00mY7fNhxvPDSPBOsY6SiWpu6Qe//cOwLddcFckKMrxJycn7PIBnsVi8RAkPzvF4aV07u4/O5+yfOvcuSsnT5+kc+ds9mlZyvL7N88yr948ZVUlC2flnIq9c+c8HbanvSy/bxo9wEa3j9XT3lm1Dpw7x/myav3Hnf+fi8NztpWFNi07zzI/PTF+sQVxmZVzTAuZVxz6HoYIOxzpZnM45VX5+jHNd3I7E8jN0M10YIZDGucxzYq54BrbhRFtDnkuN9VcUL35wri2WXkhNORh6VF7TLP8wmAzfCyM8EmWZbqTc8H15kvgctdJJAKXThs/qb+1MKs/jlxGGhhdljzcPouR2bG1J7GMpMrpMALhwqlYVsVpUx3morjBLiyo40Zp7fodPomTvCW0zrpHVZXb77Lyu2ORPaeVnIvRXfs9lYd8Lj5tefmIITSFfDo8y39mZSXz2aF1M/CyMEr5lFWzWa1tF0A0qFna+c7WK22Ds7UKl3p+lNXjYVsyiadzbTSfNtc75OdKptqjymNc3cSA0CazgYAlQlaPD4X870mW1aum8JmL5Ib2NQ0d5ZVHnC4BNb0exqMsykOe7h/KbJfPBml6ucZIljLf/qtI8zLdVNlhPlba19KIdy/lw2hROA524OYaI6tLu7dcZThtRHsfSyN8Sfd7WT2k2+2b6lEW8vT0Wl1rNlre35WQly9ZtXlcFDztchH8/iD1v6sT5TtZnvYgkbHrG203ewkwl0Qyq46shwYU6MIOF+NxBC63bNmjNjxdGzy9OtjBRj6+xmhzC4X9aBuerg2eWC/sMPcOrg11Qmqzg847/EpdYdeXWf0wvX2NuDeXcft4bzxcG+xwAbLb10xXUyYsJwb6V8Xu9KS2/j+nRfpkm6o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R4WKrC3QJb8LbmdZYxwbtgurE6zNAF7gNc4bjciH1ge9SPEfu2Xu2+Sg87A7KmNwbEdDScHy5gltVeDHdF++UW4AZ0z+Xc1M9UQHJhzcGmhvp5yn33PCVwgPbfTW5r9lxKDOf8NW+gA9MUAPGb5Bi12WbNrentMjyspkIALGo1QnZYajfD1Ae3JmuuOmq+U02A8MGsZxN9Y959XwWYg2nLjyVWczwwS/x2j7vmMkZx3DCzLQRpM2Lj4rjhAzIESGKOQPVGF3J3AePSY61JNSqBpRw7FXrbTxJtxWJIusuRjsyxiAtLalbS6+2p7sdwj+6yPmS+TfOtet1kzwSKX+hGcBGk3BTHTXrMCBcxLF4Et3I1Lih7SIbgFp8zW3p1wxFU5iwfw+kTwiWTH0Nth6vDCICOu5KHS/UltRlFNR839fXb+oZZBy5063ZT7LL0Zbuc2Eioe69g3Nj+D+ePB1YSv8vlLHX6xQ0DccEDg+93+3luMp7Qt0pB2QTSQMglMf08MbknhjOZlcVP/UdehzurAEzmkPVQqoX5t6FSCK4fceOHHzWH6GG9EnBx3z1cPFSG1nD2szUrfmJxWP3B2RdyMQifZ4TGMJL54RuYwaIibHZMguVf5b+Ph6JZf4dbthBwGDWhGHOZrHGGljXkDERk1Knc3OziU3OM9EJugasVi4d0u5XVoyzk6Wkw0VzQO7cpnNj7J42/es7yLkEf3VZAPw/RvJsDQ4+tkTvTTfMmNOAARg6tLH9YOcfsKPdZLp27+w9fvvwfVTwpIT+jAAA="; \ No newline at end of file diff --git a/docs/classes/classes_EventEmitter.EventEmitter.html b/docs/classes/classes_EventEmitter.EventEmitter.html index a46ba0d..d7c0abf 100644 --- a/docs/classes/classes_EventEmitter.EventEmitter.html +++ b/docs/classes/classes_EventEmitter.EventEmitter.html @@ -1,21 +1,21 @@ -EventEmitter | Grindery Wallet SDK - v0.3.0

Summary

A class for emitting provider events

+EventEmitter | Grindery Wallet SDK - v0.4.0

Summary

A class for emitting provider events

Since

0.2.0

-

Hierarchy (view full)

Constructors

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

events: Map<"accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message", Function[]>

Summary

A map of events and their listeners

-

Methods

  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

      +

Constructors

Properties

events: Map<"accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message", Function[]>

Summary

A map of events and their listeners

+

Methods

  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • Rest ...data: any[]

      Event data

    Returns EventEmitter

    The instance of the class itself

    Summary

    Emits an event

    -
  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • callback: Function

      Callback function

    Returns EventEmitter

    The instance of the class itself

    Summary

    Adds a listener to the event

    -
  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • callback: Function

      Callback function

    Returns EventEmitter

    The instance of the class itself

    Summary

    Removes a listener from the event

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/classes_Provider.Provider.html b/docs/classes/classes_Provider.Provider.html index 62eb1e5..0d608e7 100644 --- a/docs/classes/classes_Provider.Provider.html +++ b/docs/classes/classes_Provider.Provider.html @@ -1,6 +1,6 @@ -Provider | Grindery Wallet SDK - v0.3.0

Summary

The base wallet provider class

+Provider | Grindery Wallet SDK - v0.4.0

Summary

The base wallet provider class

Since

0.2.0

-

Hierarchy (view full)

Constructors

Hierarchy (view full)

Constructors

Properties

Constructors

Properties

isGrinderyWallet: boolean = true
methods: Partial<ProviderMethods> = ...

Summary

The list of supported provider methods.

-
rpc: Rpc = ...
storage: SdkStorage = ...

Methods

  • Private

    Returns void

    Summary

    Announces the provider to the window object

    +

Constructors

Properties

isGrinderyWallet: boolean = true
methods: Partial<ProviderMethods> = ...

Summary

The list of supported provider methods.

+
rpc: Rpc = ...
storage: SdkStorage = ...

Methods

  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

      +
  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • Rest ...data: any[]

      Event data

    Returns Provider

    The instance of the class itself

    Summary

    Emits an event

    -
  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

      +
  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • callback: Function

      Callback function

    Returns Provider

    The instance of the class itself

    Summary

    Adds a listener to the event

    -
  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • callback: Function

      Callback function

    Returns Provider

    The instance of the class itself

    Summary

    Removes a listener from the event

    -
  • Private

    Returns Promise<void>

    Summary

    Restores the pairing process if pairing token is stored in the local storage

    -
  • Private

    Returns Promise<void>

    Summary

    Restores the session if session Id is stored in the local storage

    -
  • Private

    Returns Promise<void>

    Summary

    Restores the pairing process if pairing token is stored in the local storage

    +
  • Private

    Returns Promise<void>

    Summary

    Restores the session if session Id is stored in the local storage

    +
  • Parameters

    • chainId: any

      Chain id in hex format

    Returns Promise<null>

    Null on success

    Summary

    Switches the chain

    Since

    0.3.0

    -
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/classes_ProviderError.ProviderError.html b/docs/classes/classes_ProviderError.ProviderError.html index f357e02..4a561b1 100644 --- a/docs/classes/classes_ProviderError.ProviderError.html +++ b/docs/classes/classes_ProviderError.ProviderError.html @@ -1,6 +1,6 @@ -ProviderError | Grindery Wallet SDK - v0.3.0

Summary

Error class for wallet Provider

+ProviderError | Grindery Wallet SDK - v0.4.0

Summary

Error class for wallet Provider

Since

0.1.0

-

Hierarchy

  • Error
    • ProviderError

Constructors

Hierarchy

  • Error
    • ProviderError

Constructors

Properties

cause? code? data? @@ -10,7 +10,7 @@

Since

0.1.0

prepareStackTrace? stackTraceLimit

Methods

Constructors

Properties

cause?: unknown
code?: number
data?: unknown
message: string
name: string = 'GrinderyWalletProviderError'
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

+

Constructors

Properties

cause?: unknown
code?: number
data?: unknown
message: string
name: string = 'GrinderyWalletProviderError'
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

Type declaration

    • (err, stackTraces): any
    • Parameters

      • err: Error
      • stackTraces: CallSite[]

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    -

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

\ No newline at end of file +

Parameters

  • targetObject: object
  • Optional constructorOpt: Function

Returns void

\ No newline at end of file diff --git a/docs/classes/classes_Rpc.Rpc.html b/docs/classes/classes_Rpc.Rpc.html index 318b835..ce25622 100644 --- a/docs/classes/classes_Rpc.Rpc.html +++ b/docs/classes/classes_Rpc.Rpc.html @@ -1,6 +1,6 @@ -Rpc | Grindery Wallet SDK - v0.3.0

Summary

The Grindery RPC API wrapper class

+Rpc | Grindery Wallet SDK - v0.4.0

Summary

The Grindery RPC API wrapper class

Since

0.2.0

-

Constructors

Constructors

Methods

  • Optional timeout: number

    Optional. The time in milliseconds to wait for the request result. Default is 30000.

  • Returns Promise<T>

    The result of the provider request

    Summary

    Sends a provider request to the Grindery RPC API and waits for the result.

    -
    • Type Parameters

      • T

      Parameters

      • method: RpcMethodNames

        Request method name

      • Optional params: object | unknown[]

        Request parameters

      Returns Promise<T>

      The result of the request

      Summary

      Sends a request to the Grindery Walletconnect RPC API.

      -
    • Protected

      Parameters

    • Protected

      Parameters

      • method: string

        Provider request method name

      • Optional params: readonly unknown[]

        Provider request parameters

      Returns Promise<request>

      Promise resolving with the request token to use in the waitGrinderyRpcProviderRequest method

      Summary

      Sends a provider request to the Grindery RPC API.

      -
    • Protected

      Type Parameters

      • T

      Parameters

      • requestToken: string

        A token to identify provider request. Recieved in the results of sendGrinderyRpcProviderRequest method.

        +
    • Protected

      Type Parameters

      • T

      Parameters

      • requestToken: string

        A token to identify provider request. Recieved in the results of sendGrinderyRpcProviderRequest method.

      • Optional timeout: number

        Optional. The time in milliseconds to wait for the request result. Default is 30000.

      Returns Promise<T>

      The result of the provider request

      Summary

      Waits for the result of the provider request.

      -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/classes/classes_SdkStorage.SdkStorage.html b/docs/classes/classes_SdkStorage.SdkStorage.html index 5bc81d7..0230a69 100644 --- a/docs/classes/classes_SdkStorage.SdkStorage.html +++ b/docs/classes/classes_SdkStorage.SdkStorage.html @@ -1,22 +1,22 @@ -SdkStorage | Grindery Wallet SDK - v0.3.0

    Summary

    A class to handle local storage

    +SdkStorage | Grindery Wallet SDK - v0.4.0

    Summary

    A class to handle local storage

    Since

    0.2.0

    -

    Constructors

    Constructors

    Methods

    • Parameters

      • key: "address" | "pairingToken" | "sessionId" | "connectUrl" | "connectUrlBrowser" | "shortToken" | "clientId" | "chainId"

        Provider storage key

        +
    • Parameters

      • key: "address" | "pairingToken" | "sessionId" | "connectUrl" | "connectUrlBrowser" | "shortToken" | "clientId" | "chainId"

        Provider storage key

      Returns string

      The value of the storage by the key

      Summary

      Gets the value of the storage by the key

      -
    • Parameters

      • key: "address" | "pairingToken" | "sessionId" | "connectUrl" | "connectUrlBrowser" | "shortToken" | "clientId" | "chainId"

        Provider storage key

        +
    • Parameters

      • key: "address" | "pairingToken" | "sessionId" | "connectUrl" | "connectUrlBrowser" | "shortToken" | "clientId" | "chainId"

        Provider storage key

      • value: string

        The value to set

      Returns string

      Summary

      Sets the value of the storage by the key

      -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/classes/classes_WalletSDK.WalletSDK.html b/docs/classes/classes_WalletSDK.WalletSDK.html index dee5e9b..f41edaf 100644 --- a/docs/classes/classes_WalletSDK.WalletSDK.html +++ b/docs/classes/classes_WalletSDK.WalletSDK.html @@ -1,11 +1,12 @@ -WalletSDK | Grindery Wallet SDK - v0.3.0

    Summary

    The Wallet SDK class

    +WalletSDK | Grindery Wallet SDK - v0.4.0

    Summary

    The Wallet SDK class

    Since

    0.2.0

    -

    Constructors

    Constructors

    Properties

    provider: Provider

    Summary

    The provider instance

    -
    storage: SdkStorage = ...

    Summary

    SdkStorage class instance

    -

    Methods

    • Returns Promise<string[]>

      The array of ethereum addresses

      +

    Constructors

    Properties

    provider: Provider

    Summary

    The provider instance

    +
    storage: SdkStorage = ...

    Summary

    SdkStorage class instance

    +

    Methods

    • Returns Promise<string[]>

      The array of ethereum addresses

      Summary

      Initiate connection to the Grindery Wallet

      Since

      0.1.0

      -
    • Returns Promise<boolean>

      True if wallet is disconnected

      +
    • Returns Promise<boolean>

      True if wallet is disconnected

      Summary

      Disconnects Grindery Wallet

      Since

      0.1.0

      -
    • Returns string

      Returns chain id in CAIP-2 format

      +
    • Returns string

      Returns chain id in CAIP-2 format

      Summary

      Gets currently connected chain

      Since

      0.3.0

      -
    • Parameters

      • userId: string

        Telegram user ID

        +

      Returns Promise<string>

      Grindery Wallet address

      +

      Summary

      Exchange Telegram user ID to Grindery Wallet address

      +

      Since

      0.4.0

      +
    • Private

      Parameters

      Returns void

      Summary

      Handles the pairing request, by opening the Grindery Wallet

      -
    • Private

      Parameters

      Returns void

      Summary

      Handles the pairing request, by opening the Grindery Wallet

      +
    • Returns boolean

      True if the provider is connected to the server.

      Summary

      Checks if the provider is connected to the server

      Example

      const isConnected = window.Grindery.WalletSDK.isConnected();
       
      -
    • Returns boolean

      True if the provider is connected to the server and the Grindery Wallet.

      +
    • Returns boolean

      True if the provider is connected to the server and the Grindery Wallet.

      Summary

      Checks if the provider is connected to the server and the Grindery Wallet

      -
    • Parameters

      • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

        Event name

      • callback: Function

        Callback function

      Returns WalletSDK

      The instance of the class itself

      Summary

      Adds a listener to the event

      -
    • Parameters

      • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

        Event name

        +
    • Parameters

      • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

        Event name

      • callback: Function

        Callback function

      Returns WalletSDK

      The instance of the class itself

      Summary

      Removes a listener from the event

      -
    • Parameters

      • params: {
            data?: string;
            to: string;
            value?: string;
        }

        The transaction parameters

        +
    • Parameters

      • params: {
            data?: string;
            to: string;
            value?: string;
        }

        The transaction parameters

        • Optional data?: string

          The data to send

        • to: string

          The recipient address

        • Optional value?: string

          The amount to send in wei

      Returns Promise<string>

      Transaction hash string

      Summary

      Sends a transaction request to the Grindery Wallet

      Since

      0.1.0

      -
    • Parameters

      • message: string

        The message to sign

      Returns Promise<string>

      Signature string

      Summary

      Sends a personal signature request to the Grindery Wallet

      Since

      0.1.0

      -
    • Parameters

      • chainId: string

        Chain id in CAIP-2 format

      Returns Promise<null>

      Returns null on success

      Summary

      Requests the Grindery Wallet to switch the chain

      Since

      0.3.0

      -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/enums/classes_EventEmitter.ProviderEvents.html b/docs/enums/classes_EventEmitter.ProviderEvents.html index 71a67e6..a0e0a5b 100644 --- a/docs/enums/classes_EventEmitter.ProviderEvents.html +++ b/docs/enums/classes_EventEmitter.ProviderEvents.html @@ -1,10 +1,10 @@ -ProviderEvents | Grindery Wallet SDK - v0.3.0

    Summary

    Provider events

    +ProviderEvents | Grindery Wallet SDK - v0.4.0

    Summary

    Provider events

    Since

    0.2.0

    Link

    https://eips.ethereum.org/EIPS/eip-1193#provider-events

    -

    Enumeration Members

    Enumeration Members

    accountsChanged: "accountsChanged"
    chainChanged: "chainChanged"
    connect: "connect"
    disconnect: "disconnect"
    message: "message"
    pair: "pair"
    \ No newline at end of file +

    Enumeration Members

    accountsChanged: "accountsChanged"
    chainChanged: "chainChanged"
    connect: "connect"
    disconnect: "disconnect"
    message: "message"
    pair: "pair"
    \ No newline at end of file diff --git a/docs/enums/classes_Provider.ProviderMethodNames.html b/docs/enums/classes_Provider.ProviderMethodNames.html index 7ea5913..15bccd2 100644 --- a/docs/enums/classes_Provider.ProviderMethodNames.html +++ b/docs/enums/classes_Provider.ProviderMethodNames.html @@ -1,7 +1,7 @@ -ProviderMethodNames | Grindery Wallet SDK - v0.3.0

    Summary

    The Grindery wallet provider method names

    +ProviderMethodNames | Grindery Wallet SDK - v0.4.0

    Summary

    The Grindery wallet provider method names

    Since

    0.2.0

    Since

    0.3.0 Added eth_chainId, wallet_addEthereumChain and wallet_switchEthereumChain methods

    -

    Enumeration Members

    Enumeration Members

    Enumeration Members

    eth_accounts: "eth_accounts"
    eth_chainId: "eth_chainId"
    eth_requestAccounts: "eth_requestAccounts"
    eth_sendTransaction: "eth_sendTransaction"
    gws_disconnect: "gws_disconnect"
    personal_sign: "personal_sign"
    wallet_addEthereumChain: "wallet_addEthereumChain"
    wallet_switchEthereumChain: "wallet_switchEthereumChain"
    \ No newline at end of file +

    Enumeration Members

    eth_accounts: "eth_accounts"
    eth_chainId: "eth_chainId"
    eth_requestAccounts: "eth_requestAccounts"
    eth_sendTransaction: "eth_sendTransaction"
    gws_disconnect: "gws_disconnect"
    personal_sign: "personal_sign"
    wallet_addEthereumChain: "wallet_addEthereumChain"
    wallet_switchEthereumChain: "wallet_switchEthereumChain"
    \ No newline at end of file diff --git a/docs/enums/classes_Rpc.RpcMethodNames.html b/docs/enums/classes_Rpc.RpcMethodNames.html index 0ec5a67..7612808 100644 --- a/docs/enums/classes_Rpc.RpcMethodNames.html +++ b/docs/enums/classes_Rpc.RpcMethodNames.html @@ -1,7 +1,8 @@ -RpcMethodNames | Grindery Wallet SDK - v0.3.0

    Summary

    The Grindery RPC API method names

    -

    Enumeration Members

    disconnect +RpcMethodNames | Grindery Wallet SDK - v0.4.0

    Summary

    The Grindery RPC API method names

    +

    Enumeration Members

    disconnect: "disconnect"
    request: "request"
    requestPairing: "requestPairing"
    waitForPairingResult: "waitForPairingResult"
    waitForRequestResult: "waitForRequestResult"
    \ No newline at end of file +

    Enumeration Members

    disconnect: "disconnect"
    getUserWalletAddress: "getUserWalletAddress"
    request: "request"
    requestPairing: "requestPairing"
    waitForPairingResult: "waitForPairingResult"
    waitForRequestResult: "waitForRequestResult"
    \ No newline at end of file diff --git a/docs/enums/classes_SdkStorage.SdkStorageKeys.html b/docs/enums/classes_SdkStorage.SdkStorageKeys.html index a423042..9446e03 100644 --- a/docs/enums/classes_SdkStorage.SdkStorageKeys.html +++ b/docs/enums/classes_SdkStorage.SdkStorageKeys.html @@ -1,6 +1,6 @@ -SdkStorageKeys | Grindery Wallet SDK - v0.3.0

    Summary

    SdkStorage keys

    +SdkStorageKeys | Grindery Wallet SDK - v0.4.0

    Summary

    SdkStorage keys

    Since

    0.2.0

    -

    Enumeration Members

    Enumeration Members

    Enumeration Members

    address: "address"
    chainId: "chainId"
    clientId: "clientId"
    connectUrl: "connectUrl"
    connectUrlBrowser: "connectUrlBrowser"
    pairingToken: "pairingToken"
    sessionId: "sessionId"
    shortToken: "shortToken"
    \ No newline at end of file +

    Enumeration Members

    address: "address"
    chainId: "chainId"
    clientId: "clientId"
    connectUrl: "connectUrl"
    connectUrlBrowser: "connectUrlBrowser"
    pairingToken: "pairingToken"
    sessionId: "sessionId"
    shortToken: "shortToken"
    \ No newline at end of file diff --git a/docs/example/dist/classes/Rpc.d.ts b/docs/example/dist/classes/Rpc.d.ts index 67a6f5b..fcd1ee3 100644 --- a/docs/example/dist/classes/Rpc.d.ts +++ b/docs/example/dist/classes/Rpc.d.ts @@ -6,7 +6,8 @@ export declare enum RpcMethodNames { waitForPairingResult = "waitForPairingResult", request = "request", waitForRequestResult = "waitForRequestResult", - 'disconnect' = "disconnect" + 'disconnect' = "disconnect", + getUserWalletAddress = "getUserWalletAddress" } /** * @summary The Grindery RPC API request results @@ -53,6 +54,10 @@ export declare namespace RpcRequestResults { * @summary `disconnect` method result */ type disconnect = boolean; + /** + * @summary `getUserWalletAddress` method result + */ + type getUserWalletAddress = string; } /** * @summary The Grindery RPC API wrapper class diff --git a/docs/example/dist/classes/WalletSDK.d.ts b/docs/example/dist/classes/WalletSDK.d.ts index 12f8530..5b804be 100644 --- a/docs/example/dist/classes/WalletSDK.d.ts +++ b/docs/example/dist/classes/WalletSDK.d.ts @@ -1,5 +1,6 @@ import { ProviderEventName } from './EventEmitter'; import { Provider } from './Provider'; +import { RpcRequestResults } from './Rpc'; export type WalletSDKConfig = { appId?: string; }; @@ -81,6 +82,14 @@ export declare class WalletSDK { * @returns {string} Returns chain id in CAIP-2 format */ getChain(): string; + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */ + getUserWalletAddress(userId: string): Promise; /** * @summary Adds a listener to the event * @public diff --git a/docs/example/dist/grindery-wallet-sdk.cjs.development.js b/docs/example/dist/grindery-wallet-sdk.cjs.development.js index be0629b..d8e7da0 100644 --- a/docs/example/dist/grindery-wallet-sdk.cjs.development.js +++ b/docs/example/dist/grindery-wallet-sdk.cjs.development.js @@ -684,6 +684,7 @@ var RpcMethodNames; RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1614,13 +1615,48 @@ var WalletSDK = /*#__PURE__*/function () { _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/docs/example/dist/grindery-wallet-sdk.cjs.development.js.map b/docs/example/dist/grindery-wallet-sdk.cjs.development.js.map index f0df5b6..009c2ec 100644 --- a/docs/example/dist/grindery-wallet-sdk.cjs.development.js.map +++ b/docs/example/dist/grindery-wallet-sdk.cjs.development.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.cjs.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA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ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,cAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC7BA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAPWA,cAAc,KAAdA,cAAc,GAOzB,E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AC4O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;AACpC,KAAA;GACD,CAAA;AAAA,EAAA,OAAAnB,SAAA,CAAA;AAAA,CAAA,EAAA;;AChNH;;AAEG;AACI,IAAMwB,iBAAiB,GAAGxB,UAAS;AAE1C,SAASyB,IAAIA,GAAA;AAAA,EAAA,IAAA1P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACAyB,IAAI,EAAE;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.cjs.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTI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zMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG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AAQ,KAAA,IAAA,GAAA,KAAA,CAAA,GAAfF,gBAAA,CAAiBC,MAAM,CAAA;IACtC,IAAME,WAAW,0DAAwDhG,UAAY,CAAA;AACrF,IAAA,IACE8F,MAAM,IACNA,MAAM,CAACG,gBAAgB,IACvBH,MAAM,CAACI,QAAQ,IACfJ,MAAM,CAACI,QAAQ,KAAK,SAAS,EAC7B;AACAJ,MAAAA,MAAM,CAACG,gBAAgB,CAAClG,iBAAiB,CAAC,CAAA;MAC1C,IAAI+F,MAAM,CAACK,KAAK,EAAE;AAChB9O,QAAAA,MAAM,CAAC0O,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;AAChC,OAAA;AACF,KAAC,MAAM;AACL9O,MAAAA,MAAM,CAAC+O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;AACpC,KAAA;GACD,CAAA;AAAA,EAAA,OAAAtB,SAAA,CAAA;AAAA,CAAA,EAAA;;AClOH;;AAEG;AACI,IAAM2B,iBAAiB,GAAG3B,UAAS;AAE1C,SAAS4B,IAAIA,GAAA;AAAA,EAAA,IAAA7P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACA4B,IAAI,EAAE;;;;"} \ No newline at end of file diff --git a/docs/example/dist/grindery-wallet-sdk.cjs.production.min.js b/docs/example/dist/grindery-wallet-sdk.cjs.production.min.js index e83b74b..abc1259 100644 --- a/docs/example/dist/grindery-wallet-sdk.cjs.production.min.js +++ b/docs/example/dist/grindery-wallet-sdk.cjs.production.min.js @@ -1,2 +1,2 @@ -"use strict";function e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(e=function(){return!!t})()}function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof y?t:y).prototype),a=new O(n||[]);return o(i,"_invoke",{value:k(e,r,a)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var d="suspendedStart",f="suspendedYield",g="executing",w="completed",v={};function y(){}function N(){}function m(){}var M={};p(M,s,(function(){return this}));var I=Object.getPrototypeOf,D=I&&I(I(z([])));D&&D!==n&&i.call(D,s)&&(M=D);var j=m.prototype=y.prototype=Object.create(M);function T(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,o,a,s){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(p).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var n;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(o,o):o()}})}function k(t,r,n){var i=d;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===w){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=b(s,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?w:f,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=w,n.method="throw",n.arg=u.arg)}}}function b(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,b(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},r}function r(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,c,"next",e)}function c(e){r(a,i,o,s,c,"throw",e)}s(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),l=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:U(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},r}function r(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var s=e.apply(t,n);function a(e){r(s,i,o,a,c,"next",e)}function c(e){r(s,i,o,a,c,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),l=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MU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TIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"mkQAMA,IAAYA,yDAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OAAOO,IAAIF,IACnBN,KAAKC,OAAOQ,IAAIH,EAAO,IAEzBN,KAAKC,OAAOS,IAAIJ,GAAQK,KAAKJ,GACtBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAC9C,GAAIP,KAAKC,OAAOO,IAAIF,GAAQ,CAC1B,IAAMO,EAAYb,KAAKC,OAAOS,IAAIJ,GAAQQ,QAAO,SAACC,GAAE,OAAKA,IAAOR,KAChEP,KAAKC,OAAOQ,IAAIH,EAAOO,EACzB,CACA,OAAOb,IACT,EAEAG,EAOUa,KAAA,SAAKV,GAAwC,IAAAW,IAAAA,EAAAC,UAAAC,OAAXC,MAAWC,MAAAJ,EAAAA,EAAAA,OAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAXF,EAAWE,EAAAJ,GAAAA,UAAAI,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VQ/F,EAAjBc,mBAWM8E,EAAOK,OACT7N,OAAOyN,SAASD,OAAOK,SAGzB7N,OAAO8N,KAAKJ,EAAa,WAE5BnB,CAAA,CA/MmB,GDETwB,EAAoBxB,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.cjs.production.min.js","sources":["../src/classes/EventEmitter.ts","../src/classes/SdkStorage.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/index.ts","../src/classes/WalletSDK.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3ND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Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"mkQAMA,IAAYA,yDAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OAAOO,IAAIF,IACnBN,KAAKC,OAAOQ,IAAIH,EAAO,IAEzBN,KAAKC,OAAOS,IAAIJ,GAAQK,KAAKJ,GACtBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAC9C,GAAIP,KAAKC,OAAOO,IAAIF,GAAQ,CAC1B,IAAMO,EAAYb,KAAKC,OAAOS,IAAIJ,GAAQQ,QAAO,SAACC,GAAE,OAAKA,IAAOR,KAChEP,KAAKC,OAAOQ,IAAIH,EAAOO,EACzB,CACA,OAAOb,IACT,EAEAG,EAOUa,KAAA,SAAKV,GAAwC,IAAAW,IAAAA,EAAAC,UAAAC,OAAXC,MAAWC,MAAAJ,EAAAA,EAAAA,OAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAXF,EAAWE,EAAAJ,GAAAA,UAAAI,GAOrD,OANItB,KAAKC,OAAOO,IAAIF,KAClBiB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,OAAlBA,EAAGxN,OAAO6L,WAAP2B,OAAeA,EAAfA,EAAiB1B,gBAAjB0B,EAAAA,EAA4BC,MACzC,SAACpB,GAA4B,OAC3BA,aAAoBvF,GAAYuF,EAAS7E,oBAY7C,OATG6E,GACDrM,OAAO6L,oBAAoB/E,GAC3B9G,OAAO6L,SAASrE,mBAEhB6E,EAAWrM,OAAO6L,UAEfQ,IACHA,EAAW,IAAIvF,GAEVuF,CACT,EAEA1O,EAMQgP,cAAA,SAAA/E,GAG2B,IAAA8F,EAC3BC,EAAwB,OAAlBD,EAAG1N,OAAO4N,eAAQ,EAAfF,EAAiBC,OAC1BE,uDAJIjG,EAAVe,WAMEgF,GACAA,EAAOG,kBACPH,EAAOI,UACa,YAApBJ,EAAOI,UAEPJ,EAAOG,iBAVQlG,EAAjBc,mBAWMiF,EAAOK,OACThO,OAAO4N,SAASD,OAAOK,SAGzBhO,OAAOiO,KAAKJ,EAAa,WAE5BtB,CAAA,CAhOmB,GDCT2B,EAAoB3B,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file diff --git a/docs/example/dist/grindery-wallet-sdk.esm.js b/docs/example/dist/grindery-wallet-sdk.esm.js index 7378f29..bc0e0ee 100644 --- a/docs/example/dist/grindery-wallet-sdk.esm.js +++ b/docs/example/dist/grindery-wallet-sdk.esm.js @@ -680,6 +680,7 @@ var RpcMethodNames; RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1610,13 +1611,48 @@ var WalletSDK = /*#__PURE__*/function () { _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/docs/example/dist/grindery-wallet-sdk.esm.js.map b/docs/example/dist/grindery-wallet-sdk.esm.js.map index 6ca2d36..1d0bed7 100644 --- a/docs/example/dist/grindery-wallet-sdk.esm.js.map +++ b/docs/example/dist/grindery-wallet-sdk.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.esm.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1Njgg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2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,cAAA,CAAA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,gBAAgB,IACvBH,MAAM,CAACI,QAAQ,IACfJ,MAAM,CAACI,QAAQ,KAAK,SAAS,EAC7B;AACAJ,MAAAA,MAAM,CAACG,gBAAgB,CAAC/F,iBAAiB,CAAC,CAAA;MAC1C,IAAI4F,MAAM,CAACK,KAAK,EAAE;AAChB3O,QAAAA,MAAM,CAACuO,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;AAChC,OAAA;AACF,KAAC,MAAM;AACL3O,MAAAA,MAAM,CAAC4O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;AACpC,KAAA;GACD,CAAA;AAAA,EAAA,OAAAnB,SAAA,CAAA;AAAA,CAAA,EAAA;;AChNH;;AAEG;AACI,IAAMwB,iBAAiB,GAAGxB,UAAS;AAE1C,SAASyB,IAAIA,GAAA;AAAA,EAAA,IAAA1P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACAyB,IAAI,EAAE;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.esm.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0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zLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACA4B,IAAI,EAAE;;;;"} \ No newline at end of file diff --git a/docs/example/dist/grindery-wallet-sdk.umd.development.js b/docs/example/dist/grindery-wallet-sdk.umd.development.js index 9519afa..1f57f09 100644 --- a/docs/example/dist/grindery-wallet-sdk.umd.development.js +++ b/docs/example/dist/grindery-wallet-sdk.umd.development.js @@ -686,6 +686,7 @@ RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1616,13 +1617,48 @@ _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/docs/example/dist/grindery-wallet-sdk.umd.development.js.map b/docs/example/dist/grindery-wallet-sdk.umd.development.js.map index 2e3429a..450c933 100644 --- a/docs/example/dist/grindery-wallet-sdk.umd.development.js.map +++ b/docs/example/dist/grindery-wallet-sdk.umd.development.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.umd.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: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MTA3IDcxLjQ2NTdMNTAuMDU1IDcxLjcwNDJDNDkuNzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;MACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;QACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;OAC3B,CAAA,CAAA;EACH,GAAA;EACF,CAAA;EAEA;EACAyB,IAAI,EAAE;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.umd.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3NDggNjYuMTc2OCA2NS44MzUyIDY1LjYwNzkgNjQuOTc1NUM2NC43MDMzIDYzLjYwODYgNjIuODUyNCA2My4yMDgzIDYxLjQ0ODIgNjQuMDY1TDU1LjY2NDggNjcuOTQyOEw1MC41NTYyIDcxLjM3NDdDNTAuNTA3OSA3MS40MDU1IDUwLjQ1OTQgNzEuNDM1OCA1MC40MTA3IDcxLjQ2NTdMNTAuMDU1IDcxLjcwNDJDNDkuNzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;EAKG;EACH,IAAYA,cAOX,CAAA;EAPD,CAAA,UAAYA,cAAc,EAAA;EACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;EACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;EACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;EACnBA,EAAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YA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Q,KAAK,SAAS,EAC7B;EACAJ,MAAAA,MAAM,CAACG,gBAAgB,CAAClG,iBAAiB,CAAC,CAAA;QAC1C,IAAI+F,MAAM,CAACK,KAAK,EAAE;EAChB9O,QAAAA,MAAM,CAAC0O,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;EAChC,OAAA;EACF,KAAC,MAAM;EACL9O,MAAAA,MAAM,CAAC+O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;EACpC,KAAA;KACD,CAAA;EAAA,EAAA,OAAAtB,SAAA,CAAA;EAAA,CAAA,EAAA;;EClOH;;EAEG;AACI,MAAM2B,iBAAiB,GAAG3B,UAAS;EAE1C,SAAS4B,IAAIA,GAAA;EAAA,EAAA,IAAA7P,gBAAA,CAAA;IACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;MACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;QACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;OAC3B,CAAA,CAAA;EACH,GAAA;EACF,CAAA;EAEA;EACA4B,IAAI,EAAE;;;;;;;;;;"} \ No newline at end of file diff --git a/docs/example/dist/grindery-wallet-sdk.umd.production.min.js b/docs/example/dist/grindery-wallet-sdk.umd.production.min.js index 268a771..7d2c924 100644 --- a/docs/example/dist/grindery-wallet-sdk.umd.production.min.js +++ b/docs/example/dist/grindery-wallet-sdk.umd.production.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["grindery-wallet-sdk"]={})}(this,(function(e){"use strict";function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}function r(){r=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof y?t:y).prototype),s=new O(n||[]);return o(i,"_invoke",{value:b(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",f="suspendedYield",g="executing",w="completed",v={};function y(){}function N(){}function m(){}var M={};p(M,a,(function(){return this}));var I=Object.getPrototypeOf,D=I&&I(I(z([])));D&&D!==n&&i.call(D,a)&&(M=D);var j=m.prototype=y.prototype=Object.create(M);function T(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,o,s,a){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,s,a)}),(function(e){r("throw",e,s,a)})):t.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,a)}))}a(c.arg)}var n;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(o,o):o()}})}function b(t,r,n){var i=d;return function(o,s){if(i===g)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?w:f,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=w,n.method="throw",n.arg=u.arg)}}}function k(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var s=o.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function n(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,c,"next",e)}function c(e){n(s,i,o,a,c,"throw",e)}a(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),d=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:U(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function n(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,c,"next",e)}function c(e){n(s,i,o,a,c,"throw",e)}a(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),d=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1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uMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"ozQAMA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OAAOO,IAAIF,IACnBN,KAAKC,OAAOQ,IAAIH,EAAO,IAEzBN,KAAKC,OAAOS,IAAIJ,GAAQK,KAAKJ,GACtBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAC9C,GAAIP,KAAKC,OAAOO,IAAIF,GAAQ,CAC1B,IAAMO,EAAYb,KAAKC,OAAOS,IAAIJ,GAAQQ,QAAO,SAACC,GAAE,OAAKA,IAAOR,KAChEP,KAAKC,OAAOQ,IAAIH,EAAOO,EACzB,CACA,OAAOb,IACT,EAEAG,EAOUa,KAAA,SAAKV,GAAwC,IAAAW,IAAAA,EAAAC,UAAAC,OAAXC,MAAWC,MAAAJ,EAAAA,EAAAA,OAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAXF,EAAWE,EAAAJ,GAAAA,UAAAI,GAOrD,OANItB,KAAKC,OAAOO,IAAIF,KAClBiB,QAAQC,IAAI,gCAAiClB,EAAOc,EAAK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,KAAKJ,EAAa,WAE5BnB,CAAA,CA/MmB,GDETwB,EAAoBxB,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.umd.production.min.js","sources":["../src/classes/EventEmitter.ts","../src/classes/SdkStorage.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/index.ts","../src/classes/WalletSDK.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3NDggNjYuMTc2OCA2NS44MzUyIDY1LjYwNzkgNjQuOTc1NUM2NC43MDMzIDYzLjYwODYgNjIu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\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"ozQAMA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OAAOO,IAAIF,IACnBN,KAAKC,OAAOQ,IAAIH,EAAO,IAEzBN,KAAKC,OAAOS,IAAIJ,GAAQK,KAAKJ,GACtBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAC9C,GAAIP,KAAKC,OAAOO,IAAIF,GAAQ,CAC1B,IAAMO,EAAYb,KAAKC,OAAOS,IAAIJ,GAAQQ,QAAO,SAACC,GAAE,OAAKA,IAAOR,KAChEP,KAAKC,OAAOQ,IAAIH,EAAOO,EACzB,CACA,OAAOb,IACT,EAEAG,EAOUa,KAAA,SAAKV,GAAwC,IAAAW,IAAAA,EAAAC,UAAAC,OAAXC,MAAWC,MAAAJ,EAAAA,EAAAA,OAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAXF,EAAWE,EAAAJ,GAAAA,UAAAI,GAOrD,OANItB,KAAKC,OAAOO,IAAIF,KAClBiB,QAAQC,IAAI,gCAAiClB,EAAOc,EAAK,IACzDpB,KAAKC,OAAOS,IAAIJ,GAAQmB,SAA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4BC,MACzC,SAACpB,GAA4B,OAC3BA,aAAoBvF,GAAYuF,EAAS7E,oBAY7C,OATG6E,GACDrM,OAAO6L,oBAAoB/E,GAC3B9G,OAAO6L,SAASrE,mBAEhB6E,EAAWrM,OAAO6L,UAEfQ,IACHA,EAAW,IAAIvF,GAEVuF,CACT,EAEA1O,EAMQgP,cAAA,SAAA/E,GAG2B,IAAA8F,EAC3BC,EAAwB,OAAlBD,EAAG1N,OAAO4N,eAAQ,EAAfF,EAAiBC,OAC1BE,uDAJIjG,EAAVe,WAMEgF,GACAA,EAAOG,kBACPH,EAAOI,UACa,YAApBJ,EAAOI,UAEPJ,EAAOG,iBAVQlG,EAAjBc,mBAWMiF,EAAOK,OACThO,OAAO4N,SAASD,OAAOK,SAGzBhO,OAAOiO,KAAKJ,EAAa,WAE5BtB,CAAA,CAhOmB,GDCT2B,EAAoB3B,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file diff --git a/docs/example/index.html b/docs/example/index.html index 51a2700..f866f76 100644 --- a/docs/example/index.html +++ b/docs/example/index.html @@ -36,6 +36,7 @@ >.

    +
    Waiting wallet provider...
    diff --git a/docs/example/main.js b/docs/example/main.js index bf5381f..af06d6d 100644 --- a/docs/example/main.js +++ b/docs/example/main.js @@ -22,6 +22,26 @@ const showUsername = (target) => { } }; +const getAndShowWalletAddress = (target) => { + const WebApp = window && window.Telegram && window.Telegram.WebApp; + if (WebApp) { + const user = WebApp && WebApp.initDataUnsafe && WebApp.initDataUnsafe.user; + if (user && user.id && target) { + window.Grindery.WalletSDK.getUserWalletAddress(user.id) + .then((address) => { + if (address) { + target.innerHTML = `

    Auto-detected wallet address: ${shortenAddress( + address + )}

    `; + } + }) + .catch((error) => { + console.error('getUserWalletAddress', error); + }); + } + } +}; + const showConnectButton = (target) => { if (!target) { return; @@ -43,6 +63,7 @@ const showConnectedWallet = (address, target) => { if (!target || !address) { return; } + document.getElementById('wallet').innerHTML = ''; target.innerHTML = `

    Grindery Wallet Connected to ${ newChainId === 'eip155:204' ? 'Polygon' : 'opBNB' @@ -252,6 +273,7 @@ const onProviderConnect = ({ chainId }) => { newChainName = chainId === '0xcc' ? 'Polygon' : 'opBNB'; listenProviderEvents(targetEl); showUsername(targetEl); + getAndShowWalletAddress(document.getElementById('wallet')); showConnectButton(targetEl); }; diff --git a/docs/functions/classes_ProviderError.newProviderError.html b/docs/functions/classes_ProviderError.newProviderError.html index 5f04ec0..59cb417 100644 --- a/docs/functions/classes_ProviderError.newProviderError.html +++ b/docs/functions/classes_ProviderError.newProviderError.html @@ -1 +1 @@ -newProviderError | Grindery Wallet SDK - v0.3.0

    \ No newline at end of file +newProviderError | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/functions/utils_chains.hexChainId.html b/docs/functions/utils_chains.hexChainId.html index 2df6cc7..fe4a8ad 100644 --- a/docs/functions/utils_chains.hexChainId.html +++ b/docs/functions/utils_chains.hexChainId.html @@ -1 +1 @@ -hexChainId | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +hexChainId | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/functions/utils_chains.unhexChainId.html b/docs/functions/utils_chains.unhexChainId.html index 1fde486..5c5ca38 100644 --- a/docs/functions/utils_chains.unhexChainId.html +++ b/docs/functions/utils_chains.unhexChainId.html @@ -1 +1 @@ -unhexChainId | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +unhexChainId | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/functions/utils_getAppId.getAppId.html b/docs/functions/utils_getAppId.getAppId.html index 3804ffe..38c0a81 100644 --- a/docs/functions/utils_getAppId.getAppId.html +++ b/docs/functions/utils_getAppId.getAppId.html @@ -1,3 +1,3 @@ -getAppId | Grindery Wallet SDK - v0.3.0
    • Returns string

      The app id

      +getAppId | Grindery Wallet SDK - v0.4.0
      • Returns string

        The app id

        Summary

        Get the app id from the script tag or window object

        -
      \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/functions/utils_uuid.uuid.html b/docs/functions/utils_uuid.uuid.html index 1aa8b2d..48c9f8d 100644 --- a/docs/functions/utils_uuid.uuid.html +++ b/docs/functions/utils_uuid.uuid.html @@ -1,3 +1,3 @@ -uuid | Grindery Wallet SDK - v0.3.0
    • Returns string

      The UUID

      +uuid | Grindery Wallet SDK - v0.4.0
      • Returns string

        The UUID

        Summary

        Generates a Version 4 (pseudorandom) UUID

        -
      \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 038acbd..a415060 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -1 +1 @@ -Grindery Wallet SDK - v0.3.0

    Grindery Wallet SDK - v0.3.0

    Class Hierarchy

    \ No newline at end of file +Grindery Wallet SDK - v0.4.0

    Grindery Wallet SDK - v0.4.0

    Class Hierarchy

    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index e0c6be4..d4765ab 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,4 +1,4 @@ -Grindery Wallet SDK - v0.3.0

    Grindery Wallet SDK - v0.3.0

    Grindery Wallet SDK is a JS library that provides a reliable, secure, and seamless connection from your dapp to the Grindery Smart-Wallet.

    +Grindery Wallet SDK - v0.4.0

    Grindery Wallet SDK - v0.4.0

    Grindery Wallet SDK is a JS library that provides a reliable, secure, and seamless connection from your dapp to the Grindery Smart-Wallet.

    Grindery Wallet Beta

    GitHub package.json dynamic @@ -19,6 +19,7 @@

  • Basic usage
    • Server connection
    • Wallet connection
    • +
    • Silently getting wallet address
    • Sending transactions
    • Signing
    • Chain switching
    • @@ -89,6 +90,13 @@

      To disconnect user's wallet use disconnect() method (and you can listen for disconnect event):

      WalletSDK.on('disconnect',  => {
      console.log('Wallet disconnected');
      });

      WalletSDK.disconnect();
      +

      Silently getting wallet address

      The SDK allows dApps to exchange Telegram user ID to user's EVM wallet address.

      +

      The method doesn't require user to go through the wallet connection process, and can be executed silently in the background. However, without fully connected wallet a dApp has read-only access, and can't request message signing or transactions sending. To do this ask user to connect the wallet first.

      +
      WalletSDK.on('connect', async () => {
      const userId = '123456';
      const telegramUserWallet =
      await window.Grindery.WalletSDK.getUserWalletAddress(userId);
      }); +
      +

      This can be especially usefull for Telegram mini-apps, where user ID can be detected automatically. For example:

      +
      WalletSDK.on('connect', async () => {
      const telegramUserWallet =
      await window.Grindery.WalletSDK.getUserWalletAddress(
      window.Telegram?.WebApp?.initDataUnsafe?.user?.id
      );
      }); +

      Sending transactions

      To request transaction sending use sendTransaction() method, once the wallet is connected:

      WalletSDK.on('accountsChanged', async (addresses: string[]) => {
      const transactionHash = await WalletSDK.sendTransaction({
      to: '0x0', // required
      value: '', // optional
      data: '', // optional
      });
      });
      @@ -148,4 +156,4 @@

      SDK Development and building

      The SDK library compiled using DTS tool (a fork of TSDX).

      See full development documentation here.

      License

      MIT

      -
  • \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/interfaces/classes_Provider.ProviderRequestArguments.html b/docs/interfaces/classes_Provider.ProviderRequestArguments.html index 623a749..869ed11 100644 --- a/docs/interfaces/classes_Provider.ProviderRequestArguments.html +++ b/docs/interfaces/classes_Provider.ProviderRequestArguments.html @@ -1,5 +1,5 @@ -ProviderRequestArguments | Grindery Wallet SDK - v0.3.0

    Summary

    The Grindery wallet provider request arguments

    +ProviderRequestArguments | Grindery Wallet SDK - v0.4.0

    Summary

    The Grindery wallet provider request arguments

    Since

    0.2.0

    -
    interface ProviderRequestArguments {
        method: "eth_requestAccounts" | "eth_accounts" | "personal_sign" | "eth_sendTransaction" | "gws_disconnect" | "eth_chainId" | "wallet_addEthereumChain" | "wallet_switchEthereumChain";
        params?: ProviderRequestArgumentsParams;
    }

    Properties

    interface ProviderRequestArguments {
        method: "eth_requestAccounts" | "eth_accounts" | "personal_sign" | "eth_sendTransaction" | "gws_disconnect" | "eth_chainId" | "wallet_addEthereumChain" | "wallet_switchEthereumChain";
        params?: ProviderRequestArgumentsParams;
    }

    Properties

    Properties

    method: "eth_requestAccounts" | "eth_accounts" | "personal_sign" | "eth_sendTransaction" | "gws_disconnect" | "eth_chainId" | "wallet_addEthereumChain" | "wallet_switchEthereumChain"
    \ No newline at end of file +

    Properties

    method: "eth_requestAccounts" | "eth_accounts" | "personal_sign" | "eth_sendTransaction" | "gws_disconnect" | "eth_chainId" | "wallet_addEthereumChain" | "wallet_switchEthereumChain"
    \ No newline at end of file diff --git a/docs/interfaces/utils_providerInfo.EIP6963ProviderInfo.html b/docs/interfaces/utils_providerInfo.EIP6963ProviderInfo.html index ec6af70..196b5bf 100644 --- a/docs/interfaces/utils_providerInfo.EIP6963ProviderInfo.html +++ b/docs/interfaces/utils_providerInfo.EIP6963ProviderInfo.html @@ -1,7 +1,7 @@ -EIP6963ProviderInfo | Grindery Wallet SDK - v0.3.0

    Represents the assets needed to display a wallet

    +EIP6963ProviderInfo | Grindery Wallet SDK - v0.4.0

    Represents the assets needed to display a wallet

    interface EIP6963ProviderInfo {
        icon: string;
        name: string;
        rdns: string;
        uuid: string;
    }

    Properties

    interface EIP6963ProviderInfo {
        icon: string;
        name: string;
        rdns: string;
        uuid: string;
    }
    \ No newline at end of file +
    uuid: string
    \ No newline at end of file diff --git a/docs/modules/classes_EventEmitter.html b/docs/modules/classes_EventEmitter.html index 83289d9..6887b47 100644 --- a/docs/modules/classes_EventEmitter.html +++ b/docs/modules/classes_EventEmitter.html @@ -1,4 +1,4 @@ -classes/EventEmitter | Grindery Wallet SDK - v0.3.0

    Module classes/EventEmitter

    Index

    Enumerations

    ProviderEvents +classes/EventEmitter | Grindery Wallet SDK - v0.4.0

    Module classes/EventEmitter

    Index

    Enumerations

    Classes

    Type Aliases

    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_Provider.ProviderRequestResults.html b/docs/modules/classes_Provider.ProviderRequestResults.html index 8afd670..79d5a6b 100644 --- a/docs/modules/classes_Provider.ProviderRequestResults.html +++ b/docs/modules/classes_Provider.ProviderRequestResults.html @@ -1,4 +1,4 @@ -ProviderRequestResults | Grindery Wallet SDK - v0.3.0

    Index

    Type Aliases

    disconnect +ProviderRequestResults | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_Provider.html b/docs/modules/classes_Provider.html index 6f9508f..cd874ec 100644 --- a/docs/modules/classes_Provider.html +++ b/docs/modules/classes_Provider.html @@ -1,8 +1,8 @@ -classes/Provider | Grindery Wallet SDK - v0.3.0

    Index

    Namespaces

    ProviderRequestResults +classes/Provider | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_ProviderError.html b/docs/modules/classes_ProviderError.html index cd03f07..ede77b8 100644 --- a/docs/modules/classes_ProviderError.html +++ b/docs/modules/classes_ProviderError.html @@ -1,4 +1,4 @@ -classes/ProviderError | Grindery Wallet SDK - v0.3.0

    Module classes/ProviderError

    Index

    Classes

    ProviderError +classes/ProviderError | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_Rpc.RpcRequestResults.html b/docs/modules/classes_Rpc.RpcRequestResults.html index 816391a..ba7efcd 100644 --- a/docs/modules/classes_Rpc.RpcRequestResults.html +++ b/docs/modules/classes_Rpc.RpcRequestResults.html @@ -1,8 +1,9 @@ -RpcRequestResults | Grindery Wallet SDK - v0.3.0

    Summary

    The Grindery RPC API request results

    +RpcRequestResults | Grindery Wallet SDK - v0.4.0

    Summary

    The Grindery RPC API request results

    Since

    0.2.0

    -

    Index

    Type Aliases

    Index

    Type Aliases

    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_Rpc.html b/docs/modules/classes_Rpc.html index b55cd65..6c5e011 100644 --- a/docs/modules/classes_Rpc.html +++ b/docs/modules/classes_Rpc.html @@ -1,4 +1,4 @@ -classes/Rpc | Grindery Wallet SDK - v0.3.0

    Index

    Namespaces

    RpcRequestResults +classes/Rpc | Grindery Wallet SDK - v0.4.0

    Index

    Namespaces

    Enumerations

    Classes

    Rpc -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_SdkStorage.html b/docs/modules/classes_SdkStorage.html index 3568115..71922a9 100644 --- a/docs/modules/classes_SdkStorage.html +++ b/docs/modules/classes_SdkStorage.html @@ -1,5 +1,5 @@ -classes/SdkStorage | Grindery Wallet SDK - v0.3.0

    Module classes/SdkStorage

    Index

    Enumerations

    SdkStorageKeys +classes/SdkStorage | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/classes_WalletSDK.html b/docs/modules/classes_WalletSDK.html index 965ad87..a80615d 100644 --- a/docs/modules/classes_WalletSDK.html +++ b/docs/modules/classes_WalletSDK.html @@ -1,3 +1,3 @@ -classes/WalletSDK | Grindery Wallet SDK - v0.3.0

    Module classes/WalletSDK

    Index

    Classes

    WalletSDK +classes/WalletSDK | Grindery Wallet SDK - v0.4.0

    Module classes/WalletSDK

    Index

    Classes

    Type Aliases

    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/utils_chains.html b/docs/modules/utils_chains.html index fce9615..ced7bf1 100644 --- a/docs/modules/utils_chains.html +++ b/docs/modules/utils_chains.html @@ -1,4 +1,4 @@ -utils/chains | Grindery Wallet SDK - v0.3.0

    Index

    Variables

    CHAINS +utils/chains | Grindery Wallet SDK - v0.4.0

    Index

    Variables

    Functions

    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/utils_getAppId.html b/docs/modules/utils_getAppId.html index 79a78ec..4bed1f0 100644 --- a/docs/modules/utils_getAppId.html +++ b/docs/modules/utils_getAppId.html @@ -1,2 +1,2 @@ -utils/getAppId | Grindery Wallet SDK - v0.3.0

    Index

    Functions

    \ No newline at end of file +utils/getAppId | Grindery Wallet SDK - v0.4.0

    Index

    Functions

    \ No newline at end of file diff --git a/docs/modules/utils_providerInfo.html b/docs/modules/utils_providerInfo.html index b1debcc..e29ab81 100644 --- a/docs/modules/utils_providerInfo.html +++ b/docs/modules/utils_providerInfo.html @@ -1,3 +1,3 @@ -utils/providerInfo | Grindery Wallet SDK - v0.3.0

    Module utils/providerInfo

    Index

    Interfaces

    EIP6963ProviderInfo +utils/providerInfo | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/modules/utils_uuid.html b/docs/modules/utils_uuid.html index 807cdbe..5df676e 100644 --- a/docs/modules/utils_uuid.html +++ b/docs/modules/utils_uuid.html @@ -1,2 +1,2 @@ -utils/uuid | Grindery Wallet SDK - v0.3.0

    Index

    Functions

    \ No newline at end of file +utils/uuid | Grindery Wallet SDK - v0.4.0

    Index

    Functions

    \ No newline at end of file diff --git a/docs/types/classes_EventEmitter.ProviderEventName.html b/docs/types/classes_EventEmitter.ProviderEventName.html index 900fb8f..18c77d8 100644 --- a/docs/types/classes_EventEmitter.ProviderEventName.html +++ b/docs/types/classes_EventEmitter.ProviderEventName.html @@ -1,3 +1,3 @@ -ProviderEventName | Grindery Wallet SDK - v0.3.0
    ProviderEventName: keyof typeof ProviderEvents

    Summary

    Provider event name

    +ProviderEventName | Grindery Wallet SDK - v0.4.0
    ProviderEventName: keyof typeof ProviderEvents

    Summary

    Provider event name

    Since

    0.2.0

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderMethodName.html b/docs/types/classes_Provider.ProviderMethodName.html index 6320a0d..f19116f 100644 --- a/docs/types/classes_Provider.ProviderMethodName.html +++ b/docs/types/classes_Provider.ProviderMethodName.html @@ -1,3 +1,3 @@ -ProviderMethodName | Grindery Wallet SDK - v0.3.0
    ProviderMethodName: keyof typeof ProviderMethodNames

    Summary

    The Grindery wallet provider method names

    +ProviderMethodName | Grindery Wallet SDK - v0.4.0
    ProviderMethodName: keyof typeof ProviderMethodNames

    Summary

    The Grindery wallet provider method names

    Since

    0.2.0

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderMethods.html b/docs/types/classes_Provider.ProviderMethods.html index fe8d242..bbd705c 100644 --- a/docs/types/classes_Provider.ProviderMethods.html +++ b/docs/types/classes_Provider.ProviderMethods.html @@ -1,3 +1,3 @@ -ProviderMethods | Grindery Wallet SDK - v0.3.0
    ProviderMethods: {
        [name in ProviderMethodNames]: ((params?) => Promise<unknown>)
    }

    Summary

    The Grindery wallet provider methods

    +ProviderMethods | Grindery Wallet SDK - v0.4.0
    ProviderMethods: {
        [name in ProviderMethodNames]: ((params?) => Promise<unknown>)
    }

    Summary

    The Grindery wallet provider methods

    Since

    0.2.0

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestArgumentsParams.html b/docs/types/classes_Provider.ProviderRequestArgumentsParams.html index d9aa8cd..2ae7deb 100644 --- a/docs/types/classes_Provider.ProviderRequestArgumentsParams.html +++ b/docs/types/classes_Provider.ProviderRequestArgumentsParams.html @@ -1,3 +1,3 @@ -ProviderRequestArgumentsParams | Grindery Wallet SDK - v0.3.0
    ProviderRequestArgumentsParams: readonly unknown[] | object

    Summary

    The Grindery wallet provider request params

    +ProviderRequestArgumentsParams | Grindery Wallet SDK - v0.4.0
    ProviderRequestArgumentsParams: readonly unknown[] | object

    Summary

    The Grindery wallet provider request params

    Since

    0.2.0

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.disconnect.html b/docs/types/classes_Provider.ProviderRequestResults.disconnect.html index e8726d7..beae2dc 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.disconnect.html +++ b/docs/types/classes_Provider.ProviderRequestResults.disconnect.html @@ -1 +1 @@ -disconnect | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +disconnect | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.eth_accounts.html b/docs/types/classes_Provider.ProviderRequestResults.eth_accounts.html index e5447c1..da64d8f 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.eth_accounts.html +++ b/docs/types/classes_Provider.ProviderRequestResults.eth_accounts.html @@ -1 +1 @@ -eth_accounts | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +eth_accounts | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.eth_chainId.html b/docs/types/classes_Provider.ProviderRequestResults.eth_chainId.html index cacc22a..29224ce 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.eth_chainId.html +++ b/docs/types/classes_Provider.ProviderRequestResults.eth_chainId.html @@ -1 +1 @@ -eth_chainId | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +eth_chainId | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.eth_requestAccounts.html b/docs/types/classes_Provider.ProviderRequestResults.eth_requestAccounts.html index 7e806cb..54ac4c1 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.eth_requestAccounts.html +++ b/docs/types/classes_Provider.ProviderRequestResults.eth_requestAccounts.html @@ -1 +1 @@ -eth_requestAccounts | Grindery Wallet SDK - v0.3.0
    eth_requestAccounts: string[]
    \ No newline at end of file +eth_requestAccounts | Grindery Wallet SDK - v0.4.0
    eth_requestAccounts: string[]
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.eth_sendTransaction.html b/docs/types/classes_Provider.ProviderRequestResults.eth_sendTransaction.html index 9af0419..afe6c96 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.eth_sendTransaction.html +++ b/docs/types/classes_Provider.ProviderRequestResults.eth_sendTransaction.html @@ -1 +1 @@ -eth_sendTransaction | Grindery Wallet SDK - v0.3.0
    eth_sendTransaction: string
    \ No newline at end of file +eth_sendTransaction | Grindery Wallet SDK - v0.4.0
    eth_sendTransaction: string
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.personal_sign.html b/docs/types/classes_Provider.ProviderRequestResults.personal_sign.html index 778f123..7602277 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.personal_sign.html +++ b/docs/types/classes_Provider.ProviderRequestResults.personal_sign.html @@ -1 +1 @@ -personal_sign | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +personal_sign | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.wallet_addEthereumChain.html b/docs/types/classes_Provider.ProviderRequestResults.wallet_addEthereumChain.html index 2c1a333..6be84d3 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.wallet_addEthereumChain.html +++ b/docs/types/classes_Provider.ProviderRequestResults.wallet_addEthereumChain.html @@ -1 +1 @@ -wallet_addEthereumChain | Grindery Wallet SDK - v0.3.0
    wallet_addEthereumChain: null
    \ No newline at end of file +wallet_addEthereumChain | Grindery Wallet SDK - v0.4.0
    wallet_addEthereumChain: null
    \ No newline at end of file diff --git a/docs/types/classes_Provider.ProviderRequestResults.wallet_switchEthereumChain.html b/docs/types/classes_Provider.ProviderRequestResults.wallet_switchEthereumChain.html index 57676be..919a31f 100644 --- a/docs/types/classes_Provider.ProviderRequestResults.wallet_switchEthereumChain.html +++ b/docs/types/classes_Provider.ProviderRequestResults.wallet_switchEthereumChain.html @@ -1 +1 @@ -wallet_switchEthereumChain | Grindery Wallet SDK - v0.3.0
    wallet_switchEthereumChain: null
    \ No newline at end of file +wallet_switchEthereumChain | Grindery Wallet SDK - v0.4.0
    wallet_switchEthereumChain: null
    \ No newline at end of file diff --git a/docs/types/classes_Rpc.RpcRequestResults.disconnect.html b/docs/types/classes_Rpc.RpcRequestResults.disconnect.html index 23554eb..498fb23 100644 --- a/docs/types/classes_Rpc.RpcRequestResults.disconnect.html +++ b/docs/types/classes_Rpc.RpcRequestResults.disconnect.html @@ -1,2 +1,2 @@ -disconnect | Grindery Wallet SDK - v0.3.0
    disconnect: boolean

    Summary

    disconnect method result

    -
    \ No newline at end of file +disconnect | Grindery Wallet SDK - v0.4.0
    disconnect: boolean

    Summary

    disconnect method result

    +
    \ No newline at end of file diff --git a/docs/types/classes_Rpc.RpcRequestResults.getUserWalletAddress.html b/docs/types/classes_Rpc.RpcRequestResults.getUserWalletAddress.html new file mode 100644 index 0000000..ecede30 --- /dev/null +++ b/docs/types/classes_Rpc.RpcRequestResults.getUserWalletAddress.html @@ -0,0 +1,2 @@ +getUserWalletAddress | Grindery Wallet SDK - v0.4.0
    getUserWalletAddress: string

    Summary

    getUserWalletAddress method result

    +
    \ No newline at end of file diff --git a/docs/types/classes_Rpc.RpcRequestResults.request.html b/docs/types/classes_Rpc.RpcRequestResults.request.html index 7565fae..e79a3c2 100644 --- a/docs/types/classes_Rpc.RpcRequestResults.request.html +++ b/docs/types/classes_Rpc.RpcRequestResults.request.html @@ -1,2 +1,2 @@ -request | Grindery Wallet SDK - v0.3.0
    request: {
        requestToken: string;
    }

    Type declaration

    • requestToken: string

    Summary

    request method result

    -
    \ No newline at end of file +request | Grindery Wallet SDK - v0.4.0
    request: {
        requestToken: string;
    }

    Type declaration

    • requestToken: string

    Summary

    request method result

    +
    \ No newline at end of file diff --git a/docs/types/classes_Rpc.RpcRequestResults.requestPairing.html b/docs/types/classes_Rpc.RpcRequestResults.requestPairing.html index acafa82..3e9bb86 100644 --- a/docs/types/classes_Rpc.RpcRequestResults.requestPairing.html +++ b/docs/types/classes_Rpc.RpcRequestResults.requestPairing.html @@ -1,2 +1,2 @@ -requestPairing | Grindery Wallet SDK - v0.3.0
    requestPairing: {
        connectUrl: string;
        connectUrlBrowser: string;
        pairingToken: string;
        shortToken: string;
    }

    Type declaration

    • connectUrl: string
    • connectUrlBrowser: string
    • pairingToken: string
    • shortToken: string

    Summary

    requestPairing method result

    -
    \ No newline at end of file +requestPairing | Grindery Wallet SDK - v0.4.0
    requestPairing: {
        connectUrl: string;
        connectUrlBrowser: string;
        pairingToken: string;
        shortToken: string;
    }

    Type declaration

    • connectUrl: string
    • connectUrlBrowser: string
    • pairingToken: string
    • shortToken: string

    Summary

    requestPairing method result

    +
    \ No newline at end of file diff --git a/docs/types/classes_Rpc.RpcRequestResults.waitForPairingResult.html b/docs/types/classes_Rpc.RpcRequestResults.waitForPairingResult.html index e2b99f0..827f2e1 100644 --- a/docs/types/classes_Rpc.RpcRequestResults.waitForPairingResult.html +++ b/docs/types/classes_Rpc.RpcRequestResults.waitForPairingResult.html @@ -1,2 +1,2 @@ -waitForPairingResult | Grindery Wallet SDK - v0.3.0
    waitForPairingResult: {
        session: {
            expiry: number;
            namespaces: {
                [key: string]: {
                    accounts: string[];
                    chains: string[];
                    events: string[];
                    methods: string[];
                };
            };
            sessionId: string;
        };
    }

    Type declaration

    • session: {
          expiry: number;
          namespaces: {
              [key: string]: {
                  accounts: string[];
                  chains: string[];
                  events: string[];
                  methods: string[];
              };
          };
          sessionId: string;
      }
      • expiry: number
      • namespaces: {
            [key: string]: {
                accounts: string[];
                chains: string[];
                events: string[];
                methods: string[];
            };
        }
        • [key: string]: {
              accounts: string[];
              chains: string[];
              events: string[];
              methods: string[];
          }
          • accounts: string[]
          • chains: string[]
          • events: string[]
          • methods: string[]
      • sessionId: string

    Summary

    waitForPairingResult method result

    -
    \ No newline at end of file +waitForPairingResult | Grindery Wallet SDK - v0.4.0
    waitForPairingResult: {
        session: {
            expiry: number;
            namespaces: {
                [key: string]: {
                    accounts: string[];
                    chains: string[];
                    events: string[];
                    methods: string[];
                };
            };
            sessionId: string;
        };
    }

    Type declaration

    • session: {
          expiry: number;
          namespaces: {
              [key: string]: {
                  accounts: string[];
                  chains: string[];
                  events: string[];
                  methods: string[];
              };
          };
          sessionId: string;
      }
      • expiry: number
      • namespaces: {
            [key: string]: {
                accounts: string[];
                chains: string[];
                events: string[];
                methods: string[];
            };
        }
        • [key: string]: {
              accounts: string[];
              chains: string[];
              events: string[];
              methods: string[];
          }
          • accounts: string[]
          • chains: string[]
          • events: string[]
          • methods: string[]
      • sessionId: string

    Summary

    waitForPairingResult method result

    +
    \ No newline at end of file diff --git a/docs/types/classes_Rpc.RpcRequestResults.waitForRequestResult.html b/docs/types/classes_Rpc.RpcRequestResults.waitForRequestResult.html index 6af19fc..c9319eb 100644 --- a/docs/types/classes_Rpc.RpcRequestResults.waitForRequestResult.html +++ b/docs/types/classes_Rpc.RpcRequestResults.waitForRequestResult.html @@ -1,2 +1,2 @@ -waitForRequestResult | Grindery Wallet SDK - v0.3.0
    waitForRequestResult: any

    Summary

    waitForRequestResult method result

    -
    \ No newline at end of file +waitForRequestResult | Grindery Wallet SDK - v0.4.0
    waitForRequestResult: any

    Summary

    waitForRequestResult method result

    +
    \ No newline at end of file diff --git a/docs/types/classes_SdkStorage.SdkStorageKey.html b/docs/types/classes_SdkStorage.SdkStorageKey.html index aeef4fd..f886a87 100644 --- a/docs/types/classes_SdkStorage.SdkStorageKey.html +++ b/docs/types/classes_SdkStorage.SdkStorageKey.html @@ -1,3 +1,3 @@ -SdkStorageKey | Grindery Wallet SDK - v0.3.0
    SdkStorageKey: keyof typeof SdkStorageKeys

    Summary

    SdkStorage key type

    +SdkStorageKey | Grindery Wallet SDK - v0.4.0
    SdkStorageKey: keyof typeof SdkStorageKeys

    Summary

    SdkStorage key type

    Since

    0.2.0

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/types/classes_SdkStorage.SdkStorageSnapshot.html b/docs/types/classes_SdkStorage.SdkStorageSnapshot.html index f139c3b..b5622ca 100644 --- a/docs/types/classes_SdkStorage.SdkStorageSnapshot.html +++ b/docs/types/classes_SdkStorage.SdkStorageSnapshot.html @@ -1 +1 @@ -SdkStorageSnapshot | Grindery Wallet SDK - v0.3.0
    SdkStorageSnapshot: {
        [key in SdkStorageKeys]?: string
    }
    \ No newline at end of file +SdkStorageSnapshot | Grindery Wallet SDK - v0.4.0
    SdkStorageSnapshot: {
        [key in SdkStorageKeys]?: string
    }
    \ No newline at end of file diff --git a/docs/types/classes_WalletSDK.WalletSDKConfig.html b/docs/types/classes_WalletSDK.WalletSDKConfig.html index f383994..1e6229d 100644 --- a/docs/types/classes_WalletSDK.WalletSDKConfig.html +++ b/docs/types/classes_WalletSDK.WalletSDKConfig.html @@ -1 +1 @@ -WalletSDKConfig | Grindery Wallet SDK - v0.3.0
    WalletSDKConfig: {
        appId?: string;
    }

    Type declaration

    • Optional appId?: string
    \ No newline at end of file +WalletSDKConfig | Grindery Wallet SDK - v0.4.0
    WalletSDKConfig: {
        appId?: string;
    }

    Type declaration

    • Optional appId?: string
    \ No newline at end of file diff --git a/docs/variables/classes_ProviderError.ProviderErrors.html b/docs/variables/classes_ProviderError.ProviderErrors.html index 7015543..3216e2a 100644 --- a/docs/variables/classes_ProviderError.ProviderErrors.html +++ b/docs/variables/classes_ProviderError.ProviderErrors.html @@ -1 +1 @@ -ProviderErrors | Grindery Wallet SDK - v0.3.0
    ProviderErrors: {
        ChainDisconnected: ProviderError;
        Disconnected: ProviderError;
        NoAppId: ProviderError;
        NoResult: ProviderError;
        PairingFailed: ProviderError;
        Unauthorized: ProviderError;
        UnsupportedMethod: ProviderError;
        UserRejected: ProviderError;
    } = ...

    Type declaration

    \ No newline at end of file +ProviderErrors | Grindery Wallet SDK - v0.4.0
    ProviderErrors: {
        ChainDisconnected: ProviderError;
        Disconnected: ProviderError;
        NoAppId: ProviderError;
        NoResult: ProviderError;
        PairingFailed: ProviderError;
        Unauthorized: ProviderError;
        UnsupportedMethod: ProviderError;
        UserRejected: ProviderError;
    } = ...

    Type declaration

    \ No newline at end of file diff --git a/docs/variables/utils_chains.CHAINS.html b/docs/variables/utils_chains.CHAINS.html index 92798e5..e1823d5 100644 --- a/docs/variables/utils_chains.CHAINS.html +++ b/docs/variables/utils_chains.CHAINS.html @@ -1,4 +1,4 @@ -CHAINS | Grindery Wallet SDK - v0.3.0
    CHAINS: string[] = ...

    Supported chains list

    +CHAINS | Grindery Wallet SDK - v0.4.0
    CHAINS: string[] = ...

    Supported chains list

    Description

    Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain

    Since

    0.3.0

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/docs/variables/utils_providerInfo.providerInfo.html b/docs/variables/utils_providerInfo.providerInfo.html index d750775..52477eb 100644 --- a/docs/variables/utils_providerInfo.providerInfo.html +++ b/docs/variables/utils_providerInfo.providerInfo.html @@ -1 +1 @@ -providerInfo | Grindery Wallet SDK - v0.3.0
    \ No newline at end of file +providerInfo | Grindery Wallet SDK - v0.4.0
    \ No newline at end of file diff --git a/example/dist/classes/Rpc.d.ts b/example/dist/classes/Rpc.d.ts index 67a6f5b..fcd1ee3 100644 --- a/example/dist/classes/Rpc.d.ts +++ b/example/dist/classes/Rpc.d.ts @@ -6,7 +6,8 @@ export declare enum RpcMethodNames { waitForPairingResult = "waitForPairingResult", request = "request", waitForRequestResult = "waitForRequestResult", - 'disconnect' = "disconnect" + 'disconnect' = "disconnect", + getUserWalletAddress = "getUserWalletAddress" } /** * @summary The Grindery RPC API request results @@ -53,6 +54,10 @@ export declare namespace RpcRequestResults { * @summary `disconnect` method result */ type disconnect = boolean; + /** + * @summary `getUserWalletAddress` method result + */ + type getUserWalletAddress = string; } /** * @summary The Grindery RPC API wrapper class diff --git a/example/dist/classes/WalletSDK.d.ts b/example/dist/classes/WalletSDK.d.ts index 12f8530..5b804be 100644 --- a/example/dist/classes/WalletSDK.d.ts +++ b/example/dist/classes/WalletSDK.d.ts @@ -1,5 +1,6 @@ import { ProviderEventName } from './EventEmitter'; import { Provider } from './Provider'; +import { RpcRequestResults } from './Rpc'; export type WalletSDKConfig = { appId?: string; }; @@ -81,6 +82,14 @@ export declare class WalletSDK { * @returns {string} Returns chain id in CAIP-2 format */ getChain(): string; + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */ + getUserWalletAddress(userId: string): Promise; /** * @summary Adds a listener to the event * @public diff --git a/example/dist/grindery-wallet-sdk.cjs.development.js b/example/dist/grindery-wallet-sdk.cjs.development.js index be0629b..d8e7da0 100644 --- a/example/dist/grindery-wallet-sdk.cjs.development.js +++ b/example/dist/grindery-wallet-sdk.cjs.development.js @@ -684,6 +684,7 @@ var RpcMethodNames; RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1614,13 +1615,48 @@ var WalletSDK = /*#__PURE__*/function () { _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/example/dist/grindery-wallet-sdk.cjs.development.js.map b/example/dist/grindery-wallet-sdk.cjs.development.js.map index f0df5b6..009c2ec 100644 --- a/example/dist/grindery-wallet-sdk.cjs.development.js.map +++ b/example/dist/grindery-wallet-sdk.cjs.development.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.cjs.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIge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Tg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACAyB,IAAI,EAAE;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.cjs.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGh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OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,cAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,cAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC7BA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAPWA,cAAc,KAAdA,cAAc,GAOzB,EAAA,CAAA,CAAA,CAAA;AAQD;;;AAGG;AACH,IAAaC,YAAY,gBAAA,YAA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C,KAAA;GACD,CAAA;AAAA,EAAA,OAAAtB,SAAA,CAAA;AAAA,CAAA,EAAA;;AClOH;;AAEG;AACI,IAAM2B,iBAAiB,GAAG3B,UAAS;AAE1C,SAAS4B,IAAIA,GAAA;AAAA,EAAA,IAAA7P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACA4B,IAAI,EAAE;;;;"} \ No newline at end of file diff --git a/example/dist/grindery-wallet-sdk.cjs.production.min.js b/example/dist/grindery-wallet-sdk.cjs.production.min.js index e83b74b..abc1259 100644 --- a/example/dist/grindery-wallet-sdk.cjs.production.min.js +++ b/example/dist/grindery-wallet-sdk.cjs.production.min.js @@ -1,2 +1,2 @@ -"use strict";function e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(e=function(){return!!t})()}function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof y?t:y).prototype),a=new O(n||[]);return o(i,"_invoke",{value:k(e,r,a)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var d="suspendedStart",f="suspendedYield",g="executing",w="completed",v={};function y(){}function N(){}function m(){}var M={};p(M,s,(function(){return this}));var I=Object.getPrototypeOf,D=I&&I(I(z([])));D&&D!==n&&i.call(D,s)&&(M=D);var j=m.prototype=y.prototype=Object.create(M);function T(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,o,a,s){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(p).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var n;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(o,o):o()}})}function k(t,r,n){var i=d;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===w){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=b(s,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?w:f,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=w,n.method="throw",n.arg=u.arg)}}}function b(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,b(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},r}function r(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,c,"next",e)}function c(e){r(a,i,o,s,c,"throw",e)}s(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),l=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:U(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},r}function r(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var s=e.apply(t,n);function a(e){r(s,i,o,a,c,"next",e)}function c(e){r(s,i,o,a,c,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),l=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3NDggNjYuMTc2OCA2NS44MzUyIDY1LjYwNzkgNjQuOTc1NUM2NC43MDMzIDYzLjYwODYgNjIuODUyNCA2My4yMDgzIDYxLjQ0ODIgNjQuMDY1TDU1LjY2NDggNjcuOTQyOEw1MC41NTYyIDcxLjM3NDdDNTAuNTA3OSA3MS40MDU1IDUwLjQ1OTQgNzEuNDM1OCA1MC40MTA3IDcxLjQ2NTdMNTAuMDU1IDcxLjcwNDJDNDkuNzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"mkQAMA,IAAYA,yDAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAA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,SAAGC,EAA0BC,GAElC,OADAP,KAAK6O,SAASxO,GAAGC,EAAOC,GACjBP,IACT,EAEAG,EAOOS,eAAA,SAAeN,EAA0BC,GAE9C,OADAP,KAAK6O,SAASjO,eAAeN,EAAOC,GAC7BP,MASTG,EAIQ+O,gBAAA,WAAe,IAAAW,EACjBhB,EAA0BgB,OAAlBA,EAAGrN,OAAO6L,WAAPwB,OAAeA,EAAfA,EAAiBvB,gBAAjBuB,EAAAA,EAA4BC,MACzC,SAACjB,GAA4B,OAC3BA,aAAoBvF,GAAYuF,EAAS7E,oBAY7C,OATG6E,GACDrM,OAAO6L,oBAAoB/E,GAC3B9G,OAAO6L,SAASrE,mBAEhB6E,EAAWrM,OAAO6L,UAEfQ,IACHA,EAAW,IAAIvF,GAEVuF,CACT,EAEA1O,EAMQgP,cAAA,SAAA/E,GAG2B,IAAA2F,EAC3BC,EAAwB,OAAlBD,EAAGvN,OAAOyN,eAAQ,EAAfF,EAAiBC,OAC1BE,uDAJI9F,EAAVe,WAME6E,GACAA,EAAOG,kBACPH,EAAOI,UACa,YAApBJ,EAAOI,UAEPJ,EAAOG,iBAVQ/F,EAAjBc,mBAWM8E,EAAOK,OACT7N,OAAOyN,SAASD,OAAOK,SAGzB7N,OAAO8N,KAAKJ,EAAa,WAE5BnB,CAAA,CA/MmB,GDETwB,EAAoBxB,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.cjs.production.min.js","sources":["../src/classes/EventEmitter.ts","../src/classes/SdkStorage.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/index.ts","../src/classes/WalletSDK.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBE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I3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"mkQAMA,IAAYA,yDAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA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4N,SAASD,OAAOK,SAGzBhO,OAAOiO,KAAKJ,EAAa,WAE5BtB,CAAA,CAhOmB,GDCT2B,EAAoB3B,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file diff --git a/example/dist/grindery-wallet-sdk.esm.js b/example/dist/grindery-wallet-sdk.esm.js index 7378f29..bc0e0ee 100644 --- a/example/dist/grindery-wallet-sdk.esm.js +++ b/example/dist/grindery-wallet-sdk.esm.js @@ -680,6 +680,7 @@ var RpcMethodNames; RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1610,13 +1611,48 @@ var WalletSDK = /*#__PURE__*/function () { _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/example/dist/grindery-wallet-sdk.esm.js.map b/example/dist/grindery-wallet-sdk.esm.js.map index 6ca2d36..1d0bed7 100644 --- a/example/dist/grindery-wallet-sdk.esm.js.map +++ b/example/dist/grindery-wallet-sdk.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.esm.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3NDggNjYuMTc2OCA2NS44MzUyIDY1LjYwNzkgNjQuOTc1NUM2NC43MDMzIDYzLjYwODYgNjIuODUyNCA2My4yMDgzIDYxLjQ0ODIgNjQuMDY1TDU1LjY2NDggNjcuOTQyOEw1MC41NTYyIDcxLjM3NDdDNTAuNTA3OSA3MS40MDU1IDUwLjQ1OTQgNzEuNDM1OCA1MC40MTA3IDcxLjQ2NTdMNTAuMDU1IDcxLjcwNDJDNDkuNzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","Grindery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CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACAyB,IAAI,EAAE;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.esm.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42MzgyIDU4LjI0MTkgNTcuNzE5MyA1OC4xODk2IDU3LjgwMDMgNTguMTM4NEw1OC4wNTgxIDU3Ljk2NTVDNTguMjA1MyA1Ny44NjY4IDU4LjM1NzggNTcuNzgxMyA1OC41MTQxIDU3LjcwODlDNTguNjQwNiA1Ny42MzY5IDU4Ljc2NjYgNTcuNTY3MyA1OC44OTIxIDU3LjUwMDFDNjEuOTUwMSA1NS44NjQ0IDY1Ljc4MDQgNTYuOTcwOSA2Ny40NDczIDU5Ljk3MTdDNjguOTA3NSA2Mi42MDAzIDY4LjI0MDggNjUuODc3NiA2NS44NjQgNjcuNzU0NUM2Ni4yMzc2IDY2Ljg3NDggNjYuMTc2OCA2NS44MzUyIDY1LjYwNzkgNjQuOTc1NUM2NC43MDMzIDY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port class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AACH,IAAYA,cAOX,CAAA;AAPD,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,cAAA,CAAA,YAA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G,gBAAgB,CAAClG,iBAAiB,CAAC,CAAA;MAC1C,IAAI+F,MAAM,CAACK,KAAK,EAAE;AAChB9O,QAAAA,MAAM,CAAC0O,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;AAChC,OAAA;AACF,KAAC,MAAM;AACL9O,MAAAA,MAAM,CAAC+O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;AACpC,KAAA;GACD,CAAA;AAAA,EAAA,OAAAtB,SAAA,CAAA;AAAA,CAAA,EAAA;;AClOH;;AAEG;AACI,IAAM2B,iBAAiB,GAAG3B,UAAS;AAE1C,SAAS4B,IAAIA,GAAA;AAAA,EAAA,IAAA7P,gBAAA,CAAA;EACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;IACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;MACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;KAC3B,CAAA,CAAA;AACH,GAAA;AACF,CAAA;AAEA;AACA4B,IAAI,EAAE;;;;"} \ No newline at end of file diff --git a/example/dist/grindery-wallet-sdk.umd.development.js b/example/dist/grindery-wallet-sdk.umd.development.js index 9519afa..1f57f09 100644 --- a/example/dist/grindery-wallet-sdk.umd.development.js +++ b/example/dist/grindery-wallet-sdk.umd.development.js @@ -686,6 +686,7 @@ RpcMethodNames["request"] = "request"; RpcMethodNames["waitForRequestResult"] = "waitForRequestResult"; RpcMethodNames["disconnect"] = "disconnect"; + RpcMethodNames["getUserWalletAddress"] = "getUserWalletAddress"; })(RpcMethodNames || (RpcMethodNames = {})); /** * @summary The Grindery RPC API wrapper class @@ -1616,13 +1617,48 @@ _proto.getChain = function getChain() { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */; + _proto.getUserWalletAddress = + /*#__PURE__*/ + function () { + var _getUserWalletAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userId) { + var rpc; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + rpc = new Rpc(); + _context6.next = 3; + return rpc.sendRpcApiRequest(RpcMethodNames.getUserWalletAddress, { + appId: getAppId(), + userId: userId + }); + case 3: + return _context6.abrupt("return", _context6.sent); + case 4: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function getUserWalletAddress(_x4) { + return _getUserWalletAddress.apply(this, arguments); + } + return getUserWalletAddress; + }() /** * @summary Adds a listener to the event * @public * @param {ProviderEventName} event Event name * @param {Function} callback Callback function * @returns {EventEmitter} The instance of the class itself - */; + */ + ; _proto.on = function on(event, callback) { this.provider.on(event, callback); return this; diff --git a/example/dist/grindery-wallet-sdk.umd.development.js.map b/example/dist/grindery-wallet-sdk.umd.development.js.map index 2e3429a..450c933 100644 --- a/example/dist/grindery-wallet-sdk.umd.development.js.map +++ b/example/dist/grindery-wallet-sdk.umd.development.js.map @@ -1 +1 @@ -{"version":3,"file":"grindery-wallet-sdk.umd.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDMuNDA5NyA2Ni4wNjExIDQ1LjI2MDYgNjYuNDYxNSA0Ni42NjQ4IDY1LjYwNDhMNTIuNDQ4MiA2MS43MjY5TDU3LjU1NjggNTguMjk1MUM1Ny42Mzg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A1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;EAKG;EACH,IAAYA,cAOX,CAAA;EAPD,CAAA,UAAYA,cAAc,EAAA;EACxBA,EAAAA,cAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;EACnCA,EAAAA,cAAA,CAAA,MAAA,CAAA,G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CAAA;EACrF,IAAA,IACE2F,MAAM,IACNA,MAAM,CAACG,gBAAgB,IACvBH,MAAM,CAACI,QAAQ,IACfJ,MAAM,CAACI,QAAQ,KAAK,SAAS,EAC7B;EACAJ,MAAAA,MAAM,CAACG,gBAAgB,CAAC/F,iBAAiB,CAAC,CAAA;QAC1C,IAAI4F,MAAM,CAACK,KAAK,EAAE;EAChB3O,QAAAA,MAAM,CAACuO,QAAQ,CAACD,MAAM,CAACK,KAAK,EAAE,CAAA;EAChC,OAAA;EACF,KAAC,MAAM;EACL3O,MAAAA,MAAM,CAAC4O,IAAI,CAACJ,WAAW,EAAE,QAAQ,CAAC,CAAA;EACpC,KAAA;KACD,CAAA;EAAA,EAAA,OAAAnB,SAAA,CAAA;EAAA,CAAA,EAAA;;EChNH;;EAEG;AACI,MAAMwB,iBAAiB,GAAGxB,UAAS;EAE1C,SAASyB,IAAIA,GAAA;EAAA,EAAA,IAAA1P,gBAAA,CAAA;IACX,IACE,EAAA,CAAAA,gBAAA,GAACY,MAAM,CAACC,QAAQ,KAAA,IAAA,IAAfb,gBAAA,CAAiBiO,SAAS,KAC3B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;MACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;QACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;OAC3B,CAAA,CAAA;EACH,GAAA;EACF,CAAA;EAEA;EACAyB,IAAI,EAAE;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.umd.development.js","sources":["../src/classes/EventEmitter.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/SdkStorage.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/classes/WalletSDK.ts","../src/index.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJ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QxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n"],"names":["ProviderEvents","EventEmitter","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","errorResponse","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","SdkStorageKeys","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","RpcMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_callee$","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_callee2$","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_callee3$","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_callee4$","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","ProviderMethodNames","Provider","_EventEmitter","_this$methods","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","_ref3","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","_ref4","isArray","accountsChanged","address","eth_sendTransaction","_ref5","personal_sign","_ref6","_callee5","_callee5$","_context5","gws_disconnect","_callee6","_callee6$","_context6","disconnect","sessionToken","eth_chainId","_ref8","_callee7","_","_callee7$","_context7","wallet_addEthereumChain","_ref9","_callee8","_callee8$","_context8","wallet_switchEthereumChain","_ref10","_callee9","_callee9$","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_callee10$","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_callee11$","_context11","namespaces","map","account","_restoreSession","_callee12","_callee12$","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,EAAErN,MAAM,CAACC,QAAQ,CAACoN,SAAS,YAAYA,SAAS,CAAC,EACjD;MACArN,MAAM,CAACC,QAAQ,GAAAsN,QAAA,CAAA,EAAA,EACTvN,MAAM,CAACC,QAAQ,IAAI,EAAE,EAAA;QACzBoN,SAAS,EAAE,IAAIA,SAAS,EAAE;OAC3B,CAAA,CAAA;EACH,GAAA;EACF,CAAA;EAEA;EACA4B,IAAI,EAAE;;;;;;;;;;"} \ No newline at end of file diff --git a/example/dist/grindery-wallet-sdk.umd.production.min.js b/example/dist/grindery-wallet-sdk.umd.production.min.js index 268a771..7d2c924 100644 --- a/example/dist/grindery-wallet-sdk.umd.production.min.js +++ b/example/dist/grindery-wallet-sdk.umd.production.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["grindery-wallet-sdk"]={})}(this,(function(e){"use strict";function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}function r(){r=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof y?t:y).prototype),s=new O(n||[]);return o(i,"_invoke",{value:b(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var d="suspendedStart",f="suspendedYield",g="executing",w="completed",v={};function y(){}function N(){}function m(){}var M={};p(M,a,(function(){return this}));var I=Object.getPrototypeOf,D=I&&I(I(z([])));D&&D!==n&&i.call(D,a)&&(M=D);var j=m.prototype=y.prototype=Object.create(M);function T(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(n,o,s,a){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&i.call(p,"__await")?t.resolve(p.__await).then((function(e){r("next",e,s,a)}),(function(e){r("throw",e,s,a)})):t.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,a)}))}a(c.arg)}var n;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(o,o):o()}})}function b(t,r,n){var i=d;return function(o,s){if(i===g)throw Error("Generator is already running");if(i===w){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=w,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?w:f,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=w,n.method="throw",n.arg=u.arg)}}}function k(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var s=o.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function n(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,c,"next",e)}function c(e){n(s,i,o,a,c,"throw",e)}a(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),d=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;L(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:U(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function n(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,c,"next",e)}function c(e){n(s,i,o,a,c,"throw",e)}a(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),n=1;n Event:",e,r[0]),this.events.get(e).forEach((function(e){e.apply(void 0,r)}))),this},e}(),d=function(){for(var e,t="",r=document.querySelectorAll("[data-app-id]"),n=0;n>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n r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U1IDcxLjcwNDJDNDkuNzU1OCA3MS45MDQ5IDQ5LjQzNDkgNzIuMDUwNiA0OS4xMDQ3IDcyLjE0MzhDNDQuNjU3MyA3NC4wNTkyIDM5LjMyMzggNzIuNTg5NCAzNi41OTI0IDY4LjQ2MjFDMzMuNzUxNiA2NC4xNjk2IDM0LjczMTcgNTguNTIzNCAzOC42OTg2IDU1LjM3MzZDMzYuODE0IDU0LjY1NzkgMzUuMDI3NSA1My41OTk1IDMzLjQzNjEgNTIuMTkzNEMyNi40MzA0IDQ2LjAwMzYgMjUuODU3NyAzNS40MjA1IDMyLjE1NjkgMjguNTU1NEMzOC40NTYyIDIxLjY5MDQgNDkuMjQxOSAyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"ozQAMA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,G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GAC7BP,MASTG,EAIQ+O,gBAAA,WAAe,IAAAW,EACjBhB,EAA0BgB,OAAlBA,EAAGrN,OAAO6L,WAAPwB,OAAeA,EAAfA,EAAiBvB,gBAAjBuB,EAAAA,EAA4BC,MACzC,SAACjB,GAA4B,OAC3BA,aAAoBvF,GAAYuF,EAAS7E,oBAY7C,OATG6E,GACDrM,OAAO6L,oBAAoB/E,GAC3B9G,OAAO6L,SAASrE,mBAEhB6E,EAAWrM,OAAO6L,UAEfQ,IACHA,EAAW,IAAIvF,GAEVuF,CACT,EAEA1O,EAMQgP,cAAA,SAAA/E,GAG2B,IAAA2F,EAC3BC,EAAwB,OAAlBD,EAAGvN,OAAOyN,eAAQ,EAAfF,EAAiBC,OAC1BE,uDAJI9F,EAAVe,WAME6E,GACAA,EAAOG,kBACPH,EAAOI,UACa,YAApBJ,EAAOI,UAEPJ,EAAOG,iBAVQ/F,EAAjBc,mBAWM8E,EAAOK,OACT7N,OAAOyN,SAASD,OAAOK,SAGzB7N,OAAO8N,KAAKJ,EAAa,WAE5BnB,CAAA,CA/MmB,GDETwB,EAAoBxB,EAIb,OAAhBnN,EAACY,OAAOC,WAAPb,EAAiBmN,WAChBvM,OAAOC,SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file +{"version":3,"file":"grindery-wallet-sdk.umd.production.min.js","sources":["../src/classes/EventEmitter.ts","../src/classes/SdkStorage.ts","../src/utils/getAppId.ts","../src/utils/uuid.ts","../src/utils/providerInfo.ts","../src/classes/ProviderError.ts","../src/utils/chains.ts","../src/classes/Rpc.ts","../src/classes/Provider.ts","../src/index.ts","../src/classes/WalletSDK.ts"],"sourcesContent":["/**\n * @summary Provider events\n * @since 0.2.0\n * @link https://eips.ethereum.org/EIPS/eip-1193#provider-events\n * @enum {string}\n */\nexport enum ProviderEvents {\n accountsChanged = 'accountsChanged',\n pair = 'pair',\n connect = 'connect',\n disconnect = 'disconnect',\n chainChanged = 'chainChanged',\n message = 'message',\n}\n\n/**\n * @summary Provider event name\n * @since 0.2.0\n */\nexport type ProviderEventName = keyof typeof ProviderEvents;\n\n/**\n * @summary A class for emitting provider events\n * @since 0.2.0\n */\nexport class EventEmitter {\n constructor() {\n this.events = new Map();\n }\n\n /**\n * @summary A map of events and their listeners\n * @private\n */\n private events: Map>;\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n if (!this.events.has(event)) {\n this.events.set(event, []);\n }\n this.events.get(event)!.push(callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n if (this.events.has(event)) {\n const callbacks = this.events.get(event)!.filter((cb) => cb !== callback);\n this.events.set(event, callbacks);\n }\n return this;\n }\n\n /**\n * @summary Emits an event\n * @public\n * @param {string} event Event name\n * @param data Event data\n * @returns {EventEmitter} The instance of the class itself\n */\n protected emit(event: ProviderEventName, ...data: any[]) {\n if (this.events.has(event)) {\n console.log('[Grindery.WalletSDK] > Event:', event, data[0]);\n this.events.get(event)!.forEach((callback) => {\n callback(...data);\n });\n }\n return this;\n }\n}\n","import { CHAINS } from '../utils/chains';\nimport { uuid } from '../utils/uuid';\n\nconst LOCALSTORAGE_KEY = 'GrinderyWalletProvider';\n\n/**\n * @summary SdkStorage keys\n * @since 0.2.0\n */\nexport enum SdkStorageKeys {\n pairingToken = 'pairingToken',\n sessionId = 'sessionId',\n connectUrl = 'connectUrl',\n connectUrlBrowser = 'connectUrlBrowser',\n shortToken = 'shortToken',\n clientId = 'clientId',\n address = 'address',\n chainId = 'chainId',\n}\n\n/**\n * @summary SdkStorage key type\n * @since 0.2.0\n */\nexport type SdkStorageKey = keyof typeof SdkStorageKeys;\n\nexport type SdkStorageSnapshot = {\n [key in SdkStorageKeys]?: string;\n};\n\n/**\n * @summary A class to handle local storage\n * @since 0.2.0\n */\nexport class SdkStorage {\n /**\n * @summary Gets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @returns {string} The value of the storage by the key\n */\n public getValue(key: SdkStorageKey): string {\n const value = this.getSnapshot()[key] || '';\n return value;\n }\n\n /**\n * @summary Sets the value of the storage by the key\n * @public\n * @param {SdkStorageKey} key Provider storage key\n * @param {string} value The value to set\n * @returns {void}\n */\n public setValue(key: SdkStorageKey, value: string): string {\n const snapshot = this.getSnapshot();\n snapshot[key] = value;\n this.saveSnapshot(snapshot);\n return value;\n }\n\n /**\n * @summary Clears the storage\n * @public\n * @returns {void}\n */\n public clear(): void {\n this.saveSnapshot({\n clientId: this.getSnapshot().clientId || uuid(),\n chainId: this.getSnapshot().chainId || CHAINS[0],\n });\n }\n\n /**\n * @summary Gets the storage\n * @since 0.2.0\n * @returns {SdkStorageSnapshot} The storage snapshot object\n */\n private getSnapshot(): SdkStorageSnapshot {\n try {\n return JSON.parse(\n localStorage.getItem(LOCALSTORAGE_KEY) || '{}'\n ) as SdkStorageSnapshot;\n } catch (error) {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify({}));\n throw new Error('Error parsing storage');\n }\n }\n\n /**\n * @summary Saves the storage\n * @since 0.2.0\n * @param {SdkStorageSnapshot} storage SdkStorage snapshot object\n */\n private saveSnapshot(storage: SdkStorageSnapshot): void {\n localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(storage));\n }\n}\n","/**\n * @summary Get the app id from the script tag or window object\n * @returns {string} The app id\n */\nexport const getAppId = (): string => {\n let appId: string = '';\n const elements = document.querySelectorAll('[data-app-id]');\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n const value = element.getAttribute('data-app-id');\n const src = element.getAttribute('src');\n const isGrinderySrc = src && src.includes('grindery-wallet-sdk');\n if (value && isGrinderySrc) {\n appId = value;\n }\n }\n if (window.Grindery?.appId) {\n appId = window.Grindery.appId;\n }\n return appId;\n};\n","/**\n * @summary Generates a Version 4 (pseudorandom) UUID\n * @returns {string} The UUID\n */\nexport const uuid = (): string => {\n let d = '';\n while (d.length < 32) d += Math.random().toString(16).substr(2);\n const vr = ((parseInt(d.substr(16, 1), 16) & 0x3) | 0x8).toString(16);\n return `${d.substr(0, 8)}-${d.substr(8, 4)}-4${d.substr(\n 13,\n 3\n )}-${vr}${d.substr(17, 3)}-${d.substr(20, 12)}`;\n};\n","import { uuid } from './uuid';\n\n/**\n * Represents the assets needed to display a wallet\n *\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#provider-info\n */\nexport interface EIP6963ProviderInfo {\n uuid: string;\n name: string;\n\n /**\n * Data URI as defined in RFC-2397.\n *\n * The image SHOULD be a square with 96x96px minimum resolution.\n * The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG.\n * @link https://eips.ethereum.org/EIPS/eip-6963#imagesicons\n */\n icon: string;\n\n /**\n * MUST BE a valid RFC-1034 Domain Name\n * @link https://eips.ethereum.org/EIPS/eip-6963#rdns\n */\n rdns: string;\n}\n\nexport const providerInfo: EIP6963ProviderInfo = {\n uuid: uuid(),\n name: 'Grindery Wallet',\n rdns: 'com.grindery.wallet',\n icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijk2IiBoZWlnaHQ9Ijk2IiByeD0iNDgiIGZpbGw9IiMwQjBEMTciLz4KPHBhdGggZD0iTTUyLjcwOTMgNTQuNjI5NUw0My40MDAzIDYwLjU2MTdDNDEuOTkwMiA2MS40NjAzIDQxLjU4OTQgNjMuMzEwNSA0Mi41MDUxIDY0LjY5NDJDNDM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AyMS4xNDMxIDU2LjI0NzYgMjcuMzMyOUM2My4yNTMzIDMzLjUyMjggNjMuODI2IDQ0LjEwNTkgNTcuNTI2NyA1MC45NzA5QzU2LjExNTIgNTIuNTA5MyA1NC40Nzg0IDUzLjczMDQgNTIuNzA5MyA1NC42Mjk1Wk01MS44MDcgNDYuMDUxNkM1NS40MjMgNDIuMDgyMyA1NS4wOTQzIDM1Ljk2MzEgNTEuMDcyNyAzMi4zODQxQzQ3LjA1MTEgMjguODA1MiA0MC44NTk1IDI5LjEyMTYgMzcuMjQzNSAzMy4wOTFDMzMuNjI3NCAzNy4wNjA0IDMzLjk1NjIgNDMuMTc5NSAzNy45Nzc4IDQ2Ljc1ODVDNDEuOTk5NCA1MC4zMzc1IDQ4LjE5MDkgNTAuMDIxIDUxLjgwNyA0Ni4wNTE2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==',\n};\n","/**\n * @summary Error class for wallet Provider\n * @since 0.1.0\n * @extends Error\n */\nexport class ProviderError extends Error {\n name: string = 'GrinderyWalletProviderError';\n code?: number;\n data?: unknown;\n\n constructor(message: string, code?: number, data?: unknown) {\n super(message);\n this.code = code;\n this.data = data;\n }\n}\n\nexport const ProviderErrors = {\n PairingFailed: new ProviderError('Pairing failed', 4900),\n Disconnected: new ProviderError('Disconnected', 4900),\n UnsupportedMethod: new ProviderError('Unsupported Method', 4200),\n Unauthorized: new ProviderError('Unauthorized', 4100),\n NoResult: new ProviderError('No result', 4900),\n NoAppId: new ProviderError('App ID is required', 4900),\n UserRejected: new ProviderError('User Rejected Request', 4001),\n ChainDisconnected: new ProviderError('Chain Disconnected', 4901),\n};\n\nexport const newProviderError = (error?: unknown): ProviderError => {\n let errorResponse: ProviderError;\n if (error instanceof ProviderError) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n error.code || 4900,\n error.data\n );\n } else if (error instanceof Error) {\n errorResponse = new ProviderError(\n error.message || 'Unknown error',\n 4900,\n error\n );\n } else {\n errorResponse = new ProviderError('Unknown error', 4900, error);\n }\n return errorResponse;\n};\n","/**\n * Supported chains list\n *\n * @description Currently supports the following chains: Polygon, BNB Smart Chain, and opBNB Smart Chain\n *\n * @since 0.3.0\n * @type {string[]} Chain ids in CAIP-2 format\n */\nexport const CHAINS: string[] = ['eip155:137', 'eip155:56', 'eip155:204'];\n\nexport const hexChainId = (chainId: string): string => {\n return `0x${parseInt(chainId.split(':')[1], 10).toString(16)}`;\n};\n\nexport const unhexChainId = (hexChainId: string): string => {\n return `eip155:${parseInt(hexChainId, 16)}`;\n};\n","import { ProviderError, ProviderErrors } from './ProviderError';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\n\n/**\n * @summary The Grindery RPC API method names\n */\nexport enum RpcMethodNames {\n requestPairing = 'requestPairing',\n waitForPairingResult = 'waitForPairingResult',\n request = 'request',\n waitForRequestResult = 'waitForRequestResult',\n 'disconnect' = 'disconnect',\n getUserWalletAddress = 'getUserWalletAddress',\n}\n\n/**\n * @summary The Grindery RPC API request results\n * @since 0.2.0\n */\nexport namespace RpcRequestResults {\n /**\n * @summary `waitForPairingResult` method result\n */\n export type waitForPairingResult = {\n session: {\n expiry: number;\n sessionId: string;\n namespaces: {\n [key: string]: {\n accounts: string[];\n chains: string[];\n events: string[];\n methods: string[];\n };\n };\n };\n };\n\n /**\n * @summary `requestPairing` method result\n */\n export type requestPairing = {\n pairingToken: string;\n connectUrl: string;\n connectUrlBrowser: string;\n shortToken: string;\n };\n\n /**\n * @summary `request` method result\n */\n export type request = {\n requestToken: string;\n };\n\n /**\n * @summary `waitForRequestResult` method result\n */\n export type waitForRequestResult = any;\n\n /**\n * @summary `disconnect` method result\n */\n export type disconnect = boolean;\n\n /**\n * @summary `getUserWalletAddress` method result\n */\n export type getUserWalletAddress = string;\n}\n\n/**\n * @summary The Grindery RPC API wrapper class\n * @since 0.2.0\n */\nexport class Rpc {\n /**\n * @summary Sends a provider request to the Grindery RPC API and waits for the result.\n * @public\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n public async sendAndWaitRpcRequest(\n method: string,\n params?: readonly unknown[],\n timeout?: number\n ): Promise {\n const request = await this.sendRpcRequest(method, params);\n return await this.waitRpcRequest(request.requestToken, timeout);\n }\n\n /**\n * @summary Sends a provider request to the Grindery RPC API.\n * @protected\n * @param {RpcMethodNames} method Provider request method name\n * @param {Array} params Provider request parameters\n * @returns {RpcRequestResults.request} Promise resolving with the request token to use in the `waitGrinderyRpcProviderRequest` method\n */\n protected async sendRpcRequest(\n method: string,\n params?: readonly unknown[]\n ): Promise {\n const storage = new SdkStorage();\n return await this.sendRpcApiRequest(\n RpcMethodNames.request,\n {\n sessionId: storage.getValue(SdkStorageKeys.sessionId),\n scope: storage.getValue(SdkStorageKeys.chainId),\n request: {\n method,\n params,\n },\n }\n );\n }\n\n /**\n * @summary Waits for the result of the provider request.\n * @protected\n * @param {string} requestToken A token to identify provider request. Recieved in the results of `sendGrinderyRpcProviderRequest` method.\n * @param {number} timeout Optional. The time in milliseconds to wait for the request result. Default is 30000.\n * @returns The result of the provider request\n */\n protected async waitRpcRequest(\n requestToken: string,\n timeout?: number\n ): Promise {\n return await this.sendRpcApiRequest(\n RpcMethodNames.waitForRequestResult,\n {\n requestToken,\n timeout,\n }\n );\n }\n\n /**\n * @summary Sends a request to the Grindery Walletconnect RPC API.\n * @public\n * @param {RpcMethodNames} method Request method name\n * @param {RequestArgumentsParams} params Request parameters\n * @returns {T} The result of the request\n */\n public async sendRpcApiRequest(\n method: RpcMethodNames,\n params?: unknown[] | object\n ): Promise {\n try {\n const response = await fetch('https://walletconnect-api.grindery.com', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: `gws_${method}`,\n params: params || [],\n }),\n });\n const data = await response.json();\n if (data.error) {\n throw new ProviderError(data.error.message, data.error.code);\n }\n if (!data.result) {\n throw ProviderErrors.NoResult;\n }\n return data.result;\n } catch (error) {\n if (error instanceof Error) {\n throw new ProviderError(error.message, 500, error);\n }\n throw new ProviderError('Server error', 500, error);\n }\n }\n}\n","import { getAppId } from '../utils/getAppId';\nimport { providerInfo } from '../utils/providerInfo';\nimport { EventEmitter, ProviderEvents } from './EventEmitter';\nimport { ProviderErrors, newProviderError } from './ProviderError';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId, unhexChainId } from '../utils/chains';\n\n/**\n * @summary The Grindery wallet provider methods\n * @since 0.2.0\n */\nexport type ProviderMethods = {\n [name in ProviderMethodNames]: (\n params?: ProviderRequestArgumentsParams\n ) => Promise;\n};\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n * @since 0.3.0 Added `eth_chainId`, `wallet_addEthereumChain` and `wallet_switchEthereumChain` methods\n */\nexport enum ProviderMethodNames {\n eth_requestAccounts = 'eth_requestAccounts',\n eth_accounts = 'eth_accounts',\n personal_sign = 'personal_sign',\n eth_sendTransaction = 'eth_sendTransaction',\n gws_disconnect = 'gws_disconnect',\n eth_chainId = 'eth_chainId',\n wallet_addEthereumChain = 'wallet_addEthereumChain',\n wallet_switchEthereumChain = 'wallet_switchEthereumChain',\n}\n\nexport namespace ProviderRequestResults {\n export type eth_accounts = string[];\n export type eth_requestAccounts = string[];\n export type personal_sign = string;\n export type eth_sendTransaction = string;\n export type disconnect = boolean;\n export type wallet_switchEthereumChain = null;\n export type wallet_addEthereumChain = null;\n export type eth_chainId = string;\n}\n\n/**\n * @summary The Grindery wallet provider method names\n * @since 0.2.0\n */\nexport type ProviderMethodName = keyof typeof ProviderMethodNames;\n\n/**\n * @summary The Grindery wallet provider request params\n * @since 0.2.0\n */\nexport type ProviderRequestArgumentsParams = readonly unknown[] | object;\n\n/**\n * @summary The Grindery wallet provider request arguments\n * @since 0.2.0\n */\nexport interface ProviderRequestArguments {\n readonly method: ProviderMethodName;\n readonly params?: ProviderRequestArgumentsParams;\n}\n\n/**\n * @summary The base wallet provider class\n * @since 0.2.0\n * @extends EventEmitter\n */\nexport class Provider extends EventEmitter {\n public isGrinderyWallet: boolean = true;\n\n constructor() {\n super();\n\n this.injectProvider();\n this.listenForRequestProviderEvents();\n this.announceProvider();\n window.addEventListener('load', () => {\n this.emit(ProviderEvents.connect, {\n chainId: hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n ),\n });\n this.restorePairing();\n this.restoreSession();\n });\n }\n\n /**\n * @public\n * @returns {boolean} True if the provider is connected to the server.\n */\n public isConnected(): boolean {\n // Always true\n return true;\n }\n\n /**\n * @summary Sends a request to the provider\n * @public\n * @param {ProviderRequestArguments} args Request arguments\n * @param {string} args.method The method name\n * @param {ProviderRequestArgumentsParams} args.params The method parameters\n * @returns {T} The result of the request\n */\n public async request({\n method,\n params,\n }: ProviderRequestArguments): Promise {\n return (await this.methods[method]?.(params)) as T;\n }\n\n private storage: SdkStorage = new SdkStorage();\n\n private rpc: Rpc = new Rpc();\n\n /**\n * @summary Switches the chain\n * @since 0.3.0\n * @param {string} chainId Chain id in hex format\n * @returns {null} `Null` on success\n */\n private switchChain = async ({ chainId }: any): Promise => {\n const chainCaip = unhexChainId(chainId);\n if (!CHAINS.includes(chainCaip)) {\n throw newProviderError(ProviderErrors.ChainDisconnected);\n }\n this.storage.setValue(SdkStorageKeys.chainId, chainCaip);\n this.emit(ProviderEvents.chainChanged, { chainId });\n return null;\n };\n\n /**\n * @summary The list of supported provider methods.\n * @private\n */\n private methods: Partial = {\n /**\n * @summary The `eth_requestAccounts` provider method\n */\n [ProviderMethodNames.eth_requestAccounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n if (this.storage.getValue('sessionId')) {\n try {\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: [],\n });\n } catch (error) {\n this.storage.setValue(SdkStorageKeys.sessionId, '');\n // skip failed request and continue with pairing\n }\n }\n if (this.storage.getValue('pairingToken')) {\n try {\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: this.storage.getValue(\n SdkStorageKeys.pairingToken\n ),\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n this.storage.clear();\n // skip failed request and continue with pairing\n }\n }\n try {\n this.storage.clear();\n const result =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.requestPairing,\n {\n appId: getAppId(),\n clientId: this.storage.getValue(SdkStorageKeys.clientId),\n }\n )) as RpcRequestResults.requestPairing;\n\n if (!result.pairingToken || !result.connectUrl) {\n throw ProviderErrors.PairingFailed;\n }\n\n this.storage.setValue(SdkStorageKeys.pairingToken, result.pairingToken);\n this.storage.setValue(SdkStorageKeys.connectUrl, result.connectUrl);\n this.storage.setValue(\n SdkStorageKeys.connectUrlBrowser,\n result.connectUrlBrowser\n );\n this.storage.setValue(SdkStorageKeys.shortToken, result.shortToken);\n this.emit(ProviderEvents.pair, {\n shortToken: result.shortToken,\n connectUrl: result.connectUrl,\n connectUrlBrowser: result.connectUrlBrowser,\n });\n const pairResult =\n (await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken: result.pairingToken,\n }\n )) as RpcRequestResults.waitForPairingResult;\n\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n this.storage.setValue(SdkStorageKeys.pairingToken, '');\n this.storage.setValue(SdkStorageKeys.connectUrl, '');\n this.storage.setValue(SdkStorageKeys.connectUrlBrowser, '');\n this.storage.setValue(SdkStorageKeys.shortToken, '');\n\n return await this.request({\n method: ProviderMethodNames.eth_accounts,\n params: params || [],\n });\n } catch (error) {\n throw error;\n }\n },\n\n /**\n * @summary The `eth_accounts` provider method\n */\n [ProviderMethodNames.eth_accounts]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n try {\n const result = (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_accounts,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_accounts;\n this.emit(ProviderEvents.accountsChanged, result);\n this.storage.setValue(SdkStorageKeys.address, result[0] || '');\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_sendTransaction` provider method\n */\n [ProviderMethodNames.eth_sendTransaction]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.eth_sendTransaction,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.eth_sendTransaction;\n },\n\n /**\n * @summary The `personal_sign` provider method\n */\n [ProviderMethodNames.personal_sign]: async (\n params?: Partial\n ): Promise => {\n return (await this.rpc.sendAndWaitRpcRequest(\n ProviderMethodNames.personal_sign,\n params ? (Array.isArray(params) ? params : [params]) : []\n )) as ProviderRequestResults.personal_sign;\n },\n\n /**\n * @summary The `gws_disconnect` provider method\n */\n [ProviderMethodNames.gws_disconnect]:\n async (): Promise => {\n try {\n const result =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.disconnect,\n {\n sessionToken: this.storage.getValue(SdkStorageKeys.sessionId),\n }\n );\n\n this.emit(ProviderEvents.disconnect, ProviderErrors.Disconnected);\n\n return result;\n } catch (error) {\n throw newProviderError(error);\n }\n },\n\n /**\n * @summary The `eth_chainId` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.eth_chainId]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n return hexChainId(\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n },\n\n /**\n * @summary The `wallet_addEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_addEthereumChain]: async (\n _?: ProviderRequestArgumentsParams\n ): Promise => {\n throw newProviderError(ProviderErrors.UserRejected);\n },\n\n /**\n * @summary The `wallet_switchEthereumChain` provider method\n * @since 0.3.0\n */\n [ProviderMethodNames.wallet_switchEthereumChain]: async (\n params?: ProviderRequestArgumentsParams\n ): Promise =>\n await this.switchChain(params),\n };\n\n /**\n * @summary Restores the pairing process if pairing token is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restorePairing(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (pairingToken && !sessionId) {\n try {\n const pairResult =\n await this.rpc.sendRpcApiRequest(\n RpcMethodNames.waitForPairingResult,\n {\n pairingToken,\n }\n );\n\n this.storage.clear();\n this.storage.setValue(\n SdkStorageKeys.sessionId,\n pairResult.session.sessionId\n );\n\n if (!pairResult.session.sessionId) {\n throw ProviderErrors.PairingFailed;\n }\n\n const accounts = (\n pairResult.session?.namespaces?.[`eip155`]?.accounts || []\n ).map((account) =>\n account.includes(':') ? account.split(':')[2] || '' : account\n );\n this.storage.setValue(SdkStorageKeys.address, accounts[0] || '');\n this.emit(ProviderEvents.accountsChanged, accounts);\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Restores the session if session Id is stored in the local storage\n * @private\n * @returns {void}\n */\n private async restoreSession(): Promise {\n const pairingToken = this.storage.getValue(SdkStorageKeys.pairingToken);\n const sessionId = this.storage.getValue(SdkStorageKeys.sessionId);\n if (sessionId && !pairingToken) {\n try {\n await this.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n } catch (error) {\n this.storage.clear();\n }\n }\n }\n\n /**\n * @summary Injects the provider into the window object\n * @private\n * @returns {void}\n */\n private injectProvider(): void {\n if (!window.ethereum) {\n window.ethereum = this;\n } else {\n if (\n window.ethereum.providers &&\n Array.isArray(window.ethereum.providers)\n ) {\n window.ethereum.providers.push(this);\n } else {\n window.ethereum.providers = [window.ethereum, this];\n }\n }\n }\n\n /**\n * @summary Announces the provider to the window object\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private announceProvider(): void {\n window.dispatchEvent(\n new CustomEvent('eip6963:announceProvider', {\n detail: Object.freeze({ info: providerInfo, provider: this }),\n })\n );\n }\n\n /**\n * @summary Listens for the request provider events\n * @private\n * @since 0.1.1\n * @link https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events\n * @returns {void}\n */\n private listenForRequestProviderEvents(): void {\n window.addEventListener('eip6963:requestProvider', () => {\n this.announceProvider();\n });\n }\n}\n","import { WalletSDK } from './classes/WalletSDK';\n\ndeclare global {\n interface Window {\n Telegram?: any;\n ethereum?: any;\n Grindery?: {\n appId?: string;\n WalletSDK?: WalletSDK;\n };\n }\n}\n\n/**\n * @summary The Grindery Wallet SDK\n */\nexport const GrinderyWalletSDK = WalletSDK;\n\nfunction init() {\n if (\n !window.Grindery?.WalletSDK ||\n !(window.Grindery.WalletSDK instanceof WalletSDK)\n ) {\n window.Grindery = {\n ...(window.Grindery || {}),\n WalletSDK: new WalletSDK(),\n };\n }\n}\n\n// Initialize the SDK\ninit();\n","import { ProviderEventName, ProviderEvents } from './EventEmitter';\nimport { Provider, ProviderMethodNames } from './Provider';\nimport { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc';\nimport { SdkStorage, SdkStorageKeys } from './SdkStorage';\nimport { CHAINS, hexChainId } from '../utils/chains';\nimport { getAppId } from '../utils/getAppId';\n\nexport type WalletSDKConfig = {\n appId?: string;\n};\n\n/**\n * @summary The Wallet SDK class\n * @since 0.2.0\n */\nexport class WalletSDK {\n /**\n * @summary The provider instance\n * @public\n */\n public provider: Provider;\n\n constructor(config?: WalletSDKConfig) {\n if (config?.appId) {\n window.Grindery = {\n ...(window.Grindery || {}),\n appId: config?.appId,\n };\n }\n this.storage.setValue(\n SdkStorageKeys.chainId,\n this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]\n );\n this.provider = this.getWeb3Provider();\n this.provider.on(ProviderEvents.pair, this.handlePairing);\n }\n\n /**\n * @summary Checks if the provider is connected to the server\n * @returns {boolean} True if the provider is connected to the server.\n *\n * @example\n * ```typescript\n * const isConnected = window.Grindery.WalletSDK.isConnected();\n * ```\n */\n public isConnected(): boolean {\n return this.provider.isConnected();\n }\n\n /**\n * @summary Checks if the provider is connected to the server and the Grindery Wallet\n * @returns {boolean} True if the provider is connected to the server and the Grindery Wallet.\n */\n public isWalletConnected(): boolean {\n return (\n this.isConnected() &&\n !!this.storage.getValue(SdkStorageKeys.pairingToken) &&\n !this.storage.getValue(SdkStorageKeys.sessionId)\n );\n }\n\n /**\n * @summary Initiate connection to the Grindery Wallet\n * @public\n * @returns {Promise} The array of ethereum addresses\n * @since 0.1.0\n */\n public async connect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_requestAccounts,\n });\n }\n\n /**\n * @summary Disconnects Grindery Wallet\n * @public\n * @returns {Promise} True if wallet is disconnected\n * @since 0.1.0\n */\n public async disconnect(): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.gws_disconnect,\n });\n }\n\n /**\n * @summary Sends a transaction request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {object} params The transaction parameters\n * @param {string} params.to The recipient address\n * @param {string} [params.value] The amount to send in wei\n * @param {string} [params.data] The data to send\n * @returns {Promise} Transaction hash string\n */\n public async sendTransaction(params: {\n to: string;\n value?: string;\n data?: string;\n }): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.eth_sendTransaction,\n params: [params],\n });\n }\n\n /**\n * @summary Sends a personal signature request to the Grindery Wallet\n * @public\n * @since 0.1.0\n * @param {string} message The message to sign\n * @returns {Promise} Signature string\n */\n public async signMessage(message: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.personal_sign,\n params: [message, this.storage.getValue('address')],\n });\n }\n\n /**\n * @summary Requests the Grindery Wallet to switch the chain\n * @public\n * @since 0.3.0\n * @param {string} chainId Chain id in CAIP-2 format\n * @returns {Promise} Returns `null` on success\n */\n public async switchChain(chainId: string): Promise {\n return await this.provider.request({\n method: ProviderMethodNames.wallet_switchEthereumChain,\n params: { chainId: hexChainId(chainId) },\n });\n }\n\n /**\n * @summary Gets currently connected chain\n * @public\n * @since 0.3.0\n * @returns {string} Returns chain id in CAIP-2 format\n */\n public getChain(): string {\n return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0];\n }\n\n /**\n * @summary Exchange Telegram user ID to Grindery Wallet address\n * @public\n * @since 0.4.0\n * @param {string} userId Telegram user ID\n * @returns {Promise} Grindery Wallet address\n */\n public async getUserWalletAddress(\n userId: string\n ): Promise {\n const rpc = new Rpc();\n return await rpc.sendRpcApiRequest(\n RpcMethodNames.getUserWalletAddress,\n { appId: getAppId(), userId }\n );\n }\n\n /**\n * @summary Adds a listener to the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public on(event: ProviderEventName, callback: Function) {\n this.provider.on(event, callback);\n return this;\n }\n\n /**\n * @summary Removes a listener from the event\n * @public\n * @param {ProviderEventName} event Event name\n * @param {Function} callback Callback function\n * @returns {EventEmitter} The instance of the class itself\n */\n public removeListener(event: ProviderEventName, callback: Function) {\n this.provider.removeListener(event, callback);\n return this;\n }\n\n /**\n * @summary SdkStorage class instance\n * @private\n */\n private storage: SdkStorage = new SdkStorage();\n\n /**\n * @summary Gets the Grindery Wallet ethereum provider\n * @returns {Provider} The Grindery Wallet ethereum provider\n */\n private getWeb3Provider(): Provider {\n let provider = window.ethereum?.providers?.find(\n (provider: Provider | unknown) =>\n provider instanceof Provider && provider.isGrinderyWallet\n );\n if (\n !provider &&\n window.ethereum instanceof Provider &&\n window.ethereum.isGrinderyWallet\n ) {\n provider = window.ethereum;\n }\n if (!provider) {\n provider = new Provider();\n }\n return provider;\n }\n\n /**\n * @summary Handles the pairing request, by opening the Grindery Wallet\n * @private\n * @param ProviderRequestPairingResult\n * @returns {void}\n */\n private handlePairing({\n shortToken,\n connectUrlBrowser,\n }: RpcRequestResults.requestPairing): void {\n const WebApp = window.Telegram?.WebApp;\n const redirectUrl = `https://walletconnect.grindery.com/connect/wc?uri=${shortToken}`;\n if (\n WebApp &&\n WebApp.openTelegramLink &&\n WebApp.platform &&\n WebApp.platform !== 'unknown'\n ) {\n WebApp.openTelegramLink(connectUrlBrowser);\n if (WebApp.close) {\n window.Telegram.WebApp.close();\n }\n } else {\n window.open(redirectUrl, '_blank');\n }\n }\n}\n"],"names":["ProviderEvents","SdkStorageKeys","EventEmitter","this","events","Map","_proto","prototype","on","event","callback","has","set","get","push","removeListener","callbacks","filter","cb","emit","_len","arguments","length","data","Array","_key","console","log","forEach","apply","getAppId","_window$Grindery","appId","elements","document","querySelectorAll","i","element","value","getAttribute","src","isGrinderySrc","includes","window","Grindery","uuid","d","Math","random","toString","substr","vr","parseInt","providerInfo","name","rdns","icon","ProviderError","_Error","message","code","_this","call","_inheritsLoose","_wrapNativeSuper","Error","ProviderErrors","PairingFailed","Disconnected","UnsupportedMethod","Unauthorized","NoResult","NoAppId","UserRejected","ChainDisconnected","newProviderError","error","CHAINS","hexChainId","chainId","split","unhexChainId","LOCALSTORAGE_KEY","RpcMethodNames","SdkStorage","getValue","key","getSnapshot","setValue","snapshot","saveSnapshot","clear","clientId","JSON","parse","localStorage","getItem","setItem","stringify","storage","ProviderMethodNames","Rpc","sendAndWaitRpcRequest","_sendAndWaitRpcRequest","_asyncToGenerator","_regeneratorRuntime","mark","_callee","method","params","timeout","request","wrap","_context","prev","next","sendRpcRequest","sent","waitRpcRequest","requestToken","abrupt","stop","_x","_x2","_x3","_sendRpcRequest","_callee2","_context2","sendRpcApiRequest","sessionId","scope","_x4","_x5","_waitRpcRequest","_callee3","_context3","waitForRequestResult","_x6","_x7","_sendRpcApiRequest","_callee4","response","_context4","fetch","headers","body","jsonrpc","id","json","result","t0","_x8","_x9","Provider","_EventEmitter","_this$methods","_ref10","_ref9","_ref8","_ref6","_ref5","_ref4","_ref3","isGrinderyWallet","rpc","switchChain","_ref2","_ref","chainCaip","chainChanged","methods","eth_requestAccounts","pairResult","_pairResult","eth_accounts","waitForPairingResult","pairingToken","session","t1","requestPairing","connectUrl","connectUrlBrowser","shortToken","pair","t2","isArray","accountsChanged","address","eth_sendTransaction","personal_sign","_callee5","_context5","gws_disconnect","_callee6","_context6","disconnect","sessionToken","eth_chainId","_callee7","_","_context7","wallet_addEthereumChain","_callee8","_context8","wallet_switchEthereumChain","_callee9","_context9","injectProvider","listenForRequestProviderEvents","announceProvider","addEventListener","connect","restorePairing","restoreSession","isConnected","_request","_callee10","_ref11","_this$methods$method","_this$methods2","_context10","_restorePairing","_callee11","_pairResult$session","accounts","_context11","namespaces","map","account","_restoreSession","_callee12","_context12","ethereum","providers","dispatchEvent","CustomEvent","detail","Object","freeze","info","provider","_this2","WalletSDK","config","_extends","getWeb3Provider","handlePairing","isWalletConnected","_connect","_disconnect","sendTransaction","_sendTransaction","signMessage","_signMessage","_switchChain","getChain","getUserWalletAddress","_getUserWalletAddress","userId","_window$ethereum","find","_window$Telegram","WebApp","Telegram","redirectUrl","openTelegramLink","platform","close","open","GrinderyWalletSDK"],"mappings":"ozQAMA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,gBAAA,kBACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,WAAA,aACAA,EAAA,aAAA,eACAA,EAAA,QAAA,SACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAYD,IChBYC,EDgBCC,EAAY,WACvB,SAAAA,IAIAC,KAIQC,YAAM,EAPZD,KAAKC,OAAS,IAAIC,GACpB,CAAC,IAAAC,EAAAJ,EAAAK,UAqDA,OA7CDD,EAOOE,GAAA,SAAGC,EAA0BC,GAKlC,OAJKP,KAAKC,OA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SAASsM,qBAAqBA,IAEvCvM,OAAOC,SAAQwM,EAAA,CAAA,EACTzM,OAAOC,UAAY,GAAE,CACzBsM,UAAW,IAAIA"} \ No newline at end of file diff --git a/example/index.html b/example/index.html index 51a2700..f866f76 100644 --- a/example/index.html +++ b/example/index.html @@ -36,6 +36,7 @@ >.

    +
    Waiting wallet provider...
    diff --git a/example/main.js b/example/main.js index bf5381f..af06d6d 100644 --- a/example/main.js +++ b/example/main.js @@ -22,6 +22,26 @@ const showUsername = (target) => { } }; +const getAndShowWalletAddress = (target) => { + const WebApp = window && window.Telegram && window.Telegram.WebApp; + if (WebApp) { + const user = WebApp && WebApp.initDataUnsafe && WebApp.initDataUnsafe.user; + if (user && user.id && target) { + window.Grindery.WalletSDK.getUserWalletAddress(user.id) + .then((address) => { + if (address) { + target.innerHTML = `

    Auto-detected wallet address: ${shortenAddress( + address + )}

    `; + } + }) + .catch((error) => { + console.error('getUserWalletAddress', error); + }); + } + } +}; + const showConnectButton = (target) => { if (!target) { return; @@ -43,6 +63,7 @@ const showConnectedWallet = (address, target) => { if (!target || !address) { return; } + document.getElementById('wallet').innerHTML = ''; target.innerHTML = `

    Grindery Wallet Connected to ${ newChainId === 'eip155:204' ? 'Polygon' : 'opBNB' @@ -252,6 +273,7 @@ const onProviderConnect = ({ chainId }) => { newChainName = chainId === '0xcc' ? 'Polygon' : 'opBNB'; listenProviderEvents(targetEl); showUsername(targetEl); + getAndShowWalletAddress(document.getElementById('wallet')); showConnectButton(targetEl); }; diff --git a/package.json b/package.json index 3a0ee35..deee4e8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grindery-wallet-sdk", "author": "Egor Miliukov", - "version": "0.3.0", + "version": "0.4.0", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/classes/Rpc.ts b/src/classes/Rpc.ts index cf11174..29dae1b 100644 --- a/src/classes/Rpc.ts +++ b/src/classes/Rpc.ts @@ -10,6 +10,7 @@ export enum RpcMethodNames { request = 'request', waitForRequestResult = 'waitForRequestResult', 'disconnect' = 'disconnect', + getUserWalletAddress = 'getUserWalletAddress', } /** @@ -61,6 +62,11 @@ export namespace RpcRequestResults { * @summary `disconnect` method result */ export type disconnect = boolean; + + /** + * @summary `getUserWalletAddress` method result + */ + export type getUserWalletAddress = string; } /** diff --git a/src/classes/WalletSDK.ts b/src/classes/WalletSDK.ts index fccb998..798d97f 100644 --- a/src/classes/WalletSDK.ts +++ b/src/classes/WalletSDK.ts @@ -1,8 +1,9 @@ import { ProviderEventName, ProviderEvents } from './EventEmitter'; import { Provider, ProviderMethodNames } from './Provider'; -import { RpcRequestResults } from './Rpc'; +import { Rpc, RpcMethodNames, RpcRequestResults } from './Rpc'; import { SdkStorage, SdkStorageKeys } from './SdkStorage'; import { CHAINS, hexChainId } from '../utils/chains'; +import { getAppId } from '../utils/getAppId'; export type WalletSDKConfig = { appId?: string; @@ -142,6 +143,23 @@ export class WalletSDK { return this.storage.getValue(SdkStorageKeys.chainId) || CHAINS[0]; } + /** + * @summary Exchange Telegram user ID to Grindery Wallet address + * @public + * @since 0.4.0 + * @param {string} userId Telegram user ID + * @returns {Promise} Grindery Wallet address + */ + public async getUserWalletAddress( + userId: string + ): Promise { + const rpc = new Rpc(); + return await rpc.sendRpcApiRequest( + RpcMethodNames.getUserWalletAddress, + { appId: getAppId(), userId } + ); + } + /** * @summary Adds a listener to the event * @public