Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cb51536b4 | ||
|
|
9b0a3df709 | ||
|
|
0c9376ff17 | ||
|
|
df338f5f75 | ||
|
|
ea0dedcb6e | ||
|
|
50bbc7c053 | ||
|
|
ff354a6ae1 | ||
|
|
8197b3ced2 | ||
|
|
65e4ddc8e0 | ||
|
|
955a20737a | ||
|
|
f0fe1fdb1b | ||
|
|
b22a572d8a | ||
|
|
9d46fce50f | ||
|
|
a18fc8e1b7 | ||
|
|
6574e4da99 | ||
|
|
5781dac184 | ||
|
|
db05717803 | ||
|
|
cb2a7e964a | ||
|
|
07f98a5b92 | ||
|
|
007770cd63 | ||
|
|
a92311a53d | ||
|
|
e6b5d9cc5d | ||
|
|
c4d51e0b80 | ||
|
|
259ff7c07c | ||
|
|
39c6fbc552 | ||
|
|
9453f74bbf | ||
|
|
bf6a8e0cab | ||
|
|
eb919ed49d | ||
|
|
4d7ecc24b7 |
@@ -30,7 +30,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest-16
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Packages
|
||||
steps:
|
||||
- name: Check out the code
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
test:
|
||||
timeout-minutes: 15
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-latest-16
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the code
|
||||
uses: actions/checkout@v4
|
||||
@@ -73,6 +73,9 @@ jobs:
|
||||
|
||||
- name: Set up foundry
|
||||
uses: foundry-rs/foundry-toolchain@v1
|
||||
with:
|
||||
version: nightly-440ec525deb00b4dca138794865c27d1e8ea4d01
|
||||
cache: false
|
||||
|
||||
- run: pnpm test
|
||||
|
||||
@@ -101,7 +104,7 @@ jobs:
|
||||
if: github.event_name != 'merge_group'
|
||||
timeout-minutes: 15
|
||||
name: "Benchmarks"
|
||||
runs-on: ubuntu-latest-16
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the code
|
||||
uses: actions/checkout@v4
|
||||
@@ -109,6 +112,12 @@ jobs:
|
||||
- name: Setup & Install
|
||||
uses: ./.github/composite-actions/install
|
||||
|
||||
- name: Set up foundry
|
||||
uses: foundry-rs/foundry-toolchain@v1
|
||||
with:
|
||||
version: nightly-440ec525deb00b4dca138794865c27d1e8ea4d01
|
||||
cache: false
|
||||
|
||||
- name: Run benchmarks
|
||||
uses: CodSpeedHQ/action@v2
|
||||
with:
|
||||
@@ -120,7 +129,7 @@ jobs:
|
||||
if: github.event_name == 'pull_request'
|
||||
timeout-minutes: 15
|
||||
name: "Size"
|
||||
runs-on: ubuntu-latest-16
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
Vendored
+4
-1
@@ -5,5 +5,8 @@
|
||||
"quickfix.biome": "explicit",
|
||||
"source.organizeImports.biome": "explicit"
|
||||
},
|
||||
"typescript.preferences.importModuleSpecifier": "relative"
|
||||
"typescript.preferences.importModuleSpecifier": "relative",
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
}
|
||||
}
|
||||
|
||||
+16
-1
@@ -21,5 +21,20 @@
|
||||
"packages/thirdweb/src/utils/bytecode/cbor-decode.ts",
|
||||
"packages/thirdweb/src/**/__generated__/**"
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"include": ["packages/thirdweb/src/**"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": {
|
||||
"noRestrictedGlobals": {
|
||||
"options": { "deniedGlobals": ["Buffer"] },
|
||||
"level": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 4.1.61
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @thirdweb-dev/wallets@2.5.3
|
||||
|
||||
## 4.1.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc)]:
|
||||
- @thirdweb-dev/wallets@2.5.2
|
||||
|
||||
## 4.1.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "4.1.59",
|
||||
"version": "4.1.61",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @thirdweb-dev/chains
|
||||
|
||||
## 0.1.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2755](https://github.com/thirdweb-dev/js/pull/2755) [`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
|
||||
|
||||
## 0.1.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2746](https://github.com/thirdweb-dev/js/pull/2746) [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
|
||||
|
||||
## 0.1.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -7,6 +7,11 @@ export default {
|
||||
"name": "blockscout",
|
||||
"url": "https://blockscoutapi.hekla.taiko.xyz",
|
||||
"standard": "EIP3091"
|
||||
},
|
||||
{
|
||||
"name": "routescan",
|
||||
"url": "https://hekla.taikoscan.network",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
|
||||
@@ -12,12 +12,6 @@ export default {
|
||||
"faucets": [
|
||||
"https://faucet.opside.network"
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://QmeCyZeibUoHNoYGzy1GkzH2uhxyRHKvH51PdaUMer4VTo",
|
||||
"width": 591,
|
||||
"height": 591,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://opside.network",
|
||||
"name": "Opside Testnet",
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 24010,
|
||||
"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": "Stealthnet Testing ",
|
||||
"nativeCurrency": {
|
||||
"name": "Stealthnet Testing Token",
|
||||
"symbol": "AVCLDDEV",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 24010,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://24010.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/stealthnet/testnet/rpc"
|
||||
],
|
||||
"shortName": "Stealthnet Testing ",
|
||||
"slug": "stealthnet-testing",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -2,19 +2,7 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "XR Sepolia",
|
||||
"chainId": 2730,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://xr-sepolia-testnet.explorer.caldera.xyz/",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://QmRdBsZF2sgWitedT5qAtBZwrYwY1xecHN9u5fgddqA1eL/xr-sepolia.png",
|
||||
"width": 300,
|
||||
"height": 300,
|
||||
"format": "png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
@@ -39,7 +27,7 @@ export default {
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://2730.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://xr-sepolia-testnet.rpc.caldera.xyz/http"
|
||||
"https://xr-sepolia-testnet.rpc.caldera.xyz/infra-partner-http"
|
||||
],
|
||||
"shortName": "xr-sepolia",
|
||||
"slug": "xr-sepolia",
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Vizing Mainnet",
|
||||
"chainId": 28518,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://explorer.vizing.com",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://QmPgpWfGsAZ5UHekWFR8rioadVe3Wox8idFyeVxuv9N4Vo",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"format": "svg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmPgpWfGsAZ5UHekWFR8rioadVe3Wox8idFyeVxuv9N4Vo",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://vizing.com",
|
||||
"name": "Vizing Mainnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 28518,
|
||||
"parent": {
|
||||
"type": "L2",
|
||||
"chain": "eip155-1",
|
||||
"bridges": [
|
||||
{
|
||||
"url": "https://bridge.vizing.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
"rpc": [
|
||||
"https://28518.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.vizing.com"
|
||||
],
|
||||
"shortName": "Vizing",
|
||||
"slug": "vizing",
|
||||
"testnet": false,
|
||||
"title": "Vizing Mainnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "EVO",
|
||||
"chainId": 3424,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Evolve Mainnet Explorer",
|
||||
"url": "https://evoexplorer.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmVxtpYYzc5214CB7BgsMC4mRNRHCD8fpbNMzZguBWyRwa",
|
||||
"width": 600,
|
||||
"height": 600,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://evolveblockchain.io",
|
||||
"name": "EVOLVE Mainnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Evolve",
|
||||
"symbol": "EVO",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 3424,
|
||||
"rpc": [
|
||||
"https://3424.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.evolveblockchain.io"
|
||||
],
|
||||
"shortName": "EVOm",
|
||||
"slug": "evolve",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -12,12 +12,6 @@ export default {
|
||||
"faucets": [
|
||||
"https://sepoliafaucet.com/"
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://qmxhs7fvjanzwm14vjpbnmklre32gsiy9chsarrnbtfa1n",
|
||||
"width": 1280,
|
||||
"height": 1280,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://docs.apexlayer.xyz/",
|
||||
"name": "APEX Testnet",
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 51435,
|
||||
"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": "QR0410s1d Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QR0410s1d Testnet Token",
|
||||
"symbol": "CWV",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 51435,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://51435.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/qr0410s1d/testnet/rpc"
|
||||
],
|
||||
"shortName": "QR0410s1d Testnet",
|
||||
"slug": "qr0410s1d-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 53687,
|
||||
"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": "QI0409s1 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0409s1 Testnet Token",
|
||||
"symbol": "QCE",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 53687,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://53687.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0409s1 Testnet",
|
||||
"slug": "qi0409s1-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -2,9 +2,19 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 555666,
|
||||
"explorers": [],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "ECLIPSE Explorer",
|
||||
"url": "https://subnets-test.avax.network/eclipsecha",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 59932,
|
||||
"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": "Insomnia Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Insomnia Testnet Token",
|
||||
"symbol": "TECH",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 59932,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://59932.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/instest/testnet/rpc"
|
||||
],
|
||||
"shortName": "Insomnia Testnet",
|
||||
"slug": "insomnia-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 64092,
|
||||
"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": "QaUser3186 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QaUser3186 Testnet Token",
|
||||
"symbol": "KII",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 64092,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://64092.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QaUser3186 Testnet",
|
||||
"slug": "qauser3186-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -10,12 +10,6 @@ export default {
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmPko9BJhR5FWTsThcwUFnnnjgLjrXVDm1n98dCuaQNW59",
|
||||
"width": 506,
|
||||
"height": 652,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://bstchain.io",
|
||||
"name": "BST Chain",
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -6,22 +6,10 @@ export default {
|
||||
{
|
||||
"name": "GuapcoinX Explorer",
|
||||
"url": "http://explorer.guapcoinx.com",
|
||||
"standard": "none",
|
||||
"icon": {
|
||||
"url": "ipfs://QmcDTR7982VQKDDz2Mh4fZbnE9hn67MuFPWQv1MimCqPvB",
|
||||
"width": 800,
|
||||
"height": 800,
|
||||
"format": "png"
|
||||
}
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmcDTR7982VQKDDz2Mh4fZbnE9hn67MuFPWQv1MimCqPvB",
|
||||
"width": 800,
|
||||
"height": 800,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://guapcoin.org/",
|
||||
"name": "GuapcoinX",
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -10,12 +10,6 @@ export default {
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreic6tcc6swh5kzljwqnswj6rlemcm7n6ra7xkgttwv5v3fv7ozj5zu",
|
||||
"width": 1500,
|
||||
"height": 1500,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://miexs.com",
|
||||
"name": "Miexs Smartchain",
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 77576,
|
||||
"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": "QaUser6624 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QaUser6624 Testnet Token",
|
||||
"symbol": "WVN",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 77576,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://77576.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QaUser6624 Testnet",
|
||||
"slug": "qauser6624-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -12,12 +12,6 @@ export default {
|
||||
"faucets": [
|
||||
"https://faucet.vention.network"
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://QmcNepHmbmHW1BZYM3MFqJW4awwhmDqhUPRXXmRnXwg1U4",
|
||||
"width": 250,
|
||||
"height": 250,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://ventionscan.io",
|
||||
"name": "Vention Smart Chain Mainnet",
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "DTBX",
|
||||
"chainId": 7923,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://explorer.dotblox.io",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmZy2TMY881ghRxXJA7VyRA8Zhj2LJJ86DpHRZs3VQZqoJ",
|
||||
"width": 53,
|
||||
"height": 53,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://explorer.dotblox.io",
|
||||
"name": "Dot Blox",
|
||||
"nativeCurrency": {
|
||||
"name": "Dot Blox",
|
||||
"symbol": "DTBX",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 7923,
|
||||
"rpc": [
|
||||
"https://7923.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.dotblox.io"
|
||||
],
|
||||
"shortName": "DTBX",
|
||||
"slug": "dot-blox",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,51 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "ETH",
|
||||
"chainId": 810181,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "zkLink Nova Block Explorer",
|
||||
"url": "https://sepolia.explorer.zklink.io",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreiaj7b6pdekv3rjuta5wsdvmfdcsat2jftjgozape7wvmyj6d3vjcm",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreiaj7b6pdekv3rjuta5wsdvmfdcsat2jftjgozape7wvmyj6d3vjcm",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://zklink.io",
|
||||
"name": "zkLink Nova Sepolia Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 810181,
|
||||
"parent": {
|
||||
"type": "L2",
|
||||
"chain": "eip155-59141",
|
||||
"bridges": [
|
||||
{
|
||||
"url": "https://sepolia.portal.zklink.io"
|
||||
}
|
||||
]
|
||||
},
|
||||
"rpc": [
|
||||
"https://810181.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://sepolia.rpc.zklink.io",
|
||||
"wss://sepolia.rpc.zklink.io"
|
||||
],
|
||||
"shortName": "zklink-nova-sepolia",
|
||||
"slip44": 1,
|
||||
"slug": "zklink-nova-sepolia-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "ETH",
|
||||
"chainId": 90354,
|
||||
"ens": {
|
||||
"registry": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Block Explorer",
|
||||
"url": "https://explorerl2new-camp-network-4xje7wy105.t.conduit.xyz",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
|
||||
"width": 83,
|
||||
"height": 82,
|
||||
"format": "svg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
|
||||
"width": 551,
|
||||
"height": 540,
|
||||
"format": "png"
|
||||
},
|
||||
"name": "Camp Network",
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 90354,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://90354.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-camp-network-4xje7wy105.t.conduit.xyz/"
|
||||
],
|
||||
"shortName": "campaign-l2",
|
||||
"slug": "camp-network",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "ETH",
|
||||
"chainId": 9789,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Tabi Testnet Explorer",
|
||||
"url": "https://testnet.tabiscan.com/",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"name": "Tabichain",
|
||||
"nativeCurrency": {
|
||||
"name": "TABI",
|
||||
"symbol": "TABI",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 9789,
|
||||
"redFlags": [],
|
||||
"rpc": [],
|
||||
"shortName": "tabichain",
|
||||
"slug": "tabichain",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 98857,
|
||||
"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": "Thetan Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Thetan Testnet Token",
|
||||
"symbol": "THG",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 98857,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://98857.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/thetantest/testnet/rpc"
|
||||
],
|
||||
"shortName": "Thetan Testnet",
|
||||
"slug": "thetan-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/chains",
|
||||
"version": "0.1.92",
|
||||
"version": "0.1.94",
|
||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||
"exports": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,25 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.13.69
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
- @thirdweb-dev/sdk@4.0.63
|
||||
- @thirdweb-dev/wallets@2.5.3
|
||||
- @thirdweb-dev/auth@4.1.61
|
||||
|
||||
## 0.13.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc), [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- @thirdweb-dev/wallets@2.5.2
|
||||
- @thirdweb-dev/sdk@4.0.62
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
- @thirdweb-dev/auth@4.1.60
|
||||
|
||||
## 0.13.67
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/cli",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.13.67",
|
||||
"version": "0.13.69",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
// ADAPTED FROM https://github.com/merkletreejs/merkletreejs
|
||||
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
// ADAPTED FROM https://github.com/merkletreejs/merkletreejs
|
||||
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 4.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
- @thirdweb-dev/sdk@4.0.63
|
||||
- @thirdweb-dev/wallets@2.5.3
|
||||
- @thirdweb-dev/auth@4.1.61
|
||||
|
||||
## 4.6.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc), [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- @thirdweb-dev/wallets@2.5.2
|
||||
- @thirdweb-dev/sdk@4.0.62
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
- @thirdweb-dev/auth@4.1.60
|
||||
|
||||
## 4.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "4.6.0",
|
||||
"version": "4.6.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,9 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.7.34
|
||||
|
||||
## 0.7.33
|
||||
|
||||
## 0.7.32
|
||||
|
||||
## 0.7.31
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.7.32",
|
||||
"version": "0.7.34",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native-compat",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.7.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
- @thirdweb-dev/sdk@4.0.63
|
||||
- @thirdweb-dev/react-core@4.6.2
|
||||
- @thirdweb-dev/wallets@2.5.3
|
||||
|
||||
## 0.7.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2745](https://github.com/thirdweb-dev/js/pull/2745) [`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Alias embedded wallet to in-app wallet
|
||||
|
||||
- Updated dependencies [[`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc), [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- @thirdweb-dev/wallets@2.5.2
|
||||
- @thirdweb-dev/sdk@4.0.62
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
- @thirdweb-dev/react-core@4.6.1
|
||||
|
||||
## 0.7.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.7.32",
|
||||
"version": "0.7.34",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -16,7 +16,9 @@ export { smartWallet } from "./wallets/wallets/smart-wallet";
|
||||
export { localWallet } from "./wallets/wallets/local-wallet";
|
||||
export { LocalWallet } from "./wallets/wallets/LocalWallet";
|
||||
export { EmbeddedWallet } from "./wallets/wallets/embedded/EmbeddedWallet";
|
||||
export { EmbeddedWallet as InAppWallet } from "./wallets/wallets/embedded/EmbeddedWallet";
|
||||
export { embeddedWallet } from "./wallets/wallets/embedded/embedded-wallet";
|
||||
export { embeddedWallet as inAppWallet } from "./wallets/wallets/embedded/embedded-wallet";
|
||||
export * from "./wallets/wallets/wallet-connect/WalletConnectBase";
|
||||
export { WalletConnect } from "./wallets/wallets/wallet-connect/WalletConnect";
|
||||
export { walletConnect } from "./wallets/wallets/wallet-connect/wallet-connect";
|
||||
@@ -27,6 +29,7 @@ export { useMetaMaskWallet } from "./wallets/hooks/useMetaMaskWallet";
|
||||
export { useRainbowWallet } from "./wallets/hooks/useRainbowWallet";
|
||||
export { useTrustWallet } from "./wallets/hooks/useTrustWallet";
|
||||
export { useEmbeddedWallet } from "./wallets/hooks/useEmbeddedWallet";
|
||||
export { useEmbeddedWallet as useInAppWallet } from "./wallets/hooks/useEmbeddedWallet";
|
||||
export { useSmartWallet } from "./wallets/hooks/useSmartWallet";
|
||||
export { useEmbeddedWalletSendVerificationEmail } from "./wallets/hooks/useEmbeddedWalletSendVerificationEmail";
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,31 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 4.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
- @thirdweb-dev/sdk@4.0.63
|
||||
- @thirdweb-dev/react-core@4.6.2
|
||||
- @thirdweb-dev/wallets@2.5.3
|
||||
|
||||
## 4.6.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2758](https://github.com/thirdweb-dev/js/pull/2758) [`a92311a`](https://github.com/thirdweb-dev/js/commit/a92311a53d587a838b7a19ca86e8c088fcc45aa3) Thanks [@MananTank](https://github.com/MananTank)! - Fix window popup blocked for social login in iOS Safari when using `useEmbeddedWallet` hook
|
||||
|
||||
- [#2745](https://github.com/thirdweb-dev/js/pull/2745) [`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Alias embedded wallet to in-app wallet
|
||||
|
||||
- [#2748](https://github.com/thirdweb-dev/js/pull/2748) [`007770c`](https://github.com/thirdweb-dev/js/commit/007770cd635fba5d38eca5efccc55592c85a106f) Thanks [@MananTank](https://github.com/MananTank)! - Increase max-height for Connect Modal
|
||||
|
||||
- Updated dependencies [[`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc), [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- @thirdweb-dev/wallets@2.5.2
|
||||
- @thirdweb-dev/sdk@4.0.62
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
- @thirdweb-dev/react-core@4.6.1
|
||||
|
||||
## 4.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "4.6.0",
|
||||
"version": "4.6.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from "@thirdweb-dev/wallets";
|
||||
import { useCallback } from "react";
|
||||
import { embeddedWallet } from "../../../wallet/wallets/embeddedWallet/embeddedWallet";
|
||||
import { openOauthSignInWindow } from "../../../wallet/utils/openOauthSignInWindow";
|
||||
|
||||
/**
|
||||
* Hook to connect `EmbeddedWallet` which allows users to login via Email or social logins
|
||||
@@ -130,6 +131,18 @@ export function useEmbeddedWallet() {
|
||||
}
|
||||
const wallet = create(embeddedWallet());
|
||||
try {
|
||||
// open window immediately to fix issue in iOS Safari
|
||||
// if not opened immediately, it adds a bit of delay between user click and opening the window which causes the popup to be blocked
|
||||
if (
|
||||
authParams.strategy === "apple" ||
|
||||
authParams.strategy === "facebook" ||
|
||||
authParams.strategy === "google"
|
||||
) {
|
||||
const win = openOauthSignInWindow(authParams.strategy);
|
||||
if (win) {
|
||||
authParams.openedWindow = win;
|
||||
}
|
||||
}
|
||||
const authResult = await wallet.authenticate(authParams);
|
||||
await wallet.connect({ authResult });
|
||||
setWallet(wallet);
|
||||
|
||||
@@ -61,6 +61,12 @@ export {
|
||||
useEmbeddedWalletUserEmail,
|
||||
} from "./hooks/wallets/useEmbeddedWallet";
|
||||
export { useEmbeddedWalletSendVerificationEmail } from "./hooks/useEmbeddedWalletSendVerificationEmail";
|
||||
export {
|
||||
useEmbeddedWallet as useInAppWallet,
|
||||
useEmbeddedWalletUserEmail as useInAppWalletUserEmail,
|
||||
} from "./hooks/wallets/useEmbeddedWallet";
|
||||
export { useEmbeddedWalletSendVerificationEmail as useInAppWalletSendVerificationEmail } from "./hooks/useEmbeddedWalletSendVerificationEmail";
|
||||
|
||||
|
||||
export {
|
||||
usePaperWalletUserEmail,
|
||||
|
||||
@@ -16,7 +16,9 @@ export {
|
||||
type CoinbaseWalletConfigOptions,
|
||||
} from "./wallet/wallets/coinbase/coinbaseWallet";
|
||||
export { embeddedWallet } from "./wallet/wallets/embeddedWallet/embeddedWallet";
|
||||
export { embeddedWallet as inAppWallet } from "./wallet/wallets/embeddedWallet/embeddedWallet";
|
||||
export type { EmbeddedWalletConfigOptions } from "./wallet/wallets/embeddedWallet/types";
|
||||
export type { EmbeddedWalletConfigOptions as InAppWalletConfigOptions } from "./wallet/wallets/embeddedWallet/types";
|
||||
|
||||
export {
|
||||
frameWallet,
|
||||
|
||||
@@ -11,7 +11,7 @@ export const modalMaxWidthWide = wideModalWidth + "px";
|
||||
export const wideModalScreenThreshold = wideModalWidth + 40;
|
||||
|
||||
export const wideModalMaxHeight = "570px";
|
||||
export const compactModalMaxHeight = "600px";
|
||||
export const compactModalMaxHeight = "650px";
|
||||
|
||||
export const defaultTheme = "dark";
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ function getWidthAndHeight(authOption: EmbeddedWalletOauthStrategy) {
|
||||
|
||||
export function openOauthSignInWindow(
|
||||
authOption: EmbeddedWalletOauthStrategy,
|
||||
themeObj: Theme,
|
||||
themeObj?: Theme,
|
||||
) {
|
||||
// open the popup in the center of the screen
|
||||
const { height, width } = getWidthAndHeight(authOption);
|
||||
@@ -39,8 +39,8 @@ export function openOauthSignInWindow(
|
||||
const title = getBodyTitle(authOption);
|
||||
win.document.title = title;
|
||||
win.document.body.innerHTML = spinnerWindowHtml;
|
||||
win.document.body.style.background = themeObj.colors.modalBg;
|
||||
win.document.body.style.color = themeObj.colors.accentText;
|
||||
win.document.body.style.background = themeObj?.colors.modalBg || "black";
|
||||
win.document.body.style.color = themeObj?.colors.accentText || "white";
|
||||
}
|
||||
|
||||
// close it when current window is closed or refreshed
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,25 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 4.0.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`8197b3c`](https://github.com/thirdweb-dev/js/commit/8197b3ced288597979f27ab88abecadad5dac2cb), [`a18fc8e`](https://github.com/thirdweb-dev/js/commit/a18fc8e1b7d7f351e43367f6a6fd77674998e701), [`65e4ddc`](https://github.com/thirdweb-dev/js/commit/65e4ddc8e02467c170658d29d71dca53737548b7), [`df338f5`](https://github.com/thirdweb-dev/js/commit/df338f5f75545dcf717c39e045e2c7e9f64e5f9d), [`9d46fce`](https://github.com/thirdweb-dev/js/commit/9d46fce50fe7ef5750ddf9fefe8131cf190450db), [`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- thirdweb@5.6.0
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
|
||||
## 4.0.62
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2678](https://github.com/thirdweb-dev/js/pull/2678) [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Custom gas settings for any evm deployments
|
||||
|
||||
- [#2754](https://github.com/thirdweb-dev/js/pull/2754) [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1) Thanks [@jnsdls](https://github.com/jnsdls)! - handle `[[{}]]` values for `properties` / `attributes` fields of NFTs
|
||||
|
||||
- Updated dependencies [[`007770c`](https://github.com/thirdweb-dev/js/commit/007770cd635fba5d38eca5efccc55592c85a106f), [`07f98a5`](https://github.com/thirdweb-dev/js/commit/07f98a5b923166f2e16c9f1759970af2032dbb54), [`e6b5d9c`](https://github.com/thirdweb-dev/js/commit/e6b5d9cc5d1907cbce3aaa895239e0f45b7e880c), [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`39c6fbc`](https://github.com/thirdweb-dev/js/commit/39c6fbc5521a816c7d9a23933cb41ad76a925d14), [`db05717`](https://github.com/thirdweb-dev/js/commit/db0571780304a7b631646b046522fa15352b5467), [`eb919ed`](https://github.com/thirdweb-dev/js/commit/eb919ed49d57589614ac959cb6cbd7c9c19cac07), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- thirdweb@5.5.0
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
|
||||
## 4.0.61
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "4.0.61",
|
||||
"version": "4.0.63",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -9,6 +9,6 @@ const PropertiesInput = /* @__PURE__ */ (() =>
|
||||
*/
|
||||
export const OptionalPropertiesInput = /* @__PURE__ */ (() =>
|
||||
z
|
||||
.union([z.array(PropertiesInput), PropertiesInput])
|
||||
.union([z.array(z.array(PropertiesInput)).transform(i => i.flat()), z.array(PropertiesInput), PropertiesInput])
|
||||
.optional()
|
||||
.nullable())();
|
||||
|
||||
@@ -19,6 +19,26 @@ export const ERROR_SUBSTRINGS_COMPOSITE = [
|
||||
["wrong", "chainid"],
|
||||
];
|
||||
|
||||
export const CUSTOM_GAS_BINS = [
|
||||
1,
|
||||
1 * 10 ** 9,
|
||||
100 * 10 ** 9,
|
||||
500 * 10 ** 9,
|
||||
1000 * 10 ** 9,
|
||||
2500 * 10 ** 9,
|
||||
5000 * 10 ** 9,
|
||||
7500 * 10 ** 9,
|
||||
10_000 * 10 ** 9,
|
||||
25_000 * 10 ** 9,
|
||||
50_000 * 10 ** 9,
|
||||
75_000 * 10 ** 9,
|
||||
100_000 * 10 ** 9,
|
||||
250_000 * 10 ** 9,
|
||||
500_000 * 10 ** 9,
|
||||
750_000 * 10 ** 9,
|
||||
1_000_000 * 10 ** 9,
|
||||
];
|
||||
|
||||
/* eslint-disable no-useless-computed-key */
|
||||
export const CUSTOM_GAS_FOR_CHAIN: Record<number, CustomChain> = {
|
||||
[5001]: {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { BigNumber, Signer } from "ethers";
|
||||
import { Signer } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
import type { DeployOptions } from "../../types/deploy/deploy-options";
|
||||
import { CUSTOM_GAS_FOR_CHAIN } from "../any-evm-constants";
|
||||
import { COMMON_FACTORY } from "./constants";
|
||||
import { isContractDeployed } from "./isContractDeployed";
|
||||
import { isEIP155Enforced } from "./isEIP155Enforced";
|
||||
import { getCreate2FactoryDeploymentInfo } from "./getCreate2FactoryDeploymentInfo";
|
||||
import { computeCreate2FactoryTransaction } from "./getCreate2FactoryAddress";
|
||||
|
||||
/**
|
||||
* Deploy Nick's Create2 factory on a given network.
|
||||
@@ -21,52 +17,19 @@ export async function deployCreate2Factory(
|
||||
options?: DeployOptions,
|
||||
): Promise<string> {
|
||||
invariant(signer.provider, "No provider");
|
||||
const commonFactoryExists = await isContractDeployed(
|
||||
COMMON_FACTORY,
|
||||
signer.provider,
|
||||
);
|
||||
if (commonFactoryExists) {
|
||||
return COMMON_FACTORY;
|
||||
}
|
||||
|
||||
const enforceEip155 = await isEIP155Enforced(signer.provider);
|
||||
const networkId = (await signer.provider.getNetwork()).chainId;
|
||||
const chainId = enforceEip155 ? networkId : 0;
|
||||
console.debug(`ChainId ${networkId} enforces EIP155: ${enforceEip155}`);
|
||||
const deploymentInfo = CUSTOM_GAS_FOR_CHAIN[networkId]
|
||||
? getCreate2FactoryDeploymentInfo(chainId, {
|
||||
gasPrice: CUSTOM_GAS_FOR_CHAIN[networkId].gasPrice,
|
||||
gasLimit: CUSTOM_GAS_FOR_CHAIN[networkId].gasLimit,
|
||||
})
|
||||
: getCreate2FactoryDeploymentInfo(chainId, {});
|
||||
|
||||
const factoryExists = await isContractDeployed(
|
||||
deploymentInfo.deployment,
|
||||
const deploymentInfo = await computeCreate2FactoryTransaction(
|
||||
signer.provider,
|
||||
);
|
||||
|
||||
// deploy community factory if not already deployed
|
||||
if (!factoryExists) {
|
||||
const gasPrice = CUSTOM_GAS_FOR_CHAIN[networkId]?.gasPrice
|
||||
? CUSTOM_GAS_FOR_CHAIN[networkId].gasPrice
|
||||
: 100 * 10 ** 9;
|
||||
const gasLimit = CUSTOM_GAS_FOR_CHAIN[networkId]?.gasLimit
|
||||
? CUSTOM_GAS_FOR_CHAIN[networkId].gasLimit
|
||||
: 100000;
|
||||
|
||||
invariant(gasLimit, "gasLimit undefined for create2 factory deploy");
|
||||
invariant(gasPrice, "gasPrice undefined for create2 factory deploy");
|
||||
|
||||
if (deploymentInfo.transaction.length > 0) {
|
||||
// send balance to the keyless signer
|
||||
const valueToSend = BigNumber.from(gasPrice).mul(gasLimit);
|
||||
|
||||
if (
|
||||
(await signer.provider.getBalance(deploymentInfo.signer)).lt(valueToSend)
|
||||
(await signer.provider.getBalance(deploymentInfo.signer)).lt(deploymentInfo.valueToSend)
|
||||
) {
|
||||
await (
|
||||
await signer.sendTransaction({
|
||||
to: deploymentInfo.signer,
|
||||
value: valueToSend,
|
||||
value: deploymentInfo.valueToSend,
|
||||
})
|
||||
).wait();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { providers } from "ethers";
|
||||
import { CUSTOM_GAS_FOR_CHAIN } from "../any-evm-constants";
|
||||
import { BigNumber, providers } from "ethers";
|
||||
import { CUSTOM_GAS_BINS, CUSTOM_GAS_FOR_CHAIN } from "../any-evm-constants";
|
||||
import { COMMON_FACTORY } from "./constants";
|
||||
import { isContractDeployed } from "./isContractDeployed";
|
||||
import { isEIP155Enforced } from "./isEIP155Enforced";
|
||||
import { getCreate2FactoryDeploymentInfo } from "./getCreate2FactoryDeploymentInfo";
|
||||
import { KeylessDeploymentInfo } from "../../types/any-evm/deploy-data";
|
||||
|
||||
/**
|
||||
* Get the CREATE2 Factory address for a network
|
||||
@@ -16,23 +17,78 @@ import { getCreate2FactoryDeploymentInfo } from "./getCreate2FactoryDeploymentIn
|
||||
export async function getCreate2FactoryAddress(
|
||||
provider: providers.Provider,
|
||||
): Promise<string> {
|
||||
const commonFactoryExists = await isContractDeployed(
|
||||
COMMON_FACTORY,
|
||||
provider,
|
||||
);
|
||||
if (commonFactoryExists) {
|
||||
return COMMON_FACTORY;
|
||||
}
|
||||
|
||||
const enforceEip155 = await isEIP155Enforced(provider);
|
||||
const networkId = (await provider.getNetwork()).chainId;
|
||||
const chainId = enforceEip155 ? networkId : 0;
|
||||
const deploymentInfo = CUSTOM_GAS_FOR_CHAIN[networkId]
|
||||
? getCreate2FactoryDeploymentInfo(chainId, {
|
||||
gasPrice: CUSTOM_GAS_FOR_CHAIN[networkId].gasPrice,
|
||||
gasLimit: CUSTOM_GAS_FOR_CHAIN[networkId].gasLimit,
|
||||
})
|
||||
: getCreate2FactoryDeploymentInfo(chainId, {});
|
||||
|
||||
const deploymentInfo = await computeCreate2FactoryTransaction(provider);
|
||||
return deploymentInfo.deployment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function computeCreate2FactoryTransaction(
|
||||
provider: providers.Provider,
|
||||
): Promise<KeylessDeploymentInfo> {
|
||||
const networkId = (await provider.getNetwork()).chainId;
|
||||
|
||||
// special handling for chains with hardcoded gasPrice and gasLimit
|
||||
if (CUSTOM_GAS_FOR_CHAIN[networkId]) {
|
||||
const enforceEip155 = await isEIP155Enforced(provider);
|
||||
const chainId = enforceEip155 ? networkId : 0;
|
||||
const gasPrice = CUSTOM_GAS_FOR_CHAIN[networkId]?.gasPrice;
|
||||
const gasLimit = CUSTOM_GAS_FOR_CHAIN[networkId]?.gasLimit;
|
||||
|
||||
const deploymentInfo = getCreate2FactoryDeploymentInfo(chainId, {
|
||||
gasPrice: gasPrice ? BigNumber.from(gasPrice) : undefined,
|
||||
gasLimit: gasLimit ? BigNumber.from(gasLimit) : undefined,
|
||||
});
|
||||
|
||||
if (await isContractDeployed(deploymentInfo.deployment, provider)) {
|
||||
deploymentInfo.transaction = "";
|
||||
}
|
||||
|
||||
return deploymentInfo;
|
||||
}
|
||||
|
||||
// default flow
|
||||
const allBinsInfo = [
|
||||
...CUSTOM_GAS_BINS.map((b) =>
|
||||
// to generate EIP-155 transaction
|
||||
getCreate2FactoryDeploymentInfo(networkId, { gasPrice: BigNumber.from(b) }),
|
||||
),
|
||||
// to generate pre-EIP-155 transaction, hence chainId 0
|
||||
...CUSTOM_GAS_BINS.map((b) =>
|
||||
getCreate2FactoryDeploymentInfo(0, { gasPrice: BigNumber.from(b) }),
|
||||
),
|
||||
];
|
||||
|
||||
const allFactories = await Promise.all(
|
||||
allBinsInfo.map((b) => isContractDeployed(b.deployment, provider)),
|
||||
);
|
||||
|
||||
const indexOfCommonFactory = allBinsInfo.findIndex(
|
||||
(b) => b.deployment === COMMON_FACTORY,
|
||||
);
|
||||
if (indexOfCommonFactory && allFactories[indexOfCommonFactory]) {
|
||||
return { ...allBinsInfo[indexOfCommonFactory], transaction: "" };
|
||||
}
|
||||
|
||||
const indexOfExistingDeployment = allFactories.findIndex((b) => b);
|
||||
if (indexOfExistingDeployment && allBinsInfo[indexOfExistingDeployment]) {
|
||||
return { ...allBinsInfo[indexOfExistingDeployment], transaction: "" };
|
||||
}
|
||||
|
||||
const [enforceEip155, gasPriceFetched] = await Promise.all([
|
||||
isEIP155Enforced(provider),
|
||||
provider.getGasPrice(),
|
||||
]);
|
||||
const chainId = enforceEip155 ? networkId : 0;
|
||||
const bin = _getNearestGasPriceBin(gasPriceFetched);
|
||||
|
||||
return getCreate2FactoryDeploymentInfo(chainId, {
|
||||
gasPrice: bin,
|
||||
});
|
||||
}
|
||||
|
||||
function _getNearestGasPriceBin(gasPrice: BigNumber): BigNumber {
|
||||
const bin = CUSTOM_GAS_BINS.find((e) => BigNumber.from(e).gte(gasPrice));
|
||||
return bin ? BigNumber.from(bin) : gasPrice;
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,4 +1,4 @@
|
||||
import { utils } from "ethers";
|
||||
import { BigNumber, utils } from "ethers";
|
||||
import { KeylessDeploymentInfo } from "../../types/any-evm/deploy-data";
|
||||
import { SIGNATURE, CREATE2_FACTORY_BYTECODE } from "./constants";
|
||||
import { getKeylessTxn } from "./getKeylessTxn";
|
||||
@@ -11,13 +11,19 @@ import { getKeylessTxn } from "./getKeylessTxn";
|
||||
*/
|
||||
export function getCreate2FactoryDeploymentInfo(
|
||||
chainId: number,
|
||||
gasOptions: { gasPrice?: number; gasLimit?: number },
|
||||
gasOptions: { gasPrice?: BigNumber; gasLimit?: BigNumber },
|
||||
): KeylessDeploymentInfo {
|
||||
const signature = utils.joinSignature(SIGNATURE);
|
||||
|
||||
// 100000 is default deployment gas limit and 100 gwei is default gas price for create2 factory deployment
|
||||
// (See: https://github.com/Arachnid/deterministic-deployment-proxy?tab=readme-ov-file#deployment-gas-limit)
|
||||
const gasPrice = gasOptions.gasPrice ? gasOptions.gasPrice : 100 * 10 ** 9;
|
||||
const gasLimit = gasOptions.gasLimit ? gasOptions.gasLimit : 100000;
|
||||
|
||||
const deploymentTransaction = getKeylessTxn(
|
||||
{
|
||||
gasPrice: gasOptions.gasPrice ? gasOptions.gasPrice : 100 * 10 ** 9,
|
||||
gasLimit: gasOptions.gasLimit ? gasOptions.gasLimit : 100000,
|
||||
gasPrice,
|
||||
gasLimit,
|
||||
nonce: 0,
|
||||
data: CREATE2_FACTORY_BYTECODE,
|
||||
chainId: chainId,
|
||||
@@ -32,5 +38,6 @@ export function getCreate2FactoryDeploymentInfo(
|
||||
return {
|
||||
...deploymentTransaction,
|
||||
deployment: create2FactoryAddress,
|
||||
valueToSend: BigNumber.from(gasPrice).mul(gasLimit),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BytesLike } from "ethers";
|
||||
import { BigNumber, BytesLike } from "ethers";
|
||||
import { PreDeployMetadataFetched } from "../../schema/contracts/custom";
|
||||
import { AddressOrEns } from "../../schema/shared/AddressOrEnsSchema";
|
||||
|
||||
@@ -24,6 +24,7 @@ export type KeylessDeploymentInfo = {
|
||||
signer: string;
|
||||
transaction: string;
|
||||
deployment: string;
|
||||
valueToSend: BigNumber;
|
||||
};
|
||||
|
||||
export type DeployedContractType =
|
||||
|
||||
@@ -26,9 +26,30 @@ import {
|
||||
englishAuctionsBytecode,
|
||||
englishAuctionsCompilerMetadata,
|
||||
} from "./mock/englishAuctionsMetadata";
|
||||
import { getCreate2FactoryAddress } from "../../src/evm/common/any-evm-utils/getCreate2FactoryAddress";
|
||||
|
||||
const itIf = (condition: boolean) => (condition ? it : it.skip);
|
||||
|
||||
describe("Create2 factory addresses", async () => {
|
||||
it("should compute correct addresses for create2 factory", async () => {
|
||||
// pre eip155
|
||||
sdk.updateSignerOrProvider(1);
|
||||
expect(await getCreate2FactoryAddress(sdk.getProvider())).to.equal("0x4e59b44847b379578588920cA78FbF26c0B4956C");
|
||||
|
||||
// eip155
|
||||
sdk.updateSignerOrProvider(923018);
|
||||
expect(await getCreate2FactoryAddress(sdk.getProvider())).to.equal("0x52329130FCBD4e15B0aC7C4505fBFB530b960AE8");
|
||||
|
||||
// eip155 with hardcoded custom gas
|
||||
sdk.updateSignerOrProvider(47);
|
||||
expect(await getCreate2FactoryAddress(sdk.getProvider())).to.equal("0x4F656d8f2e13D4980149940f4C962EC4f8aF31c5");
|
||||
|
||||
// eip155 with custom gas bin
|
||||
sdk.updateSignerOrProvider(2710);
|
||||
expect(await getCreate2FactoryAddress(sdk.getProvider())).to.equal("0x5Ffe7DeB88759a70B42bc12ABe16f72ce81F0459");
|
||||
})
|
||||
})
|
||||
|
||||
describe("Any EVM Keyless Deploy", async () => {
|
||||
let contract: SmartContract;
|
||||
let adminWallet: SignerWithAddress;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,27 @@
|
||||
# @thirdweb-dev/unity-js-bridge
|
||||
|
||||
## 0.6.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2765](https://github.com/thirdweb-dev/js/pull/2765) [`f0fe1fd`](https://github.com/thirdweb-dev/js/commit/f0fe1fdb1bd55fd7d16fc6380be000011d3682a0) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - Unity 4.11.0, EmbeddedWallet -> InAppWallet + fix 4.10 regression
|
||||
|
||||
- Updated dependencies [[`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
- @thirdweb-dev/sdk@4.0.63
|
||||
- @thirdweb-dev/wallets@2.5.3
|
||||
- @thirdweb-dev/auth@4.1.61
|
||||
|
||||
## 0.6.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc), [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- @thirdweb-dev/wallets@2.5.2
|
||||
- @thirdweb-dev/sdk@4.0.62
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
- @thirdweb-dev/auth@4.1.60
|
||||
|
||||
## 0.6.10
|
||||
|
||||
### Patch Changes
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/unity-js-bridge",
|
||||
"version": "0.6.10",
|
||||
"version": "0.6.12",
|
||||
"main": "dist/thirdweb-unity-bridge.js",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||
"license": "Apache-2.0",
|
||||
+43
-47
@@ -17,13 +17,12 @@ import {
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
type DAppMetaData,
|
||||
type EmbeddedWalletOauthStrategy,
|
||||
InAppWallet,
|
||||
type InAppWalletOauthStrategy,
|
||||
type SmartWalletConfig,
|
||||
walletIds,
|
||||
} from "@thirdweb-dev/wallets";
|
||||
import type { AbstractClientWallet } from "@thirdweb-dev/wallets/evm/wallets/base";
|
||||
import { CoinbaseWallet } from "@thirdweb-dev/wallets/evm/wallets/coinbase-wallet";
|
||||
import { EmbeddedWallet } from "@thirdweb-dev/wallets/evm/wallets/embedded-wallet";
|
||||
import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers";
|
||||
import { InjectedWallet } from "@thirdweb-dev/wallets/evm/wallets/injected";
|
||||
import { LocalWallet } from "@thirdweb-dev/wallets/evm/wallets/local-wallet";
|
||||
@@ -66,18 +65,16 @@ const bigNumberReplacer = (_key: string, value: any) => {
|
||||
return value;
|
||||
};
|
||||
|
||||
const WALLETS = [
|
||||
MetaMaskWallet,
|
||||
InjectedWallet,
|
||||
WalletConnect,
|
||||
CoinbaseWallet,
|
||||
LocalWallet,
|
||||
SmartWallet,
|
||||
EmbeddedWallet,
|
||||
const SUPPORTED_WALLET_IDS = [
|
||||
"injected",
|
||||
"metamask",
|
||||
"walletConnect",
|
||||
"coinbase",
|
||||
"localWallet",
|
||||
"smartWallet",
|
||||
"inAppWallet",
|
||||
] as const;
|
||||
|
||||
type PossibleWallet = (typeof WALLETS)[number]["id"];
|
||||
|
||||
type FundWalletInput = FundWalletOptions & {
|
||||
appId: string;
|
||||
};
|
||||
@@ -85,11 +82,11 @@ type FundWalletInput = FundWalletOptions & {
|
||||
interface TWBridge {
|
||||
initialize: (chain: ChainIdOrName, options: string) => void;
|
||||
connect: (
|
||||
wallet: PossibleWallet,
|
||||
wallet: string,
|
||||
chainId: string,
|
||||
password?: string,
|
||||
email?: string,
|
||||
personalWallet?: PossibleWallet,
|
||||
personalWallet?: string,
|
||||
authOptions?: string,
|
||||
smartWalletAccountOverride?: string,
|
||||
) => Promise<string>;
|
||||
@@ -174,10 +171,11 @@ class ThirdwebBridge implements TWBridge {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: TODO: fix use of any
|
||||
(globalThis as any).X_SDK_PLATFORM = "unity";
|
||||
// biome-ignore lint/suspicious/noExplicitAny: TODO: fix use of any
|
||||
(globalThis as any).X_SDK_VERSION = "unity-4.10.1";
|
||||
(globalThis as any).X_SDK_VERSION = "unity-4.11.0";
|
||||
// biome-ignore lint/suspicious/noExplicitAny: TODO: fix use of any
|
||||
(globalThis as any).X_SDK_OS = browser?.os ?? "unknown";
|
||||
}
|
||||
|
||||
this.initializedChain = chain;
|
||||
const sdkOptions = JSON.parse(options);
|
||||
// biome-ignore lint/suspicious/noExplicitAny: TODO: fix use of any
|
||||
@@ -215,7 +213,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
clientId: sdkOptions.clientId,
|
||||
});
|
||||
this.activeSDK = new ThirdwebSDK(chain, sdkOptions, storage);
|
||||
for (const possibleWallet of WALLETS) {
|
||||
for (const walletId of SUPPORTED_WALLET_IDS) {
|
||||
let walletInstance: AbstractClientWallet;
|
||||
const dappMetadata: DAppMetaData = {
|
||||
name: sdkOptions.wallet?.appName || "thirdweb powered game",
|
||||
@@ -224,7 +222,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
logoUrl: sdkOptions.wallet?.appIcons?.[0] || "",
|
||||
...sdkOptions.wallet?.extras,
|
||||
};
|
||||
switch (possibleWallet.id) {
|
||||
switch (walletId) {
|
||||
case "injected":
|
||||
walletInstance = new InjectedWallet({
|
||||
dappMetadata,
|
||||
@@ -232,14 +230,14 @@ class ThirdwebBridge implements TWBridge {
|
||||
clientId: sdkOptions.clientId,
|
||||
});
|
||||
break;
|
||||
case walletIds.metamask:
|
||||
case "metamask":
|
||||
walletInstance = new MetaMaskWallet({
|
||||
dappMetadata,
|
||||
chains: supportedChains,
|
||||
clientId: sdkOptions.clientId,
|
||||
});
|
||||
break;
|
||||
case walletIds.walletConnect:
|
||||
case "walletConnect":
|
||||
walletInstance = new WalletConnect({
|
||||
projectId: sdkOptions.wallet?.walletConnectProjectId,
|
||||
dappMetadata,
|
||||
@@ -261,21 +259,21 @@ class ThirdwebBridge implements TWBridge {
|
||||
},
|
||||
});
|
||||
break;
|
||||
case walletIds.coinbase:
|
||||
case "coinbase":
|
||||
walletInstance = new CoinbaseWallet({
|
||||
dappMetadata,
|
||||
chains: supportedChains,
|
||||
clientId: sdkOptions.clientId,
|
||||
});
|
||||
break;
|
||||
case walletIds.localWallet:
|
||||
case "localWallet":
|
||||
walletInstance = new LocalWallet({
|
||||
dappMetadata,
|
||||
chains: supportedChains,
|
||||
clientId: sdkOptions.clientId,
|
||||
});
|
||||
break;
|
||||
case walletIds.smartWallet: {
|
||||
case "smartWallet": {
|
||||
const config: SmartWalletConfig = {
|
||||
chain: chain,
|
||||
factoryAddress: sdkOptions.smartWalletConfig?.factoryAddress,
|
||||
@@ -292,8 +290,8 @@ class ThirdwebBridge implements TWBridge {
|
||||
walletInstance = new SmartWallet(config);
|
||||
break;
|
||||
}
|
||||
case walletIds.embeddedWallet:
|
||||
walletInstance = new EmbeddedWallet({
|
||||
case "inAppWallet":
|
||||
walletInstance = new InAppWallet({
|
||||
clientId: sdkOptions.clientId,
|
||||
chain: Ethereum,
|
||||
dappMetadata,
|
||||
@@ -301,7 +299,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown wallet type: ${possibleWallet.id}`);
|
||||
throw new Error(`Unknown wallet type: ${walletId}`);
|
||||
}
|
||||
if (walletInstance) {
|
||||
walletInstance.on("connect", async () =>
|
||||
@@ -312,19 +310,19 @@ class ThirdwebBridge implements TWBridge {
|
||||
);
|
||||
walletInstance.on("disconnect", () => this.updateSDKSigner());
|
||||
|
||||
this.walletMap.set(possibleWallet.id, walletInstance);
|
||||
this.walletMap.set(walletId, walletInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async connect(
|
||||
// biome-ignore lint/style/useDefaultParameterLast: would change the order of parameters to fix this
|
||||
wallet: PossibleWallet = "injected",
|
||||
wallet: string,
|
||||
chainId: string,
|
||||
password?: string,
|
||||
email?: string,
|
||||
phoneNumber?: string,
|
||||
personalWallet: PossibleWallet = "localWallet",
|
||||
personalWallet?: string,
|
||||
authOptions?: string,
|
||||
smartWalletAccountOverride?: string,
|
||||
) {
|
||||
@@ -335,13 +333,13 @@ class ThirdwebBridge implements TWBridge {
|
||||
const chainIdNumber = Number(chainId);
|
||||
if (walletInstance) {
|
||||
// local wallet needs to be generated or loaded before connecting
|
||||
if (walletInstance.walletId === walletIds.localWallet) {
|
||||
if (wallet === "localWallet") {
|
||||
await this.initializeLocalWallet(password as string);
|
||||
walletInstance.connect({ chainId: chainIdNumber });
|
||||
}
|
||||
|
||||
if (walletInstance.walletId === walletIds.embeddedWallet) {
|
||||
const embeddedWallet = walletInstance as EmbeddedWallet;
|
||||
if (wallet === "inAppWallet") {
|
||||
const embeddedWallet = walletInstance as InAppWallet;
|
||||
const authOptionsParsed = JSON.parse(authOptions || "{}");
|
||||
if (authOptionsParsed.authProvider === 0) {
|
||||
// EmailOTP
|
||||
@@ -358,7 +356,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
});
|
||||
} else if (authOptionsParsed.authProvider < 4) {
|
||||
// OAuth
|
||||
let authProvider: EmbeddedWalletOauthStrategy;
|
||||
let authProvider: InAppWalletOauthStrategy;
|
||||
switch (authOptionsParsed.authProvider) {
|
||||
// Google
|
||||
case 1:
|
||||
@@ -437,17 +435,21 @@ class ThirdwebBridge implements TWBridge {
|
||||
`Invalid auth provider: ${authOptionsParsed.authProvider}`,
|
||||
);
|
||||
}
|
||||
} else if (walletInstance.walletId === walletIds.smartWallet) {
|
||||
} else if (wallet === "smartWallet") {
|
||||
if (!personalWallet) {
|
||||
throw new Error("Personal wallet is required for smart wallet");
|
||||
}
|
||||
const smartWallet = walletInstance as SmartWallet;
|
||||
const eoaWallet = this.walletMap.get(personalWallet);
|
||||
// Connect flow for EOA first
|
||||
await this.connect(
|
||||
eoaWallet?.walletId,
|
||||
personalWallet,
|
||||
chainId,
|
||||
password,
|
||||
email,
|
||||
personalWallet,
|
||||
phoneNumber,
|
||||
undefined,
|
||||
authOptions,
|
||||
undefined,
|
||||
);
|
||||
await this.switchNetwork(chainId); // workaround for polygon/mumbai
|
||||
if (this.activeWallet) {
|
||||
@@ -471,7 +473,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
this.updateSDKSigner(await walletInstance.getSigner());
|
||||
return await this.activeSDK.wallet.getAddress();
|
||||
}
|
||||
throw new Error("Invalid Wallet");
|
||||
throw new Error(`This wallet is not supported in WebGL: ${wallet}`);
|
||||
}
|
||||
|
||||
public async disconnect() {
|
||||
@@ -728,9 +730,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
}
|
||||
|
||||
public async exportWallet(password: string): Promise<string> {
|
||||
const localWallet = this.walletMap.get(
|
||||
walletIds.localWallet,
|
||||
) as LocalWallet;
|
||||
const localWallet = this.walletMap.get("localWallet") as LocalWallet;
|
||||
return await localWallet.export({
|
||||
strategy: "encryptedJson",
|
||||
password: password,
|
||||
@@ -754,9 +754,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
}
|
||||
|
||||
public async initializeLocalWallet(password: string): Promise<LocalWallet> {
|
||||
const localWallet = this.walletMap.get(
|
||||
walletIds.localWallet,
|
||||
) as LocalWallet;
|
||||
const localWallet = this.walletMap.get("localWallet") as LocalWallet;
|
||||
try {
|
||||
await localWallet.loadOrCreate({
|
||||
strategy: "encryptedJson",
|
||||
@@ -872,9 +870,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
if (!this.activeWallet) {
|
||||
throw new Error("No wallet connected");
|
||||
}
|
||||
const embeddedWallet = this.walletMap.get(
|
||||
walletIds.embeddedWallet,
|
||||
) as EmbeddedWallet;
|
||||
const embeddedWallet = this.walletMap.get("inAppWallet") as InAppWallet;
|
||||
const email = await embeddedWallet.getEmail();
|
||||
return JSON.stringify({ result: email });
|
||||
}
|
||||
@@ -1,5 +1,23 @@
|
||||
# @thirdweb-dev/wallets
|
||||
|
||||
## 2.5.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6574e4d`](https://github.com/thirdweb-dev/js/commit/6574e4da9938fe7eb862a0ae779b02561967abf1)]:
|
||||
- @thirdweb-dev/chains@0.1.94
|
||||
- @thirdweb-dev/sdk@4.0.63
|
||||
|
||||
## 2.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2745](https://github.com/thirdweb-dev/js/pull/2745) [`cb2a7e9`](https://github.com/thirdweb-dev/js/commit/cb2a7e964a78b9fc8670392f1b033936dae696dc) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Alias embedded wallet to in-app wallet
|
||||
|
||||
- Updated dependencies [[`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c), [`c4d51e0`](https://github.com/thirdweb-dev/js/commit/c4d51e0b80e2d66fb85b8032dcc286f9cd164cd1), [`bf6a8e0`](https://github.com/thirdweb-dev/js/commit/bf6a8e0cab2a02a34d2ca8fbdf9d034ac176b61e)]:
|
||||
- @thirdweb-dev/sdk@4.0.62
|
||||
- @thirdweb-dev/chains@0.1.93
|
||||
|
||||
## 2.5.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/wallets",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.3",
|
||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -29,7 +29,21 @@ export { AbstractClientWallet } from "./wallets/base";
|
||||
export type { WalletOptions } from "./wallets/base";
|
||||
export { type BloctoOptions, BloctoWallet } from "./wallets/blocto";
|
||||
export * from "./wallets/coinbase-wallet";
|
||||
export * from "./wallets/embedded-wallet";
|
||||
export {
|
||||
EmbeddedWallet,
|
||||
EmbeddedWallet as InAppWallet,
|
||||
type AuthParams,
|
||||
type AuthResult,
|
||||
type EmbeddedWalletAdditionalOptions,
|
||||
type EmbeddedWalletAdditionalOptions as InAppWalletWalletAdditionalOptions,
|
||||
type EmbeddedWalletConnectionArgs,
|
||||
type EmbeddedWalletConnectionArgs as InAppWalletConnectionArgs,
|
||||
type EmbeddedWalletOauthStrategy,
|
||||
type EmbeddedWalletOauthStrategy as InAppWalletOauthStrategy,
|
||||
type EmbeddedWalletOptions,
|
||||
type EmbeddedWalletOptions as InAppWalletWalletOptions,
|
||||
supportedSmsCountries
|
||||
} from "./wallets/embedded-wallet";
|
||||
export * from "./wallets/ethers";
|
||||
export * from "./wallets/frame";
|
||||
export * from "./wallets/imtoken";
|
||||
|
||||
Binary file not shown.
+4
-4
@@ -56,19 +56,19 @@
|
||||
"@types/bun": "1.0.12",
|
||||
"@types/react": "18.2.17",
|
||||
"@viem/anvil": "0.0.9",
|
||||
"@vitest/coverage-v8": "1.4.0",
|
||||
"@vitest/coverage-v8": "1.5.0",
|
||||
"dotenv-mono": "1.3.14",
|
||||
"ethers5": "npm:[email protected]",
|
||||
"ethers6": "npm:[email protected]",
|
||||
"knip": "5.9.1",
|
||||
"knip": "5.9.4",
|
||||
"mitata": "0.1.11",
|
||||
"react": "18.2.0",
|
||||
"rimraf": "5.0.5",
|
||||
"sharp": "^0.33.3",
|
||||
"size-limit": "11.1.2",
|
||||
"typedoc-gen": "workspace:*",
|
||||
"typescript": "5.4.4",
|
||||
"vitest": "1.4.0"
|
||||
"typescript": "5.4.5",
|
||||
"vitest": "1.5.0"
|
||||
},
|
||||
"manypkg": {
|
||||
"defaultBranch": "main"
|
||||
|
||||
@@ -1,5 +1,64 @@
|
||||
# thirdweb
|
||||
|
||||
## 5.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#2760](https://github.com/thirdweb-dev/js/pull/2760) [`8197b3c`](https://github.com/thirdweb-dev/js/commit/8197b3ced288597979f27ab88abecadad5dac2cb) Thanks [@gregfromstl](https://github.com/gregfromstl)! - Adds serializeTransaction and updates sign return object to include yParity
|
||||
|
||||
- [#2766](https://github.com/thirdweb-dev/js/pull/2766) [`65e4ddc`](https://github.com/thirdweb-dev/js/commit/65e4ddc8e02467c170658d29d71dca53737548b7) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added ERC721 extensions:
|
||||
|
||||
- claimTo with allowlist support
|
||||
- lazyMint
|
||||
- setClaimConditions
|
||||
|
||||
- [#2771](https://github.com/thirdweb-dev/js/pull/2771) [`df338f5`](https://github.com/thirdweb-dev/js/commit/df338f5f75545dcf717c39e045e2c7e9f64e5f9d) Thanks [@jnsdls](https://github.com/jnsdls)! - Added ERC20 extensions:
|
||||
|
||||
- claimTo with allowlist support
|
||||
- setClaimConditions
|
||||
|
||||
- [#2757](https://github.com/thirdweb-dev/js/pull/2757) [`9d46fce`](https://github.com/thirdweb-dev/js/commit/9d46fce50fe7ef5750ddf9fefe8131cf190450db) Thanks [@jnsdls](https://github.com/jnsdls)! - add extensions for contract roles in the `thirdweb/extensions/permissions` namespace
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2761](https://github.com/thirdweb-dev/js/pull/2761) [`a18fc8e`](https://github.com/thirdweb-dev/js/commit/a18fc8e1b7d7f351e43367f6a6fd77674998e701) Thanks [@MananTank](https://github.com/MananTank)! - Connect UI context code cleanup
|
||||
|
||||
## 5.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#2752](https://github.com/thirdweb-dev/js/pull/2752) [`39c6fbc`](https://github.com/thirdweb-dev/js/commit/39c6fbc5521a816c7d9a23933cb41ad76a925d14) Thanks [@jnsdls](https://github.com/jnsdls)! - add `concatHex` utility function
|
||||
|
||||
- [#2744](https://github.com/thirdweb-dev/js/pull/2744) [`db05717`](https://github.com/thirdweb-dev/js/commit/db0571780304a7b631646b046522fa15352b5467) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added 1155 extensions:
|
||||
|
||||
- `claimTo` with allowlist support
|
||||
- `lazyMint`
|
||||
- `setClaimConditions`
|
||||
|
||||
- [#2749](https://github.com/thirdweb-dev/js/pull/2749) [`eb919ed`](https://github.com/thirdweb-dev/js/commit/eb919ed49d57589614ac959cb6cbd7c9c19cac07) Thanks [@jnsdls](https://github.com/jnsdls)! - - storage: `upload` now returns a single `uri` when a single file is passed to the `files` array.
|
||||
- extensions: added suport for `royalty`, `platformFee` and `primarySale` extensions
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2748](https://github.com/thirdweb-dev/js/pull/2748) [`007770c`](https://github.com/thirdweb-dev/js/commit/007770cd635fba5d38eca5efccc55592c85a106f) Thanks [@MananTank](https://github.com/MananTank)! - - Show ENS name and avatar in ConnectButton's Details Modal
|
||||
|
||||
- Add wallet ID alias `"embedded"` for `"inApp"` to avoid breaking change
|
||||
|
||||
```ts
|
||||
createWallet("embedded"); // supported but deprecated
|
||||
|
||||
createWallet("inApp"); // recommended
|
||||
```
|
||||
|
||||
- [#2759](https://github.com/thirdweb-dev/js/pull/2759) [`07f98a5`](https://github.com/thirdweb-dev/js/commit/07f98a5b923166f2e16c9f1759970af2032dbb54) Thanks [@MananTank](https://github.com/MananTank)! - - Improved Swap UI in ConnectButton Details Modal
|
||||
|
||||
- Prevent Modal from closing when clicking on "Switch Network" in the Swap UI
|
||||
- Fix wrong network name shown in Transaction History
|
||||
|
||||
- [#2756](https://github.com/thirdweb-dev/js/pull/2756) [`e6b5d9c`](https://github.com/thirdweb-dev/js/commit/e6b5d9cc5d1907cbce3aaa895239e0f45b7e880c) Thanks [@jnsdls](https://github.com/jnsdls)! - improve `resolveScheme` reliability and handle cases where `getNFT` for ERC1155 was breaking on missing `totalSupply` method
|
||||
|
||||
- [#2678](https://github.com/thirdweb-dev/js/pull/2678) [`9453f74`](https://github.com/thirdweb-dev/js/commit/9453f74bbfd53372fcfd942bcce6c6bfc8c00a2c) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Custom gas settings for any evm deployments
|
||||
|
||||
## 5.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
|
||||
"extends": ["../../biome.json"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": {
|
||||
"noRestrictedGlobals": {
|
||||
"options": { "deniedGlobals": ["Buffer"] },
|
||||
"level": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"ignore": [
|
||||
"src/crypto/aes/lib/md5.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"version": "5.4.2",
|
||||
"version": "5.6.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
||||
@@ -184,15 +184,15 @@
|
||||
"@radix-ui/react-focus-scope": "1.0.4",
|
||||
"@radix-ui/react-icons": "1.3.0",
|
||||
"@radix-ui/react-tooltip": "1.0.7",
|
||||
"@tanstack/react-query": "5.29.0",
|
||||
"@walletconnect/ethereum-provider": "2.12.1",
|
||||
"@tanstack/react-query": "5.29.2",
|
||||
"@walletconnect/ethereum-provider": "2.12.2",
|
||||
"abitype": "1.0.0",
|
||||
"fast-text-encoding": "^1.0.6",
|
||||
"fuse.js": "7.0.0",
|
||||
"mipd": "0.0.7",
|
||||
"node-libs-browser": "2.2.1",
|
||||
"uqr": "0.1.2",
|
||||
"viem": "2.9.9"
|
||||
"viem": "2.9.16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ethers": "^5 || ^6",
|
||||
@@ -226,7 +226,7 @@
|
||||
"push": "yalc push",
|
||||
"size": "size-limit",
|
||||
"test:watch": "vitest -c ./test/vitest.config.ts dev",
|
||||
"test": "vitest run -c ./test/vitest.config.ts --coverage --bail=1",
|
||||
"test": "vitest run -c ./test/vitest.config.ts",
|
||||
"test:cov": "vitest dev -c ./test/vitest.config.ts --coverage",
|
||||
"test:dev": "vitest run -c ./test/vitest.config.ts",
|
||||
"typedoc": "node scripts/typedoc.mjs",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[
|
||||
"event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI)",
|
||||
"function lazyMint(uint256 amount, string baseURIForTokens, bytes extraData) returns (uint256 batchId)"
|
||||
]
|
||||
@@ -1,6 +1,8 @@
|
||||
[
|
||||
"event ClaimConditionsUpdated((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, uint256 waitTimeInSecondsBetweenClaims, bytes32 merkleRoot, uint256 pricePerToken, address currency)[] claimConditions)",
|
||||
"event ClaimConditionsUpdated((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, bytes32 merkleRoot, uint256 pricePerToken, address currency, string metadata)[] claimConditions, bool resetEligibility)",
|
||||
"event TokensClaimed(uint256 indexed claimConditionIndex, address indexed claimer, address indexed receiver, uint256 quantityClaimed)",
|
||||
"function claim(address receiver, uint256 quantity, address currency, uint256 pricePerToken, (bytes32[] proof, uint256 maxQuantityInAllowlist) allowlistProof, bytes data) payable",
|
||||
"function setClaimConditions((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, uint256 waitTimeInSecondsBetweenClaims, bytes32 merkleRoot, uint256 pricePerToken, address currency)[] phases, bool resetClaimEligibility)"
|
||||
"function claim(address receiver, uint256 quantity, address currency, uint256 pricePerToken, (bytes32[] proof, uint256 quantityLimitPerWallet, uint256 pricePerToken, address currency) allowlistProof, bytes data) payable",
|
||||
"function setClaimConditions((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, uint256 waitTimeInSecondsBetweenClaims, bytes32 merkleRoot, uint256 pricePerToken, address currency)[] phases, bool resetClaimEligibility)",
|
||||
"function getClaimConditionById(uint256 _conditionId) view returns ((uint256 startTimestamp, uint256 maxClaimableSupply, uint256 supplyClaimed, uint256 quantityLimitPerWallet, bytes32 merkleRoot, uint256 pricePerToken, address currency, string metadata) condition)",
|
||||
"function getActiveClaimConditionId() view returns (uint256)"
|
||||
]
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { mkdir, rmdir, readdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { mkdir, readFile, readdir, rmdir, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
type Abi,
|
||||
type AbiFunction,
|
||||
type AbiEvent,
|
||||
type AbiFunction,
|
||||
formatAbiItem,
|
||||
parseAbiItem,
|
||||
} from "abitype";
|
||||
import { prepareMethod } from "../../src/utils/abi/prepare-method";
|
||||
import { format } from "prettier";
|
||||
import { prepareMethod } from "../../src/utils/abi/prepare-method";
|
||||
|
||||
export async function generateFromAbi(
|
||||
abi: Abi | string[],
|
||||
@@ -110,21 +110,26 @@ function generateWriteFunction(f: AbiFunction, extensionName: string): string {
|
||||
needsAbiParamToPrimitiveType
|
||||
? `import type { AbiParameterToPrimitiveType } from "abitype";\n`
|
||||
: ""
|
||||
}import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
||||
}import type { BaseTransactionOptions${
|
||||
f.inputs.length ? ", WithOverrides" : ""
|
||||
} } from "../../../../../transaction/types.js";
|
||||
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
|
||||
${
|
||||
f.inputs.length > 0
|
||||
? `import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";`
|
||||
? `import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
||||
import { once } from "../../../../../utils/promise/once.js";`
|
||||
: ""
|
||||
}
|
||||
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
||||
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
||||
|
||||
|
||||
${
|
||||
f.inputs.length > 0
|
||||
? `/**
|
||||
* Represents the parameters for the "${f.name}" function.
|
||||
*/
|
||||
|
||||
export type ${inputTypeName} = {
|
||||
export type ${inputTypeName} = WithOverrides<{
|
||||
${f.inputs
|
||||
.map(
|
||||
(x) =>
|
||||
@@ -132,7 +137,7 @@ export type ${inputTypeName} = {
|
||||
x.name,
|
||||
)}: AbiParameterToPrimitiveType<${JSON.stringify(x)}>`,
|
||||
)
|
||||
.join("\n")}}
|
||||
.join("\n")}}>
|
||||
|
||||
`
|
||||
: ""
|
||||
@@ -142,6 +147,24 @@ export const FN_SELECTOR = "${preparedMethod[0]}" as const;
|
||||
const FN_INPUTS = ${JSON.stringify(preparedMethod[1], null, 2)} as const;
|
||||
const FN_OUTPUTS = ${JSON.stringify(preparedMethod[2], null, 2)} as const;
|
||||
|
||||
/**
|
||||
* Checks if the \`${f.name}\` method is supported by the given contract.
|
||||
* @param contract The ThirdwebContract.
|
||||
* @returns A promise that resolves to a boolean indicating if the \`${f.name}\` method is supported.
|
||||
* @extension ${extensionName.toUpperCase()}
|
||||
* @example
|
||||
* \`\`\`ts
|
||||
* import { is${uppercaseFirstLetter(
|
||||
f.name,
|
||||
)}Supported } from "thirdweb/extensions/${extensionName}";
|
||||
*
|
||||
* const supported = await is${uppercaseFirstLetter(f.name)}Supported(contract);
|
||||
* \`\`\`
|
||||
*/
|
||||
export async function is${uppercaseFirstLetter(f.name)}Supported(contract: ThirdwebContract<any>) {
|
||||
return detectMethod({contract, method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const});
|
||||
}
|
||||
|
||||
${
|
||||
f.inputs.length > 0
|
||||
? `/**
|
||||
@@ -169,9 +192,31 @@ export function encode${uppercaseFirstLetter(
|
||||
`
|
||||
: ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
${
|
||||
f.inputs.length > 0
|
||||
? `/**
|
||||
* Encodes the "${f.name}" function into a Hex string with its parameters.
|
||||
* @param options - The options for the ${f.name} function.
|
||||
* @returns The encoded hexadecimal string.
|
||||
* @extension ${extensionName.toUpperCase()}
|
||||
* @example
|
||||
* \`\`\`ts
|
||||
* import { encode${uppercaseFirstLetter(
|
||||
f.name,
|
||||
)} } "thirdweb/extensions/${extensionName}";
|
||||
* const result = encode${uppercaseFirstLetter(f.name)}({\n * ${f.inputs
|
||||
.map((x) => ` ${removeLeadingUnderscore(x.name)}: ...,`)
|
||||
.join("\n * ")}\n * });
|
||||
* \`\`\`
|
||||
*/
|
||||
export function encode${uppercaseFirstLetter(f.name)}(options: ${inputTypeName}) {
|
||||
\/\/ we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
||||
\/\/ we can do this because we know the specific formats of the values
|
||||
return FN_SELECTOR + encode${uppercaseFirstLetter(f.name)}Params(options).slice(2) as \`\${typeof FN_SELECTOR}\${string}\`;
|
||||
}
|
||||
`
|
||||
: ""
|
||||
}
|
||||
/**
|
||||
* Calls the "${f.name}" function on the contract.
|
||||
* @param options - The options for the "${f.name}" function.
|
||||
@@ -203,20 +248,28 @@ export function ${f.name}(
|
||||
: ""
|
||||
}
|
||||
) {
|
||||
|
||||
${
|
||||
f.inputs.length
|
||||
? `const asyncOptions = once(async () => {
|
||||
return "asyncParams" in options ? await options.asyncParams() : options;
|
||||
})`
|
||||
: ""
|
||||
};
|
||||
|
||||
return prepareContractCall({
|
||||
contract: options.contract,
|
||||
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
||||
${
|
||||
f.inputs.length
|
||||
? `params: "asyncParams" in options ? async () => {
|
||||
|
||||
const resolvedParams = await options.asyncParams();
|
||||
? `params: async () => {
|
||||
const resolvedOptions = await asyncOptions();
|
||||
return [${f.inputs
|
||||
.map((x) => `resolvedParams.${removeLeadingUnderscore(x.name)}`)
|
||||
.map((x) => `resolvedOptions.${removeLeadingUnderscore(x.name)}`)
|
||||
.join(", ")}] as const;
|
||||
} : [${f.inputs
|
||||
.map((x) => `options.${removeLeadingUnderscore(x.name)}`)
|
||||
.join(", ")}]`
|
||||
},
|
||||
value: async () => (await asyncOptions()).overrides?.value,
|
||||
`
|
||||
: ""
|
||||
}
|
||||
});
|
||||
@@ -244,6 +297,8 @@ ${
|
||||
import type { Hex } from "../../../../../utils/encoding/hex.js";`
|
||||
: ""
|
||||
}
|
||||
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
||||
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
||||
|
||||
${
|
||||
f.inputs.length > 0
|
||||
@@ -267,6 +322,24 @@ export const FN_SELECTOR = "${preparedMethod[0]}" as const;
|
||||
const FN_INPUTS = ${JSON.stringify(preparedMethod[1], null, 2)} as const;
|
||||
const FN_OUTPUTS = ${JSON.stringify(preparedMethod[2], null, 2)} as const;
|
||||
|
||||
/**
|
||||
* Checks if the \`${f.name}\` method is supported by the given contract.
|
||||
* @param contract The ThirdwebContract.
|
||||
* @returns A promise that resolves to a boolean indicating if the \`${f.name}\` method is supported.
|
||||
* @extension ${extensionName.toUpperCase()}
|
||||
* @example
|
||||
* \`\`\`ts
|
||||
* import { is${uppercaseFirstLetter(
|
||||
f.name,
|
||||
)}Supported } from "thirdweb/extensions/${extensionName}";
|
||||
*
|
||||
* const supported = await is${uppercaseFirstLetter(f.name)}Supported(contract);
|
||||
* \`\`\`
|
||||
*/
|
||||
export async function is${uppercaseFirstLetter(f.name)}Supported(contract: ThirdwebContract<any>) {
|
||||
return detectMethod({contract, method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const});
|
||||
}
|
||||
|
||||
${
|
||||
f.inputs.length > 0
|
||||
? `/**
|
||||
@@ -294,7 +367,33 @@ export function encode${uppercaseFirstLetter(
|
||||
`
|
||||
: ""
|
||||
}
|
||||
|
||||
${
|
||||
f.inputs.length > 0
|
||||
? `/**
|
||||
* Encodes the "${f.name}" function into a Hex string with its parameters.
|
||||
* @param options - The options for the ${f.name} function.
|
||||
* @returns The encoded hexadecimal string.
|
||||
* @extension ${extensionName.toUpperCase()}
|
||||
* @example
|
||||
* \`\`\`ts
|
||||
* import { encode${uppercaseFirstLetter(
|
||||
f.name,
|
||||
)} } "thirdweb/extensions/${extensionName}";
|
||||
* const result = encode${uppercaseFirstLetter(f.name)}({\n * ${f.inputs
|
||||
.map((x) => ` ${removeLeadingUnderscore(x.name)}: ...,`)
|
||||
.join("\n * ")}\n * });
|
||||
* \`\`\`
|
||||
*/
|
||||
export function encode${uppercaseFirstLetter(
|
||||
f.name,
|
||||
)}(options: ${uppercaseFirstLetter(f.name)}Params) {
|
||||
\/\/ we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
||||
\/\/ we can do this because we know the specific formats of the values
|
||||
return FN_SELECTOR + encode${uppercaseFirstLetter(f.name)}Params(options).slice(2) as \`\${typeof FN_SELECTOR}\${string}\`;
|
||||
}
|
||||
`
|
||||
: ""
|
||||
}
|
||||
${
|
||||
f.outputs.length > 0
|
||||
? `/**
|
||||
|
||||
@@ -100,6 +100,10 @@ const customWalletInfos = [
|
||||
id: "inApp",
|
||||
name: "In-App Wallet",
|
||||
},
|
||||
{
|
||||
id: "embedded",
|
||||
name: "In-App Wallet",
|
||||
},
|
||||
{
|
||||
id: "walletConnect",
|
||||
name: "WalletConnect",
|
||||
@@ -243,7 +247,7 @@ const walletImports = allSupportedWallets
|
||||
)
|
||||
.join("\n");
|
||||
|
||||
const customWalletImports = ["smart", "inApp", "walletConnect"]
|
||||
const customWalletImports = ["smart", "inApp", "walletConnect", "embedded"]
|
||||
.map(
|
||||
(walletId) =>
|
||||
`case "${walletId}": {
|
||||
|
||||
@@ -3,8 +3,9 @@ import type {
|
||||
AbiParameter,
|
||||
AbiParametersToPrimitiveTypes,
|
||||
} from "abitype";
|
||||
import { concatHex, toFunctionSelector } from "viem";
|
||||
import { toFunctionSelector } from "viem";
|
||||
import { encodeAbiParameters } from "../utils/abi/encodeAbiParameters.js";
|
||||
import { concatHex } from "../utils/encoding/helpers/concat-hex.js";
|
||||
|
||||
/**
|
||||
* Encodes an ABI function with its arguments into a hexadecimal string.
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { zeroAddress } from "viem";
|
||||
import { beforeAll, describe, expect, test } from "vitest";
|
||||
import { ANVIL_PKEY_A } from "~test/test-wallets.js";
|
||||
import { typedData } from "~test/typed-data.js";
|
||||
import { ANVIL_CHAIN, FORKED_ETHEREUM_CHAIN } from "../../test/src/chains.js";
|
||||
import { TEST_CLIENT } from "../../test/src/test-clients.js";
|
||||
import { privateKeyAccount } from "../wallets/private-key.js";
|
||||
import { viemAdapter } from "./viem.js";
|
||||
|
||||
import { ANVIL_PKEY_A } from "~test/test-wallets.js";
|
||||
import { typedData } from "~test/typed-data.js";
|
||||
import { ANVIL_CHAIN } from "../../test/src/chains.js";
|
||||
import { mainnet } from "../chains/chain-definitions/ethereum.js";
|
||||
|
||||
const account = privateKeyAccount({
|
||||
privateKey: ANVIL_PKEY_A,
|
||||
client: TEST_CLIENT,
|
||||
@@ -68,7 +66,7 @@ describe("walletClient.toViem", () => {
|
||||
walletClient = viemAdapter.walletClient.toViem({
|
||||
client: TEST_CLIENT,
|
||||
account,
|
||||
chain: mainnet,
|
||||
chain: FORKED_ETHEREUM_CHAIN,
|
||||
});
|
||||
|
||||
const address = await walletClient.getAddresses();
|
||||
|
||||
@@ -3,10 +3,10 @@ import type {
|
||||
AbiParameter,
|
||||
AbiParametersToPrimitiveTypes,
|
||||
} from "abitype";
|
||||
import { concatHex } from "viem";
|
||||
import { prepareTransaction } from "../../transaction/prepare-transaction.js";
|
||||
import { encodeAbiParameters } from "../../utils/abi/encodeAbiParameters.js";
|
||||
import { ensureBytecodePrefix } from "../../utils/bytecode/prefix.js";
|
||||
import { concatHex } from "../../utils/encoding/helpers/concat-hex.js";
|
||||
import { type Hex, isHex } from "../../utils/encoding/hex.js";
|
||||
import type { Prettify } from "../../utils/type-utils.js";
|
||||
import type { ClientAndChain } from "../../utils/types.js";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { getContractAddress } from "viem";
|
||||
import { getGasPrice } from "../../../gas/get-gas-price.js";
|
||||
import { eth_getBalance } from "../../../rpc/actions/eth_getBalance.js";
|
||||
import { eth_sendRawTransaction } from "../../../rpc/actions/eth_sendRawTransaction.js";
|
||||
import { getRpcClient } from "../../../rpc/rpc.js";
|
||||
@@ -39,27 +40,73 @@ const SIGNATURE = {
|
||||
export async function computeCreate2FactoryAddress(
|
||||
options: ClientAndChain,
|
||||
): Promise<string> {
|
||||
// TODO add LRU cache
|
||||
const commonFactory = getContract({
|
||||
...options,
|
||||
address: COMMON_FACTORY_ADDRESS,
|
||||
});
|
||||
// if the common factory is deployed, return the address
|
||||
if (await isContractDeployed(commonFactory)) {
|
||||
const chainId = options.chain.id;
|
||||
|
||||
// special handling for chains with hardcoded gasPrice and gasLimit
|
||||
if (CUSTOM_GAS_FOR_CHAIN[chainId]) {
|
||||
const enforceEip155 = await isEIP155Enforced(options);
|
||||
const eipChain = enforceEip155 ? chainId : 0;
|
||||
const gasPrice = CUSTOM_GAS_FOR_CHAIN[chainId.toString()]?.gasPrice;
|
||||
const gasLimit = CUSTOM_GAS_FOR_CHAIN[chainId.toString()]?.gasLimit;
|
||||
|
||||
const deploymentInfo = await _getCreate2FactoryDeploymentInfo(eipChain, {
|
||||
gasPrice,
|
||||
gasLimit,
|
||||
});
|
||||
|
||||
return deploymentInfo.predictedAddress;
|
||||
}
|
||||
|
||||
// default flow
|
||||
const allBinsInfo = await Promise.all([
|
||||
// to generate EIP-155 transaction
|
||||
...CUSTOM_GAS_BINS.map((b) => {
|
||||
return _getCreate2FactoryDeploymentInfo(chainId, { gasPrice: b });
|
||||
}),
|
||||
|
||||
// to generate pre EIP-155 transaction, hence chainId 0
|
||||
...CUSTOM_GAS_BINS.map((b) => {
|
||||
return _getCreate2FactoryDeploymentInfo(0, { gasPrice: b });
|
||||
}),
|
||||
]);
|
||||
|
||||
const allFactories = await Promise.all(
|
||||
allBinsInfo.map((b) => {
|
||||
const tempFactory = getContract({
|
||||
...options,
|
||||
address: b.predictedAddress,
|
||||
});
|
||||
return isContractDeployed(tempFactory);
|
||||
}),
|
||||
);
|
||||
|
||||
const indexOfCommonFactory = allBinsInfo.findIndex(
|
||||
(b) => b.predictedAddress === COMMON_FACTORY_ADDRESS,
|
||||
);
|
||||
if (indexOfCommonFactory && allFactories[indexOfCommonFactory]) {
|
||||
return COMMON_FACTORY_ADDRESS;
|
||||
}
|
||||
|
||||
const enforceEip155 = await isEIP155Enforced(options);
|
||||
const chainId = options.chain.id;
|
||||
const custom = CUSTOM_GAS_FOR_CHAIN[chainId.toString()];
|
||||
const eipChain = enforceEip155 ? chainId : 0;
|
||||
const indexOfExistingDeployment = allFactories.findIndex((b) => b);
|
||||
if (
|
||||
indexOfExistingDeployment &&
|
||||
allBinsInfo &&
|
||||
allBinsInfo[indexOfExistingDeployment]?.predictedAddress
|
||||
) {
|
||||
// TODO: cleanup
|
||||
return allBinsInfo[indexOfExistingDeployment]?.predictedAddress as string;
|
||||
}
|
||||
|
||||
const deploymentInfo = custom
|
||||
? await _getCreate2FactoryDeploymentInfo(eipChain, {
|
||||
gasPrice: custom.gasPrice,
|
||||
gasLimit: custom.gasLimit,
|
||||
})
|
||||
: await _getCreate2FactoryDeploymentInfo(eipChain, {});
|
||||
const [enforceEip155, gasPriceFetched] = await Promise.all([
|
||||
isEIP155Enforced(options),
|
||||
getGasPrice(options),
|
||||
]);
|
||||
const eipChain = enforceEip155 ? chainId : 0;
|
||||
const bin = _getNearestGasPriceBin(gasPriceFetched);
|
||||
|
||||
const deploymentInfo = await _getCreate2FactoryDeploymentInfo(eipChain, {
|
||||
gasPrice: bin,
|
||||
});
|
||||
|
||||
return deploymentInfo.predictedAddress;
|
||||
}
|
||||
@@ -88,20 +135,19 @@ export async function deployCreate2Factory(options: ClientAndChainAndAccount) {
|
||||
const { client, chain, account } = options;
|
||||
const enforceEip155 = await isEIP155Enforced(options);
|
||||
const chainId = options.chain.id;
|
||||
const custom = CUSTOM_GAS_FOR_CHAIN[chainId.toString()];
|
||||
const eipChain = enforceEip155 ? chainId : 0;
|
||||
|
||||
const deploymentInfo = custom
|
||||
? await _getCreate2FactoryDeploymentInfo(eipChain, {
|
||||
gasPrice: custom.gasPrice,
|
||||
gasLimit: custom.gasLimit,
|
||||
})
|
||||
: await _getCreate2FactoryDeploymentInfo(eipChain, {});
|
||||
const rpcRequest = getRpcClient({
|
||||
client: client,
|
||||
chain,
|
||||
});
|
||||
|
||||
const gasPriceFetched = await getGasPrice(options);
|
||||
const bin = _getNearestGasPriceBin(gasPriceFetched);
|
||||
const deploymentInfo = await _getCreate2FactoryDeploymentInfo(eipChain, {
|
||||
gasPrice: bin,
|
||||
});
|
||||
|
||||
const balance = await eth_getBalance(rpcRequest, {
|
||||
address: deploymentInfo.signerAddress,
|
||||
});
|
||||
@@ -135,6 +181,8 @@ async function _getCreate2FactoryDeploymentInfo(
|
||||
chainId: number,
|
||||
gasOptions: { gasPrice?: bigint; gasLimit?: bigint },
|
||||
) {
|
||||
// 100000 is default deployment gas limit and 100 gwei is default gas price for create2 factory deployment
|
||||
// (See: https://github.com/Arachnid/deterministic-deployment-proxy?tab=readme-ov-file#deployment-gas-limit)
|
||||
const gasPrice = gasOptions.gasPrice ? gasOptions.gasPrice : 100n * 10n ** 9n;
|
||||
const gas = gasOptions.gasLimit ? gasOptions.gasLimit : 100000n;
|
||||
const deploymentTransaction = await getKeylessTransaction({
|
||||
@@ -143,7 +191,7 @@ async function _getCreate2FactoryDeploymentInfo(
|
||||
gas,
|
||||
nonce: 0,
|
||||
data: CREATE2_FACTORY_BYTECODE,
|
||||
chainId: Number(chainId),
|
||||
chainId: chainId !== 0 ? Number(chainId) : undefined,
|
||||
},
|
||||
signature: SIGNATURE,
|
||||
});
|
||||
@@ -159,6 +207,10 @@ async function _getCreate2FactoryDeploymentInfo(
|
||||
};
|
||||
}
|
||||
|
||||
function _getNearestGasPriceBin(gasPrice: bigint): bigint {
|
||||
return CUSTOM_GAS_BINS.find((e) => e >= gasPrice) || gasPrice;
|
||||
}
|
||||
|
||||
// TODO: move this somewhere else
|
||||
type CustomChain = {
|
||||
name: string;
|
||||
@@ -214,3 +266,23 @@ const CUSTOM_GAS_FOR_CHAIN: Record<string, CustomChain> = {
|
||||
gasLimit: 200000n,
|
||||
},
|
||||
};
|
||||
|
||||
const CUSTOM_GAS_BINS = [
|
||||
1n,
|
||||
1n * 10n ** 9n,
|
||||
100n * 10n ** 9n,
|
||||
500n * 10n ** 9n,
|
||||
1000n * 10n ** 9n,
|
||||
2500n * 10n ** 9n,
|
||||
5000n * 10n ** 9n,
|
||||
7500n * 10n ** 9n,
|
||||
10_000n * 10n ** 9n,
|
||||
25_000n * 10n ** 9n,
|
||||
50_000n * 10n ** 9n,
|
||||
75_000n * 10n ** 9n,
|
||||
100_000n * 10n ** 9n,
|
||||
250_000n * 10n ** 9n,
|
||||
500_000n * 10n ** 9n,
|
||||
750_000n * 10n ** 9n,
|
||||
1_000_000n * 10n ** 9n,
|
||||
];
|
||||
|
||||
@@ -16,9 +16,53 @@ export {
|
||||
type SetOwnerParams,
|
||||
} from "../../extensions/common/__generated__/IOwnable/write/setOwner.js";
|
||||
|
||||
export {
|
||||
setContractMetadata,
|
||||
type SetContractMetadataParams,
|
||||
} from "../../extensions/common/write/setContractMetadata.js";
|
||||
|
||||
// events
|
||||
|
||||
export {
|
||||
ownerUpdatedEvent,
|
||||
type OwnerUpdatedEventFilters,
|
||||
} from "../../extensions/common/__generated__/IOwnable/events/OwnerUpdated.js";
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Royalty
|
||||
// --------------------------------------------------------
|
||||
// read
|
||||
export { getDefaultRoyaltyInfo } from "../../extensions/common/__generated__/IRoyalty/read/getDefaultRoyaltyInfo.js";
|
||||
export {
|
||||
getRoyaltyInfoForToken,
|
||||
type GetRoyaltyInfoForTokenParams,
|
||||
} from "../../extensions/common/__generated__/IRoyalty/read/getRoyaltyInfoForToken.js";
|
||||
|
||||
// write
|
||||
export {
|
||||
setDefaultRoyaltyInfo,
|
||||
type SetDefaultRoyaltyInfoParams,
|
||||
} from "../../extensions/common/__generated__/IRoyalty/write/setDefaultRoyaltyInfo.js";
|
||||
export {
|
||||
setRoyaltyInfoForToken,
|
||||
type SetRoyaltyInfoForTokenParams,
|
||||
} from "../../extensions/common/__generated__/IRoyalty/write/setRoyaltyInfoForToken.js";
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Platform Fees
|
||||
// --------------------------------------------------------
|
||||
|
||||
export { getPlatformFeeInfo } from "../../extensions/common/__generated__/IPlatformFee/read/getPlatformFeeInfo.js";
|
||||
export {
|
||||
setPlatformFeeInfo,
|
||||
type SetPlatformFeeInfoParams,
|
||||
} from "../../extensions/common/__generated__/IPlatformFee/write/setPlatformFeeInfo.js";
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Primary Sale
|
||||
// --------------------------------------------------------
|
||||
export { primarySaleRecipient } from "../../extensions/common/__generated__/IPrimarySale/read/primarySaleRecipient.js";
|
||||
export {
|
||||
setPrimarySaleRecipient,
|
||||
type SetPrimarySaleRecipientParams,
|
||||
} from "../../extensions/common/__generated__/IPrimarySale/write/setPrimarySaleRecipient.js";
|
||||
|
||||
@@ -92,3 +92,17 @@ export {
|
||||
claimTo,
|
||||
type ClaimToParams,
|
||||
} from "../../extensions/erc1155/drops/write/claimTo.js";
|
||||
|
||||
export {
|
||||
lazyMint,
|
||||
type LazyMintParams,
|
||||
} from "../../extensions/erc1155/write/lazyMint.js";
|
||||
|
||||
export {
|
||||
setClaimConditions,
|
||||
type SetClaimConditionsParams,
|
||||
} from "../../extensions/erc1155/drops/write/setClaimConditions.js";
|
||||
|
||||
// EVENTS
|
||||
export { tokensLazyMintedEvent } from "../../extensions/erc1155/__generated__/ILazyMint/events/TokensLazyMinted.js";
|
||||
export { tokensClaimedEvent } from "../../extensions/erc1155/__generated__/IDrop1155/events/TokensClaimed.js";
|
||||
|
||||
@@ -44,3 +44,36 @@ export {
|
||||
burnFrom,
|
||||
type BurnFromParams,
|
||||
} from "../../extensions/erc20/__generated__/IBurnableERC20/write/burnFrom.js";
|
||||
|
||||
// EVENTS
|
||||
export {
|
||||
transferEvent,
|
||||
type TransferEventFilters,
|
||||
} from "../../extensions/erc20/__generated__/IERC20/events/Transfer.js";
|
||||
export {
|
||||
approvalEvent,
|
||||
type ApprovalEventFilters,
|
||||
} from "../../extensions/erc20/__generated__/IERC20/events/Approval.js";
|
||||
export {
|
||||
tokensMintedEvent,
|
||||
type TokensMintedEventFilters,
|
||||
} from "../../extensions/erc20/__generated__/IMintableERC20/events/TokensMinted.js";
|
||||
export {
|
||||
tokensClaimedEvent,
|
||||
type TokensClaimedEventFilters,
|
||||
} from "../../extensions/erc20/__generated__/IDropERC20/events/TokensClaimed.js";
|
||||
export { claimConditionsUpdatedEvent } from "../../extensions/erc20/__generated__/IDropERC20/events/ClaimConditionsUpdated.js";
|
||||
|
||||
/**
|
||||
* DROPS extension for ERC20
|
||||
*/
|
||||
export { getClaimConditionById } from "../../extensions/erc20/__generated__/IDropERC20/read/getClaimConditionById.js";
|
||||
export { getActiveClaimCondition } from "../../extensions/erc20/drops/read/getActiveClaimCondition.js";
|
||||
export {
|
||||
claimTo,
|
||||
type ClaimToParams,
|
||||
} from "../../extensions/erc20/drops/write/claimTo.js";
|
||||
export {
|
||||
setClaimConditions,
|
||||
type SetClaimConditionsParams,
|
||||
} from "../../extensions/erc20/drops/write/setClaimConditions.js";
|
||||
|
||||
@@ -78,10 +78,7 @@ export {
|
||||
setTokenURI,
|
||||
type SetTokenURIParams,
|
||||
} from "../../extensions/erc721/__generated__/INFTMetadata/write/setTokenURI.js";
|
||||
export {
|
||||
lazyMint,
|
||||
type LazyMintParams,
|
||||
} from "../../extensions/erc721/write/lazyMint.js";
|
||||
|
||||
/**
|
||||
* EVENTS extension for ERC721
|
||||
*/
|
||||
@@ -103,6 +100,14 @@ export {
|
||||
claimTo,
|
||||
type ClaimToParams,
|
||||
} from "../../extensions/erc721/drops/write/claimTo.js";
|
||||
export {
|
||||
lazyMint,
|
||||
type LazyMintParams,
|
||||
} from "../../extensions/erc721/write/lazyMint.js";
|
||||
export {
|
||||
setClaimConditions,
|
||||
type SetClaimConditionsParams,
|
||||
} from "../../extensions/erc721/drops/write/setClaimConditions.js";
|
||||
|
||||
/**
|
||||
* SIGNATURE extension for ERC721
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//--------------------------------------------------
|
||||
// Permissions
|
||||
// --------------------------------------------------------
|
||||
|
||||
// READ
|
||||
export {
|
||||
hasRole,
|
||||
type HasRoleParams,
|
||||
} from "../../extensions/permissions/read/hasRole.js";
|
||||
export {
|
||||
getRoleAdmin,
|
||||
type GetRoleAdminParams,
|
||||
} from "../../extensions/permissions/read/getRoleAdmin.js";
|
||||
|
||||
// WRITE
|
||||
export {
|
||||
grantRole,
|
||||
type GrantRoleParams,
|
||||
} from "../../extensions/permissions/write/grant.js";
|
||||
export {
|
||||
revokeRole,
|
||||
type RevokeRoleParams,
|
||||
} from "../../extensions/permissions/write/revokeRole.js";
|
||||
export {
|
||||
renounceRole,
|
||||
type RenounceRoleParams,
|
||||
} from "../../extensions/permissions/write/renounceRole.js";
|
||||
|
||||
// EVENTS
|
||||
export {
|
||||
roleGrantedEvent,
|
||||
type RoleGrantedEventFilters,
|
||||
} from "../../extensions/permissions/__generated__/IPermissions/events/RoleGranted.js";
|
||||
export {
|
||||
roleRevokedEvent,
|
||||
type RoleRevokedEventFilters,
|
||||
} from "../../extensions/permissions/__generated__/IPermissions/events/RoleRevoked.js";
|
||||
export {
|
||||
roleAdminChangedEvent,
|
||||
type RoleAdminChangedEventFilters,
|
||||
} from "../../extensions/permissions/__generated__/IPermissions/events/RoleAdminChanged.js";
|
||||
|
||||
// --------------------------------------------------------
|
||||
// PermissionsEnumerable
|
||||
// --------------------------------------------------------
|
||||
|
||||
// READ
|
||||
export {
|
||||
getRoleMember,
|
||||
type GetRoleMemberParams,
|
||||
} from "../../extensions/permissions/read/getRoleMember.js";
|
||||
export {
|
||||
getRoleMemberCount,
|
||||
type GetRoleMemberCountParams,
|
||||
} from "../../extensions/permissions/read/getRoleMemberCount.js";
|
||||
export {
|
||||
getAllRoleMembers,
|
||||
type GetAllRoleMembersParams,
|
||||
} from "../../extensions/permissions/read/getAllMembers.js";
|
||||
@@ -19,6 +19,7 @@ export type {
|
||||
} from "../react/web/ui/ConnectWallet/ConnectWalletProps.js";
|
||||
export type { NetworkSelectorProps } from "../react/web/ui/ConnectWallet/NetworkSelector.js";
|
||||
export type { WelcomeScreen } from "../react/web/ui/ConnectWallet/screens/types.js";
|
||||
export type { LocaleId } from "../react/web/ui/types.js";
|
||||
|
||||
export {
|
||||
TransactionButton,
|
||||
|
||||
@@ -113,6 +113,7 @@ export {
|
||||
} from "../transaction/actions/simulate.js";
|
||||
export { waitForReceipt } from "../transaction/actions/wait-for-tx-receipt.js";
|
||||
export { signTransaction } from "../transaction/actions/sign-transaction.js";
|
||||
export { serializeTransaction } from "../transaction/serialize-transaction.js";
|
||||
|
||||
/**
|
||||
* EVENTS
|
||||
@@ -206,6 +207,7 @@ export {
|
||||
type ToHexParameters,
|
||||
type Uint8ArrayToHexOpts,
|
||||
} from "../utils/encoding/hex.js";
|
||||
export { concatHex } from "../utils/encoding/helpers/concat-hex.js";
|
||||
|
||||
// bytes
|
||||
// to
|
||||
|
||||
@@ -47,6 +47,10 @@ export {
|
||||
signTransaction,
|
||||
type SignTransactionOptions,
|
||||
} from "../transaction/actions/sign-transaction.js";
|
||||
export {
|
||||
serializeTransaction,
|
||||
type SerializeTransactionOptions,
|
||||
} from "../transaction/serialize-transaction.js";
|
||||
|
||||
//types & utils
|
||||
export {
|
||||
|
||||
@@ -74,6 +74,7 @@ export {
|
||||
type ToHexParameters,
|
||||
type Uint8ArrayToHexOpts,
|
||||
} from "../utils/encoding/hex.js";
|
||||
export { concatHex } from "../utils/encoding/helpers/concat-hex.js";
|
||||
|
||||
// bytes
|
||||
// to
|
||||
|
||||
+65
-14
@@ -1,13 +1,18 @@
|
||||
import type { AbiParameterToPrimitiveType } from "abitype";
|
||||
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
||||
import type {
|
||||
BaseTransactionOptions,
|
||||
WithOverrides,
|
||||
} from "../../../../../transaction/types.js";
|
||||
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
|
||||
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
||||
import { once } from "../../../../../utils/promise/once.js";
|
||||
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
||||
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
||||
|
||||
/**
|
||||
* Represents the parameters for the "setClaimConditions" function.
|
||||
*/
|
||||
|
||||
export type SetClaimConditionsParams = {
|
||||
export type SetClaimConditionsParams = WithOverrides<{
|
||||
phase: AbiParameterToPrimitiveType<{
|
||||
type: "tuple";
|
||||
name: "phase";
|
||||
@@ -26,7 +31,7 @@ export type SetClaimConditionsParams = {
|
||||
type: "bool";
|
||||
name: "resetClaimEligibility";
|
||||
}>;
|
||||
};
|
||||
}>;
|
||||
|
||||
export const FN_SELECTOR = "0x426cfaf3" as const;
|
||||
const FN_INPUTS = [
|
||||
@@ -75,6 +80,27 @@ const FN_INPUTS = [
|
||||
] as const;
|
||||
const FN_OUTPUTS = [] as const;
|
||||
|
||||
/**
|
||||
* Checks if the `setClaimConditions` method is supported by the given contract.
|
||||
* @param contract The ThirdwebContract.
|
||||
* @returns A promise that resolves to a boolean indicating if the `setClaimConditions` method is supported.
|
||||
* @extension COMMON
|
||||
* @example
|
||||
* ```ts
|
||||
* import { isSetClaimConditionsSupported } from "thirdweb/extensions/common";
|
||||
*
|
||||
* const supported = await isSetClaimConditionsSupported(contract);
|
||||
* ```
|
||||
*/
|
||||
export async function isSetClaimConditionsSupported(
|
||||
contract: ThirdwebContract<any>,
|
||||
) {
|
||||
return detectMethod({
|
||||
contract,
|
||||
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the parameters for the "setClaimConditions" function.
|
||||
* @param options - The options for the setClaimConditions function.
|
||||
@@ -98,6 +124,29 @@ export function encodeSetClaimConditionsParams(
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the "setClaimConditions" function into a Hex string with its parameters.
|
||||
* @param options - The options for the setClaimConditions function.
|
||||
* @returns The encoded hexadecimal string.
|
||||
* @extension COMMON
|
||||
* @example
|
||||
* ```ts
|
||||
* import { encodeSetClaimConditions } "thirdweb/extensions/common";
|
||||
* const result = encodeSetClaimConditions({
|
||||
* phase: ...,
|
||||
* resetClaimEligibility: ...,
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function encodeSetClaimConditions(options: SetClaimConditionsParams) {
|
||||
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
||||
// we can do this because we know the specific formats of the values
|
||||
return (FN_SELECTOR +
|
||||
encodeSetClaimConditionsParams(options).slice(
|
||||
2,
|
||||
)) as `${typeof FN_SELECTOR}${string}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the "setClaimConditions" function on the contract.
|
||||
* @param options - The options for the "setClaimConditions" function.
|
||||
@@ -126,18 +175,20 @@ export function setClaimConditions(
|
||||
}
|
||||
>,
|
||||
) {
|
||||
const asyncOptions = once(async () => {
|
||||
return "asyncParams" in options ? await options.asyncParams() : options;
|
||||
});
|
||||
|
||||
return prepareContractCall({
|
||||
contract: options.contract,
|
||||
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
||||
params:
|
||||
"asyncParams" in options
|
||||
? async () => {
|
||||
const resolvedParams = await options.asyncParams();
|
||||
return [
|
||||
resolvedParams.phase,
|
||||
resolvedParams.resetClaimEligibility,
|
||||
] as const;
|
||||
}
|
||||
: [options.phase, options.resetClaimEligibility],
|
||||
params: async () => {
|
||||
const resolvedOptions = await asyncOptions();
|
||||
return [
|
||||
resolvedOptions.phase,
|
||||
resolvedOptions.resetClaimEligibility,
|
||||
] as const;
|
||||
},
|
||||
value: async () => (await asyncOptions()).overrides?.value,
|
||||
});
|
||||
}
|
||||
|
||||
Generated
+21
@@ -3,6 +3,8 @@ import type { BaseTransactionOptions } from "../../../../../transaction/types.js
|
||||
|
||||
import { decodeAbiParameters } from "viem";
|
||||
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
||||
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
||||
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
||||
|
||||
export const FN_SELECTOR = "0xe8a3d485" as const;
|
||||
const FN_INPUTS = [] as const;
|
||||
@@ -12,6 +14,25 @@ const FN_OUTPUTS = [
|
||||
},
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Checks if the `contractURI` method is supported by the given contract.
|
||||
* @param contract The ThirdwebContract.
|
||||
* @returns A promise that resolves to a boolean indicating if the `contractURI` method is supported.
|
||||
* @extension COMMON
|
||||
* @example
|
||||
* ```ts
|
||||
* import { isContractURISupported } from "thirdweb/extensions/common";
|
||||
*
|
||||
* const supported = await isContractURISupported(contract);
|
||||
* ```
|
||||
*/
|
||||
export async function isContractURISupported(contract: ThirdwebContract<any>) {
|
||||
return detectMethod({
|
||||
contract,
|
||||
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the result of the contractURI function call.
|
||||
* @param result - The hexadecimal result to decode.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user