Compare commits

...
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
3871068aa6 Version Packages (#2116)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-03 15:59:09 +13:00
Isaac DubuqueandGitHub d00ca7fd2a add patch bump to payments package (#2115) 2024-01-03 02:51:11 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
9ee3c21eac Version Packages (#2102)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-03 14:34:19 +13:00
ed3afd418c Isaac/react sdk migration (#1913)
Co-authored-by: gerrysaporito <[email protected]>
2024-01-03 00:55:16 +00:00
iketwandGitHub b90fa2cc29 [RN] Adds hideSendButtonand hideReceiveButton to ConnectWallet (#2108) 2024-01-02 20:02:44 +00:00
EimanandGitHub 2ab517aa49 changing Avalanche tether USD address mapping (#2109) 2023-12-28 16:34:34 +00:00
Manan TankandGitHub e46dd0254f [wallets] JSDoc improvements for autogenerated docs (#2103) 2023-12-22 10:06:51 +00:00
Gerry SaporitoandGitHub 1a5627f72d chore: added payments to scope (#2107) 2023-12-20 18:39:51 +00:00
YashandGitHub b808e942fd [SDK] Fix verification (#2105) 2023-12-20 15:02:04 +00:00
iketwandGitHub 7fdb1715e4 [RN] Export types to improve references (#2101) 2023-12-19 17:02:08 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
ae2fcf7e00 Version Packages (#2088)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-19 13:42:24 +13:00
iketwandGitHub 94a8f7960a [RN] Update coinbase wallet SDK to fix scheme bug (#2099) 2023-12-19 00:22:26 +00:00
Manan TankandGitHub c410a1c18a [react, react-core] - Migrate Docs content to JSDoc comments (#2084) 2023-12-18 21:11:29 +00:00
Winston YeoandGitHub 81c46e2298 [walllets]: don't rely on utils package for base url in embedded wallet (#2093) 2023-12-17 17:07:01 +00:00
YashandGitHub f369bffe5a [SDK] Deployment params: Empty default forwarders (#2090) 2023-12-16 21:57:35 +00:00
Kien NgoandGitHub fed1313a19 [SDK] Fix invalid recipient issue when deploy built-in contracts (#2020) 2023-12-15 03:05:02 +00:00
iketwandGitHub b7d4dee446 [RN] Support expo versions >=47 <50 (#2087) 2023-12-14 23:37:58 +00:00
Kien NgoandGitHub 23db97cca5 [react-core] Add hook: useTransferNativeToken (#2008) 2023-12-14 23:22:45 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
0f54e99141 Version Packages (#2083)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-15 09:31:22 +13:00
c701c388c6 feat: ethers skipFetchSetup support (#2085)
Co-authored-by: Manan Tank <[email protected]>
2023-12-15 08:37:55 +13:00
iketwandGitHub 328ef5dc9c [RN] Hide back button in WC modal when WC is the only supportedWallet (#2086) 2023-12-14 18:13:55 +00:00
iketwandGitHub 07fbb799be [RN] Adds the ability to login with any arbitrary login payload (#2074) 2023-12-13 20:50:24 +00:00
iketwandGitHub 699f31c20a [RN/React-Core] Improve comments (#2082) 2023-12-13 02:56:39 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
c97e51b855 Version Packages (#2071)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 13:11:43 +13:00
Adam MajmudarandGitHub e10173bf8a [Wallets] Add support for signTransaction for smart wallets (#2080) 2023-12-12 23:57:45 +00:00
Joaquim VergesandGitHub dbfa73d75a [SDK] Export contract verifier (#2081) 2023-12-12 23:34:31 +00:00
Joaquim VergesandGitHub 1b1212d9fb [Wallet] Export getUserOpReceipt() (#2079) 2023-12-12 22:46:52 +00:00
FirekeeperandGitHub 065f85bf71 [Unity] Support revokeSessionKey/getAllActiveSigners (#2078) 2023-12-12 21:30:46 +00:00
Joaquim VergesandGitHub 09bafa9aeb [Wallets] Respect value in smart wallet gas estimations + add getUserOpReceipt utility function (#2077) 2023-12-12 21:13:18 +00:00
Joaquim VergesandGitHub fe30c88cc3 [SDK] Re-export classes, comment cleanup (#2076) 2023-12-12 09:35:51 +00:00
Joaquim VergesandGitHub 3a9538259c [SDK] cleanup (#2075) 2023-12-12 00:12:03 +00:00
FirekeeperandGitHub 0c730e57e0 [Unity] Add JWT/AuthEndpoint login options (#2073) 2023-12-11 23:43:10 +00:00
iketwandGitHub 33c9f6b1ab [Embedded] Enforce encryption key for custom jwt (#2018) 2023-12-11 22:47:41 +00:00
iketwandGitHub 2346396bdf [RN] Adds analytics nonce to ews (#2072) 2023-12-11 22:41:32 +00:00
Manan TankandGitHub de5ebc9093 [wallets] Fix assertWindowEthereum (#2070) 2023-12-11 20:37:32 +00:00
Joaquim VergesandGitHub 42c4c33d30 [SDK] un-export unneeded classes + package reorganization (#2069) 2023-12-11 19:06:32 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
046603ac54 Version Packages (#2068)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-08 22:29:51 -08:00
YashandGitHub bcfa9463bb Fix deployments (#2067) 2023-12-09 04:37:58 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
42bda873b4 Version Packages (#2054)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-08 18:04:02 -08:00
Joaquim VergesandGitHub d2001ca464 sync chains (#2066) 2023-12-09 00:14:35 +00:00
Manan TankandGitHub c8ba5cf863 [react] - Add option to only show Official WC Modal, Fix focus trap when CW Modal is hidden (#2063) 2023-12-08 13:14:04 +00:00
Joaquim VergesandGitHub 85842c1596 [SDK] expose BaseFee in getDynamicFeeData() (#2062) 2023-12-07 23:29:17 +00:00
FirekeeperandGitHub 0fb2f1fc5e [Unity] Support for sdk.wallet.GetEmail (#2061) 2023-12-07 22:21:23 +00:00
Jonas DanielsandGitHub 497677f359 fix(sdk): roles.setAll.prepare() correctly sorts role removals (#2059) 2023-12-07 18:48:16 +00:00
Manan TankandGitHub 15ae5e7f95 [react] Add "Open Official WalletConnect Modal" in ConnectWallet (#2058) 2023-12-07 16:57:52 +00:00
FirekeeperandGitHub 5a0283d083 [Unity] Reload local wallet in case of reconnection (sw) (#2056) 2023-12-07 00:32:24 +00:00
Winston YeoandGitHub 9496606964 [wallets]: Winston/custom auth endpoint (#2052) 2023-12-06 23:35:47 +00:00
Manan TankandGitHub b50e4a41b5 [react] Use WalletConnect to connect MM on mobile by default (#2029) 2023-12-06 19:52:46 +00:00
YashandGitHub e595d4d92f [SDK] Update implementation (#2053) 2023-12-06 19:29:10 +00:00
484 changed files with 18587 additions and 3581 deletions
+42
View File
@@ -1,5 +1,47 @@
# @thirdweb-dev/auth
## 4.1.20
### Patch Changes
- Updated dependencies [[`e46dd025`](https://github.com/thirdweb-dev/js/commit/e46dd0254f157c3c4d50fe3e4f44e2e24eaf34a8)]:
- @thirdweb-dev/wallets@2.3.3
## 4.1.19
### Patch Changes
- Updated dependencies [[`c410a1c1`](https://github.com/thirdweb-dev/js/commit/c410a1c18a704d118555215db9ba7d92c3b24d8c), [`81c46e22`](https://github.com/thirdweb-dev/js/commit/81c46e22984cdb5b33b2e6eb99a0ebf0e4fbdb33)]:
- @thirdweb-dev/wallets@2.3.2
## 4.1.18
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.3.1
## 4.1.17
### Patch Changes
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
- @thirdweb-dev/wallets@2.3.0
## 4.1.16
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.2.1
## 4.1.15
### Patch Changes
- Updated dependencies [[`94966069`](https://github.com/thirdweb-dev/js/commit/9496606964d65268f8ee6bf9f78b2786e99d33ac), [`15ae5e7f`](https://github.com/thirdweb-dev/js/commit/15ae5e7f95a482a9736923c0e10916a0a6115c3d)]:
- @thirdweb-dev/wallets@2.2.0
## 4.1.14
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.14",
"version": "4.1.20",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/chains
## 0.1.62
### Patch Changes
- [#2084](https://github.com/thirdweb-dev/js/pull/2084) [`c410a1c1`](https://github.com/thirdweb-dev/js/commit/c410a1c18a704d118555215db9ba7d92c3b24d8c) Thanks [@MananTank](https://github.com/MananTank)! - JSDoc comments Improvements
## 0.1.61
### Patch Changes
- [#2066](https://github.com/thirdweb-dev/js/pull/2066) [`d2001ca4`](https://github.com/thirdweb-dev/js/commit/d2001ca464aa699ac821c97eb37de7409ba865f3) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Updatechains
## 0.1.60
### Patch Changes
+6 -9
View File
@@ -20,20 +20,17 @@ export default {
"format": "png"
},
"infoURL": "https://shimmer.network",
"name": "ShimmerEVM Testnet",
"name": "ShimmerEVM Testnet Deprecated 1072",
"nativeCurrency": {
"name": "SMR",
"symbol": "SMR",
"decimals": 6
},
"networkId": 1072,
"rpc": [
"https://shimmerevm-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1072.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://json-rpc.evm.testnet.shimmer.network"
],
"shortName": "shimmerevm-testnet",
"slug": "shimmerevm-testnet",
"rpc": [],
"shortName": "shimmerevm-testnet-deprecated-1072",
"slug": "shimmerevm-testnet-deprecated-1072",
"status": "deprecated",
"testnet": true,
"title": "ShimmerEVM Testnet"
"title": "ShimmerEVM Testnet Deprecated 1072"
} as const satisfies Chain;
+39
View File
@@ -0,0 +1,39 @@
import type { Chain } from "../src/types";
export default {
"chain": "ShimmerEVM",
"chainId": 1073,
"explorers": [
{
"name": "explorer",
"url": "https://explorer.evm.testnet.shimmer.network",
"standard": "EIP3091"
}
],
"faucets": [
"https://evm-toolkit.evm.testnet.shimmer.network",
"https://evm-faucet.testnet.shimmer.network"
],
"icon": {
"url": "ipfs://bafkreibky2sy6qhi6arktayvologkrgu5kudpgdxfkx4uosbvmstz7v4di",
"width": 720,
"height": 720,
"format": "png"
},
"infoURL": "https://shimmer.network",
"name": "ShimmerEVM Testnet",
"nativeCurrency": {
"name": "SMR",
"symbol": "SMR",
"decimals": 6
},
"networkId": 1073,
"rpc": [
"https://shimmerevm-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1073.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://json-rpc.evm.testnet.shimmer.network"
],
"shortName": "shimmerevm-testnet",
"slug": "shimmerevm-testnet",
"testnet": true,
"title": "ShimmerEVM Testnet"
} as const satisfies Chain;
+37
View File
@@ -0,0 +1,37 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 11155420,
"explorers": [
{
"name": "opscout",
"url": "https://optimism-sepolia.blockscout.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [
"https://app.optimism.io/faucet"
],
"infoURL": "https://optimism.io",
"name": "OP Sepolia Testnet",
"nativeCurrency": {
"name": "Sepolia Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 11155420,
"rpc": [
"https://op-sepolia-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://11155420.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://sepolia.optimism.io"
],
"shortName": "opsep",
"slug": "op-sepolia-testnet",
"testnet": true
} as const satisfies Chain;
+33
View File
@@ -0,0 +1,33 @@
import type { Chain } from "../src/types";
export default {
"chain": "TILTYARD",
"chainId": 1127469,
"explorers": [
{
"name": "TILTYARD Explorer",
"url": "http://testnet-explorer.tiltyard.gg",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [
{
"name": "EIP1559"
}
],
"name": "Tiltyard Subnet",
"nativeCurrency": {
"name": "Tiltyard Token",
"symbol": "TILTG",
"decimals": 18
},
"networkId": 1127469,
"rpc": [
"https://tiltyard-subnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1127469.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/tiltyard/testnet/rpc"
],
"shortName": "tiltyard",
"slug": "tiltyard-subnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 12035,
"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": "QI M 11272",
"nativeCurrency": {
"name": "QI M 11272 Token",
"symbol": "JZW",
"decimals": 18
},
"networkId": 12035,
"redFlags": [],
"rpc": [
"https://qi-m-11272.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://12035.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/b19c9e32-f359-451f-ad15-7ec784625c04"
],
"shortName": "QI M 11272",
"slug": "qi-m-11272",
"testnet": true
} as const satisfies Chain;
+1 -7
View File
@@ -6,13 +6,7 @@ export default {
{
"name": "Blockscout",
"url": "https://wan-red-ain.explorer.mainnet.skalenodes.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmT5KKrpNt6duU8QfwaYw3xf4ifTBPtjahpWsMi3gsFmcS",
"width": 440,
"height": 600,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [
+1 -13
View File
@@ -6,22 +6,10 @@ export default {
{
"name": "etndscan",
"url": "https://scan.etnd.pro",
"standard": "none",
"icon": {
"url": "ipfs://Qmd26eRJxPb1jJg5Q4mC2M4kD9Jrs5vmcnr5LczHFMGwSD",
"width": 128,
"height": 128,
"format": "png"
}
"standard": "none"
}
],
"faucets": [],
"icon": {
"url": "ipfs://Qmd26eRJxPb1jJg5Q4mC2M4kD9Jrs5vmcnr5LczHFMGwSD",
"width": 128,
"height": 128,
"format": "png"
},
"infoURL": "https://www.etnd.pro",
"name": "ETND Chain Mainnets",
"nativeCurrency": {
+43
View File
@@ -0,0 +1,43 @@
import type { Chain } from "../src/types";
export default {
"chain": "Immutable zkEVM",
"chainId": 13473,
"explorers": [
{
"name": "Immutable Testnet explorer",
"url": "https://explorer.testnet.immutable.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw",
"width": 1168,
"height": 1168,
"format": "png"
}
}
],
"faucets": [
"https://docs.immutable.com/docs/zkEVM/guides/faucet"
],
"icon": {
"url": "ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw",
"width": 1168,
"height": 1168,
"format": "png"
},
"infoURL": "https://www.immutable.com",
"name": "Immutable zkEVM Testnet",
"nativeCurrency": {
"name": "Test IMX",
"symbol": "tIMX",
"decimals": 18
},
"networkId": 13473,
"rpc": [
"https://immutable-zkevm-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://13473.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.testnet.immutable.com"
],
"shortName": "imx-testnet",
"slug": "immutable-zkevm-testnet",
"testnet": true
} as const satisfies Chain;
+43
View File
@@ -0,0 +1,43 @@
import type { Chain } from "../src/types";
export default {
"chain": "Immutable zkEVM",
"chainId": 15003,
"explorers": [
{
"name": "Immutable Devnet explorer",
"url": "https://explorer.dev.immutable.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw",
"width": 1168,
"height": 1168,
"format": "png"
}
}
],
"faucets": [
"https://docs.immutable.com/docs/zkEVM/guides/faucet"
],
"icon": {
"url": "ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw",
"width": 1168,
"height": 1168,
"format": "png"
},
"infoURL": "https://www.immutable.com",
"name": "Immutable zkEVM Devnet",
"nativeCurrency": {
"name": "Dev IMX",
"symbol": "dIMX",
"decimals": 18
},
"networkId": 15003,
"rpc": [
"https://immutable-zkevm-devnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://15003.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.dev.immutable.com"
],
"shortName": "imx-devnet",
"slug": "immutable-zkevm-devnet",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 17026,
"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": "QI1204I3",
"nativeCurrency": {
"name": "QI1204I3 Token",
"symbol": "BHOX",
"decimals": 18
},
"networkId": 17026,
"redFlags": [],
"rpc": [
"https://qi1204i3.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://17026.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-test.io/e7aeac38-06b2-4aaa-87b4-2c2da10fa43e"
],
"shortName": "QI1204I3",
"slug": "qi1204i3",
"testnet": true
} as const satisfies Chain;
+3 -7
View File
@@ -12,7 +12,7 @@ export default {
"format": ".png"
},
"infoURL": "https://tryroll.com/",
"name": "Roll Testnet",
"name": "Form Testnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
@@ -20,13 +20,9 @@ export default {
},
"networkId": 1748,
"redFlags": [],
"rpc": [
"https://roll-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1748.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://roll.calderachain.xyz/http"
],
"rpc": [],
"shortName": "Roll",
"slug": "roll-testnet",
"slug": "form-testnet",
"testnet": true,
"title": "Roll Testnet"
} as const satisfies Chain;
-6
View File
@@ -10,12 +10,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmePhfibWz9jnGUqF9Rven4x734br1h3LxrChYTEjbbQvo",
"width": 256,
"height": 256,
"format": "png"
},
"infoURL": "https://proofofmemes.org",
"name": "Proof Of Memes",
"nativeCurrency": {
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "MRK",
"chainId": 1909,
"explorers": [
{
"name": "blockscout",
"url": "https://merklescan.com",
"standard": "none"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZocJpCSLoQqoYFkF1kn7uKDuAiFRNTK8P5PoVeiigDBU",
"width": 114,
"height": 132,
"format": "png"
},
"infoURL": "https://merklescan.com",
"name": "Merkle Scan",
"nativeCurrency": {
"name": "Merkle",
"symbol": "MRK",
"decimals": 18
},
"networkId": 1909,
"rpc": [
"https://merkle-scan.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://1909.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://marklechain-rpc.merklescan.com"
],
"shortName": "MRK",
"slug": "merkle-scan",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 19683,
"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": "ST 12-07 V1",
"nativeCurrency": {
"name": "ST 12-07 V1 Token",
"symbol": "XRL",
"decimals": 18
},
"networkId": 19683,
"redFlags": [],
"rpc": [
"https://st-12-07-v1.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://19683.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-test.io/d26b972e-1832-4d3a-bf7b-d0ce1f4331c2"
],
"shortName": "ST 12-07 V1",
"slug": "st-12-07-v1",
"testnet": true
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "X1",
"chainId": 202212,
"explorers": [
{
"name": "Blockscout",
"url": "https://explorer.x1-devnet.xen.network",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [],
"infoURL": "https://docs.xen.network/x1/",
"name": "X1 Devnet",
"nativeCurrency": {
"name": "XN",
"symbol": "XN",
"decimals": 18
},
"networkId": 202212,
"rpc": [
"https://x1-devnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://202212.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://x1-devnet.xen.network"
],
"shortName": "x1-devnet",
"slug": "x1-devnet",
"testnet": false
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "X1",
"chainId": 204005,
"explorers": [
{
"name": "Blockscout",
"url": "https://explorer.x1-testnet.xen.network",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [],
"infoURL": "https://docs.xen.network/go-x1/",
"name": "X1 Network",
"nativeCurrency": {
"name": "XN",
"symbol": "XN",
"decimals": 18
},
"networkId": 204005,
"rpc": [
"https://x1-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://204005.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://x1-testnet.xen.network"
],
"shortName": "x1-testnet",
"slug": "x1-network",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "BSL",
"chainId": 21912,
"explorers": [
{
"name": "BSL Mainnet Explorer",
"url": "https://scan.nftruth.io",
"standard": "EIP3091"
}
],
"faucets": [],
"infoURL": "https://bsquarelab.com/",
"name": "BSL Mainnet",
"nativeCurrency": {
"name": "Origin NFT",
"symbol": "ONF",
"decimals": 18
},
"networkId": 21912,
"rpc": [
"https://bsl.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://21912.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"http://rpc-mainnet.nftruth.io:8545",
"ws://rpc-mainnet.nftruth.io:8645"
],
"shortName": "onf",
"slug": "bsl",
"testnet": false
} as const satisfies Chain;
+23
View File
@@ -0,0 +1,23 @@
import type { Chain } from "../src/types";
export default {
"chain": "ebro",
"chainId": 2306,
"explorers": [],
"faucets": [],
"infoURL": "https://www.ebrochain.com",
"name": "Ebro Network",
"nativeCurrency": {
"name": "Ebro",
"symbol": "ebro",
"decimals": 18
},
"networkId": 2306,
"rpc": [
"https://ebro-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://2306.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://greendinoswap.com"
],
"shortName": "ebro",
"slug": "ebro-network",
"testnet": false
} as const satisfies Chain;
+1 -6
View File
@@ -14,11 +14,6 @@ export default {
"format": "png"
}
},
{
"name": "native",
"url": "https://devnet.explorer.neon-labs.org",
"standard": "EIP3091"
},
{
"name": "neonscan",
"url": "https://devnet.neonscan.org",
@@ -35,7 +30,7 @@ export default {
"format": "png"
},
"infoURL": "https://neon-labs.org",
"name": "Neon EVM DevNet",
"name": "Neon EVM Devnet",
"nativeCurrency": {
"name": "Neon",
"symbol": "NEON",
+6 -2
View File
@@ -22,14 +22,18 @@ export default {
"format": "png"
},
"infoURL": "https://neonevm.org",
"name": "Neon EVM MainNet",
"name": "Neon EVM Mainnet",
"nativeCurrency": {
"name": "Neon",
"symbol": "NEON",
"decimals": 18
},
"networkId": 245022934,
"rpc": [],
"rpc": [
"https://neon-evm.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://245022934.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://neon-proxy-mainnet.solana.p2p.org"
],
"shortName": "neonevm-mainnet",
"slug": "neon-evm",
"testnet": false
+1
View File
@@ -36,5 +36,6 @@ export default {
],
"shortName": "neonevm-testnet",
"slug": "neon-evm-testnet",
"status": "deprecated",
"testnet": true
} as const satisfies Chain;
+1 -1
View File
@@ -5,7 +5,7 @@ export default {
"explorers": [
{
"name": "Cronos Explorer",
"url": "https://cronoscan.com",
"url": "https://explorer.cronos.org",
"standard": "none"
}
],
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"chain": "FRAX",
"chainId": 252,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmQLJk5G7zF8ZDxSxkRcpHqEqcifrJEhGmEKC6zwyPXWAw/fraxchain.png",
"width": 512,
"height": 512,
"format": "PNG"
},
"infoURL": "https://mainnet.frax.com",
"name": "Fraxchain Mainnet",
"nativeCurrency": {
"name": "Frax Ether",
"symbol": "frxETH",
"decimals": 18
},
"networkId": 252,
"redFlags": [],
"rpc": [],
"shortName": "fraxchain",
"slug": "fraxchain",
"status": "incubating",
"testnet": false
} as const satisfies Chain;
+32
View File
@@ -0,0 +1,32 @@
import type { Chain } from "../src/types";
export default {
"chain": "FRAX",
"chainId": 2522,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmQLJk5G7zF8ZDxSxkRcpHqEqcifrJEhGmEKC6zwyPXWAw/fraxchain.png",
"width": 512,
"height": 512,
"format": "PNG"
},
"infoURL": "https://testnet.frax.com",
"name": "Fraxchain Testnet",
"nativeCurrency": {
"name": "Frax Ether",
"symbol": "frxETH",
"decimals": 18
},
"networkId": 2522,
"redFlags": [],
"rpc": [
"https://fraxchain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://2522.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.testnet.frax.com"
],
"shortName": "fraxchain-testnet",
"slug": "fraxchain-testnet",
"status": "active",
"testnet": false
} as const satisfies Chain;
+8 -8
View File
@@ -4,14 +4,14 @@ export default {
"chainId": 2710,
"explorers": [
{
"name": "Morphism Testnet Explorer",
"url": "https://explorer-testnet.morphism.xyz",
"name": "Morph Testnet Explorer",
"url": "https://explorer-testnet.morphl2.io",
"standard": "EIP3091"
}
],
"faucets": [],
"infoURL": "https://morphism.xyz",
"name": "Morphism Testnet",
"infoURL": "https://morphl2.io",
"name": "Morph Testnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
@@ -23,16 +23,16 @@ export default {
"chain": "eip155-1",
"bridges": [
{
"url": "https://bridge-testnet.morphism.xyz"
"url": "https://bridge-testnet.morphl2.io"
}
]
},
"rpc": [
"https://morphism-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://morph-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://2710.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.morphism.xyz"
"https://rpc-testnet.morphl2.io"
],
"shortName": "tmorph",
"slug": "morphism-testnet",
"slug": "morph-testnet",
"testnet": true
} as const satisfies Chain;
+7 -8
View File
@@ -15,17 +15,15 @@ export default {
}
}
],
"faucets": [
"https://goerli.portal.zksync.io/faucet"
],
"faucets": [],
"icon": {
"url": "ipfs://QmRkhUD6J3B9WhT4hEWLrcFVTrBhx3CQgNC783aJsrwxSN",
"width": 512,
"height": 512,
"format": "svg"
},
"infoURL": "https://era.zksync.io/docs/",
"name": "zkSync Era Testnet",
"infoURL": "https://zksync.io/",
"name": "zkSync Era Goerli Testnet (deprecated)",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
@@ -37,16 +35,17 @@ export default {
"chain": "eip155-1",
"bridges": [
{
"url": "https://goerli.portal.zksync.io/bridge"
"url": "https://bridge.zksync.io/"
}
]
},
"rpc": [
"https://zksync-era-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zksync-era-goerli-testnet-deprecated.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://280.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.era.zksync.dev"
],
"shortName": "zksync-goerli",
"slug": "zksync-era-testnet",
"slug": "zksync-era-goerli-testnet-deprecated",
"status": "deprecated",
"testnet": true
} as const satisfies Chain;
+44 -11
View File
@@ -1,20 +1,53 @@
import type { Chain } from "../src/types";
export default {
"chain": "OGC",
"chain": "ETH",
"chainId": 300,
"explorers": [],
"explorers": [
{
"name": "zkSync Block Explorer",
"url": "https://sepolia.explorer.zksync.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRkhUD6J3B9WhT4hEWLrcFVTrBhx3CQgNC783aJsrwxSN",
"width": 512,
"height": 512,
"format": "svg"
}
}
],
"faucets": [],
"infoURL": "https://docs.gnosischain.com",
"name": "(deprecated) Optimism on GC",
"icon": {
"url": "ipfs://QmRkhUD6J3B9WhT4hEWLrcFVTrBhx3CQgNC783aJsrwxSN",
"width": 512,
"height": 512,
"format": "svg"
},
"infoURL": "https://zksync.io/",
"name": "zkSync Sepolia Testnet",
"nativeCurrency": {
"name": "xDAI",
"symbol": "xDAI",
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 300,
"rpc": [],
"shortName": "ogc",
"slug": "deprecated-optimism-on-gc",
"status": "deprecated",
"testnet": false
"parent": {
"type": "L2",
"chain": "eip155-1",
"bridges": [
{
"url": "https://bridge.zksync.io/"
}
]
},
"redFlags": [
"reusedChainId"
],
"rpc": [
"https://zksync-sepolia-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://300.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://sepolia.era.zksync.dev"
],
"shortName": "zksync-sepolia",
"slug": "zksync-sepolia-testnet",
"testnet": true
} as const satisfies Chain;
+3 -3
View File
@@ -23,7 +23,7 @@ export default {
"format": "svg"
},
"infoURL": "https://zksync.io/",
"name": "zkSync Era Mainnet",
"name": "zkSync Mainnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
@@ -40,11 +40,11 @@ export default {
]
},
"rpc": [
"https://zksync-era.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zksync.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://324.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet.era.zksync.io"
],
"shortName": "zksync",
"slug": "zksync-era",
"slug": "zksync",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 35730,
"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": "QR1129I1",
"nativeCurrency": {
"name": "QR1129I1 Token",
"symbol": "YXAX",
"decimals": 18
},
"networkId": 35730,
"redFlags": [],
"rpc": [
"https://qr1129i1.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://35730.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/qr1129i1/testnet/rpc"
],
"shortName": "QR1129I1",
"slug": "qr1129i1",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 36908,
"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": "QR1205s1",
"nativeCurrency": {
"name": "QR1205s1 Token",
"symbol": "MDN",
"decimals": 18
},
"networkId": 36908,
"redFlags": [],
"rpc": [
"https://qr1205s1.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://36908.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/qr1205s1/testnet/rpc"
],
"shortName": "QR1205s1",
"slug": "qr1205s1",
"testnet": true
} as const satisfies Chain;
+24
View File
@@ -0,0 +1,24 @@
import type { Chain } from "../src/types";
export default {
"chain": "Firechain",
"chainId": 3885,
"explorers": [],
"faucets": [],
"infoURL": "https://docs.thefirechain.com/",
"name": "Firechain zkEVM Ghostrider",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 3885,
"rpc": [
"https://firechain-zkevm-ghostrider.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://3885.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.zkevm.ghostrider.thefirechain.com"
],
"shortName": "firechain-zkEVM-ghostrider",
"slug": "firechain-zkevm-ghostrider",
"testnet": false,
"title": "Firechain zkEVM Ghostrider"
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "X1",
"chainId": 4003,
"explorers": [
{
"name": "Blockscout",
"url": "https://explorer.x1-fastnet.xen.network",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
}
}
],
"faucets": [],
"infoURL": "https://docs.xen.network/go-x1/",
"name": "X1 Fastnet",
"nativeCurrency": {
"name": "XN",
"symbol": "XN",
"decimals": 18
},
"networkId": 4003,
"rpc": [
"https://x1-fastnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://4003.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://x1-fastnet.xen.network"
],
"shortName": "x1-fastnet",
"slug": "x1-fastnet",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "XFI",
"chainId": 4157,
"explorers": [
{
"name": "Scan Testnet",
"url": "https://scan.testnet.ms/",
"standard": "EIP1559"
}
],
"faucets": [],
"features": [],
"name": "CrossFi Testnet",
"nativeCurrency": {
"name": "XFI",
"symbol": "XFI",
"decimals": 18
},
"networkId": 4157,
"redFlags": [],
"rpc": [
"https://crossfi-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://4157.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.testnet.ms/"
],
"shortName": "XFI",
"slug": "crossfi-testnet",
"testnet": true,
"title": "https://scan.testnet.ms/"
} as const satisfies Chain;
+49
View File
@@ -0,0 +1,49 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 43851,
"explorers": [
{
"name": "ZKFair Testnet Info",
"url": "https://testnet-scan.zkfair.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmVb682D4mUXkKNP28xxJDNgSYbDLvEc3kVYx7TQxEa6Cw",
"width": 400,
"height": 400,
"format": "jpg"
}
}
],
"faucets": [],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"icon": {
"url": "ipfs://QmVb682D4mUXkKNP28xxJDNgSYbDLvEc3kVYx7TQxEa6Cw",
"width": 400,
"height": 400,
"format": "jpg"
},
"infoURL": "https://zkfair.io",
"name": "ZKFair Testnet",
"nativeCurrency": {
"name": "USDC Token",
"symbol": "USDC",
"decimals": 18
},
"networkId": 43851,
"rpc": [
"https://zkfair-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://43851.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet-rpc.zkfair.io"
],
"shortName": "ZKFair-Testnet",
"slug": "zkfair-testnet",
"testnet": true
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "Areon",
"chainId": 463,
"explorers": [
{
"name": "AreonScan",
"url": "https://areonscan.com",
"standard": "none"
}
],
"faucets": [],
"icon": {
"url": "ipfs://bafkreihs2nrnizpcuzjmuu2yi7wrtwd7qlqje46qnil5bnntfbfkb2roea",
"width": 1000,
"height": 1000,
"format": "png"
},
"infoURL": "https://areon.network",
"name": "Areon Network Mainnet",
"nativeCurrency": {
"name": "Areon",
"symbol": "AREA",
"decimals": 18
},
"networkId": 463,
"rpc": [
"https://areon-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://463.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet-rpc.areon.network"
],
"shortName": "area",
"slug": "areon-network",
"testnet": false
} as const satisfies Chain;
+2 -2
View File
@@ -5,7 +5,7 @@ export default {
"explorers": [
{
"name": "Scroll Sepolia Etherscan",
"url": "https://sepolia.scrollscan.dev",
"url": "https://sepolia.scrollscan.com",
"standard": "EIP3091"
},
{
@@ -28,7 +28,7 @@ export default {
"chain": "eip155-11155111",
"bridges": [
{
"url": "https://scroll.io/bridge"
"url": "https://sepolia.scroll.io/bridge"
}
]
},
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 56914,
"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": "KK1223",
"nativeCurrency": {
"name": "KK1223 Token",
"symbol": "KLK",
"decimals": 18
},
"networkId": 56914,
"redFlags": [],
"rpc": [
"https://kk1223.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://56914.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/bf540c23-4601-4768-9e26-f2e5f0f89c18"
],
"shortName": "KK1223",
"slug": "kk1223",
"testnet": true
} as const satisfies Chain;
+41
View File
@@ -0,0 +1,41 @@
import type { Chain } from "../src/types";
export default {
"chain": "GCODE",
"chainId": 59971,
"explorers": [
{
"name": "Genesys Scan",
"url": "https://genesysscan.io",
"standard": "none",
"icon": {
"url": "ipfs://bafkreihgmpaceze7rxpajv7yrlx3cb6daqubippkpvgryzairtaubsjjoe",
"width": 512,
"height": 512,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://bafkreihgmpaceze7rxpajv7yrlx3cb6daqubippkpvgryzairtaubsjjoe",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://genesyscode.io",
"name": "Genesys Code Mainnet",
"nativeCurrency": {
"name": "GenesysCode",
"symbol": "GCODE",
"decimals": 18
},
"networkId": 59971,
"rpc": [
"https://genesys-code.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://59971.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet.genesyscode.io/"
],
"shortName": "gcode",
"slug": "genesys-code",
"testnet": false
} as const satisfies Chain;
+11 -10
View File
@@ -1,11 +1,11 @@
import type { Chain } from "../src/types";
export default {
"chain": "RTH",
"chain": "HYP",
"chainId": 622277,
"explorers": [
{
"name": "rethereum",
"url": "https://explorer.rethereum.org",
"name": "hypra",
"url": "https://explorer.hypra.network",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
@@ -30,22 +30,23 @@ export default {
"height": 830,
"format": "png"
},
"infoURL": "https://www.rethereum.org",
"name": "Rethereum Mainnet",
"infoURL": "https://www.hypra.network",
"name": "Hypra Mainnet",
"nativeCurrency": {
"name": "Rethereum",
"symbol": "RTH",
"name": "Hypra",
"symbol": "HYP",
"decimals": 18
},
"networkId": 622277,
"rpc": [
"https://rethereum.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://hypra.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://622277.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.hypra.network",
"https://rpc.rethereum.org",
"https://rethereum.rpc.restratagem.com",
"https://rpc.rthcentral.org"
],
"shortName": "rth",
"slug": "rethereum",
"shortName": "hyp",
"slug": "hypra",
"testnet": false
} as const satisfies Chain;
@@ -1,7 +1,7 @@
import type { Chain } from "../src/types";
export default {
"chain": "AUT",
"chainId": 65010000,
"chainId": 65010001,
"explorers": [
{
"name": "autonity-blockscout",
@@ -19,20 +19,20 @@ export default {
"format": "png"
},
"infoURL": "https://autonity.org/",
"name": "Autonity Bakerloo (Thames) Testnet",
"name": "Autonity Bakerloo (Barada) Testnet",
"nativeCurrency": {
"name": "Bakerloo Auton",
"symbol": "ATN",
"decimals": 18
},
"networkId": 65010000,
"networkId": 65010001,
"rpc": [
"https://autonity-bakerloo-thames-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://65010000.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://autonity-bakerloo-barada-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://65010001.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc1.bakerloo.autonity.org/",
"wss://rpc1.bakerloo.autonity.org/ws/"
],
"shortName": "bakerloo-0",
"slug": "autonity-bakerloo-thames-testnet",
"shortName": "bakerloo-01",
"slug": "autonity-bakerloo-barada-testnet",
"testnet": true
} as const satisfies Chain;
+29
View File
@@ -0,0 +1,29 @@
import type { Chain } from "../src/types";
export default {
"chain": "Kalichain",
"chainId": 653,
"explorers": [
{
"name": "kalichain explorer",
"url": "https://explorer.kalichain.com",
"standard": "EIP3091"
}
],
"faucets": [],
"infoURL": "https://kalichain.com",
"name": "Kalichain Mainnet",
"nativeCurrency": {
"name": "kalis",
"symbol": "KALIS",
"decimals": 18
},
"networkId": 653,
"rpc": [
"https://kalichain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://653.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.kalichain.com"
],
"shortName": "kalichain",
"slug": "kalichain",
"testnet": false
} as const satisfies Chain;
+27
View File
@@ -0,0 +1,27 @@
import type { Chain } from "../src/types";
export default {
"chain": "OCASH",
"chainId": 660868,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://ipfs.io/ipfs/QmbwuoezvkfZBY9nrZ65n3iHGyhJG6yDRyhPjqE6k3uCiM",
"width": 350,
"height": 350,
"format": "PNG"
},
"infoURL": "https://www.overline.network",
"name": "Ocash testnet",
"nativeCurrency": {
"name": "OCASH",
"symbol": "OCASH",
"decimals": 18
},
"networkId": 660868,
"redFlags": [],
"rpc": [],
"shortName": "ocash",
"slug": "ocash-testnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 69740,
"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": "Will's Testnet",
"nativeCurrency": {
"name": "Will's Testnet Token",
"symbol": "WLDVNT",
"decimals": 18
},
"networkId": 69740,
"redFlags": [],
"rpc": [
"https://will-s-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://69740.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "Will's Testnet",
"slug": "will-s-testnet",
"testnet": true
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 70466,
"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": "Cohan test3",
"nativeCurrency": {
"name": "Cohan test3 Token",
"symbol": "HYN",
"decimals": 18
},
"networkId": 70466,
"redFlags": [],
"rpc": [
"https://cohan-test3.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://70466.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/f44b72ee-0574-44d2-a10b-363a74964145"
],
"shortName": "Cohan test3",
"slug": "cohan-test3",
"testnet": true
} as const satisfies Chain;
+24
View File
@@ -0,0 +1,24 @@
import type { Chain } from "../src/types";
export default {
"chain": "BLU",
"chainId": 727,
"explorers": [],
"faucets": [],
"infoURL": "https://www.blucrates.com",
"name": "Blucrates",
"nativeCurrency": {
"name": "Blucrates",
"symbol": "BLU",
"decimals": 18
},
"networkId": 727,
"rpc": [
"https://blucrates.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://727.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://data.bluchain.pro"
],
"shortName": "blu",
"slip44": 727,
"slug": "blucrates",
"testnet": false
} as const satisfies Chain;
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 80182,
"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": "QI M 12051",
"nativeCurrency": {
"name": "QI M 12051 Token",
"symbol": "VTV",
"decimals": 18
},
"networkId": 80182,
"redFlags": [],
"rpc": [
"https://qi-m-12051.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://80182.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avacloud-dev.io/b19c9e32-f359-451f-ad15-7ec784625c04"
],
"shortName": "QI M 12051",
"slug": "qi-m-12051",
"testnet": true
} as const satisfies Chain;
+29
View File
@@ -0,0 +1,29 @@
import type { Chain } from "../src/types";
export default {
"chain": "Nordek",
"chainId": 81041,
"explorers": [
{
"name": "nordek",
"url": "https://nordekscan.com",
"standard": "EIP3091"
}
],
"faucets": [],
"infoURL": "https://nordekscan.com",
"name": "Nordek Mainnet",
"nativeCurrency": {
"name": "NRK",
"symbol": "NRK",
"decimals": 18
},
"networkId": 81041,
"rpc": [
"https://nordek.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://81041.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet-rpc.nordekscan.com"
],
"shortName": "nordek",
"slug": "nordek",
"testnet": false
} as const satisfies Chain;
+39
View File
@@ -0,0 +1,39 @@
import type { Chain } from "../src/types";
export default {
"chain": "Firechain",
"chainId": 814,
"explorers": [],
"faucets": [],
"icon": {
"url": "ipfs://QmYjuztyURb3Fc6ZTLgCbwQa64CcVoigF5j9cafzuSbqgf",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://docs.thefirechain.com/",
"name": "Firechain zkEVM",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 814,
"parent": {
"type": "L2",
"chain": "eip155-1",
"bridges": [
{
"url": "https://zkevm.bridge.rpc.thefirechain.com"
}
]
},
"rpc": [
"https://firechain-zkevm.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://814.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.zkevm.thefirechain.com"
],
"shortName": "firechan-zkEVM",
"slug": "firechain-zkevm",
"testnet": false,
"title": "Firechain zkEVM"
} as const satisfies Chain;
+1 -1
View File
@@ -5,7 +5,7 @@ export default {
"explorers": [
{
"name": "blockscout",
"url": "https://testnet.torusscan.com",
"url": "https://testnet.toruscan.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
+31
View File
@@ -0,0 +1,31 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 88883,
"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": "Proj Orc Testnet Alpha",
"nativeCurrency": {
"name": "Proj Orc Testnet Alpha Token",
"symbol": "STX",
"decimals": 18
},
"networkId": 88883,
"redFlags": [],
"rpc": [
"https://proj-orc-testnet-alpha.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://88883.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/projorctes/testnet/rpc"
],
"shortName": "Proj Orc Testnet Alpha",
"slug": "proj-orc-testnet-alpha",
"testnet": true
} as const satisfies Chain;
+2 -1
View File
@@ -29,7 +29,8 @@ export default {
"rpc": [
"https://jibchain-l1.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://8899.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-l1.jibchain.net"
"https://rpc-l1.jibchain.net",
"https://jib-rpc.inan.in.th"
],
"shortName": "jbc",
"slug": "jibchain-l1",
+17 -5
View File
@@ -2,12 +2,24 @@ import type { Chain } from "../src/types";
export default {
"chain": "Oort Mainnet",
"chainId": 970,
"explorers": [],
"explorers": [
{
"name": "Oort Mainnet Explorer",
"url": "https://mainnet-scan.oortech.com",
"standard": "none",
"icon": {
"url": "ipfs://bafkreidrbvklkb52sgmg7cmy42fhf7vqpig7qj7bnrq24ijdwywkzr2tfy",
"width": 1440,
"height": 1440,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZ1jbxFZcuotj3eZ6iKFrg9ZXnaV8AK6sGRa7ELrceWyD",
"width": 1043,
"height": 1079,
"url": "ipfs://bafkreidrbvklkb52sgmg7cmy42fhf7vqpig7qj7bnrq24ijdwywkzr2tfy",
"width": 1440,
"height": 1440,
"format": "png"
},
"infoURL": "https://oortech.com",
@@ -21,7 +33,7 @@ export default {
"rpc": [
"https://oort.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://970.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.oortech.com"
"https://mainnet-rpc.oortech.com"
],
"shortName": "ccn",
"slug": "oort",
+21 -5
View File
@@ -2,12 +2,24 @@ import type { Chain } from "../src/types";
export default {
"chain": "MainnetDev",
"chainId": 9700,
"explorers": [],
"explorers": [
{
"name": "Oort MainnetDev Scan",
"url": "https://dev-scan.oortech.com",
"standard": "none",
"icon": {
"url": "ipfs://bafkreidrbvklkb52sgmg7cmy42fhf7vqpig7qj7bnrq24ijdwywkzr2tfy",
"width": 1440,
"height": 1440,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZ1jbxFZcuotj3eZ6iKFrg9ZXnaV8AK6sGRa7ELrceWyD",
"width": 1043,
"height": 1079,
"url": "ipfs://bafkreidrbvklkb52sgmg7cmy42fhf7vqpig7qj7bnrq24ijdwywkzr2tfy",
"width": 1440,
"height": 1440,
"format": "png"
},
"infoURL": "https://oortech.com",
@@ -18,7 +30,11 @@ export default {
"decimals": 18
},
"networkId": 9700,
"rpc": [],
"rpc": [
"https://oort-dev.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://9700.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://dev-rpc.oortech.com"
],
"shortName": "MainnetDev",
"slug": "oort-dev",
"testnet": false,
+16 -4
View File
@@ -2,12 +2,24 @@ import type { Chain } from "../src/types";
export default {
"chain": "Ascraeus",
"chainId": 972,
"explorers": [],
"explorers": [
{
"name": "Oort Ascraeus Explorer",
"url": "https://ascraeus-scan.oortech.com",
"standard": "none",
"icon": {
"url": "ipfs://bafkreidrbvklkb52sgmg7cmy42fhf7vqpig7qj7bnrq24ijdwywkzr2tfy",
"width": 1440,
"height": 1440,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZ1jbxFZcuotj3eZ6iKFrg9ZXnaV8AK6sGRa7ELrceWyD",
"width": 1043,
"height": 1079,
"url": "ipfs://bafkreidrbvklkb52sgmg7cmy42fhf7vqpig7qj7bnrq24ijdwywkzr2tfy",
"width": 1440,
"height": 1440,
"format": "png"
},
"infoURL": "https://oortech.com",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.60",
"version": "0.1.62",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
+2 -2
View File
@@ -83,7 +83,7 @@ export async function fetchChains(options?: {
/**
*
* @param chainId - the chainId of the chain to resolve
* @returns a Promise that resolves to the Chain object
* @returns A Promise that resolves to the Chain object
* @throws if the chainId is not found
*/
export async function getChainByChainIdAsync(chainId: number): Promise<Chain> {
@@ -98,7 +98,7 @@ export async function getChainByChainIdAsync(chainId: number): Promise<Chain> {
/**
*
* @param slug - the slug of the chain to resolve
* @returns a Promise that resolves to the Chain object
* @returns A Promise that resolves to the Chain object
* @throws if the slug is not found
*/
export async function getChainBySlugAsync(slug: string): Promise<Chain> {
File diff suppressed because one or more lines are too long
+56
View File
@@ -1,5 +1,61 @@
# thirdweb
## 0.13.28
### Patch Changes
- Updated dependencies [[`b808e942`](https://github.com/thirdweb-dev/js/commit/b808e942fdaa81b5de61dcb3f2083081cb99ea11), [`e46dd025`](https://github.com/thirdweb-dev/js/commit/e46dd0254f157c3c4d50fe3e4f44e2e24eaf34a8)]:
- @thirdweb-dev/sdk@4.0.24
- @thirdweb-dev/wallets@2.3.3
- @thirdweb-dev/auth@4.1.20
## 0.13.27
### Patch Changes
- Updated dependencies [[`c410a1c1`](https://github.com/thirdweb-dev/js/commit/c410a1c18a704d118555215db9ba7d92c3b24d8c), [`fed1313a`](https://github.com/thirdweb-dev/js/commit/fed1313a199011a9b52d7c5e11ad6e72fc969002), [`f369bffe`](https://github.com/thirdweb-dev/js/commit/f369bffe5a30e2e8a9df2ac62f24f93f96324186), [`81c46e22`](https://github.com/thirdweb-dev/js/commit/81c46e22984cdb5b33b2e6eb99a0ebf0e4fbdb33)]:
- @thirdweb-dev/storage@2.0.8
- @thirdweb-dev/wallets@2.3.2
- @thirdweb-dev/chains@0.1.62
- @thirdweb-dev/sdk@4.0.23
- @thirdweb-dev/auth@4.1.19
## 0.13.26
### Patch Changes
- Updated dependencies [[`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e)]:
- @thirdweb-dev/sdk@4.0.22
- @thirdweb-dev/wallets@2.3.1
- @thirdweb-dev/auth@4.1.18
## 0.13.25
### Patch Changes
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
- @thirdweb-dev/wallets@2.3.0
- @thirdweb-dev/auth@4.1.17
## 0.13.24
### Patch Changes
- Updated dependencies [[`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173)]:
- @thirdweb-dev/sdk@4.0.21
- @thirdweb-dev/wallets@2.2.1
- @thirdweb-dev/auth@4.1.16
## 0.13.23
### Patch Changes
- Updated dependencies [[`d2001ca4`](https://github.com/thirdweb-dev/js/commit/d2001ca464aa699ac821c97eb37de7409ba865f3), [`85842c15`](https://github.com/thirdweb-dev/js/commit/85842c1596c901e228be1894b6702a8871d9e794), [`e595d4d9`](https://github.com/thirdweb-dev/js/commit/e595d4d92f03e36cbe61e1f00a366e37ede5d814), [`497677f3`](https://github.com/thirdweb-dev/js/commit/497677f3596977fa90ebc0fa76cb5842d46d8dcf), [`94966069`](https://github.com/thirdweb-dev/js/commit/9496606964d65268f8ee6bf9f78b2786e99d33ac), [`15ae5e7f`](https://github.com/thirdweb-dev/js/commit/15ae5e7f95a482a9736923c0e10916a0a6115c3d)]:
- @thirdweb-dev/chains@0.1.61
- @thirdweb-dev/sdk@4.0.20
- @thirdweb-dev/wallets@2.2.0
- @thirdweb-dev/auth@4.1.15
## 0.13.22
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.13.22",
"version": "0.13.28",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+11
View File
@@ -0,0 +1,11 @@
{
"presets": [
"@babel/preset-typescript",
["@babel/preset-env", { "targets": "defaults, not ie 11" }]
],
"plugins": [
"@babel/plugin-transform-flow-strip-types",
"@babel/plugin-transform-private-methods",
"@babel/plugin-proposal-class-properties"
]
}
+4
View File
@@ -0,0 +1,4 @@
# folders
dist/
# files
+21
View File
@@ -0,0 +1,21 @@
module.exports = {
root: true,
extends: ["thirdweb"],
plugins: ["better-tree-shaking"],
rules: {
"better-tree-shaking/no-top-level-side-effects": "error",
"no-restricted-imports": [
"error",
{
paths: [
{
name: "eventemitter3",
importNames: ["EventEmitter"],
message:
"Do not use named import for importing EventEmitter, Use default import instead.",
},
],
},
],
},
};
+18
View File
@@ -0,0 +1,18 @@
# @thirdweb-dev/payments
## 1.0.1
### Patch Changes
- [#2115](https://github.com/thirdweb-dev/js/pull/2115) [`d00ca7fd`](https://github.com/thirdweb-dev/js/commit/d00ca7fd2a0fa3e694bb37d1f486d3d4cf1ad79e) Thanks [@IDubuque](https://github.com/IDubuque)! - Update exports with new payments interface
## 1.0.0
### Major Changes
- [#1913](https://github.com/thirdweb-dev/js/pull/1913) [`ed3afd41`](https://github.com/thirdweb-dev/js/commit/ed3afd418cb6e0d711814a1c52afb302460751ba) Thanks [@IDubuque](https://github.com/IDubuque)! - The `@thirdweb-dev/payments` package is a continuation of the `@paperxyz/js-client-sdk`, aligning with the new branding and expanded capabilities under thirdweb. It inherits the core functionality of Paper's developer-first NFT checkout solution.
### Changed
- Rebranded package from `@paperxyz/js-client-sdk` to `@thirdweb-dev/payments`. Users of the old package should migrate to this new package name.
- Changed PaperSdkError typename to PaymentsSdkError
+14
View File
@@ -0,0 +1,14 @@
<p align="center">
<br />
<a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/packages/sdk/logo.svg?raw=true" width="200" alt=""/></a>
<br />
</p>
<h1 align="center">thirdweb Checkouts SDK</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/payments"><img src="https://img.shields.io/npm/v/@thirdweb-dev/payments?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
<p align="center"><strong>web3 Checkouts library to integrate any NFT checkout into your applications.</strong></p>
<br />
+58
View File
@@ -0,0 +1,58 @@
{
"name": "@thirdweb-dev/payments",
"version": "1.0.1",
"main": "dist/thirdweb-dev-payments.cjs.js",
"module": "dist/thirdweb-dev-payments.esm.js",
"types": "dist/thirdweb-dev-payments.cjs.d.ts",
"browser": {
"./dist/thirdweb-dev-payments.esm.js": "./dist/thirdweb-dev-payments.browser.esm.js"
},
"exports": {
".": {
"module": {
"browser": "./dist/thirdweb-dev-payments.browser.esm.js",
"default": "./dist/thirdweb-dev-payments.esm.js"
},
"default": "./dist/thirdweb-dev-payments.cjs.js"
},
"./package.json": "./package.json"
},
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/payments",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/thirdweb-dev/js/issues"
},
"author": "thirdweb eng <[email protected]>",
"files": [
"dist/"
],
"preconstruct": {
"entrypoints": [
"index.ts"
],
"exports": {
"envConditions": [
"browser"
]
}
},
"sideEffects": false,
"dependencies": {
"ethers": "^5.7.2"
},
"devDependencies": {
"@thirdweb-dev/tsconfig": "workspace:*",
"eslint-config-thirdweb": "workspace:*",
"typescript": "^5.1.6",
"@preconstruct/cli": "2.7.0"
},
"scripts": {
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"build": "tsc && preconstruct build",
"preconstruct:fix": "preconstruct fix",
"push": "yalc push"
}
}
@@ -0,0 +1,56 @@
// UNCHANGED: MERGED FROM sdk-common-utilities/blockchain
export const ChainToPublicRpc: Record<Chain, string> = {
Ethereum: "https://ethereum.rpc.thirdweb.com",
Goerli: "https://goerli.rpc.thirdweb.com",
Mumbai: "https://mumbai.rpc.thirdweb.com",
Polygon: "https://polygon.rpc.thirdweb.com",
Avalanche: "https://avalanche.rpc.thirdweb.com",
Optimism: "https://optimism.rpc.thirdweb.com",
OptimismGoerli: "https://optimism-goerli.rpc.thirdweb.com",
BSC: "https://binance.rpc.thirdweb.com",
BSCTestnet: "https://binance-testnet.rpc.thirdweb.com",
ArbitrumOne: "https://arbitrum.rpc.thirdweb.com",
ArbitrumGoerli: "https://arbitrum-goerli.rpc.thirdweb.com",
Fantom: "https://fantom.rpc.thirdweb.com",
FantomTestnet: "https://fantom-testnet.rpc.thirdweb.com",
Sepolia: "https://sepolia.rpc.thirdweb.com",
AvalancheFuji: "https://avalanche-fuji.rpc.thirdweb.com",
};
export const ChainIdToChain: Record<number, Chain> = {
1: "Ethereum",
5: "Goerli",
80001: "Mumbai",
137: "Polygon",
43114: "Avalanche",
10: "Optimism",
420: "OptimismGoerli",
56: "BSC",
97: "BSCTestnet",
42161: "ArbitrumOne",
421613: "ArbitrumGoerli",
250: "Fantom",
4002: "FantomTestnet",
11155111: "Sepolia",
43113: "AvalancheFuji",
};
// General Embedded wallet types
export type Chain =
| "Polygon"
| "Mumbai"
| "Goerli"
| "Ethereum"
| "Avalanche"
| "Optimism"
| "OptimismGoerli"
| "BSC"
| "BSCTestnet"
| "ArbitrumOne"
| "ArbitrumGoerli"
| "Fantom"
| "FantomTestnet"
| "Sepolia"
| "AvalancheFuji";
export type SupportedChainName = Chain | "Rinkeby";
@@ -0,0 +1,12 @@
// UNCHANGED: MERGED FROM sdk-common-utilities/iframeMessages
export type MessageType<T> =
| {
eventType: string;
success: true;
data: T;
}
| {
eventType: string;
success: false;
error: string;
};
+4
View File
@@ -0,0 +1,4 @@
// CHANGED: export merged sdk-common-utilities/constants & js-client-sdk/constants
export * from "./settings";
export * from "./blockchain";
export * from "./style";
@@ -0,0 +1,43 @@
// UNCHANGED: MERGE BETWEEN sdk-common-utilities/settings and js-client-sdk/settings
const isDev = (): boolean => {
return !!(
typeof window !== "undefined" &&
window.localStorage.getItem("IS_PAPER_DEV") === "true"
);
};
const isOldPaperDomain = (): boolean =>
typeof window !== "undefined" &&
(window.location.hostname === "paper.xyz" ||
window.location.hostname.endsWith(".paper.xyz"));
const isThirdwebDomain = (): boolean =>
typeof window !== "undefined" &&
(window.location.hostname === "thirdweb.com" ||
window.location.hostname.endsWith(".thirdweb.com"));
export const getPaperOriginUrl = (): string => {
if (isDev()) {
return (
window.localStorage.getItem("PAPER_DEV_URL") ?? "http://localhost:3000"
);
}
if (isOldPaperDomain()) {
return window.location.origin;
}
if (isThirdwebDomain()) {
return window.location.origin;
}
return "https://payments.thirdweb.com";
};
// eslint-disable-next-line better-tree-shaking/no-top-level-side-effects
export const PAPER_APP_URL = getPaperOriginUrl();
export const CHECKOUT_WITH_ETH_IFRAME_URL = "/sdk/2022-08-12/checkout-with-eth";
export const CHECKOUT_WITH_CARD_IFRAME_URL =
"/sdk/2022-08-12/checkout-with-card";
export const CREATE_WALLET_IFRAME_URL = "/sdk/v2/verify-email";
+25
View File
@@ -0,0 +1,25 @@
// // UNCHANGED: MERGED FROM sdk-common-utilities/style
export type StyleObject = Partial<CSSStyleDeclaration>;
export interface ICustomizationOptions {
colorPrimary?: string;
colorBackground?: string;
colorText?: string;
borderRadius?: number;
fontFamily?: string;
inputBackgroundColor?: string;
inputBorderColor?: string;
}
export type CustomizationOptionsType = {
[key in keyof ICustomizationOptions]: string;
};
export type Locale = "en" | "fr" | "es" | "it" | "de" | "ja" | "ko" | "zh";
export const DEFAULT_BRAND_OPTIONS = {
colorPrimary: "#cf3781",
colorBackground: "#ffffff",
colorText: "#1a202c",
borderRadius: 12,
fontFamily: "Open Sans",
};
+8
View File
@@ -0,0 +1,8 @@
// CHANGED: exports
// Customization options and base urls
export * from "./constants";
// Types
export * from "./interfaces";
// Components
export * from "./lib";
@@ -0,0 +1,67 @@
// UNCHANGED
export interface ReviewResult {
/**
* A unique ID for this purchase.
*/
id: string;
/**
* The cardholder's full name provided by the buyer.
*/
cardholderName: string;
}
export interface KycModal {
iframeLink: string;
}
/**
* The ICheckoutWithCardConfigs interface defines the configuration options for the checkoutWithCard component provided by Paper.
* This component allows users to generate a card payment component for NFTs without needing any backend calls.
*
* The configuration options include:
*
* - `contractId`: The id of your contract (not the address) found in you seller dashboard.
* - `walletAddress`: The wallet address to which the payment will be sent (AKA the receiving wallet).
* - `email`: (Optional) Email address of the buyer.
* - `quantity`: (Optional) The number of items to be purchased.
* - `metadata`: (Optional) A record of additional information about the transaction.
* - `mintMethod`: (Optional, Only required for Custom Contract Types) The contract function name, function args, and payment information which will be sent to your contract.
* - `contractArgs`: (Optional) Depending on the contract type, this can defined additional args to call your contract with. See [Thirdweb/Reservoir docs](https://docs.withpaper.com/reference/thirdweb-contracts) for more details.
* - `feeBearer`: (Optional) Who will bear the transaction fee, either 'BUYER' or 'SELLER'.
* - `capturePaymentLater`: (Optional) If set to true, the payment is authorized but not captured immediately.
* - `fiatCurrency`: (Optional) The type of fiat currency for the payment.
* - `title`: (Optional) The title to be displayed on the Stripe receipt.
* - `sendEmailOnTransferSucceeded`: (Optional) If set to true, an email is sent when the transfer succeeds.
* - `postPurchaseMessageMarkdown`: (Optional) A post-purchase message in Markdown format.
* - `postPurchaseButtonText`: (Optional) The text for the post-purchase button.
* - `successCallbackUrl`: (Optional) The URL to be called back when the transaction is successful.
*
* Note: This interface is part of an open-source npm package. Please ensure you understand the implications of each field before using this interface.
*/
export interface ICheckoutWithCardConfigs {
contractId: string;
walletAddress: string;
email?: string;
quantity?: number;
mintMethod?: {
name: string;
args: Record<string, any>;
payment: { value: string; currency: string };
};
contractArgs?: Record<string, any>;
// payment customizations
capturePaymentLater?: boolean;
fiatCurrency?: string;
// stripe receipt
title?: string;
// email
sendEmailOnTransferSucceeded?: boolean;
postPurchaseMessageMarkdown?: string;
postPurchaseButtonText?: string;
successCallbackUrl?: string;
}
+17
View File
@@ -0,0 +1,17 @@
// UNCHANGED
import type { StyleObject } from "../constants/style";
export interface ModalStyles {
main: StyleObject;
overlay: StyleObject;
body: StyleObject;
iframe: StyleObject;
closeButton?: StyleObject;
spinner: StyleObject;
}
export interface ModalInterface {
modalContainer?: HTMLElement;
modalStyles?: Partial<ModalStyles>;
}
@@ -0,0 +1,19 @@
// UNCHANGED
export type PaperUser = {
/**
* The user's email address.
* This address is case-insensitive (i.e. different capitalizations map to the same wallet).
*/
emailAddress: string;
/**
* The Paper Wallet address associated with this user's email address.
*/
walletAddress: string;
/**
* The user's access code. Will only be set if [clientId] was provided. This can be used to query about the user details.
*/
accessCode?: string;
};
@@ -0,0 +1,31 @@
// CHANGED: Updated name to Payments
export type PaymentsSDKError = {
/**
* An enum representing the error encountered.
* The value is a human-readable, English message describing the error.
*/
code: PaymentsSDKErrorCode | PayWithCryptoErrorCode;
error: Error;
};
export enum PaymentsSDKErrorCode {
UserAbandonedCheckout = "User abandoned the checkout",
UserLoginFailed = "User login failed",
InvalidProps = "The props you passed in to this component are not valid.",
InvalidCard = "The card information is invalid. Please double check that the Card, CVC, and Zip code are all correct.",
EmailNotVerified = "The email was unable to be verified.",
NotEnoughSupply = "There is not enough supply to claim.",
AddressNotAllowed = "This address is not on the allowlist.",
NoActiveClaimPhase = "There is no active claim phase at the moment.",
}
export enum PayWithCryptoErrorCode {
ErrorConnectingToWallet = "Error connecting to wallet",
ErrorSendingTransaction = "Something went wrong sending transaction",
InsufficientBalance = `Insufficient ETH`,
TransactionCancelled = "Transaction Cancelled",
WrongChain = `Wrong Chain Detected`,
ChainSwitchUnderway = "There is a network switch already underway",
PendingSignature = "Pending Signature",
}
@@ -0,0 +1,28 @@
// UNCHANGED
export interface PriceSummary {
quantity: number;
unitPrice: PriceDetail;
networkFees: PriceDetail;
serviceFees: PriceDetail;
total: PriceDetail;
cryptoToFiatConversionRate?: number;
}
export interface PriceDetail {
/**
* A human-readable string to display.
* Example: $123.45 CAD
*/
display: string;
/**
* This is the value in smallest units (cents, yen, wei).
* Example: 12345
*/
valueInSubunits: number;
/**
* The currency associated with the value.
* Example: USD, ETH
*/
currency: string;
}
@@ -0,0 +1,5 @@
// CHANGED: Added exports
export * from "./CheckoutWithCard";
export * from "./PaymentsSdkError";
export * from "./PaperUser";
export * from "./PriceSummary";
@@ -0,0 +1,256 @@
// CHANGED: Added clientId to interface
import type { ICustomizationOptions, Locale } from "../constants/style";
import { DEFAULT_BRAND_OPTIONS } from "../constants/style";
import { getPaperOriginUrl } from "../constants/settings";
import {
CHECKOUT_WITH_CARD_IFRAME_URL,
PAPER_APP_URL,
} from "../constants/settings";
import type {
ICheckoutWithCardConfigs,
KycModal,
ReviewResult,
} from "../interfaces/CheckoutWithCard";
import type {
PaymentsSDKError,
PaymentsSDKErrorCode,
} from "../interfaces/PaymentsSdkError";
import type { PriceSummary } from "../interfaces/PriceSummary";
import { LinksManager } from "../utils/LinksManager";
import { openCenteredPopup } from "../utils/device";
import { postMessageToIframe } from "../utils/postMessageToIframe";
import type { PaperPaymentElementConstructorArgs } from "./CreatePaymentElement";
import { PaperPaymentElement } from "./CreatePaymentElement";
import { Modal } from "./Modal";
export interface CheckoutWithCardLinkArgs {
clientId?: string;
sdkClientSecret?: string;
appName?: string;
options?: ICustomizationOptions;
locale?: Locale;
configs?: ICheckoutWithCardConfigs;
/**
* @deprecated: No longer used. Domain is set to "withpaper.com".
*/
useAltDomain?: boolean;
}
export function createCheckoutWithCardLink({
clientId,
sdkClientSecret,
appName,
options = { ...DEFAULT_BRAND_OPTIONS },
locale,
configs,
}: CheckoutWithCardLinkArgs): URL {
const CheckoutWithCardUrlBase = new URL(
CHECKOUT_WITH_CARD_IFRAME_URL,
PAPER_APP_URL,
);
let clientSecret = sdkClientSecret;
if (!clientSecret && configs) {
clientSecret = btoa(JSON.stringify(configs));
}
if (!clientSecret) {
const error = `Must have either sdkClientSecret or configs field set. Received neither`;
const destination = `/error?errorMessage=${error}`;
const domain = getPaperOriginUrl();
return new URL(destination, domain);
}
if (!clientId) {
const error = `Must have clientId field set. Please add clientId`;
const destination = `/error?errorMessage=${error}`;
const domain = getPaperOriginUrl();
return new URL(destination, domain);
}
const checkoutWithCardLink = new LinksManager(CheckoutWithCardUrlBase);
checkoutWithCardLink.addClientId(clientId ?? "");
checkoutWithCardLink.addClientSecret(clientSecret ?? "");
checkoutWithCardLink.addStylingOptions(options);
checkoutWithCardLink.addLocale(locale);
checkoutWithCardLink.addAppName(appName);
return checkoutWithCardLink.getLink();
}
export interface CheckoutWithCardMessageHandlerArgs {
iframe: HTMLIFrameElement;
onPaymentSuccess?: (props: {
transactionId: string;
/** @deprecated */
id: string;
}) => void;
onReview?: (result: ReviewResult) => void;
onError?: (error: PaymentsSDKError) => void;
onOpenKycModal?: (props: KycModal) => void;
onCloseKycModal?: () => void;
onBeforeModalOpen?: (props: { url: string }) => void;
onPriceUpdate?: (props: PriceSummary) => void;
useAltDomain?: boolean;
}
export function createCheckoutWithCardMessageHandler({
iframe,
onError,
onReview,
onPaymentSuccess,
onBeforeModalOpen,
onPriceUpdate,
}: CheckoutWithCardMessageHandlerArgs) {
let modal: Modal;
return (event: MessageEvent) => {
if (!event.origin.startsWith(PAPER_APP_URL)) {
return;
}
const { data } = event;
switch (data.eventType) {
case "checkoutWithCardError":
if (onError) {
onError({
code: data.code as PaymentsSDKErrorCode,
error: data.error,
});
}
break;
case "paymentSuccess":
if (onPaymentSuccess) {
onPaymentSuccess({ transactionId: data.id, id: data.id });
}
if (data.postToIframe) {
postMessageToIframe(iframe, data.eventType, data);
}
break;
case "reviewComplete":
if (onReview) {
onReview({
id: data.id,
cardholderName: data.cardholderName,
});
}
break;
case "openModalWithUrl":
if (
onBeforeModalOpen &&
data.url &&
data.url.includes("promptKYCModal")
) {
onBeforeModalOpen({
url: data.url,
});
} else {
modal = new Modal(undefined, {
body: {
colorScheme: "light",
},
});
modal.open({ iframeUrl: data.url });
}
break;
case "completedSDKModal":
modal.close();
if (data.postToIframe) {
postMessageToIframe(iframe, data.eventType, data);
}
break;
case "requestedPopup": {
// The iframe requested a popup.
// The reference to this window is not stored so the popup cannot
// be programmatically closed.
const popupRef = openCenteredPopup({
url: data.url,
width: data.width,
height: data.height,
});
if (!popupRef) {
console.error("CheckoutWithCard: Unable to open popup.");
}
break;
}
case "sizing":
iframe.style.height = data.height + "px";
iframe.style.maxHeight = data.height + "px";
break;
case "onPriceUpdate": {
onPriceUpdate?.(data);
break;
}
default:
// Ignore unrecognized event
}
};
}
export type CheckoutWithCardElementArgs = Omit<
CheckoutWithCardMessageHandlerArgs,
"iframe"
> &
CheckoutWithCardLinkArgs &
PaperPaymentElementConstructorArgs;
export function createCheckoutWithCardElement({
clientId,
onCloseKycModal,
onOpenKycModal,
sdkClientSecret,
appName,
elementOrId,
onLoad,
onError,
locale,
options,
onPaymentSuccess,
onReview,
onBeforeModalOpen,
onPriceUpdate,
useAltDomain = true,
configs,
}: CheckoutWithCardElementArgs) {
const checkoutWithCardId = "checkout-with-card-iframe";
const checkoutWithCardMessageHandler = (iframe: HTMLIFrameElement) =>
createCheckoutWithCardMessageHandler({
iframe,
onCloseKycModal,
onOpenKycModal,
onError,
onPaymentSuccess,
onReview,
onBeforeModalOpen,
onPriceUpdate,
useAltDomain,
});
const checkoutWithCardUrl = createCheckoutWithCardLink({
clientId,
sdkClientSecret,
appName,
locale,
options,
useAltDomain,
configs,
});
const paymentElement = new PaperPaymentElement({
onLoad,
elementOrId,
});
return paymentElement.createPaymentElement({
handler: checkoutWithCardMessageHandler,
iframeId: checkoutWithCardId,
link: checkoutWithCardUrl,
});
}
@@ -0,0 +1,334 @@
// CHANGED: Imports only
import type { ethers } from "ethers";
import {
CHECKOUT_WITH_ETH_IFRAME_URL,
PAPER_APP_URL,
getPaperOriginUrl,
} from "../constants/settings";
import type { ICustomizationOptions, Locale } from "../constants/style";
import { DEFAULT_BRAND_OPTIONS } from "../constants/style";
import type { PaymentsSDKError } from "../interfaces/PaymentsSdkError";
import { PayWithCryptoErrorCode } from "../interfaces/PaymentsSdkError";
import type { PriceSummary } from "../interfaces/PriceSummary";
import { LinksManager } from "../utils/LinksManager";
import { handlePayWithCryptoError } from "../utils/handleCheckoutWithEthError";
import { postMessageToIframe } from "../utils/postMessageToIframe";
import type { PaperPaymentElementConstructorArgs } from "./CreatePaymentElement";
import { PaperPaymentElement } from "./CreatePaymentElement";
export const PAY_WITH_ETH_ERROR = "payWithEthError";
export async function checkAndSendEth({
data,
iframe,
payingWalletSigner,
suppressErrorToast,
onError,
onPaymentSuccess,
}: {
payingWalletSigner: ethers.Signer;
data: {
chainId: number;
chainName: string;
blob: string;
paymentAddress: string;
value: string;
transactionId: string;
};
suppressErrorToast: boolean;
iframe: HTMLIFrameElement;
onPaymentSuccess?:
| CheckoutWithEthMessageHandlerArgs["onPaymentSuccess"]
| CheckoutWithEthMessageHandlerArgs["onSuccess"];
onError?: (error: PaymentsSDKError) => Promise<void> | void;
}) {
try {
const chainId = await payingWalletSigner.getChainId();
if (chainId !== data.chainId) {
throw {
isErrorObject: true,
title: PayWithCryptoErrorCode.WrongChain,
description: `Please change to ${data.chainName} to proceed.`,
};
}
} catch (e) {
await handlePayWithCryptoError(e as Error, onError, (errorObject) => {
postMessageToIframe(iframe, PAY_WITH_ETH_ERROR, {
error: errorObject,
suppressErrorToast,
});
});
return;
}
// send the transaction
try {
console.log("sending funds...", data);
const result = await payingWalletSigner.sendTransaction({
chainId: data.chainId,
data: data.blob,
to: data.paymentAddress,
value: data.value,
});
const receipt = await result.wait();
if (onPaymentSuccess && result) {
await onPaymentSuccess({
onChainTxResponse: result,
onChainTxReceipt: receipt,
transactionId: data.transactionId,
});
}
if (result) {
postMessageToIframe(iframe, "paymentSuccess", {
suppressErrorToast,
transactionHash: result.hash,
});
}
} catch (error) {
console.log("error sending funds", error);
await handlePayWithCryptoError(error as Error, onError, (errorObject) => {
postMessageToIframe(iframe, PAY_WITH_ETH_ERROR, {
error: errorObject,
suppressErrorToast,
});
});
}
}
export interface CheckoutWithEthMessageHandlerArgs {
iframe: HTMLIFrameElement;
onPaymentSuccess?: (props: {
onChainTxReceipt: ethers.providers.TransactionReceipt;
transactionId: string;
}) => Promise<void> | void;
/** @deprecated */
onSuccess?: (props: {
onChainTxResponse: ethers.providers.TransactionResponse;
transactionId: string;
}) => Promise<void> | void;
onPriceUpdate?: (props: PriceSummary) => void;
onError?: (error: PaymentsSDKError) => void;
suppressErrorToast?: boolean;
setUpUserPayingWalletSigner?: (args: {
chainId: number;
chainName?: string;
}) => void | Promise<void>;
payingWalletSigner: ethers.Signer;
}
export function createCheckoutWithEthMessageHandler({
iframe,
onError,
onPaymentSuccess,
onPriceUpdate,
payingWalletSigner,
suppressErrorToast = false,
setUpUserPayingWalletSigner,
}: CheckoutWithEthMessageHandlerArgs) {
return async (event: MessageEvent) => {
if (!event.origin.startsWith(PAPER_APP_URL)) {
return;
}
const data = event.data;
switch (data.eventType) {
case "payWithEth": {
if (data.error) {
await handlePayWithCryptoError(
new Error(data.error),
onError,
(errorObject) => {
postMessageToIframe(iframe, PAY_WITH_ETH_ERROR, {
error: errorObject,
suppressErrorToast,
});
},
);
return;
}
// Allows Dev's to inject any chain switching for their custom signer here.
if (setUpUserPayingWalletSigner) {
try {
console.log("setting up signer");
await setUpUserPayingWalletSigner({
chainId: data.chainId,
chainName: data.chainName,
});
} catch (error) {
console.log("error setting up signer", error);
await handlePayWithCryptoError(
error as Error,
onError,
(errorObject) => {
postMessageToIframe(iframe, PAY_WITH_ETH_ERROR, {
error: errorObject,
suppressErrorToast,
});
},
);
return;
}
}
await checkAndSendEth({
data,
iframe,
payingWalletSigner,
suppressErrorToast,
onError,
onPaymentSuccess,
});
break;
}
case "checkout-with-eth-sizing": {
iframe.style.height = data.height + "px";
iframe.style.maxHeight = data.height + "px";
break;
}
case "onPriceUpdate": {
onPriceUpdate?.(data as PriceSummary);
break;
}
default:
break;
}
};
}
export interface ICheckoutWithEthConfigs {
contractId: string;
walletAddress: string;
email?: string;
quantity?: number;
mintMethod?: {
name: string;
args: Record<string, any>[];
payment: { value: string; currency: string };
};
contractArgs?: Record<string, any>;
// payment customizations
capturePaymentLater?: boolean;
fiatCurrency?: string;
// stripe receipt
title?: string;
// email
sendEmailOnTransferSucceeded?: boolean;
postPurchaseMessageMarkdown?: string;
postPurchaseButtonText?: string;
successCallbackUrl?: string;
}
export interface CheckoutWithEthLinkArgs {
sdkClientSecret?: string;
appName?: string;
payingWalletSigner: ethers.Signer;
receivingWalletType?:
| "WalletConnect"
| "MetaMask"
| "Coinbase Wallet"
| string;
showConnectWalletOptions?: boolean;
locale?: Locale;
options?: ICustomizationOptions;
configs?: ICheckoutWithEthConfigs;
}
export async function createCheckoutWithEthLink({
sdkClientSecret,
payingWalletSigner,
receivingWalletType,
showConnectWalletOptions = false,
appName,
locale,
options = {
...DEFAULT_BRAND_OPTIONS,
},
configs,
}: CheckoutWithEthLinkArgs) {
const checkoutWithEthUrlBase = new URL(
CHECKOUT_WITH_ETH_IFRAME_URL,
PAPER_APP_URL,
);
const address = await payingWalletSigner.getAddress();
let clientSecret = sdkClientSecret;
if (!clientSecret && configs) {
clientSecret = btoa(JSON.stringify(configs));
}
if (!clientSecret) {
const error = `Must have either sdkClientSecret or configs field set. Received neither`;
const destination = `/error?errorMessage=${error}`;
const domain = getPaperOriginUrl();
return new URL(destination, domain);
}
const checkoutWithEthLink = new LinksManager(checkoutWithEthUrlBase);
checkoutWithEthLink.addClientSecret(clientSecret ?? "");
checkoutWithEthLink.addRecipientWalletAddress(address);
checkoutWithEthLink.addPayerWalletAddress(address);
checkoutWithEthLink.addReceivingWalletType(receivingWalletType);
checkoutWithEthLink.addAppName(appName);
checkoutWithEthLink.addShowConnectWalletOptions(showConnectWalletOptions);
checkoutWithEthLink.addStylingOptions(options);
checkoutWithEthLink.addLocale(locale);
return checkoutWithEthLink.getLink();
}
export type CheckoutWithEthElementArgs = Omit<
Omit<CheckoutWithEthMessageHandlerArgs, "iframe">,
"setUpUserPayingWalletSigner"
> &
CheckoutWithEthLinkArgs &
PaperPaymentElementConstructorArgs;
export async function createCheckoutWithEthElement({
sdkClientSecret,
suppressErrorToast,
onError,
onLoad,
payingWalletSigner,
receivingWalletType,
appName,
showConnectWalletOptions,
locale,
options,
elementOrId,
onPaymentSuccess: _onPaymentSuccess,
onSuccess,
}: CheckoutWithEthElementArgs): Promise<HTMLIFrameElement> {
const onPaymentSuccess =
_onPaymentSuccess ??
(onSuccess as CheckoutWithEthMessageHandlerArgs["onPaymentSuccess"]);
const checkoutWithEthId = "checkout-with-eth-iframe";
const checkoutWithEthMessageHandler = (iframe: HTMLIFrameElement) =>
createCheckoutWithEthMessageHandler({
iframe,
onError,
payingWalletSigner,
suppressErrorToast,
onPaymentSuccess,
});
const checkoutWithEthUrl = await createCheckoutWithEthLink({
payingWalletSigner,
sdkClientSecret,
appName,
locale,
options,
receivingWalletType,
showConnectWalletOptions,
});
const paymentElement = new PaperPaymentElement({
onLoad,
elementOrId,
});
return paymentElement.createPaymentElement({
handler: checkoutWithEthMessageHandler,
iframeId: checkoutWithEthId,
link: checkoutWithEthUrl,
});
}
@@ -0,0 +1,76 @@
// CHANGED: packageJson import + version string
// eslint-disable-next-line @typescript-eslint/no-var-requires, better-tree-shaking/no-top-level-side-effects
const packageJson = require("../package.json");
export interface PaperPaymentElementConstructorArgs {
onLoad?: (event?: Event) => void;
elementOrId?: string | HTMLElement;
}
export class PaperPaymentElement {
private elementOrId?: PaperPaymentElementConstructorArgs["elementOrId"];
private onLoad?: PaperPaymentElementConstructorArgs["onLoad"];
constructor({ elementOrId, onLoad }: PaperPaymentElementConstructorArgs) {
this.elementOrId = elementOrId;
this.onLoad = onLoad;
}
createPaymentElement({
handler,
link,
iframeId,
}: {
handler: (
iframe: HTMLIFrameElement,
) => (event: MessageEvent) => void | Promise<void>;
link: URL;
iframeId: string;
}) {
const iframe = document.createElement("iframe");
iframe.src = link.href;
iframe.id = iframeId;
iframe.allow = "payment";
iframe.setAttribute(
"style",
"margin-left:auto; margin-right:auto; width:100%; height: 100%; min-height:375px; transition-property:all; transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1); transition-duration:150ms; color-scheme: light;",
);
iframe.onload = (event: Event) => {
if (this.onLoad) {
this.onLoad(event);
}
};
iframe.setAttribute(
"data-thirdweb-sdk-version",
`${packageJson.name}@${packageJson.version}`,
);
if (!this.elementOrId) {
window.addEventListener("message", handler(iframe));
return iframe;
}
let container: HTMLElement | string = this.elementOrId;
if (typeof container === "string") {
const domElement = document.getElementById(container);
if (!domElement) {
throw new Error("Invalid id given");
}
container = domElement;
}
const existing: HTMLIFrameElement | null = container.querySelector(
"#" + iframeId,
);
// if we already created an iframe, consider updating the iframe link if it's new
if (existing) {
if (existing.src === link.href) {
return existing;
}
existing.src = link.href;
return existing;
}
window.addEventListener("message", handler(iframe));
return container.appendChild(iframe);
}
}
+146
View File
@@ -0,0 +1,146 @@
import type { StyleObject } from "../../constants/style";
import type { ModalStyles } from "../../interfaces/Modal";
import { getDefaultModalStyles } from "./styles";
import packageJson from "../../../package.json";
const MAIN_CLASSNAME = "paper--drawer-main";
const OVERLAY_CLASSNAME = "paper--drawer-overlay";
const BODY_CLASSNAME = "paper--drawer-body";
const CLOSE_CLASSNAME = "paper--drawer-close";
export class Drawer {
protected container: HTMLElement;
protected main: HTMLDivElement;
protected overlay: HTMLDivElement;
protected closeButton: HTMLButtonElement;
protected iframe: HTMLIFrameElement;
protected onCloseCallback: (() => void) | undefined;
protected closeTimeout: number | undefined;
// eslint-disable-next-line better-tree-shaking/no-top-level-side-effects
styles = getDefaultModalStyles();
body: HTMLDivElement;
constructor(container?: HTMLElement, styles?: Partial<ModalStyles>) {
this.container = container || document.body;
if (styles) {
this.mergeStyles(styles);
}
this.main = document.createElement("div");
this.main.className = MAIN_CLASSNAME;
this.overlay = document.createElement("div");
this.overlay.className = OVERLAY_CLASSNAME;
this.body = document.createElement("div");
this.body.className = BODY_CLASSNAME;
this.closeButton = document.createElement("button");
this.closeButton.className = CLOSE_CLASSNAME;
this.closeButton.innerHTML = "&#x2715;";
this.closeButton.onclick = () => {
this.close();
};
this.iframe = document.createElement("iframe");
this.iframe.allow = "camera; microphone; payment";
this.iframe.setAttribute(
"data-thirdweb-sdk-version",
`${packageJson.name}@${packageJson.version}`,
);
this.assignStyles(this.main, this.styles.main);
this.assignStyles(this.overlay, this.styles.overlay);
this.assignStyles(this.body, this.styles.body);
this.assignStyles(this.iframe, this.styles.iframe);
if (this.styles.closeButton) {
this.assignStyles(this.closeButton, this.styles.closeButton);
}
}
open({ iframeUrl }: { iframeUrl?: string } = {}) {
if (iframeUrl) {
this.iframe.src = iframeUrl;
this.body.appendChild(this.iframe);
}
this.addAccessibility();
this.main.appendChild(this.overlay);
this.main.appendChild(this.body);
this.main.appendChild(this.closeButton);
this.container.appendChild(this.main);
document.body.style.overflow = "hidden";
// Animate in.
this.overlay.style.backgroundColor = "rgba(0, 0, 0, 0.5)";
this.body.style.right = "0px";
this.body.style.opacity = "1";
return this.iframe;
}
close() {
this.closeButton.remove();
// Animate out.
this.overlay.style.backgroundColor = "rgba(0, 0, 0, 0)";
this.body.style.right = "-100px";
this.body.style.opacity = "0";
// Remove drawer from DOM.
this.closeTimeout = window.setTimeout(() => {
document.body.style.overflow = "visible";
this.main.remove();
window.clearTimeout(this.closeTimeout);
this.onCloseCallback?.();
}, 250);
}
setOnCloseCallback(callback: () => void) {
this.onCloseCallback = callback;
}
protected mergeStyles(styles: Partial<ModalStyles>) {
this.styles.body = {
...this.styles.body,
...(styles.body || {}),
};
this.styles.overlay = {
...this.styles.overlay,
...(styles.overlay || {}),
};
this.styles.main = {
...this.styles.main,
...(styles.main || {}),
};
this.styles.iframe = {
...this.styles.iframe,
...(styles.iframe || {}),
};
this.styles.closeButton = {
...this.styles.closeButton,
...(styles.closeButton || {}),
};
}
protected addAccessibility() {
this.main.setAttribute("aria-hidden", "true");
this.overlay.setAttribute("aria-hidden", "true");
this.body.setAttribute("aria-modal", "true");
this.body.setAttribute("role", "dialog");
}
protected assignStyles(el: HTMLElement, styles: StyleObject) {
Object.assign(el.style, styles);
}
}
@@ -0,0 +1,67 @@
import type { ModalStyles } from "../../interfaces/Modal";
const fullScreen = {
position: "fixed",
top: "0px",
left: "0px",
right: "0px",
bottom: "0px",
};
export const getDefaultModalStyles = (): ModalStyles => ({
main: {
...fullScreen,
zIndex: "2147483646",
display: "flex",
alignItems: "center",
justifyContent: "end",
},
overlay: {
...fullScreen,
backgroundColor: "rgba(0, 0, 0, 0)",
transition: "background-color ease-out 0.2s",
},
body: {
position: "fixed",
width: "100%",
maxWidth: "420px",
top: "0px",
bottom: "0px",
right: "-100px",
opacity: "0",
boxShadow: "0px 10px 20px rgba(0, 0, 0, 0.25)",
backgroundColor: window.matchMedia("(prefers-color-scheme: dark)").matches
? "#2F2F2F"
: "white",
overflow: "hidden",
transition: "all ease-out 0.2s",
},
spinner: {
position: "absolute",
top: "0",
bottom: "0",
left: "0",
right: "0",
margin: "auto",
borderWidth: "3px",
borderColor: "#2D3748 #2D3748 transparent transparent",
borderRadius: "50%",
width: "30px",
height: "30px",
animation: "spin 1s linear infinite",
},
iframe: {
height: "100%",
width: "100%",
border: "none",
backgroundColor: "transparent",
},
closeButton: {
position: "fixed",
cursor: "pointer",
top: "0.75rem",
right: "1rem",
color: "#888",
padding: "2px 8px",
},
});
+116
View File
@@ -0,0 +1,116 @@
import type { StyleObject } from "../../constants/style";
import type { ModalStyles } from "../../interfaces/Modal";
import { getDefaultModalStyles, modalKeyframeAnimations } from "./styles";
import packageJson from "../../../package.json";
export const MODAL_ID = "paper-js-sdk-modal";
export class Modal {
protected container: HTMLElement;
protected main: HTMLDivElement;
protected overlay: HTMLDivElement;
protected iframe: HTMLIFrameElement;
protected spinner: HTMLDivElement;
protected style: HTMLStyleElement;
// eslint-disable-next-line better-tree-shaking/no-top-level-side-effects
styles = getDefaultModalStyles();
body: HTMLDivElement;
constructor(container?: HTMLElement, styles?: Partial<ModalStyles>) {
this.container = container || document.body;
if (styles) {
this.mergeStyles(styles);
}
this.main = document.createElement("div");
this.main.id = MODAL_ID;
this.overlay = document.createElement("div");
this.overlay.id = `${MODAL_ID}-overlay`;
this.body = document.createElement("div");
this.body.id = `${MODAL_ID}-body`;
this.spinner = document.createElement("div");
this.spinner.id = `${MODAL_ID}-spinner`;
this.iframe = document.createElement("iframe");
this.iframe.id = `${MODAL_ID}-iframe`;
this.iframe.allow = "camera; microphone; payment";
this.iframe.setAttribute(
"data-thirdweb-sdk-version",
`${packageJson.name}@${packageJson.version}`,
);
this.style = document.createElement("style");
this.style.innerHTML = modalKeyframeAnimations;
this.assignStyles(this.main, this.styles.main);
this.assignStyles(this.overlay, this.styles.overlay);
this.assignStyles(this.body, this.styles.body);
this.assignStyles(this.spinner, this.styles.spinner);
this.assignStyles(this.iframe, this.styles.iframe);
}
open({ iframeUrl }: { iframeUrl?: string } = {}) {
if (iframeUrl) {
this.body.appendChild(this.spinner);
this.iframe.src = iframeUrl;
// Remove the spinner when the iframe loads.
this.iframe.onload = () => this.body.removeChild(this.spinner);
this.body.appendChild(this.iframe);
}
this.addAccessibility();
this.main.appendChild(this.overlay);
this.main.appendChild(this.style);
this.main.appendChild(this.body);
this.container.appendChild(this.main);
document.body.style.overflow = "hidden";
}
close() {
this.body.style.animation = "pew-modal-slideOut 0.2s forwards";
window.setTimeout(() => this.main.remove(), 250);
}
protected mergeStyles(styles: Partial<ModalStyles>) {
this.styles.body = {
...this.styles.body,
...(styles.body || {}),
};
this.styles.spinner = {
...this.styles.spinner,
...(styles.spinner || {}),
};
this.styles.overlay = {
...this.styles.overlay,
...(styles.overlay || {}),
};
this.styles.main = {
...this.styles.main,
...(styles.main || {}),
};
this.styles.iframe = {
...this.styles.iframe,
...(styles.iframe || {}),
};
}
protected addAccessibility() {
this.main.setAttribute("aria-hidden", "true");
this.overlay.setAttribute("aria-hidden", "true");
this.body.setAttribute("aria-modal", "true");
this.body.setAttribute("role", "dialog");
}
protected assignStyles(el: HTMLElement, styles: StyleObject) {
Object.assign(el.style, styles);
}
}
+75
View File
@@ -0,0 +1,75 @@
import type { ModalStyles } from "../../interfaces/Modal";
const fullScreen = {
top: "0px",
left: "0px",
right: "0px",
bottom: "0px",
};
export const getDefaultModalStyles = (): ModalStyles => ({
main: {
...fullScreen,
position: "fixed",
zIndex: "10000",
display: "flex",
alignItems: "center",
justifyContent: "center",
pointerEvents: "auto",
},
overlay: {
...fullScreen,
position: "absolute",
backgroundColor: "rgba(0, 0, 0, 0.33)",
pointerEvents: "auto",
},
body: {
background: "transparent",
borderRadius: "12px",
position: "relative",
overflow: "hidden",
width: "100%",
maxWidth: "500px",
height: "700px",
maxHeight: "80%",
animation: "pew-modal-slideIn 0.2s forwards",
pointerEvents: "auto",
},
spinner: {
position: "absolute",
top: "0",
bottom: "0",
left: "0",
right: "0",
margin: "auto",
borderWidth: "3px",
borderColor: "#2D3748 #2D3748 transparent transparent",
borderRadius: "50%",
width: "30px",
height: "30px",
animation: "spin 1s linear infinite",
},
iframe: {
position: "relative",
height: "100%",
width: "100%",
border: "none",
background: "transparent",
},
});
export const modalKeyframeAnimations = `
@keyframes pew-modal-slideIn {
from {opacity: 0; transform: translate3d(0, 20px, 0);}
to {opacity: 1; transform: translate3d(0, 0, 0);}
}
@keyframes pew-modal-slideOut {
from {opacity: 1; transform: translate3d(0, 0, 0);}
to {opacity: 0; transform: translate3d(0, 20px, 0);}
}
@keyframes spin {
to { transform: rotate(360deg); }
}
`;
+4
View File
@@ -0,0 +1,4 @@
// CHANGED: ADDED
export * from "./CheckoutWithCard";
export * from "./CheckoutWithEth";
export * from "./renderPaperCheckoutLink";
@@ -0,0 +1,82 @@
// UNCHANGED
import { PAPER_APP_URL } from "../constants/settings";
import { Drawer } from "./Drawer";
async function sleepForSeconds(seconds: number) {
return new Promise((res) => {
setTimeout(() => {
res(0);
}, seconds * 1000);
});
}
export function renderPaperCheckoutLink({
checkoutLinkUrl,
onPaymentSucceeded,
onPaymentFailed,
onTransferSucceeded,
onModalClosed,
}: {
checkoutLinkUrl: string;
onPaymentSucceeded?: ({ transactionId }: { transactionId: string }) => void;
onPaymentFailed?: ({ transactionId }: { transactionId: string }) => void;
onTransferSucceeded?: ({
transactionId,
claimedTokens,
}: {
transactionId: string;
claimedTokens: any;
}) => void;
onModalClosed?: () => void;
}) {
const drawer = new Drawer();
const formattedCheckoutLinkUrl = new URL(checkoutLinkUrl);
formattedCheckoutLinkUrl.searchParams.set("display", "DRAWER");
drawer.open({ iframeUrl: formattedCheckoutLinkUrl.href });
if (onModalClosed) {
drawer.setOnCloseCallback(onModalClosed);
}
const messageHandler = async (e: MessageEvent) => {
if (e.origin !== PAPER_APP_URL) {
return;
}
const result = e.data;
if (!result.eventType) {
return;
}
switch (result.eventType) {
case "paymentSuccess": {
const transactionId = e.data.id;
onPaymentSucceeded?.({ transactionId });
break;
}
case "claimSuccessful": {
const { id: transactionId, claimedTokens } = e.data;
onTransferSucceeded?.({ transactionId, claimedTokens });
await sleepForSeconds(3.5);
drawer.close();
break;
}
case "redirectAfterSuccess": {
const redirectUrl = e.data.redirectUrl;
window.location.assign(redirectUrl);
break;
}
case "paymentFailed": {
const transactionId = e.data.id;
onPaymentFailed?.({ transactionId });
break;
}
case "modalClosed": {
onModalClosed?.();
break;
}
default:
throw new Error(`Unsupported eventType ${result.eventType}`);
}
};
window.addEventListener("message", messageHandler);
}
@@ -0,0 +1,95 @@
// CHANGED: added clientId to link
import type { ICustomizationOptions, Locale } from "../constants/style";
export class LinksManager {
private link: URL;
constructor(baseLink: URL) {
this.link = baseLink;
}
addStylingOptions(options: ICustomizationOptions) {
if (options.colorPrimary) {
this.link.searchParams.set("colorPrimary", options.colorPrimary);
}
if (options.colorBackground) {
this.link.searchParams.set("colorBackground", options.colorBackground);
}
if (options.colorText) {
this.link.searchParams.set("colorText", options.colorText);
}
if (options.borderRadius !== undefined) {
this.link.searchParams.set(
"borderRadius",
options.borderRadius.toString(),
);
}
if (options.fontFamily) {
this.link.searchParams.set("fontFamily", options.fontFamily);
}
if (options.inputBackgroundColor) {
this.link.searchParams.set(
"inputBackgroundColor",
options.inputBackgroundColor,
);
}
if (options.inputBorderColor) {
this.link.searchParams.set("inputBorderColor", options.inputBorderColor);
}
}
addClientSecret(sdkClientSecret: string) {
this.link.searchParams.set("sdkClientSecret", sdkClientSecret);
}
addClientId(clientId: string) {
this.link.searchParams.set("clientId", clientId);
}
addLocale(locale?: Locale) {
if (locale) {
this.link.searchParams.set("locale", locale.toString());
}
}
addOTP() {
this.link.searchParams.set("withOTP", "true");
}
addAppName(appName?: string) {
if (appName) {
this.link.searchParams.set("appName", appName);
}
}
addShowConnectWalletOptions(showConnectWalletOptions: boolean) {
this.link.searchParams.append(
"showConnectWalletOptions",
showConnectWalletOptions.toString(),
);
}
addReceivingWalletType(walletType?: string) {
this.link.searchParams.append("walletType", walletType || "Preset");
}
addRecipientWalletAddress(address: string) {
this.link.searchParams.set("recipientWalletAddress", address);
}
addPayerWalletAddress(address: string) {
this.link.searchParams.append("payerWalletAddress", address);
}
addDate(date?: Date) {
this.link.searchParams.set(
"date",
date ? date.toString() : Date.now().toString(),
);
}
getLink(): URL {
return this.link;
}
}
+29
View File
@@ -0,0 +1,29 @@
// UNCHANGED
/**
* Opens a popup centered on the current window.
* Note that modern browsers may prevent popups from opening automatically,
* so try to handle the case where the window returned is null.
*
* @returns Window | null - The Window object that was opened. If null is returned, the popup failed to open.
*/
export const openCenteredPopup = ({
url,
width = 440,
height = 700,
}: {
url: string;
width?: number;
height?: number;
}): Window | null => {
if (!window?.top) {
return null;
}
const y = window.top.outerHeight / 2 + window.top.screenY - height / 2;
const x = window.top.outerWidth / 2 + window.top.screenX - width / 2;
return window.open(
url,
"_blank",
`popup=true,width=${width},height=${height},top=${y},left=${x}`,
);
};
@@ -0,0 +1,95 @@
// Changed: Updated PaperSDKError
import type { PaymentsSDKError } from "../interfaces/PaymentsSdkError";
import { PayWithCryptoErrorCode } from "../interfaces/PaymentsSdkError";
export interface IErrorObject {
isErrorObject: boolean;
title: PayWithCryptoErrorCode;
description: string;
}
export const handlePayWithCryptoError = async (
error: Error | IErrorObject,
onError?: (code: PaymentsSDKError) => Promise<void> | void,
postToParent?: (errorObject: Omit<IErrorObject, "isErrorObject">) => void,
) => {
if ("isErrorObject" in error) {
if (onError) {
await onError({ code: error.title, error: new Error(error.title) });
}
if (postToParent) {
postToParent({ ...error });
}
} else if (!("message" in error)) {
if (onError) {
await onError({
code: PayWithCryptoErrorCode.ErrorSendingTransaction,
error: new Error(JSON.stringify(error)),
});
}
if (postToParent) {
postToParent({
description: `${error}`,
title: PayWithCryptoErrorCode.ErrorSendingTransaction,
});
}
} else {
if (
error.message.includes("rejected") ||
error.message.includes("denied transaction")
) {
if (onError) {
await onError({
code: PayWithCryptoErrorCode.TransactionCancelled,
error,
});
}
if (postToParent) {
postToParent({
description: "",
title: PayWithCryptoErrorCode.TransactionCancelled,
});
}
} else if (error.message.includes("insufficient funds")) {
if (onError) {
await onError({
code: PayWithCryptoErrorCode.InsufficientBalance,
error,
});
}
if (postToParent) {
postToParent({
description:
"Check your wallet's ETH balance to make sure you have enough!",
title: PayWithCryptoErrorCode.InsufficientBalance,
});
}
} else if (error.message.includes("Error switching chain")) {
if (onError) {
await onError({
code: PayWithCryptoErrorCode.ChainSwitchUnderway,
error,
});
}
if (postToParent) {
postToParent({
description: "Check your wallet app",
title: PayWithCryptoErrorCode.ChainSwitchUnderway,
});
}
} else {
if (onError) {
await onError({
code: PayWithCryptoErrorCode.ErrorSendingTransaction,
error,
});
}
if (postToParent) {
postToParent({
description: `${error.message}`,
title: PayWithCryptoErrorCode.ErrorSendingTransaction,
});
}
}
}
};
@@ -0,0 +1,8 @@
// UNCHANGED
export function postMessageToIframe<T>(
frame: HTMLIFrameElement,
eventType: string,
data: T,
) {
frame.contentWindow?.postMessage({ eventType, ...data }, "*");
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "@thirdweb-dev/tsconfig/sdk.json",
"include": ["src", "types"],
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": {
"noUncheckedIndexedAccess": true
}
}
+64
View File
@@ -1,5 +1,69 @@
# @thirdweb-dev/react-core
## 4.2.1
## 4.2.0
### Patch Changes
- Updated dependencies [[`b808e942`](https://github.com/thirdweb-dev/js/commit/b808e942fdaa81b5de61dcb3f2083081cb99ea11), [`e46dd025`](https://github.com/thirdweb-dev/js/commit/e46dd0254f157c3c4d50fe3e4f44e2e24eaf34a8)]:
- @thirdweb-dev/sdk@4.0.24
- @thirdweb-dev/wallets@2.3.3
- @thirdweb-dev/auth@4.1.20
## 4.1.17
### Patch Changes
- [#2084](https://github.com/thirdweb-dev/js/pull/2084) [`c410a1c1`](https://github.com/thirdweb-dev/js/commit/c410a1c18a704d118555215db9ba7d92c3b24d8c) Thanks [@MananTank](https://github.com/MananTank)! - JSDoc comments Improvements
- [#2008](https://github.com/thirdweb-dev/js/pull/2008) [`23db97cc`](https://github.com/thirdweb-dev/js/commit/23db97cca51211df82d430fbfff4bbfbd7d4dc38) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add hook for transferring native token
- Updated dependencies [[`c410a1c1`](https://github.com/thirdweb-dev/js/commit/c410a1c18a704d118555215db9ba7d92c3b24d8c), [`fed1313a`](https://github.com/thirdweb-dev/js/commit/fed1313a199011a9b52d7c5e11ad6e72fc969002), [`f369bffe`](https://github.com/thirdweb-dev/js/commit/f369bffe5a30e2e8a9df2ac62f24f93f96324186), [`81c46e22`](https://github.com/thirdweb-dev/js/commit/81c46e22984cdb5b33b2e6eb99a0ebf0e4fbdb33)]:
- @thirdweb-dev/storage@2.0.8
- @thirdweb-dev/wallets@2.3.2
- @thirdweb-dev/chains@0.1.62
- @thirdweb-dev/sdk@4.0.23
- @thirdweb-dev/auth@4.1.19
## 4.1.16
### Patch Changes
- [#2082](https://github.com/thirdweb-dev/js/pull/2082) [`699f31c2`](https://github.com/thirdweb-dev/js/commit/699f31c20a76cd284dbed1629c4a19d93aca7b7f) Thanks [@iketw](https://github.com/iketw)! - Better comments
- Updated dependencies [[`c701c388`](https://github.com/thirdweb-dev/js/commit/c701c388c65a1e531b88991d8fd67d25f153992e)]:
- @thirdweb-dev/sdk@4.0.22
- @thirdweb-dev/wallets@2.3.1
- @thirdweb-dev/auth@4.1.18
## 4.1.15
### Patch Changes
- Updated dependencies [[`33c9f6b1`](https://github.com/thirdweb-dev/js/commit/33c9f6b1ab3e65187b2c49c083412d39a1334bba), [`de5ebc90`](https://github.com/thirdweb-dev/js/commit/de5ebc9093aaf5fc08bc0d2d414138b520fe17fe), [`e10173bf`](https://github.com/thirdweb-dev/js/commit/e10173bf8aeaaabdb45231109b4da0c52c91b9da), [`09bafa9a`](https://github.com/thirdweb-dev/js/commit/09bafa9aebadb01641214747148c67d0b39c1275)]:
- @thirdweb-dev/wallets@2.3.0
- @thirdweb-dev/auth@4.1.17
## 4.1.14
### Patch Changes
- Updated dependencies [[`bcfa9463`](https://github.com/thirdweb-dev/js/commit/bcfa9463bbae6bf1d3b6389b7a141f65ef3e1173)]:
- @thirdweb-dev/sdk@4.0.21
- @thirdweb-dev/wallets@2.2.1
- @thirdweb-dev/auth@4.1.16
## 4.1.13
### Patch Changes
- Updated dependencies [[`d2001ca4`](https://github.com/thirdweb-dev/js/commit/d2001ca464aa699ac821c97eb37de7409ba865f3), [`85842c15`](https://github.com/thirdweb-dev/js/commit/85842c1596c901e228be1894b6702a8871d9e794), [`e595d4d9`](https://github.com/thirdweb-dev/js/commit/e595d4d92f03e36cbe61e1f00a366e37ede5d814), [`497677f3`](https://github.com/thirdweb-dev/js/commit/497677f3596977fa90ebc0fa76cb5842d46d8dcf), [`94966069`](https://github.com/thirdweb-dev/js/commit/9496606964d65268f8ee6bf9f78b2786e99d33ac), [`15ae5e7f`](https://github.com/thirdweb-dev/js/commit/15ae5e7f95a482a9736923c0e10916a0a6115c3d)]:
- @thirdweb-dev/chains@0.1.61
- @thirdweb-dev/sdk@4.0.20
- @thirdweb-dev/wallets@2.2.0
- @thirdweb-dev/auth@4.1.15
## 4.1.12
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.1.12",
"version": "4.2.1",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -35,23 +35,120 @@ type NetworkMetadata = {
* It's important to note that some wallet apps do not support programmatic network switching and switchNetwork will be undefined.
* For those situations, you can typically switch networks in the wallet app this hook will still work.
*
* Hook for getting information about the current network and switching to a different network.
*
* Returns an array value containing two elements.
*
* 1. An object containing the following properties:
*
* - `data` object contains information about the wallet's current and supported networks.
* - `loading` indicates if the switch network request is in progress.
* - `error` holds the `Error` object if there was an error when attempting to switch network.
*
* 2. A function to switch to a different network.
*
* @example
* ```javascript
* import { useNetwork } from "@thirdweb-dev/react";
*
* const App = () => {
* const [, switchNetwork] = useNetwork();
* function App() {
* const [{ data, error, loading }, switchNetwork] = useNetwork();
*
* return (
* // switchNetwork is undefined if the wallet does not support programmatic network switching
* // 137 is the chainId for Polygon in this example
* <button onClick={() => switchNetwork(137)}>
* Switch Network
* <button
* onClick={async () => {
* if (!switchNetwork) {
* console.log("can not switch network");
* return;
* }
*
* const result = await switchNetwork(80001);
* if (result.data) {
* console.log("Switched to Mumbai testnet successfully");
* } else {
* console.log("Error switching to Mumbai testnet", result.error);
* }
* }}
* >
* Switch to Mumbai
* </button>
* );
* };
* }
* ```
*
* @deprecated - use `useChain`, `useSwitchChain`, `useChainId` instead
* @returns
*
* ```ts
* const [{ data, error, loading }, switchNetwork] = useNetwork();
* ```
* #### data
*
* If wallet is connected to a network that is one of `supportedChains` provided in `ThirdwebProvider` or one of the default supported chains, `data` object will contain the following:
*
* ```ts
* {
* chain: Chain; // The connected network
* chains: Chain[]; // All supported networks
* }
* ```
*
* If wallet is connected to a network that is NOT one of `supportedChains` provided in `ThirdwebProvider` or default supported, `data` object will contain the following:
*
* ```ts
* {
* // chainId of current connected network + unsupported flag
* chain: { chainId: number, unsupported: true };
* // All supported networks
* chains: Chain[];
* }
* ```
*
* If wallet is not connected, `data` object will contain the following:
*
* ```ts
* {
* chain: undefined;
* chains: []; // Empty array
* }
* ```
*
* #### error
*
* `error` contains an `Error` object if there was an error when attempting to switch network using the `switchNetwork` function
*
* `undefined` if there is no switch network error
*
* ```ts
* Error | undefined;
* ```
*
* #### loading
*
* `loading` is `true` when switching network using the `switchNetwork` function, and `false` otherwise.
*
*
* #### switchNetwork
*
* `switchNetwork` is a function to switch to a different network. It takes a `chainId` as an argument and returns a promise that resolves to an object containing `data` and `error` properties.
*
* If switching network was successful, `data` will contain the new network information. and `error` will be `undefined`. If switching network failed, `data` will be `undefined` and `error` will contain an `Error` object.
*
* `switchNetwork` is `undefined` if not connected to a wallet or if the connected wallet does not allow programmatic switching.
*
* ```ts
* type SwitchNetwork = undefined | (chainId: number) => Promise<
* | {
* data: Chain | undefined;
* error: undefined;
* }
* | {
* data: undefined;
* error: Error;
* }>
* ```
*
* @deprecated use `useChain`, `useSwitchChain`, `useChainId` instead
* @internal
*/
export function useNetwork(): [NetworkMetadata, SwitchNetwork | undefined] {
const chain = useChain();
@@ -28,7 +28,10 @@ import { WalletInstance } from "../types/wallet";
export type WalletId = (typeof walletIds)[keyof typeof walletIds];
type WalletIdToWalletTypeMap = {
/**
* @wallet
*/
export type WalletIdToWalletTypeMap = {
metamask: MetaMaskWallet;
coin98: Coin98Wallet;
coinbase: CoinbaseWallet;
@@ -54,12 +57,40 @@ type WalletIdToWalletTypeMap = {
};
/**
* @returns the current active wallet instance
* Hook to get the instance of the currently connected wallet.
*
* @example
* ```jsx
* import { useWallet } from "@thirdweb-dev/react";
*
* function App() {
* const walletInstance = useWallet();
* }
* ```
* @returns Currently connected `WalletInstance` , or `undefined` if no wallet is connected.
* @walletConnection
*/
export function useWallet(): WalletInstance | undefined;
/**
* Hook to get the instance of the currently connected wallet if it matches the given `walletId`.
*
* @example
* ```jsx
* import { useWallet } from "@thirdweb-dev/react";
*
* function App() {
* const metamaskWalletInstance = useWallet('metamask');
* }
* ```
*
* @returns Currently connected `WalletInstance` with given `walletId` , or `undefined` if no wallet is connected or if the connected wallet does not match the given `walletId`.
* @walletConnection
*/
export function useWallet<T extends WalletId>(
walletId: T,
): WalletIdToWalletTypeMap[T] | undefined;
export function useWallet(): WalletInstance | undefined;
export function useWallet<T extends WalletId>(walletId?: T) {
const context = useWalletContext();
invariant(
@@ -86,7 +117,27 @@ export function useWallet<T extends WalletId>(walletId?: T) {
}
/**
* @returns the current active wallet's configuration object
*
* Hook to get the `WalletConfig` object of the currently connected wallet.
*
* This is useful to get metadata about the connected wallet, such as the wallet name, logo, etc
*
* @example
*
* ```jsx
* import { useWalletConfig } from "@thirdweb-dev/react";
*
* function App() {
* const walletConfig = useWalletConfig();
*
* const walletName = walletConfig?.meta.name;
* const walletLogo = walletConfig?.meta.iconURL;
* }
* ```
*
* @returns The current connected wallet's configuration object or `undefined` if no wallet is connected.
*
* @walletConnection
*/
export function useWalletConfig() {
const context = useWalletContext();
@@ -98,7 +149,8 @@ export function useWalletConfig() {
}
/**
*
* @internal
* Get `supportedWallets` passed in the `<ThirdwebProvider/>`
* @returns `supportedWallets` configured in the `<ThirdwebProvider/>`
*/
export function useWallets() {
@@ -111,8 +163,55 @@ export function useWallets() {
}
/**
* Hook for connecting a wallet to your app.
*
* @returns a method to connect to a wallet class
* The wallet also needs to be added in `ThirdwebProvider`'s `supportedWallets` prop to enable auto-connection on page load.
*
* @example
* ```jsx
* import { useConnect, metamaskWallet } from "@thirdweb-dev/react";
*
* const metamaskConfig = metamaskWallet();
*
* function App() {
* const connect = useConnect();
*
* return (
* <button
* onClick={async () => {
* const wallet = await connect(metamaskConfig, connectOptions);
* console.log("connected to ", wallet);
* }}
* >
* Connect to MetaMask
* </button>
* );
* }
* ```
*
* @returns A function to connect a wallet
*
* ```ts
* const connect = useConnect();
*
* function handleConnect() {
* const wallet = await connect(walletConfig, connectOptions);
* }
* ```
*
* The function accepts two arguments: `walletConfig` and `connectOptions`
*
* #### walletConfig
* The wallet to connect. Must be of type `WalletConfig`.
*
* [Learn more about the available wallet options](https://portal.thirdweb.com/react/connecting-wallets).
*
* #### connectOptions
* The typeof `connectOptions` object depends on the wallet you are connecting. For some wallets, it may be optional
*
* If you are using typescript, `connect` will automatically infer the type of `connectOptions` based on the `walletConfig` you pass in as the first argument and will show type errors if you pass in invalid options.
*
* @walletConnection
*/
export function useConnect() {
const context = useWalletContext();
@@ -124,8 +223,21 @@ export function useConnect() {
}
/**
* Hook for disconnecting the currently connected wallet.
*
* @returns a method to disconnect from the current active wallet
* @example
* ```jsx
* import { useDisconnect } from "@thirdweb-dev/react";
*
* function App() {
* const disconnect = useDisconnect();
*
* return <button onClick={disconnect}>Disconnect</button>;
* }
* ```
*
* @returns A function to disconnect from current connected wallet
* @walletConnection
*/
export function useDisconnect() {
const context = useWalletContext();
@@ -137,15 +249,32 @@ export function useDisconnect() {
}
/**
* Hook for checking whether your app is connected to a wallet or not.
*
* @returns the connection status of the wallet
* @example
* ```jsx
* import { useConnectionStatus } from "@thirdweb-dev/react";
*
* function App() {
* const connectionStatus = useConnectionStatus();
*
* if (connectionStatus === "unknown") return <p> Loading... </p>;
* if (connectionStatus === "connecting") return <p> Connecting... </p>;
* if (connectionStatus === "connected") return <p> You are connected </p>;
* if (connectionStatus === "disconnected")
* return <p> You are not connected to a wallet </p>;
* }
* ```
*
* @returns The wallet connection status
*
* It can be one of the following:
* 1. `unknown` - when wallet connection status is not yet known
* 2. `connecting` - when wallet is connecting
* 3. `connected` - when wallet is connected
* 4. `disconnected` - when wallet is disconnected
* - `unknown`: connection status is not known yet. This is the initial state.
* - `connecting`: wallet is being connected. Either because of a user action, or when the wallet is auto-connecting on page load.
* - `connected`: the wallet is connected and ready to be used.
* - `disconnected`: the wallet is not connected.
*
* @walletConnection
*/
export function useConnectionStatus() {
const context = useWalletContext();
@@ -157,8 +286,54 @@ export function useConnectionStatus() {
}
/**
* Hook for setting the `connectionStatus` of the wallet which is returned by the `useConnectionStatus` hook
*
* @returns a method to create an instance of given wallet class
* This is only useful if you are manually connecting a wallet instance as mentioned in [Build your Wallet](https://portal.thirdweb.com/wallet/build-a-wallet)
*
* @example
*
* ```ts
* import {
* useCreateWalletInstance,
* useSetConnectionStatus,
* useSetConnectedWallet,
* metamaskWallet
* } from "@thirdweb-dev/react";
*
* const walletConfig = metamaskWallet();
*
* function Example() {
* const createWalletInstance = useCreateWalletInstance();
* const setConnectionStatus = useSetConnectionStatus();
* const setConnectedWallet = useSetConnectedWallet();
*
* // Call this function to connect your wallet
* const handleConnect = async () => {
* // 1. create instance
* const walletInstance = createWalletInstance(walletConfig);
* setConnectionStatus("connecting");
*
* try {
* // 2. Call `connect` method of your wallet
* await walletInstance.connect(
* connectOptions, // if your wallet.connect method accepts any options, specify it here
* );
*
* // 3. Set connected wallet
* setConnectedWallet(walletInstance);
* props.close();
* } catch (e) {
* setConnectionStatus("disconnected");
* console.error("failed to connect", e);
* }
* };
*
* return <div> ... </div>;
* }
* ```
*
* @returns A function that sets the `connectionStatus` of the wallet
* @walletConnection
*/
export function useSetConnectionStatus() {
const context = useWalletContext();
@@ -170,8 +345,36 @@ export function useSetConnectionStatus() {
}
/**
* Hook for creating a wallet instance from given `WalletConfig` object.
*
* @returns a method to create an instance of given wallet class
* If you just want to connect the wallet and don't need the wallet instance before connecting the wallet, use the `useConnect` hook instead.
*
* @example
*
* ```jsx
* import { useConnect, metamaskWallet } from "@thirdweb-dev/react";
*
* const metamaskConfig = metamaskWallet();
*
* function App() {
* const createWalletInstance = useCreateWalletInstance();
*
* return (
* <button
* onClick={() => {
* const metamaskWalletInstance = createWalletInstance(metamaskConfig);
* console.log(metamaskWalletInstance);
* }}
* >
* create wallet instance
* </button>
* );
* }
* ```
*
* @returns A function that creates a wallet instance for given `WalletConfig` object.
*
* @walletConnection
*/
export function useCreateWalletInstance() {
const context = useWalletContext();
@@ -183,8 +386,25 @@ export function useCreateWalletInstance() {
}
/**
* Hook for switching to a different network.
*
* @returns a method to connect the wallet to network/chain with given chainId
* @example
* ```jsx
* import { useSwitchChain } from "@thirdweb-dev/react";
* import { Goerli } from "@thirdweb-dev/chains";
*
* function App() {
* const switchChain = useSwitchChain();
* return (
* <button onClick={() => switchChain(Goerli.chainId)}>
* Switch to Goerli
* </button>
* );
* }
* ```
*
* @returns A function to switch the network in the currently connected wallet to network with given `chainId`
* @networkConnection
*/
export function useSwitchChain() {
const context = useWalletContext();
@@ -196,8 +416,54 @@ export function useSwitchChain() {
}
/**
* Hook for setting a wallet instance as "connected" - once done, the wallet connection hooks like `useWallet`, `useAddress`, `useSigner`, `useConnectionStatus` etc will return the data for that wallet instance
*
* @returns a method to set a connected wallet instance
* This is only useful if you are manually connecting a wallet instance as mentioned in [Build your Wallet](https://portal.thirdweb.com/wallet/build-a-wallet)
*
* @example
*
* ```ts
* import {
* useCreateWalletInstance,
* useSetConnectionStatus,
* useSetConnectedWallet,
* metamaskWallet
* } from "@thirdweb-dev/react";
*
* const walletConfig = metamaskWallet();
*
* function Example() {
* const createWalletInstance = useCreateWalletInstance();
* const setConnectionStatus = useSetConnectionStatus();
* const setConnectedWallet = useSetConnectedWallet();
*
* // Call this function to connect your wallet
* const handleConnect = async () => {
* // 1. create instance
* const walletInstance = createWalletInstance(walletConfig);
* setConnectionStatus("connecting");
*
* try {
* // 2. Call `connect` method of your wallet
* await walletInstance.connect(
* connectOptions, // if your wallet.connect method accepts any options, specify it here
* );
*
* // 3. Set connected wallet
* setConnectedWallet(walletInstance);
* props.close();
* } catch (e) {
* setConnectionStatus("disconnected");
* console.error("failed to connect", e);
* }
* };
*
* return <div> ... </div>;
* }
* ```
*
* @returns A function to set a wallet instance as "connected".
* @walletConnection
*/
export function useSetConnectedWallet() {
const context = useWalletContext();
@@ -84,11 +84,10 @@ export interface ThirdwebProviderCoreProps<TChains extends Chain[]>
/**
* @internal
*/
export const ThirdwebProviderCore = <TChains extends Chain[]>({
createWalletStorage = createAsyncLocalStorage,
...props
}: React.PropsWithChildren<ThirdwebProviderCoreProps<TChains>>) => {
const { activeChain } = props;
export const ThirdwebProviderCore = <TChains extends Chain[]>(
props: React.PropsWithChildren<ThirdwebProviderCoreProps<TChains>>,
) => {
const { activeChain, createWalletStorage = createAsyncLocalStorage } = props;
const supportedChains = (props.supportedChains || defaultChains) as Chain[];
@@ -48,7 +48,11 @@ type WalletConnectParams<I extends WalletInstance> = Parameters<
I["connect"]
>[0];
type ConnectionStatus = "unknown" | "connected" | "disconnected" | "connecting";
export type ConnectionStatus =
| "unknown"
| "connected"
| "disconnected"
| "connecting";
type ConnectFnArgs<I extends WalletInstance> =
// if second argument is optional
@@ -597,6 +601,9 @@ export function useWalletContext() {
return ctx;
}
/**
* Get WalletConnect handler instance
*/
export function useWalletConnectHandler() {
const ctx = useWalletContext();
if (!ctx) {

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