Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 29 additions & 69 deletions apps/portal/src/app/typescript/v5/wallets/page.mdx
Original file line number Diff line number Diff line change
@@ -1,69 +1,29 @@
import { Breadcrumb, createMetadata, ArticleIconCard, Stack } from "@doc";
import { ComponentIcon } from "lucide-react";

export const metadata = createMetadata({
image: {
title: "Accounts & Wallets",
icon: "typescript",
},
title: "Accounts & Wallets | thirdweb SDK",
description: "Learn about accounts and wallets in the thirdweb SDK.",
});

# Accounts & Wallets

We distinguish between "accounts" and "wallets" in the thirdweb SDK. We believe this ultimately provides a more predictable and flexible API for developers.

## What is an Account?

- An account always has an `address` and a way to `sign` messages, transactions, and typed data.
- An account is always mapped to exactly one address on the blockchain.
- An account cannot be "connected" or "disconnected" like a wallet, instead it is often the result of a wallet being connected.

See also: [Account (ethereum.org)](https://ethereum.org/en/glossary/#account)

## What is a Wallet?

- A wallet "contains" one or more accounts.
- A wallet can be "connected" (often prompting the user for approval) or "disconnected".
- A wallet cannot independently sign messages, transactions, or typed data, instead, it delegates this to the account(s) it "contains".


<Stack>

<ArticleIconCard
title="Supported Wallets"
icon={ComponentIcon}
href="/wallets/external-wallets"
description="See all 500+ wallets supported by the thirdweb SDKs"
/>

</Stack>

## Example: Connect a wallet and access an account to send a transaction.

```ts
import { sendTransaction } from "thirdweb";
// We use MetaMask wallet as an example, the pattern is the same for all wallets
import { createWallet } from "thirdweb/wallets";

// initialize the wallet, you can pick any of the 300+ wallet connectors supported
// wallet ids are typed, let your TS editor autocomplete them for you
// ex: "io.metamask", "com.coinbase.wallet", "me.rainbow", etc...
const wallet = createWallet("io.metamask");

// connect the wallet, this returns a promise that resolves to the connected account
const account = await wallet.connect({
// pass the client you created with `createThirdwebClient()`
client,
});

// sign & send a transaction with the account -> returns the transaction hash
const { transactionHash } = await sendTransaction({
// assuming you have called `prepareTransaction()` or `prepareContractCall()` before which returns the prepared transaction to send
transaction,
// Pass the account to sign the transaction with
account,
});
```

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract GreenbackReward is ERC1155, AccessControl {
// دور خاص للمُحققين الذين سيراجعون الصور
bytes32 public constant VERIFIER_ROLE = keccak256("VERIFIER_ROLE");

// معرف الرمز الخاص بنقاط إعادة التدوير
uint256 public constant RECYCLE_TOKEN = 1;

constructor() ERC1155("https://api.greenback.io/tokens/{id}.json") {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}

// دالة منح المكافأة: تُستخدم فقط من قِبل المُحققين بعد مراجعة الصورة
function grantRecycleReward(address user, uint256 quantity) public onlyRole(VERIFIER_ROLE) {
// كل وحدة تدوير (صورة) تساوي 10 نقاط
uint256 rewardAmount = quantity * 10;
_mint(user, RECYCLE_TOKEN, rewardAmount, "");
}

// دالة لدعم الواجهات البرمجية
function supportsInterface(bytes4 interfaceId) public view override(ERC1155, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
}
Comment on lines +1 to +29

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Documentation page replaced with unrelated Solidity contract code.

This PR replaces the TypeScript SDK wallet documentation (/typescript/v5/wallets) with a Solidity smart contract. This is problematic for several reasons:

  1. Wrong file type: This is an .mdx file meant for documentation. Raw Solidity code will cause MDX parsing errors.
  2. Breaks documentation links: Other documentation pages (e.g., send/page.mdx, migrate/page.mdx) link to this route expecting wallet documentation.
  3. Content mismatch: The file path typescript/v5/wallets/page.mdx is clearly for TypeScript SDK documentation, not a Solidity contract.

This change should be reverted. If the GreenbackReward contract is intended to be added to the repository, it belongs in a different location (likely a contracts directory with a .sol extension).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/portal/src/app/typescript/v5/wallets/page.mdx` around lines 1 - 29, This
MDX doc was accidentally replaced by a Solidity contract (GreenbackReward with
symbols like grantRecycleReward, RECYCLE_TOKEN, constructor); revert this file
to the original TypeScript SDK wallet documentation content for the v5 wallets
page, and move the Solidity code into the appropriate contracts directory as a
.sol file (e.g., create a new GreenbackReward.sol) so it no longer breaks MDX
parsing and documentation links; ensure references from other docs still point
to the restored MDX and update the repo structure so smart-contract code is
stored with .sol files, not in the MDX documentation.

Loading