-
Notifications
You must be signed in to change notification settings - Fork 559
Update page.mdx #7342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update page.mdx #7342
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,23 +1,56 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { createMetadata, DocImage, Grid, SDKCard, FeatureCard } from "@doc"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import PayOverviewImage from "./assets/pay-overview.png"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import SupportedChains from "../_images/supported-chains.png"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import {RocketIcon, ArrowLeftRightIcon, WalletIcon, PencilIcon, ShieldCheckIcon, PiggyBankIcon, GlobeIcon, ComponentIcon, CodeIcon, ApiIcon, WebhookIcon} from "lucide-react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export const metadata = createMetadata({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
title: "thirdweb Universal Bridge", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
icon: "thirdweb", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
title: "thirdweb Universal Bridge Docs: Web3 Payments, On-ramping, bridging & swapping", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
description: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Learn everything about thirdweb's web3 payments solution, Universal Bridge. Technical docs on onramping, bridging + swapping.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Universal Bridge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// SPDX-License-Identifier: MIT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pragma solidity ^0.8.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
contract DarkMint is ERC20, Ownable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uint256 public tokenPrice = 0.001 ether; // السعر لكل توكن | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
constructor() ERC20("DarkMint", "DMT") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_mint(address(this), 1000000000 * 10 ** decimals()); // العقد يملك التوكن | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function buyTokens() public payable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
require(msg.value > 0, "أرسل بعض ETH لشراء التوكن"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uint256 amount = (msg.value * (10 ** decimals())) / tokenPrice; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
require(balanceOf(address(this)) >= amount, "كمية غير كافية"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_transfer(address(this), msg.sender, amount); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// سحب العائدات | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function withdraw() public onlyOwner { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
payable(owner()).transfer(address(this).balance); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Universal Bridge allows you to create both simple and advanced payment flows for bridging, swapping, onramping, and peer-to-peer purchases. It's been used to drive millions in NFT sales, bridge native tokens to brand new chains, send stablecoins between users, and more. To get started check out the [SDK functions](https://portal.thirdweb.com/typescript/v5/buy/quote), [API reference](https://bridge.thirdweb.com/reference), or [playground](https://playground.thirdweb.com/connect/pay). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const transak = new TransakSDK({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiKey: 'YOUR_API_KEY', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
environment: 'STAGING', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
defaultCryptoCurrency: 'ETH', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
walletAddress: '0xYourWallet', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fiatCurrency: 'USD', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
email: '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
redirectURL: '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hostURL: window.location.origin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
widgetHeight: '625px', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
widgetWidth: '500px' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
transak.init(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+26
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix script block syntax and dependencies
Example diff: + import Script from 'next/script';
+ import TransakSDK from '@transak/transak-sdk';
- <script>
+ <Script strategy="lazyOnload">
const transak = new TransakSDK({
apiKey: 'YOUR_API_KEY',
...
});
transak.init();
- </script>
- });
+ </Script> 📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[uncategorized] ~40-~40: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION) 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<DocImage src={PayOverviewImage} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
async function buyTokens() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const tx = await contract.buyTokens({ value: ethers.utils.parseEther("0.01") }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log("معاملة قيد الإرسال..."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const receipt = await tx.wait(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (receipt.status === 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log("✅ تم الشراء بنجاح"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log("❌ فشل في الشراء"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}<DocImage src={PayOverviewImage} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+43
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initialize and import the contract before calling import { ethers } from 'ethers';
import DarkMintABI from './DarkMint.json';
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const contractAddress = '0x...'; // deployed address
const contract = new ethers.Contract(contractAddress, DarkMintABI, signer); 🤖 Prompt for AI Agents
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Import missing import PayOverviewImage from 'public/assets/pay-overview.png'; 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Features | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Wrap Solidity code in a proper MDX code block
Raw Solidity lines must be enclosed in triple backticks with the
solidity
language tag (or a<CodeBlock>
component) to render correctly in MDX. For example:🤖 Prompt for AI Agents