# Connect Wallet

#### npm

```bash
npm install 0xsodium ethers
```

#### yarn

```
yarn add 0xsodium ethers
```

#### pnpm

```
pnpm install 0xsodium ethers
```

```typescript
import { sodium } from "0xsodium";

// calling wallet with iframe
const wallet = await sodium.initWallet("polygon", {
    walletAppURL: "https://sodium-two.vercel.app",
    transports: {
        iframeTransport: {
            enabled: true
        }
    }
});

// auto connect wallet in sodium gallery
const wallet = await sodium.initWallet("polygon", {
    walletAppURL: "https://sodium-two.vercel.app",
    transports: {
        iframeTransport: {
            enabled: true,
        },
        appTransport: {
            enabled: true
        }
    }
});
```

After instantiation, you can call the `connect` method to connect to the wallet

```javascript
const connectDetails = await wallet.connect({
  app: "Your Dapp name",
  authorize: true,
});

console.log("user accepted connect?", connectDetails.connected);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sodiums.gitbook.io/sodium-documentation/sdk/connect-wallet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
