Connection
connect
Sets the wallet provider. Must be called once before using any wallet-dependent functions.
- Signature
- Example
connect(
provider: any,
): Promise<void>
const provider = window.ethereum; // Specify the provider (e.g. MetaMask)
await owney.connect(provider);
Parameters
provider: any— An EIP-1193 wallet provider (e.g. from MetaMask, Coinbase Wallet, WalletConnect, Privy, etc.).
Returns
Promise<void>
disconnect
Disconnects from all agents and clears the set provider. After calling this, you must call connect() again before using wallet-dependent functions.
- Signature
- Example
disconnect(): Promise<void>
await owney.disconnect();
Returns
Promise<void>
isConnected
Checks whether the SDK currently has a set provider (i.e. connect() was called and disconnect() has not been called since).
- Signature
- Example
isConnected(): boolean
const connected = owney.isConnected();
Returns
boolean—trueif connected,falseotherwise.