{"id":13796386,"url":"https://github.com/web3sp/venom-connect","last_synced_at":"2025-05-13T00:30:48.939Z","repository":{"id":59567744,"uuid":"537382866","full_name":"web3sp/venom-connect","owner":"web3sp","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-05T12:23:15.000Z","size":2627,"stargazers_count":40,"open_issues_count":6,"forks_count":16,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-11T06:33:14.017Z","etag":null,"topics":["venom-blockchain","venom-developer-program","venom-extension","venom-mobile","venom-wallet"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/web3sp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-16T09:05:38.000Z","updated_at":"2024-10-21T08:41:33.000Z","dependencies_parsed_at":"2024-04-06T22:32:52.277Z","dependency_job_id":"d006d99d-8ac5-4ace-a915-33099dacaf15","html_url":"https://github.com/web3sp/venom-connect","commit_stats":{"total_commits":106,"total_committers":4,"mean_commits":26.5,"dds":0.2924528301886793,"last_synced_commit":"268db8a5f9b2e0876febb77d10f6a1cb5d3ca8d9"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3sp%2Fvenom-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3sp%2Fvenom-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3sp%2Fvenom-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3sp%2Fvenom-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web3sp","download_url":"https://codeload.github.com/web3sp/venom-connect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225159857,"owners_count":17430193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["venom-blockchain","venom-developer-program","venom-extension","venom-mobile","venom-wallet"],"created_at":"2024-08-03T23:01:09.664Z","updated_at":"2024-11-18T10:31:17.004Z","avatar_url":"https://github.com/web3sp.png","language":"TypeScript","funding_links":[],"categories":["Programming"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/venom-blockchain/developer-program\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/venom-blockchain/developer-program/main/vf-dev-program.png\" alt=\"Logo\" width=\"366.8\" height=\"146.4\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# VenomConnect\n\n## Install\n\nUse a package manager like:\n\n`yarn add venom-connect`\n\n---\n\n## How to use VenomConnect?\n\n_You can clone this repository and run one of the available usage examples. Right now it's only [React app](./examples/react/)._\n\n## Import VenomConnect\n\n```javascript\nimport { VenomConnect } from \"venom-connect\";\n```\n\n## Init VenomConnect with your own settings\n\nVenomConnect accepts an object with settings.\n\nThere are two types of settings:\n\n- general settings for this library\n  - `theme`\n  - `checkNetworkId`\n  - `checkNetworkName`\n  - `nTries`\n- list of settings for different wallets, connection methods\n  - `providersOptions`\n\n### Theme (`theme`)\n\nYou can specify one of the preset themes. To do this, you need to pass its name as a string.\n\nAvailable themes:\n\n- `'light'`\n- `'dark'`\n- `'venom'`\n\n_As an advanced feature, instead of a preset theme, you can use your own theme object with the individual values you need. You can use standard themes as a template for writing your own themes. They are located in `/src/themes` folder in the repository of this project._\n\n### Expected network ID or IDs (`checkNetworkId`)\n\nHere you need to set the correct network IDs for your site to work.\n\nAvailable formats:\n\n- `\"1000\"`\n- `[ \"1000\", /* ... */ ]`\n\n! Use value 0 to work with local-node !\n\n### Expected network Name (`checkNetworkName`)\n\nHere you need to set the correct network Name for your site to work.\n\nAvailable format:\n\n- `\"Venom Mainnet\"`\n\n_You don't have to fill in this field, then the default Name is **`Venom Mainnet`** for `1`, **`Venom Local Node`** for `0` or **`Venom Testnet`** for `1000`._\n\n### Number of Tries to connect to wallet (`nTries`)\n\nHere you need to set the number of tries to connect to wallet\n\n_You don't have to fill in this field, then the default option is 0_\n\n### Providers options (`providersOptions`)\n\nProvider Options is an object in which _the keys are the wallet IDs_ and _the values are the settings objects for the corresponding wallet_.\n\nThe keys of the object must accept the IDs of only wallets available in this library.\n\nCurrently available IDs (new wallets may be added in the future):\n\n- `venomwallet`\n- `everwallet`\n- `oxychatwallet`\n\nThe value is an object with the settings of this wallet:\n\n- `links`\n- `walletWaysToConnect`\n- `defaultWalletWaysToConnect`\n\n### Links (`links`)\n\nThis is an object with the necessary links for this wallet:\n\n- `extension`\n- `ios`\n- `android`\n- `qr`\n- `apk`\n\nTo set **your own link**, pass **_the string_.**\n\nTo use **the default link**, pass **_undefined_** or _don't use the needed field at all._\n\nTo **hide** the corresponding field, pass **_null_.**\n\n### Ways to connect a wallet (`walletWaysToConnect`)\n\nThis is an array with the available ways to connect this wallet, that you want to configure.\nIf there is no such need, use the `defaultWalletWaysToConnect` field.\n\n**Attention! `type:\"extension\"` you have to configure anyway**\n\n### Default ways to connect a wallet (`defaultWalletWaysToConnect`)\n\nThis is an array with the available ways to connect this wallet, which you want to use if you want to use the default values..\n\nList of default options:\n\n- `\"mobile\"` — slide with a list of all download links at once\n- `\"ios\"` — slide for showing on ios devices\n- `\"android\"` — slide for showing on android devices\n\n### How to configure `extension`\n\n- Basic options\n  - `package` — NPM package\n  - `packageOptions` — An object that is passed inside the RPM package during initialization\n  - `packageOptionsStandalone` — An object that is passed inside the RPM package during initialization (for standalone)\n  - `id` — ID of the corresponding option\n  - `type` — type of the corresponding option; `\"extension\"` for example\n- Overwrite default options\n  - High-level setup\n    - `name` — your own extension name\n    - `logo` — your own logo link\n  - Low-level setup (advanced)\n    - `options`\n    - `connector`\n    - `authConnector`\n\n```javascript\nconst initVenomConnect = async () =\u003e {\n  return new VenomConnect({\n    theme: \"light\",\n    providersOptions: {\n      venomwallet: {\n        links: {\n          extension: \"...\",\n          android: undefined,\n          ios: null,\n        },\n        walletWaysToConnect: [\n          {\n            package: ProviderRpcClient,\n\n            packageOptions: {\n              fallback:\n                VenomConnect.getPromise(\"venomwallet\", \"extension\") ||\n                (() =\u003e Promise.reject()),\n              forceUseFallback: true,\n            },\n            packageOptionsStandalone: {\n              fallback: () =\u003e\n                EverscaleStandaloneClient.create({\n                  connection: {\n                    id: 1,\n                    group: \"venom_mainnet\",\n                    type: \"jrpc\",\n                    data: {\n                      endpoint: \"https://jrpc.venom.foundation/rpc\",\n                    },\n                  },\n                }),\n              forceUseFallback: true,\n            },\n\n            id: \"extension\",\n            type: \"extension\",\n          },\n        ],\n        defaultWalletWaysToConnect: [\"mobile\", \"ios\", \"android\"],\n      },\n    },\n  });\n};\n\nconst onInitButtonClick = async () =\u003e {\n  const venomConnect = await initVenomConnect();\n  // you can save venomConnect here\n\n  // and check the Authorization\n  await checkAuth(venomConnect);\n};\n```\n\n## Interaction with the library\n\n### Available methods (API)\n\nThe initialized library returns an instance that contains a number of functions available for use:\n\n- `connect`\n- `connectTo`\n- `checkAuth`\n- `on`\n- `off`\n- `currentProvider` — getter\n- `getStandalone`\n- `getPromise` — static method\n- `updateTheme`\n- `toggleExtensionWindow` — static method\n\u003c!-- - `getInfo` --\u003e\n\n#### `connect`\n\nThis function causes the pop-up to be displayed with the available connection methods: through the extension, links to mobile applications.\n\n#### `connectTo` (advanced)\n\nThis function allows you to get a specific provider **bypassing the selection pop-up** `connect(walletId, connectorTypeId)`.\n\n#### `checkAuth`\n\nThis function checks authorization in the available connection methods (extensions) and **returns** the corresponding **instance** of the wallet provider.\n\n#### `on`\n\n**Subscribing** to internal library events. `on(event, callback)`\n\nReturns the corresponding `off` function with no accepted parameters.\n\n#### `off`\n\n**Unsubscribe** from internal library events. `on(event, callback)`\n\n#### `currentProvider`\n\nReturns the current provider or _null_.\n\n#### `getStandalone`\n\nThe function of getting a standalone provider by its ID. `getStandalone(\"venomwallet\")` or `getStandalone()` By default, the ID is **venomwallet**.\n\n#### `getPromise`\n\nThe function of getting an object with promises, each of which waits for the initialization of the corresponding provider (_for example: `__venom`_) on the `window` object and is resolved by them or after several attempts is rejected.\n\nYou can get the promise you need by wallet ID and connection type `getPromise(\"venomwallet\", \"extension\")` or you can use the default connection type (\"extension\") `getPromise(\"venomwallet\")`.\n\n#### `updateTheme`\n\nYou can use this function to interactively switch themes in runtime.\n\n#### `toggleExtensionWindow`\n\nToggle the backdrop when performing an action in the extension window. `toggleExtensionWindow({ isExtensionWindowOpen: boolean; popUpText?: { title: string; text?: string; }; })`\n\n### Subscribing to events\n\nAvailable events:\n\n- `connect` — called every time the visibility of the pop-up changes; returns the current provider object\n- `error`\n- `close` — after the user closes the pop-up\n- `select` — after clicking on one of the extension items; opening the extension window\n- `extension-auth` — after successful authorization in the extension window\n- `extension-window-closed` — after closing the authorization window prematurely\n\n```javascript\nconst onConnect = async (provider: ProviderRpcClient | undefined) =\u003e {\n  // you can save the provider here\n};\n\nuseEffect(() =\u003e {\n  const off = venomConnect?.on(\"connect\", onConnect);\n\n  return () =\u003e {\n    off?.();\n  };\n}, [venomConnect]);\n```\n\n## Connecting/disconnecting to the provider via the VenomConnect pop-up window\n\n```javascript\nconst onConnectButtonClick = async () =\u003e {\n  venomConnect?.connect();\n};\n\nconst onDisconnectButtonClick = async () =\u003e {\n  venomProvider?.disconnect();\n};\n```\n\n## Use the provider\n\n```javascript\nconst getAddress = async (provider: ProviderRpcClient) =\u003e {\n  // get whatever you want\n  const providerState = await provider?.getProviderState?.();\n\n  const address =\n    providerState?.permissions.accountInteraction?.address.toString();\n\n  return address;\n};\n```\n\n## Connecting to the provider after refreshing the page\n\nThis check is called before the standard pop-up call (`connect`).\n\n```javascript\nconst checkAuth = async (venomConnect: VenomConnect) =\u003e {\n  const authObjectOrFalse = await venomConnect?.checkAuth();\n\n  if (authObjectOrFalse) {\n    // You can get the data you need. For example, the address.\n    await getAddress(venomConnect);\n  }\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb3sp%2Fvenom-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb3sp%2Fvenom-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb3sp%2Fvenom-connect/lists"}