Compare commits

..
Author SHA1 Message Date
Jonas DanielsandGitHub e1cd07c3e0 Version Packages (#2840) 2024-04-24 08:42:51 -07:00
Jonas DanielsandGitHub 8683449abb fix: Fix exportLocalWallet component rendering issue (#2845) 2024-04-23 22:16:13 -07:00
cfff7e838a Fix custom chain not used in wallet connection (#2768)
Co-authored-by: Jonas Daniels <[email protected]>
2024-04-24 04:48:23 +00:00
948f155e7c feat(transactions): add support for gasless transactions (#2818)
Co-authored-by: Joaquim Verges <[email protected]>
2024-04-23 21:56:19 -07:00
Joaquim VergesandGitHub d7e6671c0a fix: handle signature mint with price and currency (#2842) 2024-04-23 23:01:21 +00:00
560d8adafa feat: Add sign-in with Phone number in in-app wallet (#2679)
Signed-off-by: Winston Yeo <[email protected]>
Signed-off-by: Jonas Daniels <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: Manan Tank <[email protected]>
2024-04-23 22:57:06 +00:00
Manan TankandGitHub 3be61ddc52 Enable Buy Modal by default with useSendTransaction hook (#2839) 2024-04-23 13:58:14 -07:00
gregandGitHub a0e26a8c4f Contributing guide updates (#2833) 2024-04-23 12:54:38 -07:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>GitHub Action
2c8bdfd493 Version Packages (#2835)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-04-23 11:50:27 -07:00
Jonas DanielsandGitHub 3810df57aa feat: add missing events for erc721, erc1155 and erc20 (#2836) 2024-04-23 18:00:22 +00:00
github-actions[bot]GitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
45677ad620 chore(chains): update chains (#2821)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-23 11:03:22 -07:00
Jonas DanielsandGitHub 0b5bb015f9 chore: Add @gregfromstl as code owner (#2837) 2024-04-23 11:00:10 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20d73bf0eb build(deps): bump @walletconnect/ethereum-provider from 2.12.1 to 2.12.2 (#2825)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-23 16:51:45 +00:00
Farhan KhwajaandGitHub 773b70aa1c Update: Added httpMethod to usage-tracker (#2832) 2024-04-23 16:27:41 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e77488217b build(deps): bump @thirdweb-dev/contracts from 3.13.0 to 3.14.0 (#2826)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-23 16:26:35 +00:00
129 changed files with 4181 additions and 522 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
# Platform team owns everything by default
- @jnsdls @joaquim-verges @MananTank
- @jnsdls @joaquim-verges @MananTank @gregfromstl
# legacy packages
+50 -40
View File
@@ -1,9 +1,5 @@
# Contributing to thirdweb
You can find a full video tutorial on how to contribute to thirdweb below:
https://www.youtube.com/watch?v=TXsQ3qok3B0
## Getting Started
To get started, read the [How this repo works](#how-this-repo-works) section below to learn about the structure of this repo.
@@ -12,23 +8,19 @@ From there, you can take a look at our [Good First Issues](https://github.com/th
If you have any questions about the issue, feel free to ask on our [Discord server](https://discord.gg/thirdweb) in the `#contributors` channel; where you'll be able to get help from our team and other contributors.
<br/>
<br />
## How this repo works
[@thirdweb-dev/js](https://github.com/thirdweb-dev/js) is a monorepo, meaning it contains many projects within it.
We use [Turborepo](https://turbo.build/repo/docs) to manage the repository, and help speed up the [CI/CD](https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment) pipeline to ship to production faster 🚢. Turborepo is a project dependency, and doesn't need to be installed separately.
We use [Turborepo](https://turborepo.org/docs/getting-started) to manage the monorepo, and help speed up the [CI/CD](https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment) pipeline to ship to production faster 🚢.
We use [pnpm](https://pnpm.io) for package management across the repo. `pnpm` is similar to `npm` or `yarn` but with more efficient disk space usage.
You can see a quick outline of each of the projects within this repo below, each living within the [/packages](/packages) directory:
**With the v5 SDK, we've consolidated everything into a single project at [/packages/thirdweb](./packages/thirdweb). You can still find the legacy packages at [/legacy_packages](./legacy_packages).**
| Package | Description | Latest Version |
| ------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [/sdk](./legacy_packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/react](./legacy_packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/auth](./legacy_packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/storage](./legacy_packages/storage) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/cli](./legacy_packages/cli) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
This single package provides a performant & lightweight SDK to interact with any EVM chain across Node, React, and React Native. Learn more about how to use the thirdweb SDK in our [documentation](https://portal.thirdweb.com/typescript/v5).
<br />
## How to contribute
@@ -36,7 +28,7 @@ Let's explore how you can set up the repo on your local machine and start contri
This section requires some existing knowledge of [Git](https://git-scm.com/), [Node.js](https://nodejs.org/en/) and [pnpm](https://pnpm.io/).
<br/>
<br />
### Getting the repo
@@ -50,26 +42,50 @@ To begin:
3. Create a new branch on your fork to start working on your changes:
```
git checkout -b MY_BRANCH_NAME
```bash
git checkout -b <YOUR BRANCH NAME>
```
4. Install the dependencies:
```
```bash
pnpm install
```
If you are on windows, use the `--ignore-scripts` flag
```
```bash
pnpm install --ignore-scripts
```
Now you have got the repo on your local machine, and you're ready to start making your changes!
Now you have the repo on your local machine, and you're ready to start making your changes!
<br/>
### Test Your Changes
We use [yalc](https://github.com/wclr/yalc) to test changes locally.
#### Writing Unit Tests
Try to include unit test coverage with your changes where appropriate. We use `vitest` for testing, look for files with the `.test.ts` extension for examples of how to structure your unit tests.
To run your tests, run the following from the package directory (most likely /packages/thirdweb):
```bash
pnpm test:dev <YOUR TEST FILE PATH>
```
> Specifying your test file path is optional, but will save time by only running specific tests each time. Before opening your PR, run `pnpm test` from the monorepo root (without specifying your test file) to ensure your changes didn't break any existing tests.
#### Linting
We use a linter to maintain best practices across projects. Once your changes are complete (or periodically while making changes), run the linter with the following command from the repo root:
```bash
pnpm lint
```
If there are errors, try running `pnpm fix` to auto-fix any basic errors. Other linter errors, like missing documentation, will need to be fixed manually. See existing files for examples of inline documentation.
#### Creating a Local Test Project
You can use [yalc](https://github.com/wclr/yalc) to test changes on a local project.
Install the yalc CLI globally:
@@ -77,40 +93,35 @@ Install the yalc CLI globally:
pnpm add yalc -g
```
First, create a test project where you can experiment with your changes:
First, create a test project where you can experiment with your changes. This can be any node project that uses your changes.
You can create a basic starter project with the `sdk` and `react` packages installed using the CLI:
Push your local version to your `yalc` store with:
```bash
npx thirdweb create --app
pnpm build && pnpm push
```
Use `yalc` to link your local changes in the monorepo to the test project, by running the following command from your test repo:
Link your local changes in the monorepo to the test project by running the following command from your test repo:
```bash
yalc add @thirdweb-dev/react # Link the react package
yalc add @thirdweb-dev/sdk # Link the sdk package
# etc...
yalc add thirdweb
```
From the monorepo, run the following command to publish your local changes to the test project:
Now, each time you make a change to the monorepo, you can run `pnpm push` from the monorepo then `yalc update thirdweb` from your test project to publish your latest changes to the test project.
```bash
pnpm push
```
If your changes modify dependencies, you may need to reinstall dependencies on your test project with `pnpm install`
Now, each time you make a change to the monorepo, you can run `pnpm push` to publish your changes to the test project.
To make sure your latest changes are used, in your test project you may need to:
In your test project, you need to:
1. Delete the dependencies cache. If you're using Next.js, that is the `.next` directory, and if you're using CRA, that is the `node_modules/.cache` directory.
1. Delete the dependencies cache. If you're using Next.js, that's the `.next` directory, and if you're using CRA, that's the `node_modules/.cache` directory.
2. Restart the development server.
#### Testing from npm
You can also test your changes by publishing a dev package to npm and adding your package as you normally do in your projects.
Once you have your PR up you can add a comment with the text: `/release-pr`. This will trigger a GitHub action that will publish a dev version to npm.
**Once you have your PR up** you can add a comment with the text: `/release-pr`. This will trigger a GitHub action that will publish a dev version to npm.
You can see the action progress in GitHub's `Actions` tab, look for the workflow: `release-pr`.
@@ -154,9 +165,8 @@ git commit -am "My commit message"
3. Push your changes to the SDK:
```
git push origin MY_BRANCH_NAME
git push origin <YOUR BRANCH NAME>
```
4. Create a [pull request](https://www.atlassian.com/git/tutorials/making-a-pull-request) to the `main` branch of the official (not your fork) SDK repo.
It's helpful to tag PRs with `[SDK]`, `[REACT]`, `[AUTH]`, (the name of the package you're modifying) to indicate the package that you are engaging with.
+3
View File
@@ -8,5 +8,8 @@
"typescript.preferences.importModuleSpecifier": "relative",
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/auth
## 4.1.67
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.5.9
## 4.1.66
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.5.8
## 4.1.65
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.65",
"version": "4.1.67",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/chains
## 0.1.99
### Patch Changes
- [#2821](https://github.com/thirdweb-dev/js/pull/2821) [`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
## 0.1.98
### Patch Changes
+3 -2
View File
@@ -17,7 +17,7 @@ export default {
"format": "png"
},
"infoURL": "https://worldland.foundation",
"name": "Worldland Mainnet",
"name": "WorldLand Mainnet",
"nativeCurrency": {
"name": "Worldland",
"symbol": "WLC",
@@ -26,7 +26,8 @@ export default {
"networkId": 103,
"rpc": [
"https://103.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://seoul.worldland.foundation"
"https://seoul.worldland.foundation",
"https://seoul2.worldland.foundation"
],
"shortName": "WLC",
"slug": "worldland",
+1 -1
View File
@@ -17,7 +17,7 @@ export default {
"format": "png"
},
"infoURL": "https://worldland.foundation",
"name": "Worldland Testnet",
"name": "WorldLand Testnet",
"nativeCurrency": {
"name": "Worldland",
"symbol": "WLC",
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"chain": "SaitaBlockChain(SBC)",
"chainId": 1209,
"explorers": [
{
"name": "Saitascan explorer",
"url": "https://saitascan.io",
"standard": "none",
"icon": {
"url": "ipfs://QmVFWTqfqnMXbiPKpDFucE9QSQ1SVsUWs4HxBqRGjgQCbu",
"width": 974,
"height": 263,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmVFWTqfqnMXbiPKpDFucE9QSQ1SVsUWs4HxBqRGjgQCbu",
"width": 974,
"height": 263,
"format": "png"
},
"infoURL": "https://saitachain.com",
"name": "SaitaBlockChain(SBC)",
"nativeCurrency": {
"name": "SaitaBlockChain(SBC)",
"symbol": "STC",
"decimals": 18
},
"networkId": 1209,
"rpc": [
"https://1209.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-nodes.saitascan.io"
],
"shortName": "SBC",
"slug": "saitablockchain-sbc",
"testnet": false
} as const satisfies Chain;
-6
View File
@@ -4,12 +4,6 @@ export default {
"chainId": 1221,
"explorers": [],
"faucets": [],
"icon": {
"url": "ipfs://QmeC4mKGbBpwmLfFxUSsareWkSWJomevUmex8ajjxo1zHx",
"width": 500,
"height": 500,
"format": "png"
},
"infoURL": "https://www.cyclenetwork.io/",
"name": "Cycle Network Testnet",
"nativeCurrency": {
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"chain": "IGC",
"chainId": 1499,
"explorers": [
{
"name": "IGC-Scan",
"url": "https://igcscan.com",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmeXuzaYXCDwHgQdpuE9L55JfEChzj11P73Ngrn8vDTE9T",
"width": 1024,
"height": 1024,
"format": "png"
},
"infoURL": "https://idosgames.com/",
"name": "iDos Games Chain Testnet",
"nativeCurrency": {
"name": "iDos Games Coin",
"symbol": "IGC",
"decimals": 18
},
"networkId": 1499,
"rpc": [
"https://1499.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.idos.games"
],
"shortName": "IGC",
"slug": "idos-games-chain-testnet",
"testnet": true
} as const satisfies Chain;
+6
View File
@@ -13,6 +13,12 @@ export default {
"https://www.okx.com/xlayer/faucet"
],
"features": [],
"icon": {
"url": "ipfs://QmSLkiAAr6VtJ6jEqEzz3QdZtVEHzR6Az7E4XD8qXwjuio",
"width": 1000,
"height": 1000,
"format": "png"
},
"infoURL": "https://www.okx.com/xlayer",
"name": "X Layer Testnet",
"nativeCurrency": {
+6
View File
@@ -11,6 +11,12 @@ export default {
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmSLkiAAr6VtJ6jEqEzz3QdZtVEHzR6Az7E4XD8qXwjuio",
"width": 1000,
"height": 1000,
"format": "png"
},
"infoURL": "https://www.okx.com/xlayer",
"name": "X Layer Mainnet",
"nativeCurrency": {
+19 -19
View File
@@ -4,19 +4,19 @@ export default {
"chainId": 2021,
"explorers": [
{
"name": "Edgscan by Bharathcoorg",
"name": "Edgscan EdgeEVM explorer by Bharathcoorg",
"url": "https://edgscan.live",
"standard": "EIP3091"
},
{
"name": "Subscan",
"url": "https://edgeware.subscan.io",
"name": "Edgscan EdgeWASM explorer by Bharathcoorg",
"url": "https://edgscan.ink",
"standard": "none",
"icon": {
"url": "ipfs://Qma2GfW5nQHuA7nGqdEfwaXPL63G9oTwRTQKaGTfjNtM2W",
"width": 400,
"height": 400,
"format": "png"
"url": "ipfs://QmVV7ibcq8pS44Nt77jWSLNY2RkfQooHBCZMBPSMdAfZ3d",
"width": 88,
"height": 88,
"format": "svg"
}
}
],
@@ -30,10 +30,10 @@ export default {
}
],
"icon": {
"url": "ipfs://QmS3ERgAKYTmV7bSWcUPSvrrCC9wHQYxtZqEQYx9Rw4RGA",
"width": 352,
"height": 304,
"format": "png"
"url": "ipfs://QmWCSXYLigYE6qEiese4cso2icgKQyosV3x1adtxJnRyJ9",
"width": 88,
"height": 76,
"format": "svg"
},
"infoURL": "https://edgeware.io",
"name": "Edgeware EdgeEVM Mainnet",
@@ -46,15 +46,15 @@ export default {
"rpc": [
"https://2021.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://edgeware-evm.jelliedowl.net",
"https://mainnet2.edgewa.re/evm",
"https://mainnet3.edgewa.re/evm",
"https://mainnet4.edgewa.re/evm",
"https://mainnet5.edgewa.re/evm",
"https://edgeware-evm0.jelliedowl.net",
"https://edgeware-evm1.jelliedowl.net",
"https://edgeware-evm2.jelliedowl.net",
"https://edgeware-evm3.jelliedowl.net",
"wss://edgeware.jelliedowl.net",
"wss://mainnet2.edgewa.re",
"wss://mainnet3.edgewa.re",
"wss://mainnet4.edgewa.re",
"wss://mainnet5.edgewa.re"
"wss://edgeware-rpc0.jelliedowl.net",
"wss://edgeware-rpc1.jelliedowl.net",
"wss://edgeware-rpc2.jelliedowl.net",
"wss://edgeware-rpc3.jelliedowl.net"
],
"shortName": "edg",
"slip44": 523,
+13 -1
View File
@@ -2,7 +2,19 @@ import type { Chain } from "../src/types";
export default {
"chain": "VANAR",
"chainId": 2040,
"explorers": [],
"explorers": [
{
"name": "Vanar Explorer",
"url": "https://explorer.vanarchain.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://Qmbx25iq4Vn4zLooPit9bbguXJzdiogwtVQWtSseyQPuSC",
"width": 1000,
"height": 1628,
"format": "png"
}
}
],
"faucets": [],
"features": [
{
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 25968,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser5275",
"nativeCurrency": {
"name": "QaUser5275 Token",
"symbol": "EZL",
"decimals": 18
},
"networkId": 25968,
"redFlags": [],
"rpc": [
"https://25968.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser5275",
"slug": "qauser5275",
"testnet": true
} as const satisfies Chain;
+47
View File
@@ -0,0 +1,47 @@
import type { Chain } from "../src/types";
export default {
"chain": "MiYou Chain",
"chainId": 30088,
"ens": {
"registry": "0xFEfa9B3061435977424DD947E756566cFB60473E"
},
"explorers": [
{
"name": "MiYou block explorer",
"url": "https://myscan.miyou.io",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"icon": {
"url": "ipfs://QmfP1QDK42B7EzYWsYN2PGfjkZUQtSjm1k5gNNT52ixsKL",
"width": 216,
"height": 216,
"format": "png"
},
"infoURL": "https://www.miyou.io",
"name": "MiYou Mainnet",
"nativeCurrency": {
"name": "Miyou",
"symbol": "MY",
"decimals": 18
},
"networkId": 30088,
"rpc": [
"https://30088.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://blockchain.miyou.io",
"https://blockchain.miyoulab.com"
],
"shortName": "MiYou",
"slip44": 60,
"slug": "miyou",
"testnet": false
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 313311,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "LT11",
"nativeCurrency": {
"name": "LT11 Token",
"symbol": "LT",
"decimals": 18
},
"networkId": 313311,
"redFlags": [],
"rpc": [
"https://313311.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/lt11/testnet/rpc"
],
"shortName": "LT11",
"slug": "lt11",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 32366,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser4578 Testnet",
"nativeCurrency": {
"name": "QaUser4578 Testnet Token",
"symbol": "EXP",
"decimals": 18
},
"networkId": 32366,
"redFlags": [],
"rpc": [
"https://32366.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser4578 Testnet",
"slug": "qauser4578-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 33795,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser9260",
"nativeCurrency": {
"name": "QaUser9260 Token",
"symbol": "SBM",
"decimals": 18
},
"networkId": 33795,
"redFlags": [],
"rpc": [
"https://33795.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser9260",
"slug": "qauser9260",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 33841,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI0422s2 Testnet",
"nativeCurrency": {
"name": "QI0422s2 Testnet Token",
"symbol": "HOS",
"decimals": 18
},
"networkId": 33841,
"redFlags": [],
"rpc": [
"https://33841.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QI0422s2 Testnet",
"slug": "qi0422s2-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 40100,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser4426",
"nativeCurrency": {
"name": "QaUser4426 Token",
"symbol": "PMC",
"decimals": 18
},
"networkId": 40100,
"redFlags": [],
"rpc": [
"https://40100.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser4426",
"slug": "qauser4426",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 47992,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser2555",
"nativeCurrency": {
"name": "QaUser2555 Token",
"symbol": "PRY",
"decimals": 18
},
"networkId": 47992,
"redFlags": [],
"rpc": [
"https://47992.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser2555",
"slug": "qauser2555",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 5041,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "OMOCHI",
"nativeCurrency": {
"name": "OMOCHI Token",
"symbol": "OMCH",
"decimals": 18
},
"networkId": 5041,
"redFlags": [],
"rpc": [
"https://5041.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/omochi/mainnet/rpc"
],
"shortName": "OMOCHI",
"slug": "omochi",
"testnet": false
} as const satisfies Chain;
+1 -1
View File
@@ -25,6 +25,6 @@ export default {
"https://subnets.avax.network/omochi/testnet/rpc"
],
"shortName": "OMOCHI",
"slug": "omochi",
"slug": "omochi-omochi",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 55246,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser6469",
"nativeCurrency": {
"name": "QaUser6469 Token",
"symbol": "ZZX",
"decimals": 18
},
"networkId": 55246,
"redFlags": [],
"rpc": [
"https://55246.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser6469",
"slug": "qauser6469",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 64643,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "qasim Testnet",
"nativeCurrency": {
"name": "qasim Testnet Token",
"symbol": "SQJ",
"decimals": 18
},
"networkId": 64643,
"redFlags": [],
"rpc": [
"https://64643.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "qasim Testnet",
"slug": "qasim-testnet",
"testnet": true
} as const satisfies Chain;
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"chain": "UltronSmartchain",
"chainId": 662,
"explorers": [
{
"name": "ultronsmartchain explorer",
"url": "https://scan.ultronsmartchain.io",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmTns2FXAqDCq1QJsocUBGjhxsgWYK7pFfD4UrRZ9JBsF1",
"width": 50,
"height": 50,
"format": "png"
},
"infoURL": "https://ultronsmartchain.io",
"name": "UltronSmartchain",
"nativeCurrency": {
"name": "ulc",
"symbol": "ULC",
"decimals": 18
},
"networkId": 662,
"rpc": [
"https://662.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.ultronsmartchain.io"
],
"shortName": "ultronsmartchain",
"slug": "ultronsmartchain",
"testnet": false
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 68064,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser3451 Testnet",
"nativeCurrency": {
"name": "QaUser3451 Testnet Token",
"symbol": "NKL",
"decimals": 18
},
"networkId": 68064,
"redFlags": [],
"rpc": [
"https://68064.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser3451 Testnet",
"slug": "qauser3451-testnet",
"testnet": true
} as const satisfies Chain;
+24 -4
View File
@@ -2,7 +2,19 @@ import type { Chain } from "../src/types";
export default {
"chain": "Cyber",
"chainId": 7560,
"explorers": [],
"explorers": [
{
"name": "Cyber Mainnet Explorer",
"url": "https://cyberscan.co",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmP61yDNPv7fxY9ZzPs4CjQDbZLoKtF8eWWjszVYbwkabd",
@@ -20,11 +32,19 @@ export default {
"networkId": 7560,
"parent": {
"type": "L2",
"chain": "eip155-1"
"chain": "eip155-1",
"bridges": [
{
"url": "https://cyber-bridge.alt.technology/deposit"
}
]
},
"rpc": [],
"rpc": [
"https://7560.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://cyber.alt.technology/",
"wss://cyber-ws.alt.technology/"
],
"shortName": "cyeth",
"slug": "cyber",
"status": "incubating",
"testnet": false
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 82261,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI0423s1 Testnet",
"nativeCurrency": {
"name": "QI0423s1 Testnet Token",
"symbol": "PUU",
"decimals": 18
},
"networkId": 82261,
"redFlags": [],
"rpc": [
"https://82261.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QI0423s1 Testnet",
"slug": "qi0423s1-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 84860,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QI0422I1 Testnet",
"nativeCurrency": {
"name": "QI0422I1 Testnet Token",
"symbol": "LLV",
"decimals": 18
},
"networkId": 84860,
"redFlags": [],
"rpc": [
"https://84860.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QI0422I1 Testnet",
"slug": "qi0422i1-testnet",
"testnet": true
} as const satisfies Chain;
+4 -7
View File
@@ -2,9 +2,6 @@ import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 90354,
"ens": {
"registry": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
},
"explorers": [
{
"name": "Block Explorer",
@@ -26,7 +23,7 @@ export default {
"height": 400,
"format": "jpg"
},
"name": "Camp Network Testnet",
"name": "Camp Network",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
@@ -38,7 +35,7 @@ export default {
"https://90354.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-camp-network-4xje7wy105.t.conduit.xyz/"
],
"shortName": "campaign-l2-test",
"slug": "camp-network-testnet",
"testnet": true
"shortName": "campaign-l2",
"slug": "camp-network",
"testnet": false
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 933039,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QR0422T1TS Testnet",
"nativeCurrency": {
"name": "QR0422T1TS Testnet Token",
"symbol": "DIF",
"decimals": 18
},
"networkId": 933039,
"redFlags": [],
"rpc": [
"https://933039.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/qr0422t1ts/testnet/rpc"
],
"shortName": "QR0422T1TS Testnet",
"slug": "qr0422t1ts-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 93797,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser8328",
"nativeCurrency": {
"name": "QaUser8328 Token",
"symbol": "CPY",
"decimals": 18
},
"networkId": 93797,
"redFlags": [],
"rpc": [
"https://93797.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser8328",
"slug": "qauser8328",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 9543,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser4523",
"nativeCurrency": {
"name": "QaUser4523 Token",
"symbol": "NBW",
"decimals": 18
},
"networkId": 9543,
"redFlags": [],
"rpc": [
"https://9543.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser4523",
"slug": "qauser4523",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 95549,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "Borne Testnet Testnet",
"nativeCurrency": {
"name": "Borne Testnet Testnet Token",
"symbol": "BORNE",
"decimals": 18
},
"networkId": 95549,
"redFlags": [],
"rpc": [
"https://95549.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/borne/testnet/rpc"
],
"shortName": "Borne Testnet Testnet",
"slug": "borne-testnet-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 96081,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser2213 Testnet",
"nativeCurrency": {
"name": "QaUser2213 Testnet Token",
"symbol": "QLV",
"decimals": 18
},
"networkId": 96081,
"redFlags": [],
"rpc": [
"https://96081.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser2213 Testnet",
"slug": "qauser2213-testnet",
"testnet": true
} as const satisfies Chain;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.98",
"version": "0.1.99",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
File diff suppressed because one or more lines are too long
+19
View File
@@ -1,5 +1,24 @@
# thirdweb
## 0.13.75
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@4.0.69
- @thirdweb-dev/wallets@2.5.9
- @thirdweb-dev/auth@4.1.67
## 0.13.74
### Patch Changes
- Updated dependencies [[`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- @thirdweb-dev/chains@0.1.99
- @thirdweb-dev/sdk@4.0.68
- @thirdweb-dev/wallets@2.5.8
- @thirdweb-dev/auth@4.1.66
## 0.13.73
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/cli",
"main": "dist/cli/index.js",
"version": "0.13.73",
"version": "0.13.75",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+1 -1
View File
@@ -424,7 +424,7 @@
"license": "Apache-2.0",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/contracts-js",
"dependencies": {
"@thirdweb-dev/contracts": "3.13.0"
"@thirdweb-dev/contracts": "3.14.0"
},
"devDependencies": {
"@ethersproject/abi": "^5.7.0",
+19
View File
@@ -1,5 +1,24 @@
# @thirdweb-dev/react-core
## 4.6.8
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@4.0.69
- @thirdweb-dev/wallets@2.5.9
- @thirdweb-dev/auth@4.1.67
## 4.6.7
### Patch Changes
- Updated dependencies [[`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- @thirdweb-dev/chains@0.1.99
- @thirdweb-dev/sdk@4.0.68
- @thirdweb-dev/wallets@2.5.8
- @thirdweb-dev/auth@4.1.66
## 4.6.6
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.6.6",
"version": "4.6.8",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.7.40
## 0.7.39
## 0.7.38
## 0.7.37
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.7.38",
"version": "0.7.40",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native-compat",
"license": "Apache-2.0",
+19
View File
@@ -1,5 +1,24 @@
# @thirdweb-dev/react-native
## 0.7.40
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@4.0.69
- @thirdweb-dev/react-core@4.6.8
- @thirdweb-dev/wallets@2.5.9
## 0.7.39
### Patch Changes
- Updated dependencies [[`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- @thirdweb-dev/chains@0.1.99
- @thirdweb-dev/sdk@4.0.68
- @thirdweb-dev/react-core@4.6.7
- @thirdweb-dev/wallets@2.5.8
## 0.7.38
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.7.38",
"version": "0.7.40",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+21
View File
@@ -1,5 +1,26 @@
# @thirdweb-dev/react
## 4.6.8
### Patch Changes
- [#2679](https://github.com/thirdweb-dev/js/pull/2679) [`560d8ad`](https://github.com/thirdweb-dev/js/commit/560d8adafa011dc48e48e73d7eb6a36170d38cef) Thanks [@ElasticBottle](https://github.com/ElasticBottle)! - Fix In-App wallet country selector styles on windows
- Updated dependencies []:
- @thirdweb-dev/sdk@4.0.69
- @thirdweb-dev/react-core@4.6.8
- @thirdweb-dev/wallets@2.5.9
## 4.6.7
### Patch Changes
- Updated dependencies [[`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- @thirdweb-dev/chains@0.1.99
- @thirdweb-dev/sdk@4.0.68
- @thirdweb-dev/react-core@4.6.7
- @thirdweb-dev/wallets@2.5.8
## 4.6.6
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "4.6.6",
"version": "4.6.8",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -12,3 +12,4 @@ export const StyledH2 = /* @__PURE__ */ styled.h2;
export const StyledP = /* @__PURE__ */ styled.p;
export const StyledUl = /* @__PURE__ */ styled.ul;
export const StyledSelect = /* @__PURE__ */ styled.select;
export const StyledOption = /* @__PURE__ */ styled.option;
@@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
import React, { useRef } from "react";
import { fontSize, spacing } from "../../../design-system";
import { useCustomTheme } from "../../../design-system/CustomThemeProvider";
import { StyledSelect } from "../../../design-system/elements";
import { StyledOption, StyledSelect } from "../../../design-system/elements";
export function CountrySelector({
countryCode,
@@ -52,12 +52,12 @@ export function CountrySelector({
</option>
{supportedCountriesForSms.map((country) => {
return (
<option
<Option
key={country.countryIsoCode}
value={`${country.countryIsoCode} +${country.phoneNumberCode}`}
>
{country.countryName} +{country.phoneNumberCode}{" "}
</option>
</Option>
);
})}
</Select>
@@ -65,7 +65,20 @@ export function CountrySelector({
);
}
export const Select = /* @__PURE__ */ StyledSelect(() => {
const Option = /* @__PURE__ */ StyledOption(() => {
const theme = useCustomTheme();
return {
color: theme.colors.primaryText,
background: theme.colors.modalBg,
transition: "background 0.3s ease",
"&:hover": {
background: theme.colors.walletSelectorButtonHoverBg,
},
};
});
const Select = /* @__PURE__ */ StyledSelect(() => {
const theme = useCustomTheme();
return {
fontSize: fontSize.sm,
Binary file not shown.
+15
View File
@@ -1,5 +1,20 @@
# @thirdweb-dev/sdk
## 4.0.69
### Patch Changes
- Updated dependencies [[`560d8ad`](https://github.com/thirdweb-dev/js/commit/560d8adafa011dc48e48e73d7eb6a36170d38cef), [`d7e6671`](https://github.com/thirdweb-dev/js/commit/d7e6671c0a34cc8a3523f397a45d754617c9fbb0), [`948f155`](https://github.com/thirdweb-dev/js/commit/948f155e7c2406cc5a172a6c5abe18ba8da89e2a), [`3be61dd`](https://github.com/thirdweb-dev/js/commit/3be61ddc52cef168cda0bee13e93a926dedf479a), [`cfff7e8`](https://github.com/thirdweb-dev/js/commit/cfff7e838af1c464c9b5fbb547153eaae41e2c66)]:
- thirdweb@5.11.0
## 4.0.68
### Patch Changes
- Updated dependencies [[`3810df5`](https://github.com/thirdweb-dev/js/commit/3810df57aa9590b0a2fa14071a5c061bd94b1ec6), [`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- thirdweb@5.10.1
- @thirdweb-dev/chains@0.1.99
## 4.0.67
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "4.0.67",
"version": "4.0.69",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/sdk",
"license": "Apache-2.0",
Binary file not shown.
@@ -1,5 +1,24 @@
# @thirdweb-dev/unity-js-bridge
## 0.6.18
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@4.0.69
- @thirdweb-dev/wallets@2.5.9
- @thirdweb-dev/auth@4.1.67
## 0.6.17
### Patch Changes
- Updated dependencies [[`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- @thirdweb-dev/chains@0.1.99
- @thirdweb-dev/sdk@4.0.68
- @thirdweb-dev/wallets@2.5.8
- @thirdweb-dev/auth@4.1.66
## 0.6.16
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.6.16",
"version": "0.6.18",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+15
View File
@@ -1,5 +1,20 @@
# @thirdweb-dev/wallets
## 2.5.9
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@4.0.69
## 2.5.8
### Patch Changes
- Updated dependencies [[`45677ad`](https://github.com/thirdweb-dev/js/commit/45677ad62012c63e3443f2e236311eb9a2bad094)]:
- @thirdweb-dev/chains@0.1.99
- @thirdweb-dev/sdk@4.0.68
## 2.5.7
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "2.5.7",
"version": "2.5.9",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"browser": {
@@ -537,7 +537,7 @@
"@thirdweb-dev/crypto": "workspace:*",
"@thirdweb-dev/sdk": "workspace:*",
"@walletconnect/core": "^2.12.1",
"@walletconnect/ethereum-provider": "2.12.1",
"@walletconnect/ethereum-provider": "2.12.2",
"@walletconnect/jsonrpc-utils": "^1.0.8",
"@walletconnect/modal": "^2.6.2",
"@walletconnect/types": "^2.12.1",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/service-utils
## 0.4.28
### Patch Changes
- [#2832](https://github.com/thirdweb-dev/js/pull/2832) [`773b70a`](https://github.com/thirdweb-dev/js/commit/773b70aa1c113c775a1c44f3262b5de0547b5359) Thanks [@farhanW3](https://github.com/farhanW3)! - added httpMethod to usage-tracker
## 0.4.27
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/service-utils",
"version": "0.4.27",
"version": "0.4.28",
"main": "dist/thirdweb-dev-service-utils.cjs.js",
"module": "dist/thirdweb-dev-service-utils.esm.js",
"exports": {
@@ -70,6 +70,19 @@ const usageEventSchema = z.object({
tokenAddress: z.string().optional(),
amountWei: z.string().optional(),
amountUSDCents: z.number().nonnegative().optional(),
httpMethod: z
.enum([
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"CONNECT",
"OPTIONS",
"TRACE",
])
.optional(),
});
export type UsageEvent = z.infer<typeof usageEventSchema>;
+130
View File
@@ -1,5 +1,135 @@
# thirdweb
## 5.11.0
### Minor Changes
- [#2679](https://github.com/thirdweb-dev/js/pull/2679) [`560d8ad`](https://github.com/thirdweb-dev/js/commit/560d8adafa011dc48e48e73d7eb6a36170d38cef) Thanks [@ElasticBottle](https://github.com/ElasticBottle)! - Add support for connecting in-app wallet using phone number
## Usage in TypeScript
```ts
import { createThirdwebClient, createWallet } from "thirdweb";
import { preAuthenticate } from "thirdweb/wallets/in-app";
const client = createThirdwebClient({ clientId: "..." });
const phoneNumber = '+123456789';
// Send OTP to given phone number
async function sendOTP() {
await preAuthenticate({
strategy: "phone",
phoneNumber,
client,
});
}
async function connect() {
// create a in-app wallet instance
const wallet = createWallet('inApp');
// if the OTP is correct, the wallet will be connected else an error will be thrown
const account = await wallet.connect({
client,
strategy: "phone";
phoneNumber,
verificationCode: '...' // Pass the OTP entered by the user
});
console.log('connected to', account);
}
```
## Usage in React
```tsx
import { createThirdwebClient } from "thirdweb";
import { preAuthenticate } from "thirdweb/wallets/in-app";
import { useConnect } from "thirdweb/react";
const client = createThirdwebClient({ clientId: "..." });
function Component() {
const { connect } = useConnect();
const [phoneNumber, setPhoneNumber] = useState(''); // get phone number from user
const [otp, setOtp] = useState(''); // get OTP from user
// Send OTP to given phone number
async function sendOTP() {
await preAuthenticate({
strategy: "phone",
phoneNumber,
client,
});
}
async function connect() {
// create a in-app wallet instance
const wallet = createWallet('inApp');
// if the OTP is correct, the wallet will be connected else an error will be thrown
await wallet.connect({
client,
strategy: "phone";
phoneNumber,
verificationCode: otp
});
// set the wallet as active
connect(wallet)
}
// render UI to get OTP and phone number from user
return <div> ... </div>
}
```
- [#2818](https://github.com/thirdweb-dev/js/pull/2818) [`948f155`](https://github.com/thirdweb-dev/js/commit/948f155e7c2406cc5a172a6c5abe18ba8da89e2a) Thanks [@jnsdls](https://github.com/jnsdls)! - **Gasless transactions in Typescript**
```ts
import { sendTransaction } from "thirdweb";
const result = sendTransaction({
transaction,
account,
gasless: {
provider: "engine",
relayerUrl: "https://...",
relayerForwarderAddress: "0x...",
},
});
```
**Gasless transactions in React**
```jsx
import { useSendTransaction } from "thirdweb/react";
const { mutate } = useSendTransaction({
gasless: {
provider: "engine",
relayerUrl: "https://...",
relayerForwarderAddress: "0x...",
},
});
// Call mutate with the transaction object
mutate(transaction);
```
### Patch Changes
- [#2842](https://github.com/thirdweb-dev/js/pull/2842) [`d7e6671`](https://github.com/thirdweb-dev/js/commit/d7e6671c0a34cc8a3523f397a45d754617c9fbb0) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - fix: handle signature minting with price and currency
- [#2839](https://github.com/thirdweb-dev/js/pull/2839) [`3be61dd`](https://github.com/thirdweb-dev/js/commit/3be61ddc52cef168cda0bee13e93a926dedf479a) Thanks [@MananTank](https://github.com/MananTank)! - Enable Buy Modal by default with useSendTransaction hook
- [#2768](https://github.com/thirdweb-dev/js/pull/2768) [`cfff7e8`](https://github.com/thirdweb-dev/js/commit/cfff7e838af1c464c9b5fbb547153eaae41e2c66) Thanks [@MananTank](https://github.com/MananTank)! - Fix custom chain not being used
## 5.10.1
### Patch Changes
- [#2836](https://github.com/thirdweb-dev/js/pull/2836) [`3810df5`](https://github.com/thirdweb-dev/js/commit/3810df57aa9590b0a2fa14071a5c061bd94b1ec6) Thanks [@jnsdls](https://github.com/jnsdls)! - add missing events for `erc721`, `erc1155` and `erc20`
## 5.10.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "thirdweb",
"version": "5.10.0",
"version": "5.11.0",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -74,24 +74,6 @@ export {
} from "../../extensions/erc1155/__generated__/INFTMetadata/write/setTokenURI.js";
export { freezeMetadata } from "../../extensions/erc1155/__generated__/INFTMetadata/write/freezeMetadata.js";
// EVENTS
export {
transferSingleEvent,
type TransferSingleEventFilters,
} from "../../extensions/erc1155/__generated__/IERC1155/events/TransferSingle.js";
export {
transferBatchEvent,
type TransferBatchEventFilters,
} from "../../extensions/erc1155/__generated__/IERC1155/events/TransferBatch.js";
export {
approvalForAllEvent,
type ApprovalForAllEventFilters,
} from "../../extensions/erc1155/__generated__/IERC1155/events/ApprovalForAll.js";
export { metadataUpdateEvent } from "../../extensions/erc1155/__generated__/INFTMetadata/events/MetadataUpdate.js";
export { metadataFrozenEvent } from "../../extensions/erc1155/__generated__/INFTMetadata/events/MetadataFrozen.js";
export { batchMetadataUpdateEvent } from "../../extensions/erc1155/__generated__/INFTMetadata/events/BatchMetadataUpdate.js";
/**
* DROPS extension for ERC1155
*/
@@ -123,3 +105,22 @@ export {
// EVENTS
export { tokensLazyMintedEvent } from "../../extensions/erc1155/__generated__/ILazyMint/events/TokensLazyMinted.js";
export { tokensClaimedEvent } from "../../extensions/erc1155/__generated__/IDrop1155/events/TokensClaimed.js";
export {
transferSingleEvent,
type TransferSingleEventFilters,
} from "../../extensions/erc1155/__generated__/IERC1155/events/TransferSingle.js";
export {
transferBatchEvent,
type TransferBatchEventFilters,
} from "../../extensions/erc1155/__generated__/IERC1155/events/TransferBatch.js";
export {
approvalForAllEvent,
type ApprovalForAllEventFilters,
} from "../../extensions/erc1155/__generated__/IERC1155/events/ApprovalForAll.js";
export { metadataUpdateEvent } from "../../extensions/erc1155/__generated__/INFTMetadata/events/MetadataUpdate.js";
export { metadataFrozenEvent } from "../../extensions/erc1155/__generated__/INFTMetadata/events/MetadataFrozen.js";
export { batchMetadataUpdateEvent } from "../../extensions/erc1155/__generated__/INFTMetadata/events/BatchMetadataUpdate.js";
export {
tokensMintedWithSignatureEvent,
type TokensMintedWithSignatureEventFilters,
} from "../../extensions/erc1155/__generated__/ISignatureMintERC1155/events/TokensMintedWithSignature.js";
@@ -45,25 +45,6 @@ export {
type BurnFromParams,
} from "../../extensions/erc20/__generated__/IBurnableERC20/write/burnFrom.js";
// EVENTS
export {
transferEvent,
type TransferEventFilters,
} from "../../extensions/erc20/__generated__/IERC20/events/Transfer.js";
export {
approvalEvent,
type ApprovalEventFilters,
} from "../../extensions/erc20/__generated__/IERC20/events/Approval.js";
export {
tokensMintedEvent,
type TokensMintedEventFilters,
} from "../../extensions/erc20/__generated__/IMintableERC20/events/TokensMinted.js";
export {
tokensClaimedEvent,
type TokensClaimedEventFilters,
} from "../../extensions/erc20/__generated__/IDropERC20/events/TokensClaimed.js";
export { claimConditionsUpdatedEvent } from "../../extensions/erc20/__generated__/IDropERC20/events/ClaimConditionsUpdated.js";
/**
* DROPS extension for ERC20
*/
@@ -98,3 +79,26 @@ export {
withdraw,
type WithdrawParams,
} from "../../extensions/erc20/__generated__/IWETH/write/withdraw.js";
// EVENTS
export {
transferEvent,
type TransferEventFilters,
} from "../../extensions/erc20/__generated__/IERC20/events/Transfer.js";
export {
approvalEvent,
type ApprovalEventFilters,
} from "../../extensions/erc20/__generated__/IERC20/events/Approval.js";
export {
tokensMintedEvent,
type TokensMintedEventFilters,
} from "../../extensions/erc20/__generated__/IMintableERC20/events/TokensMinted.js";
export {
tokensClaimedEvent,
type TokensClaimedEventFilters,
} from "../../extensions/erc20/__generated__/IDropERC20/events/TokensClaimed.js";
export { claimConditionsUpdatedEvent } from "../../extensions/erc20/__generated__/IDropERC20/events/ClaimConditionsUpdated.js";
export {
tokensMintedWithSignatureEvent,
type TokensMintedWithSignatureEventFilters,
} from "../../extensions/erc20/__generated__/ISignatureMintERC20/events/TokensMintedWithSignature.js";
@@ -79,18 +79,6 @@ export {
type SetTokenURIParams,
} from "../../extensions/erc721/__generated__/INFTMetadata/write/setTokenURI.js";
/**
* EVENTS extension for ERC721
*/
export {
transferEvent,
type TransferEventFilters,
} from "../../extensions/erc721/__generated__/IERC721A/events/Transfer.js";
export {
tokensLazyMintedEvent,
type TokensLazyMintedEventFilters,
} from "../../extensions/erc721/__generated__/ILazyMint/events/TokensLazyMinted.js";
/**
* DROPS extension for ERC721
*/
@@ -126,3 +114,37 @@ export {
setSharedMetadata,
type SetSharedMetadataParams,
} from "../../extensions/erc721/write/setSharedMetadata.js";
/**
* EVENTS extension for ERC721
*/
export {
transferEvent,
type TransferEventFilters,
} from "../../extensions/erc721/__generated__/IERC721A/events/Transfer.js";
export {
tokensLazyMintedEvent,
type TokensLazyMintedEventFilters,
} from "../../extensions/erc721/__generated__/ILazyMint/events/TokensLazyMinted.js";
export {
approvalEvent,
type ApprovalEventFilters,
} from "../../extensions/erc721/__generated__/IERC721A/events/Approval.js";
export {
approvalForAllEvent,
type ApprovalForAllEventFilters,
} from "../../extensions/erc721/__generated__/IERC721A/events/ApprovalForAll.js";
export {
tokensMintedWithSignatureEvent,
type TokensMintedWithSignatureEventFilters,
} from "../../extensions/erc721/__generated__/ISignatureMintERC721/events/TokensMintedWithSignature.js";
export { claimConditionsUpdatedEvent } from "../../extensions/erc721/__generated__/IDrop/events/ClaimConditionsUpdated.js";
export {
tokensClaimedEvent,
type TokensClaimedEventFilters,
} from "../../extensions/erc721/__generated__/IDrop/events/TokensClaimed.js";
export { sharedMetadataUpdatedEvent } from "../../extensions/erc721/__generated__/ISharedMetadata/events/SharedMetadataUpdated.js";
export {
tokenURIRevealedEvent,
type TokenURIRevealedEventFilters,
} from "../../extensions/erc721/__generated__/IDelayedReveal/events/TokenURIRevealed.js";
@@ -18,7 +18,7 @@ export type SetClaimConditionsParams = {
* ```ts
* import { setClaimConditions } from "thirdweb/extensions/erc1155";
*
* const tx = await setClaimConditions({
* const tx = setClaimConditions({
* contract,
* tokenId: 0n,
* phases: [
@@ -1,14 +1,21 @@
import type { AbiParameterToPrimitiveType, Address } from "abitype";
import { maxUint256 } from "viem";
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/addresses.js";
import {
NATIVE_TOKEN_ADDRESS,
isNativeTokenAddress,
} from "../../../constants/addresses.js";
import type { ThirdwebContract } from "../../../contract/contract.js";
import type { BaseTransactionOptions } from "../../../transaction/types.js";
import { toBigInt } from "../../../utils/bigint.js";
import { dateToSeconds, tenYearsFromNow } from "../../../utils/date.js";
import type { Hex } from "../../../utils/encoding/hex.js";
import type { NFTInput } from "../../../utils/nft/parseNft.js";
import { randomBytes32 } from "../../../utils/uuid.js";
import type { Account } from "../../../wallets/interfaces/wallet.js";
import { mintWithSignature as generatedMintWithSignature } from "../__generated__/ISignatureMintERC1155/write/mintWithSignature.js";
import {
type MintWithSignatureParams,
mintWithSignature as generatedMintWithSignature,
} from "../__generated__/ISignatureMintERC1155/write/mintWithSignature.js";
/**
* Mints a new ERC1155 token with the given minter signature
@@ -29,7 +36,19 @@ import { mintWithSignature as generatedMintWithSignature } from "../__generated_
* @extension ERC1155
* @returns A promise that resolves to the transaction result.
*/
export const mintWithSignature = generatedMintWithSignature;
export function mintWithSignature(
options: BaseTransactionOptions<MintWithSignatureParams>,
) {
const value = isNativeTokenAddress(options.payload.currency)
? options.payload.pricePerToken * options.payload.quantity
: 0n;
return generatedMintWithSignature({
...options,
overrides: {
value,
},
});
}
export type GenerateMintSignatureOptions = {
account: Account;
@@ -61,6 +61,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("generateMintSignature1155", () => {
mintRequest: {
to: TEST_ACCOUNT_B.address,
quantity: 10n,
pricePerToken: "0.1",
metadata: {
name: "My NFT",
description: "This is my NFT",
@@ -1,12 +1,19 @@
import type { AbiParameterToPrimitiveType, Address } from "abitype";
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/addresses.js";
import {
NATIVE_TOKEN_ADDRESS,
isNativeTokenAddress,
} from "../../../constants/addresses.js";
import type { ThirdwebContract } from "../../../contract/contract.js";
import type { BaseTransactionOptions } from "../../../transaction/types.js";
import { dateToSeconds, tenYearsFromNow } from "../../../utils/date.js";
import type { Hex } from "../../../utils/encoding/hex.js";
import { randomBytes32 } from "../../../utils/uuid.js";
import type { Account } from "../../../wallets/interfaces/wallet.js";
import { name } from "../../common/read/name.js";
import { mintWithSignature as generatedMintWithSignature } from "../__generated__/ISignatureMintERC20/write/mintWithSignature.js";
import {
type MintWithSignatureParams,
mintWithSignature as generatedMintWithSignature,
} from "../__generated__/ISignatureMintERC20/write/mintWithSignature.js";
/**
* Mints a new ERC20 token with the given minter signature
@@ -27,7 +34,19 @@ import { mintWithSignature as generatedMintWithSignature } from "../__generated_
* @extension ERC20
* @returns A promise that resolves to the transaction result.
*/
export const mintWithSignature = generatedMintWithSignature;
export function mintWithSignature(
options: BaseTransactionOptions<MintWithSignatureParams>,
) {
const value = isNativeTokenAddress(options.payload.currency)
? options.payload.price
: 0n;
return generatedMintWithSignature({
...options,
overrides: {
value,
},
});
}
export type GenerateMintSignatureOptions = {
account: Account;
@@ -1,13 +1,20 @@
import type { AbiParameterToPrimitiveType, Address } from "abitype";
import type { Hex } from "viem";
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/addresses.js";
import {
NATIVE_TOKEN_ADDRESS,
isNativeTokenAddress,
} from "../../../constants/addresses.js";
import type { ThirdwebContract } from "../../../contract/contract.js";
import type { BaseTransactionOptions } from "../../../transaction/types.js";
import { toBigInt } from "../../../utils/bigint.js";
import { dateToSeconds, tenYearsFromNow } from "../../../utils/date.js";
import type { NFTInput } from "../../../utils/nft/parseNft.js";
import { randomBytes32 } from "../../../utils/uuid.js";
import type { Account } from "../../../wallets/interfaces/wallet.js";
import { mintWithSignature as generatedMintWithSignature } from "../__generated__/ISignatureMintERC721/write/mintWithSignature.js";
import {
type MintWithSignatureParams,
mintWithSignature as generatedMintWithSignature,
} from "../__generated__/ISignatureMintERC721/write/mintWithSignature.js";
/**
* Mints a new ERC721 token with the given minter signature
@@ -28,7 +35,19 @@ import { mintWithSignature as generatedMintWithSignature } from "../__generated_
* @extension ERC721
* @returns A promise that resolves to the transaction result.
*/
export const mintWithSignature = generatedMintWithSignature;
export function mintWithSignature(
options: BaseTransactionOptions<MintWithSignatureParams>,
) {
const value = isNativeTokenAddress(options.payload.currency)
? options.payload.price
: 0n;
return generatedMintWithSignature({
...options,
overrides: {
value,
},
});
}
export type GenerateMintSignatureOptions = {
account: Account;
@@ -10,6 +10,7 @@ import type {
// WalletWithPersonalAccount,
} from "../../../../wallets/interfaces/wallet.js";
import {
getLastConnectedChain,
getStoredActiveWalletId,
getStoredConnectedWalletIds,
} from "../../../../wallets/manager/index.js";
@@ -178,10 +179,13 @@ export function AutoConnect(props: AutoConnectProps) {
return;
}
const lastConnectedChain = await getLastConnectedChain(asyncLocalStorage);
async function handleWalletConnection(wallet: Wallet) {
setConnectionStatus("connecting");
return wallet.autoConnect({
client: props.client,
chain: lastConnectedChain ?? undefined,
});
}
@@ -1,5 +1,6 @@
import { type UseMutationResult, useMutation } from "@tanstack/react-query";
import { estimateGasCost } from "../../../../transaction/actions/estimate-gas-cost.js";
import type { GaslessOptions } from "../../../../transaction/actions/gasless/types.js";
import { sendTransaction } from "../../../../transaction/actions/send-transaction.js";
import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
@@ -34,6 +35,7 @@ type ShowModalData = {
*/
export function useSendTransactionCore(
showPayModal?: (data: ShowModalData) => void,
gasless?: GaslessOptions,
): UseMutationResult<WaitForReceiptOptions, Error, PreparedTransaction> {
const account = useActiveAccount();
@@ -47,6 +49,7 @@ export function useSendTransactionCore(
return sendTransaction({
transaction: tx,
account,
gasless,
});
}
@@ -56,6 +59,7 @@ export function useSendTransactionCore(
const res = await sendTransaction({
transaction: tx,
account,
gasless,
});
resolve(res);
@@ -171,13 +171,14 @@ export function useConnect() {
* Disconnect from given account
* @example
* ```jsx
* import { useDisconnect } from "thirdweb/react";
* import { useDisconnect, useActiveWallet } from "thirdweb/react";
*
* function Example() {
* const { disconnect } = useDisconnect();
* const wallet = useActiveWallet();
*
* return (
* <button onClick={() => disconnect(account)}>
* <button onClick={() => disconnect(wallet)}>
* Disconnect
* </button>
* );
@@ -1,5 +1,6 @@
import { useContext, useState } from "react";
import type { ThirdwebClient } from "../../../client/client.js";
import type { GaslessOptions } from "../../../transaction/actions/gasless/types.js";
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
import { useSendTransactionCore } from "../../core/hooks/contract/useSendTransaction.js";
import { SetRootElementContext } from "../../core/providers/RootElementContext.js";
@@ -47,6 +48,12 @@ export type SendTransactionConfig = {
theme?: Theme | "light" | "dark";
}
| false;
/**
* Configuration for gasless transactions.
* Refer to [`GaslessOptions`](https://portal.thirdweb.com/references/typescript/v5/GaslessOptions) for more details.
*/
gasless?: GaslessOptions;
};
/**
@@ -70,8 +77,9 @@ export function useSendTransaction(config: SendTransactionConfig = {}) {
const setRootEl = useContext(SetRootElementContext);
return useSendTransactionCore(
typeof payModal === "object"
? (data) => {
payModal === false
? undefined
: (data) => {
setRootEl(
<TxModal
tx={data.tx}
@@ -89,8 +97,8 @@ export function useSendTransaction(config: SendTransactionConfig = {}) {
nativeTokenSymbol={data.walletBalance.symbol}
/>,
);
}
: undefined,
},
config.gasless,
);
}
@@ -2,7 +2,6 @@ import styled from "@emotion/styled";
import {
ChevronRightIcon,
ExitIcon,
// EnterIcon,
PaperPlaneIcon,
PinBottomIcon,
PlusIcon,
@@ -16,7 +15,6 @@ import { getContract } from "../../../../contract/contract.js";
import { resolveAvatar } from "../../../../extensions/ens/resolve-avatar.js";
import { resolveName } from "../../../../extensions/ens/resolve-name.js";
import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
import { getUserEmail } from "../../../../wallets/in-app/core/authentication/index.js";
import {
useChainQuery,
useChainsQuery,
@@ -27,7 +25,6 @@ import {
useActiveAccount,
useActiveWallet,
useActiveWalletChain,
// useConnect,
useDisconnect,
useSwitchActiveWalletChain,
} from "../../../core/hooks/wallets/wallet-hooks.js";
@@ -383,7 +380,10 @@ export const ConnectedWalletDetails: React.FC<{
<Container px="lg">
<ConnectedToSmartWallet />
<InAppWalletEmail />
{(activeWallet?.id === "embedded" || activeWallet?.id === "inApp") && (
<InAppWalletUserInfo />
)}
{/* Send, Receive, Swap */}
<Container
@@ -876,20 +876,31 @@ function ConnectedToSmartWallet() {
return null;
}
function InAppWalletEmail() {
function InAppWalletUserInfo() {
const { client } = useConnectUI();
const emailQuery = useQuery({
queryKey: ["in-app-wallet-user", client],
queryFn: async () => {
const data = await getUserEmail({
client: client,
});
const account = useActiveAccount();
return data || null;
const userInfoQuery = useQuery({
queryKey: ["in-app-wallet-user", client, account?.address],
queryFn: async () => {
const { getUserEmail, getUserPhoneNumber } = await import(
"../../../../wallets/in-app/core/authentication/index.js"
);
const [email, phone] = await Promise.all([
getUserEmail({
client: client,
}),
getUserPhoneNumber({
client: client,
}),
]);
return email || phone || null;
},
});
if (emailQuery.data) {
if (userInfoQuery.data) {
return (
<Container
flex="row"
@@ -898,7 +909,7 @@ function InAppWalletEmail() {
paddingBottom: spacing.md,
}}
>
<Text size="sm">{emailQuery.data}</Text>
<Text size="sm">{userInfoQuery.data}</Text>
</Container>
);
}
@@ -4,6 +4,7 @@ import { useActiveAccount } from "../../../../core/hooks/wallets/wallet-hooks.js
import {
useIsWalletModalOpen,
useSetIsWalletModalOpen,
useSetSelectionData,
} from "../../../providers/wallet-ui-states-provider.js";
import { Modal } from "../../components/Modal.js";
import { onModalUnmount, reservedScreens } from "../constants.js";
@@ -15,6 +16,7 @@ import { useSetupScreen } from "./screen.js";
*/
const ConnectModal = () => {
const screenSetup = useSetupScreen();
const setSelectionData = useSetSelectionData();
const { screen, setScreen, initialScreen } = screenSetup;
const isWalletModalOpen = useIsWalletModalOpen();
const setIsWalletModalOpen = useSetIsWalletModalOpen();
@@ -25,8 +27,9 @@ const ConnectModal = () => {
setIsWalletModalOpen(false);
onModalUnmount(() => {
setScreen(initialScreen);
setSelectionData({});
});
}, [initialScreen, setIsWalletModalOpen, setScreen]);
}, [initialScreen, setIsWalletModalOpen, setScreen, setSelectionData]);
const activeAccount = useActiveAccount();
@@ -72,16 +75,8 @@ const ConnectModal = () => {
return;
}
setIsWalletModalOpen(value);
if (!value) {
onModalUnmount(() => {
// if (connectionStatus === "connecting") {
// disconnect();
// }
setScreen(initialScreen);
});
closeModal();
}
}}
>
@@ -3,6 +3,7 @@ import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
import { useSiweAuth } from "../../../../core/hooks/auth/useSiweAuth.js";
import { useConnectUI } from "../../../../core/hooks/others/useWalletConnectionCtx.js";
import { useConnect } from "../../../../core/hooks/wallets/wallet-hooks.js";
import { useSetSelectionData } from "../../../providers/wallet-ui-states-provider.js";
import { LoadingScreen } from "../../../wallets/shared/LoadingScreen.js";
import { WalletSelector } from "../WalletSelector.js";
import { onModalUnmount, reservedScreens } from "../constants.js";
@@ -39,6 +40,7 @@ export const ConnectModalContent = (props: {
client,
} = useConnectUI();
const { connect } = useConnect();
const setSelectionData = useSetSelectionData();
const siweAuth = useSiweAuth(auth);
const showSignatureScreen = siweAuth.requiresAuth && !siweAuth.isLoggedIn;
@@ -52,6 +54,7 @@ export const ConnectModalContent = (props: {
}
onModalUnmount(() => {
setSelectionData({});
setModalVisibility(true);
});
@@ -69,6 +72,7 @@ export const ConnectModalContent = (props: {
connect,
showSignatureScreen,
setScreen,
setSelectionData,
],
);
@@ -1,102 +0,0 @@
import { PinBottomIcon } from "@radix-ui/react-icons";
import type { LocalWallet } from "../../../../../wallets/local/index._ts";
import {
useActiveAccount,
useActiveWallet,
} from "../../../../core/hooks/wallets/wallet-hooks.js";
import { shortenString } from "../../../../core/utils/addresses.js";
import { downloadTextFile } from "../../../wallets/local/utils/downloadTextFile.js";
import { Spacer } from "../../components/Spacer.js";
import {
Container,
ModalHeader,
Line,
ScreenBottomContainer,
} from "../../components/basic.js";
import { Button } from "../../components/buttons.js";
import { Label } from "../../components/formElements.js";
import { spacing, iconSize } from "../../design-system/index.js";
import { Text } from "../../components/text.js";
import { useState, useEffect } from "react";
import { useWalletConnectionCtx } from "../../../../core/hooks/others/useWalletConnectionCtx.js";
import { getLocalWalletLocale } from "../../../wallets/local/locale/getLocalWalletLocale.js";
import type { LocalWalletLocale } from "../../../wallets/local/locale/types.js";
import { LoadingScreen } from "../../../wallets/shared/LoadingScreen.js";
/**
* Export the private key and download it as a text file for current active local wallet
* @internal
*/
export function ExportLocalWallet(props: {
onExport: () => void;
onBack: () => void;
}) {
const { locale: localeId } = useWalletConnectionCtx();
const [locale, setLocale] = useState<LocalWalletLocale | undefined>();
useEffect(() => {
getLocalWalletLocale(localeId).then((_local) => {
setLocale(_local);
});
}, [localeId]);
const isWideScreen = false;
const wallet = useActiveWallet() as LocalWallet;
const account = useActiveAccount();
if (!locale) {
return <LoadingScreen />;
}
const handleExport = async () => {
const privateKey = await wallet.export({
strategy: "privateKey",
encryption: false,
});
downloadTextFile(privateKey, "privateKey.txt");
props.onExport();
};
return (
<Container fullHeight animate="fadein">
<div>
<Container p="lg">
<ModalHeader
onBack={props.onBack}
title={locale.exportScreen.title}
/>
</Container>
<Line />
<Container expand p="lg">
<Text multiline>{locale.exportScreen.downloadMessage}</Text>
<Spacer y="xl" />
<Label>{locale.exportScreen.walletAddress}</Label>
<Spacer y="sm" />
<Text>{shortenString(account?.address || "")}</Text>
</Container>
<Spacer y="lg" />
<ScreenBottomContainer
style={{
borderTop: isWideScreen ? "none" : undefined,
}}
>
<Button
variant="accent"
fullWidth
style={{
display: "flex",
gap: spacing.sm,
}}
type="submit"
onClick={handleExport}
>
<PinBottomIcon width={iconSize.sm} height={iconSize.sm} />
{locale.exportScreen.download}
</Button>
</ScreenBottomContainer>
</div>
</Container>
);
}
@@ -11,3 +11,5 @@ export const StyledInput = /* @__PURE__ */ styled.input;
export const StyledH2 = /* @__PURE__ */ styled.h2;
export const StyledP = /* @__PURE__ */ styled.p;
export const StyledUl = /* @__PURE__ */ styled.ul;
export const StyledSelect = /* @__PURE__ */ styled.select;
export const StyledOption = /* @__PURE__ */ styled.option;
@@ -0,0 +1,111 @@
import { useQuery } from "@tanstack/react-query";
import { useRef } from "react";
import { useCustomTheme } from "../../ui/design-system/CustomThemeProvider.js";
import { StyledOption, StyledSelect } from "../../ui/design-system/elements.js";
import { fontSize, spacing } from "../../ui/design-system/index.js";
export function CountrySelector({
countryCode,
setCountryCode,
}: {
countryCode: string;
setCountryCode: React.Dispatch<React.SetStateAction<string>>;
}) {
const selectRef = useRef<HTMLSelectElement>(null);
const { data: supportedCountries } = useQuery({
queryKey: ["supported-sms-countries"],
queryFn: async () => {
const { supportedSmsCountries } = await import(
"./supported-sms-countries.js"
);
return supportedSmsCountries;
},
});
const supportedCountriesForSms = supportedCountries ?? [
{
countryIsoCode: "US",
countryName: "United States",
phoneNumberCode: 1,
},
];
return (
<>
<Select
ref={selectRef}
name="countries"
id="countries"
value={countryCode}
onChange={(e) => {
setCountryCode(e.target.value);
}}
>
<Option
style={{
display: "none",
}}
value={countryCode}
>
{countryCode}
</Option>
{supportedCountriesForSms.map((country) => {
return (
<Option
key={country.countryIsoCode}
value={`${country.countryIsoCode} +${country.phoneNumberCode}`}
>
{country.countryName} +{country.phoneNumberCode}{" "}
</Option>
);
})}
</Select>
</>
);
}
const Option = /* @__PURE__ */ StyledOption(() => {
const theme = useCustomTheme();
return {
color: theme.colors.primaryText,
background: theme.colors.modalBg,
transition: "background 0.3s ease",
"&:hover": {
background: theme.colors.tertiaryBg,
},
};
});
const Select = /* @__PURE__ */ StyledSelect(() => {
const theme = useCustomTheme();
return {
fontSize: fontSize.sm,
display: "block",
padding: spacing.sm,
boxSizing: "border-box",
outline: "none",
border: "none",
borderRadius: "6px",
color: theme.colors.primaryText,
WebkitAppearance: "none",
appearance: "none",
cursor: "pointer",
background: "transparent",
"&::placeholder": {
color: theme.colors.secondaryText,
},
boxShadow: `0 0 0 1.5px ${theme.colors.borderColor}`,
"&:focus, &:hover": {
boxShadow: `0 0 0 2px ${theme.colors.accentText}`,
},
"&[disabled]": {
cursor: "not-allowed",
},
minWidth: "0px",
maxWidth: "90px",
textOverflow: "ellipsis",
overflow: "hidden",
whiteSpace: "nowrap",
};
});
@@ -24,10 +24,16 @@ function InAppWalletConnectUI(props: {
return <LoadingScreen />;
}
if (state?.emailLogin) {
const otpUserInfo = state?.emailLogin
? { email: state.emailLogin }
: state?.phoneLogin
? { phone: state.phoneLogin }
: undefined;
if (otpUserInfo) {
return (
<InAppWalletOTPLoginUI
email={state.emailLogin}
userInfo={otpUserInfo}
locale={locale}
done={props.done}
goBack={props.goBack}
@@ -1,4 +1,5 @@
import styled from "@emotion/styled";
import { useCallback, useState } from "react";
import type {
InAppWalletAuth,
InAppWalletSocialAuth,
@@ -17,12 +18,16 @@ import { Button } from "../../ui/components/buttons.js";
import { useCustomTheme } from "../../ui/design-system/CustomThemeProvider.js";
import { fontSize, iconSize, spacing } from "../../ui/design-system/index.js";
import { InputSelectionUI } from "./InputSelectionUI.js";
import { LinkButton } from "./LinkButton.js";
import type { InAppWalletLocale } from "./locale/types.js";
import { openOauthSignInWindow } from "./openOauthSignInWindow.js";
import { socialIcons } from "./socialIcons.js";
import type { InAppWalletSelectUIState } from "./types.js";
import { validateEmail } from "./validateEmail.js";
const defaultAuthOptions: InAppWalletAuth[] = [
"email",
"phone",
"google",
"apple",
"facebook",
@@ -43,7 +48,9 @@ export const InAppWalletFormUI = (props: InAppWalletFormUIProps) => {
const locale = props.locale;
const { chain, client, connectModal } = useConnectUI();
const { done, wallet } = props;
const setData = useSetSelectionData();
const setData = useSetSelectionData() as (
value: InAppWalletSelectUIState,
) => void;
const themeObj = useCustomTheme();
@@ -54,12 +61,48 @@ export const InAppWalletFormUI = (props: InAppWalletFormUIProps) => {
};
const config = props.wallet.getConfig();
const authOptions = config?.auth?.options || defaultAuthOptions;
const enableEmailLogin = authOptions.includes("email");
const emailIndex = authOptions.indexOf("email");
const isEmailEnabled = emailIndex !== -1;
const phoneIndex = authOptions.indexOf("phone");
const isPhoneEnabled = phoneIndex !== -1;
const [inputMode, setInputMode] = useState<"email" | "phone" | "none">(() => {
if (isEmailEnabled && isPhoneEnabled) {
return emailIndex < phoneIndex ? "email" : "phone";
}
if (isEmailEnabled) {
return "email";
}
if (isPhoneEnabled) {
return "phone";
}
return "none";
});
const placeholder =
inputMode === "email" ? locale.emailPlaceholder : locale.phonePlaceholder;
const emptyErrorMessage =
inputMode === "email" ? locale.emailRequired : locale.phoneRequired;
let type = "text";
if (inputMode === "email") {
type = "email";
} else if (inputMode === "phone") {
type = "tel";
}
const switchInputModeText =
inputMode === "email" ? locale.signInWithPhone : locale.signInWithEmail;
const switchInputMode = useCallback(() => {
setInputMode((prev) => (prev === "email" ? "phone" : "email"));
}, []);
const allowSwitchInputMode = isEmailEnabled && isPhoneEnabled;
const socialLogins = authOptions.filter(
(x) => x !== "email",
(x) => x !== "email" && x !== "phone",
) as InAppWalletSocialAuth[];
const hasSocialLogins = socialLogins.length > 0;
@@ -100,7 +143,13 @@ export const InAppWalletFormUI = (props: InAppWalletFormUIProps) => {
const showOnlyIcons = socialLogins.length > 1;
return (
<Container flex="column" gap="lg">
<Container
flex="column"
gap="lg"
style={{
position: "relative",
}}
>
{/* Social Login */}
{hasSocialLogins && (
<Container
@@ -137,36 +186,67 @@ export const InAppWalletFormUI = (props: InAppWalletFormUIProps) => {
</Container>
)}
{connectModal.size === "wide" && hasSocialLogins && enableEmailLogin && (
<TextDivider text={locale.or} />
)}
{connectModal.size === "wide" &&
hasSocialLogins &&
(isEmailEnabled || isPhoneEnabled) && <TextDivider text={locale.or} />}
{/* Email Login */}
{enableEmailLogin && (
<InputSelectionUI
onSelect={(email) => {
setData({
emailLogin: email,
});
props.select();
}}
placeholder={locale.emailPlaceholder}
name="email"
type="email"
errorMessage={(_input) => {
const input = _input.replace(/\+/g, "").toLowerCase();
const emailRegex =
/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,})$/g;
const isValidEmail = emailRegex.test(input);
if (!isValidEmail) {
return locale.invalidEmail;
}
{inputMode !== "none" && (
<Container>
{inputMode === "email" ? (
<InputSelectionUI
type={type}
onSelect={(value) => {
setData({ emailLogin: value });
props.select();
}}
placeholder={placeholder}
name="email"
errorMessage={(input) => {
const isValidEmail = validateEmail(input.toLowerCase());
if (!isValidEmail) {
return locale.invalidEmail;
}
return undefined;
}}
emptyErrorMessage={emptyErrorMessage}
submitButtonText={locale.submitEmail}
/>
) : (
<InputSelectionUI
format="phone"
type={type}
onSelect={(value) => {
// removes white spaces and special characters
setData({ phoneLogin: value.replace(/[-\(\) ]/g, "") });
props.select();
}}
placeholder={placeholder}
name="phone"
errorMessage={(_input) => {
// removes white spaces and special characters
const input = _input.replace(/[-\(\) ]/g, "");
const isPhone = /^[0-9]+$/.test(input);
return undefined;
}}
emptyErrorMessage={locale.emailRequired}
submitButtonText={locale.submitEmail}
/>
if (!isPhone && isPhoneEnabled) {
return locale.invalidPhone;
}
return undefined;
}}
emptyErrorMessage={emptyErrorMessage}
submitButtonText={locale.submitEmail}
/>
)}
{allowSwitchInputMode && (
<>
<Spacer y="md" />
<LinkButton onClick={switchInputMode} type="button">
{switchInputModeText}
</LinkButton>
</>
)}
</Container>
)}
</Container>
);
@@ -21,60 +21,89 @@ type VerificationStatus =
| "valid"
| "idle"
| "payment_required";
type EmailStatus = "sending" | SendEmailOtpReturnType | "error";
type ScreenToShow =
| "base"
| "create-password"
| "enter-password-or-recovery-code";
type AccountStatus = "sending" | SendEmailOtpReturnType | "error";
type ScreenToShow = "base" | "enter-password-or-recovery-code";
/**
* @internal
*/
export function InAppWalletOTPLoginUI(props: {
userInfo: { email: string } | { phone: string };
wallet: Wallet<"inApp">;
email: string;
locale: InAppWalletLocale;
done: () => void;
goBack?: () => void;
}) {
const { wallet, done, goBack } = props;
const email = props.email;
const { wallet, done, goBack, userInfo } = props;
const { client, chain, connectModal } = useConnectUI();
const isWideModal = connectModal.size === "wide";
const locale = props.locale;
const [otpInput, setOtpInput] = useState("");
const [verifyStatus, setVerifyStatus] = useState<VerificationStatus>("idle");
const [emailStatus, setEmailStatus] = useState<EmailStatus>("sending");
const [accountStatus, setAccountStatus] = useState<AccountStatus>("sending");
const [screen] = useState<ScreenToShow>("base");
const sendEmail = useCallback(async () => {
const sendEmailOrSms = useCallback(async () => {
setOtpInput("");
setVerifyStatus("idle");
setEmailStatus("sending");
setAccountStatus("sending");
try {
const status = await preAuthenticate({
email,
strategy: "email",
client,
});
setEmailStatus(status);
if ("email" in userInfo) {
const status = await preAuthenticate({
email: userInfo.email,
strategy: "email",
client,
});
setAccountStatus(status);
} else if ("phone" in userInfo) {
const status = await preAuthenticate({
phoneNumber: userInfo.phone,
strategy: "phone",
client,
});
setAccountStatus(status);
} else {
throw new Error("Invalid userInfo");
}
} catch (e) {
console.error(e);
setVerifyStatus("idle");
setEmailStatus("error");
setAccountStatus("error");
}
}, [client, email]);
}, [client, userInfo]);
async function connect(otp: string) {
if ("email" in userInfo) {
await wallet.connect({
chain,
strategy: "email",
email: userInfo.email,
verificationCode: otp,
client,
});
} else if ("phone" in userInfo) {
await wallet.connect({
chain,
strategy: "phone",
phoneNumber: userInfo.phone,
verificationCode: otp,
client,
});
} else {
throw new Error("Invalid userInfo");
}
}
const verify = async (otp: string) => {
if (typeof emailStatus !== "object" || otp.length !== 6) {
if (typeof accountStatus !== "object" || otp.length !== 6) {
return;
}
setVerifyStatus("idle");
if (typeof emailStatus !== "object") {
if (typeof accountStatus !== "object") {
return;
}
@@ -86,23 +115,16 @@ export function InAppWalletOTPLoginUI(props: {
setVerifyStatus("verifying");
const needsRecoveryCode =
emailStatus.recoveryShareManagement === "USER_MANAGED" &&
(emailStatus.isNewUser || emailStatus.isNewDevice);
accountStatus.recoveryShareManagement === "USER_MANAGED" &&
(accountStatus.isNewUser || accountStatus.isNewDevice);
// USER_MANAGED
if (needsRecoveryCode) {
if (emailStatus.isNewUser) {
if (accountStatus.isNewUser) {
try {
await wallet.connect({
chain,
strategy: "email",
email,
verificationCode: otp,
client,
});
await connect(otp);
} catch (e) {
if (e instanceof Error && e.message.includes("encryption key")) {
// TODO: do we need this?
// setScreen("create-password");
} else {
throw e;
@@ -111,13 +133,7 @@ export function InAppWalletOTPLoginUI(props: {
} else {
try {
// verifies otp for UI feedback
await wallet.connect({
chain,
strategy: "email",
email,
verificationCode: otp,
client,
});
await connect(otp);
} catch (e) {
if (e instanceof Error && e.message.includes("encryption key")) {
// TODO: do we need this?
@@ -131,17 +147,8 @@ export function InAppWalletOTPLoginUI(props: {
// AWS_MANAGED
else {
const authResult = await wallet.connect({
chain,
strategy: "email",
email,
verificationCode: otp,
client,
});
if (!authResult) {
throw new Error("Failed to verify OTP");
}
// verifies otp for UI feedback
await connect(otp);
done();
}
@@ -164,9 +171,9 @@ export function InAppWalletOTPLoginUI(props: {
useEffect(() => {
if (!emailSentOnMount.current) {
emailSentOnMount.current = true;
sendEmail();
sendEmailOrSms();
}
}, [sendEmail]);
}, [sendEmailOrSms]);
if (screen === "base") {
return (
@@ -185,7 +192,9 @@ export function InAppWalletOTPLoginUI(props: {
{!isWideModal && <Spacer y="xl" />}
<Text>{locale.emailLoginScreen.enterCodeSendTo}</Text>
<Spacer y="sm" />
<Text color="primaryText">{email}</Text>
<Text color="primaryText">
{"email" in userInfo ? userInfo.email : userInfo.phone}
</Text>
<Spacer y="xl" />
</Container>
@@ -251,7 +260,7 @@ export function InAppWalletOTPLoginUI(props: {
{!isWideModal && <Line />}
<Container p={isWideModal ? undefined : "lg"}>
{emailStatus === "error" && (
{accountStatus === "error" && (
<>
<Text size="sm" center color="danger">
{locale.emailLoginScreen.failedToSendCode}
@@ -259,7 +268,7 @@ export function InAppWalletOTPLoginUI(props: {
</>
)}
{emailStatus === "sending" && (
{accountStatus === "sending" && (
<Container
flex="row"
center="both"
@@ -273,8 +282,8 @@ export function InAppWalletOTPLoginUI(props: {
</Container>
)}
{typeof emailStatus === "object" && (
<LinkButton onClick={sendEmail} type="button">
{typeof accountStatus === "object" && (
<LinkButton onClick={sendEmailOrSms} type="button">
{locale.emailLoginScreen.resendCode}
</LinkButton>
)}
@@ -3,10 +3,9 @@ import { Spacer } from "../../ui/components/Spacer.js";
import { Button } from "../../ui/components/buttons.js";
import { Input } from "../../ui/components/formElements.js";
import { Text } from "../../ui/components/text.js";
import { spacing } from "../../ui/design-system/index.js";
import { CountrySelector } from "./CountrySelector.js";
/**
* @internal
*/
export function InputSelectionUI(props: {
onSelect: (data: string) => void;
placeholder: string;
@@ -15,7 +14,9 @@ export function InputSelectionUI(props: {
errorMessage?: (input: string) => string | undefined;
emptyErrorMessage?: string;
submitButtonText: string;
format?: "phone";
}) {
const [countryCodeInfo, setCountryCodeInfo] = useState("US +1");
const [input, setInput] = useState("");
const [error, setError] = useState<string | undefined>();
const [showError, setShowError] = useState(false);
@@ -26,7 +27,11 @@ export function InputSelectionUI(props: {
return;
}
props.onSelect(input);
props.onSelect(
props.format === "phone"
? `+${countryCodeInfo.split("+")[1]}${input}`
: input,
);
};
const renderingError =
@@ -34,15 +39,31 @@ export function InputSelectionUI(props: {
(!input && !!props.emptyErrorMessage && showError);
return (
<div>
<div
style={{
width: "100%",
}}
>
<div
style={{
position: "relative",
display: "flex",
flexDirection: "row",
gap: spacing.sm,
}}
>
{props.format === "phone" && (
<CountrySelector
countryCode={countryCodeInfo}
setCountryCode={setCountryCodeInfo}
/>
)}
<Input
tabIndex={-1}
placeholder={props.placeholder}
style={{
flexGrow: 1,
}}
variant="outline"
type={props.type}
name={props.name}
@@ -0,0 +1,19 @@
import { useCustomTheme } from "../../ui/design-system/CustomThemeProvider.js";
import { StyledButton } from "../../ui/design-system/elements.js";
import { fontSize } from "../../ui/design-system/index.js";
export const LinkButton = /* @__PURE__ */ StyledButton(() => {
const theme = useCustomTheme();
return {
all: "unset",
color: theme.colors.accentText,
fontSize: fontSize.sm,
cursor: "pointer",
textAlign: "center",
fontWeight: 500,
width: "100%",
"&:hover": {
color: theme.colors.primaryText,
},
};
});
@@ -48,4 +48,9 @@ export default {
submitButton: "Verify",
wrongPassword: "Wrong password",
},
signInWithEmail: "Sign in with Email",
invalidPhone: "Invalid phone number",
phonePlaceholder: "Enter phone number",
signInWithPhone: "Sign in with phone number",
phoneRequired: "phone number is required",
} satisfies InAppWalletLocale;
@@ -48,4 +48,9 @@ export default {
submitButton: "Verificar",
wrongPassword: "Contraseña incorrecta",
},
invalidPhone: "Número de teléfono inválido",
phonePlaceholder: "Ingresa tu número de teléfono",
signInWithPhone: "Iniciar sesión con número de teléfono",
phoneRequired: "Se requiere número de teléfono",
signInWithEmail: "Iniciar sesión con correo electrónico",
} satisfies InAppWalletLocale;
@@ -47,4 +47,9 @@ export default {
submitButton: "確認",
wrongPassword: "パスワードが違います",
},
invalidPhone: "無効な電話番号",
signInWithEmail: "電子メールでサインインする",
phonePlaceholder: "電話番号を入力してください",
signInWithPhone: "電話番号でログイン",
phoneRequired: "電話番号が必要です",
} satisfies InAppWalletLocale;
@@ -48,4 +48,9 @@ export default {
submitButton: "Patunayan",
wrongPassword: "Maling password",
},
signInWithEmail: "Mag-sign in gamit ang email",
invalidPhone: "Hindi wastong numero ng telepono",
phonePlaceholder: "Ilagay ang iyong numero ng telepono",
signInWithPhone: "Mag-login gamit ang numero ng telepono",
phoneRequired: "Kinakailangan ang numero ng telepono",
} satisfies InAppWalletLocale;
@@ -29,6 +29,11 @@ export type InAppWalletLocale = {
title: string;
wrongPassword: string;
};
phonePlaceholder: string;
phoneRequired: string;
signInWithPhone: string;
signInWithEmail: string;
invalidPhone: string;
or: string;
invalidEmail: string;
signIn: string;
File diff suppressed because it is too large Load Diff
@@ -5,6 +5,7 @@ export type InAppWalletSelectUIState =
| undefined
| {
emailLogin?: string;
phoneLogin?: string;
socialLogin?: {
type: InAppWalletSocialAuth;
connectionPromise: Promise<Account>;

Some files were not shown because too many files have changed in this diff Show More