connect()
Othent JS SDK connect() function
Prompts the user to sign in/up (connects the user's wallet) using Auth0's popup.
Note that while connect()
's function signature is identical to that of ArConnect's connect()
, you don't need to request permissions from the user to interact with their wallets, as Othent implicitly requires all permissions.
Caution: Users using Othent are giving dApps that use Othent full control of their wallet.
This function will throw an error in the following cases:
When passing
permissions
different toundefined
and the default value (all permissions). Passing anything else will throw an error.When this function is called before the user interacts with the page (e.g. by clicking on a button), as that will result in a
Unable to open a popup
error.When the user closes the Auth0 popup before authenticating, as that will result in a
Popup closed
error.When authentication fails.
API
permissions?: PermissionType[]
permissions?: PermissionType[]
An array of permission to request from the user, but only undefined
or an array with all permissions are valid. Passing anything else will throw an error.
ACCESS_ADDRESS
Allow the app to get the active wallet's address
ACCESS_PUBLIC_KEY
Enable the app to access the active wallet's public key
ACCESS_ALL_ADDRESSES
Enable the app to access all wallet addresses added to ArConnect
SIGN_TRANSACTION
Allow the app to sign an Arweave transaction (Base layer)
ENCRYPT
Enable the app to encrypt data with the user's wallet through ArConnect
DECRYPT
Allow the app to decrypt data encrypted with the user's wallet
SIGNATURE
Allow the app to sign messages with the user's wallet through ArConnect
ACCESS_ARWEAVE_CONFIG
Enable the app to access the current gateway config
DISPATCH
Allow the app to dispatch a transaction (bundle or base layer)
Caution: Users using Othent are giving dApps that use Othent full control of their wallet.
appInfo?: AppInfo
appInfo?: AppInfo
You must provide your application's name and version, and optionally logo, to the SDK when instantiating it. These values can also be changed when calling connect()
, to make Othent compatible with projects using ArConnect.
gateway?: GatewayConfig
gateway?: GatewayConfig
If your application requires the usage of a special gateway or you want to test with an ArLocal testnet gateway, you'll have to provide some information about it when connecting to Othent's SDK.
You can set this value when instantiating Othent
and also change it when calling connect()
, to make Othent compatible with projects using ArConnect.
return Promise<UserDetails | null>
return Promise<UserDetails | null>
A Promise
with the UserDetails
or null
if the log in modal was closed, could not even be opened or authentication failed.
Example usage
Last updated