From 7c2a813ad9979673e14996f75bd5359a0e258ec4 Mon Sep 17 00:00:00 2001 From: obadaibrahimelamairh-bit <289868488+obadaibrahimelamairh-bit@users.noreply.github.com> Date: Mon, 8 Jun 2026 21:45:09 +0300 Subject: [PATCH] Update page.mdx Signed-off-by: obadaibrahimelamairh-bit <289868488+obadaibrahimelamairh-bit@users.noreply.github.com> --- .../src/app/typescript/v5/wallets/page.mdx | 98 ++++++------------- 1 file changed, 29 insertions(+), 69 deletions(-) diff --git a/apps/portal/src/app/typescript/v5/wallets/page.mdx b/apps/portal/src/app/typescript/v5/wallets/page.mdx index 7ef17a02013..1dcfe900ad6 100644 --- a/apps/portal/src/app/typescript/v5/wallets/page.mdx +++ b/apps/portal/src/app/typescript/v5/wallets/page.mdx @@ -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". - - - - - - - - -## 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); + } +}