Sodium Documentation
  • Overview
    • Security Architecture
    • Key Management
    • Sodium Network
    • Compatible With ERC-4337
    • Trusted Execution Environment
    • Roadmap
  • SDK
    • Connect Wallet
    • Sign Messages
    • Transfer
    • Wallet Connector
      • web3.js
      • web3-react-v8
      • viem
      • wagmi
      • rainbowkit
      • web3-modal-v2
  • Terms
    • Terms of Use for Sodium Wallet
    • Privacy Policy
    • Sodium List of Restricted Regions
Powered by GitBook
On this page
  1. SDK

Connect Wallet

npm

npm install 0xsodium ethers

yarn

yarn add 0xsodium ethers

pnpm

pnpm install 0xsodium ethers
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

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

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

Last updated 2 years ago