Connect

ArConnect Injected API connect() function

To use the different functionalities the ArConnect API provides, you need to request permissions from the user to interact with their wallets. Each API function has their own permission(s), which can be requested at any time with the connect() function.

Note: The appInfo argument is optional, if it is not provided, the extension will use your site's title and favicon as application data.

Note: The gateway argument is optional, if it is not provided, the extension will use the default arweave.net gateway for the executed API. functions

Permissions

ArConnect requires specific permissions from the user for each interaction that involves the usage of their wallet.

Additional application information

You can provide your application's name and logo to the extension. Please make sure the app name only includes the name of your application and the logo is high quality and clearly visible on dark and light backgrounds.

interface AppInfo {
  name?: string; // optional application name
  logo?: string; // optional application logo url
}

Custom gateway config

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 these when connecting to ArConnect.

interface Gateway {
  host: string;
  port: number;
  protocol: "http" | "https";
}

Example usage

// connect to the extension
await window.arweaveWallet.connect(
  // request permissions to read the active address
  ["ACCESS_ADDRESS"],
  // provide some extra info for our app
  {
    name: "Super Cool App",
    logo: "https://arweave.net/jAvd7Z1CBd8gVF2D6ESj7SMCCUYxDX_z3vpp5aHdaYk"
  },
  // custom gateway
  {
    host: "g8way.io",
    port: 443,
    protocol: "https"
  }
);

Last updated