Skip to content

Commit 5e3a575

Browse files
committed
address comments
1 parent 7227db5 commit 5e3a575

File tree

2 files changed

+40
-25
lines changed
  • apps/portal/src/app/contracts/arbitrum-stylus

2 files changed

+40
-25
lines changed

apps/portal/src/app/contracts/arbitrum-stylus/airdrop-contract/page.mdx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const metadata = createMetadata({
1515

1616
If you need to send tokens to thousands of wallets at once, you can leverage the Stylus Airdrop contracts.
1717

18-
Learn how to deploy Stylus Airdrop contracts through dashboard or CLI for inexpensive, WASM-powered distribituion on [Arbitrum](https://thirdweb.com/arbitrum) chain.
18+
Learn how to deploy Stylus Airdrop contracts through dashboard or CLI for inexpensive, WASM-powered distribution on [Arbitrum](https://thirdweb.com/arbitrum) chain.
1919

2020
### Benefits
2121

@@ -105,18 +105,26 @@ The following includes three common patterns using thirdweb TypeScript SDK:
105105
**When to use:** you already have every recipient’s address and want to send everything in a single transaction.
106106

107107
```javascript
108-
import { createThirdwebClient, getContract, sendTransaction } from "thirdweb";
108+
import { createThirdwebClient, getContract, sendTransaction} from "thirdweb";
109109
import { arbitrumSepolia } from "thirdweb/chains";
110110
import { airdropERC721 } from "thirdweb/extensions/airdrop";
111-
import { createWallet } from "thirdweb/wallets";
112-
113-
const client = createThirdwebClient({ secretKey: process.env.TW_SECRET_KEY! });
114-
const wallet = createWallet("private-key-wallet");
115-
const account = await wallet.connect({
116-
client,
117-
chain: arbitrumSepolia,
118-
privateKey: process.env.PRIVATE_KEY!,
119-
});
111+
import { createWallet, injectedProvider } from "thirdweb/wallets";
112+
113+
const client = createThirdwebClient({ clientId });
114+
115+
const wallet = createWallet("io.metamask"); // pass the wallet id
116+
117+
// if user has wallet installed, connect to it
118+
if (injectedProvider("io.metamask")) {
119+
await wallet.connect({ client });
120+
}
121+
// open WalletConnect modal so user can scan the QR code and connect
122+
else {
123+
await wallet.connect({
124+
client,
125+
walletConnect: { showQrModal: true },
126+
});
127+
}
120128

121129
const contract = getContract({
122130
client,

apps/portal/src/app/contracts/arbitrum-stylus/stylus-contract/page.mdx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This tutorial will cover how to create a simple NFT template project with thirdw
3030
- [Create a project on your thirdweb account](https://thirdweb.com/dashboard)
3131
- Install thirdweb CLI by running `npm install -g thirdweb`
3232
- Install Rust tool chain by running `curl https://sh.rustup.rs -sSf | sh` or visit rust-lang.org
33-
- Install solc by running by running `npm install -g solc` or visit soliditylang.org
33+
- Install solc by running `npm install -g solc` or visit soliditylang.org
3434
- Install Node version 18 or higher
3535

3636
## Scaffold an ERC-721 Stylus project
@@ -42,6 +42,8 @@ In your CLI, create a new directory and run the following command to create a ne
4242
```bash
4343
npx thirdweb create-stylus
4444
```
45+
46+
Select the ERC-721 template when prompted. This will scaffold a new Stylus project with a basic ERC-721 contract.
4547
</Step>
4648

4749
<Step title="Set Collection Name & Symbol">
@@ -91,22 +93,27 @@ Once the transaction confirms, the CLI will redirect you to the contract managem
9193

9294
You can mint NFTs programmatically using the thirdweb SDKs. Use the following code snippet to mint NFTs:
9395

94-
```
96+
```javascript
9597
import { createThirdwebClient, getContract, sendTransaction } from "thirdweb";
9698
import { arbitrumSepolia } from "thirdweb/chains";
9799
import { mintTo } from "thirdweb/extensions/erc721";
98-
import { createWallet } from "thirdweb/wallets";
99-
100-
// 1 · Create a client (use secret key on backend or clientId in browser)
101-
const client = createThirdwebClient({ secretKey: process.env.TW_SECRET_KEY! });
102-
103-
// 2 · Connect a wallet / account (here using a private-key wallet for Node.js)
104-
const wallet = createWallet("private-key-wallet");
105-
const account = await wallet.connect({
106-
client,
107-
chain: arbitrumSepolia,
108-
privateKey: process.env.PRIVATE_KEY!,
109-
});
100+
import { createWallet, injectedProvider } from "thirdweb/wallets";
101+
102+
const client = createThirdwebClient({ clientId });
103+
104+
const wallet = createWallet("io.metamask"); // pass the wallet id
105+
106+
// if user has wallet installed, connect to it
107+
if (injectedProvider("io.metamask")) {
108+
await wallet.connect({ client });
109+
}
110+
// open WalletConnect modal so user can scan the QR code and connect
111+
else {
112+
await wallet.connect({
113+
client,
114+
walletConnect: { showQrModal: true },
115+
});
116+
}
110117

111118
// 3 · Wrap the deployed contract
112119
const contract = getContract({

0 commit comments

Comments
 (0)