Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c578a437cc | ||
|
|
0c5b03b8d6 | ||
|
|
9af346eead | ||
|
|
d9fb134ad4 | ||
|
|
1c7264b403 | ||
|
|
a140ee99b2 | ||
|
|
6e1fe6e582 | ||
|
|
536b0f1240 | ||
|
|
b626782b0e | ||
|
|
1d76334dd3 | ||
|
|
d498c79a91 | ||
|
|
736b45ac8e | ||
|
|
b5e1d3bb2b | ||
|
|
6816219ac1 | ||
|
|
48065bcd91 | ||
|
|
a388d07a3d | ||
|
|
483e2b9109 | ||
|
|
f7f4f20737 | ||
|
|
6aa6f7e0bd | ||
|
|
d4d9550713 | ||
|
|
3cb298ac4b | ||
|
|
c747670b98 | ||
|
|
c08e6ba988 | ||
|
|
60fb188943 | ||
|
|
1ce8558df4 | ||
|
|
3ce5f9a0c3 | ||
|
|
3d615a62d0 |
@@ -1,5 +1,19 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 3.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f)]:
|
||||
- @thirdweb-dev/wallets@0.3.3
|
||||
|
||||
## 3.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273)]:
|
||||
- @thirdweb-dev/wallets@0.3.2
|
||||
|
||||
## 3.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "3.2.1",
|
||||
"version": "3.2.3",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @thirdweb-dev/chains
|
||||
|
||||
## 0.1.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||
|
||||
## 0.1.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1229](https://github.com/thirdweb-dev/js/pull/1229) [`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052) Thanks [@jnsdls](https://github.com/jnsdls)! - add/update chains
|
||||
|
||||
## 0.1.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "BRC Chain Mainnet",
|
||||
"chain": "BRC",
|
||||
"rpc": [
|
||||
"https://brc-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.brcchain.io"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.brcchain.io"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "BRC Chain mainnet native token",
|
||||
"symbol": "BRC",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://bridge.brcchain.io",
|
||||
"shortName": "BRC",
|
||||
"chainId": 12123,
|
||||
"networkId": 12123,
|
||||
"icon": {
|
||||
"url": "ipfs://QmX8qGX7xoZqYUpHxA85uZwQX2fgbTHvmddE1NfseDyBED",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "BRC Chain Explorer",
|
||||
"url": "https://scan.brcchain.io",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "brc-chain"
|
||||
} as const satisfies Chain;
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chain": "ATH",
|
||||
"rpc": [
|
||||
"https://atheios.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://wallet.atheios.com:8797"
|
||||
"https://rpc.atheios.org/"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
"symbol": "ATH",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://atheios.com",
|
||||
"infoURL": "https://atheios.org",
|
||||
"shortName": "ath",
|
||||
"chainId": 1620,
|
||||
"networkId": 11235813,
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Horizen Yuma Testnet",
|
||||
"shortName": "Yuma",
|
||||
"chain": "Yuma",
|
||||
"icon": {
|
||||
"url": "ipfs://QmSFMBk3rMyu45Sy9KQHjgArFj4HdywANNYrSosLMUdcti",
|
||||
"width": 1213,
|
||||
"height": 1213,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://horizen-yuma-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://yuma-testnet.horizenlabs.io/ethv1"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"faucets": [
|
||||
"https://yuma-testnet-faucet.horizen.io"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Testnet Zen",
|
||||
"symbol": "tZEN",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://horizen.io/",
|
||||
"chainId": 1662,
|
||||
"networkId": 1662,
|
||||
"slip44": 121,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Yuma Testnet Block Explorer",
|
||||
"url": "https://yuma-explorer.horizen.io",
|
||||
"icon": {
|
||||
"url": "ipfs://QmSFMBk3rMyu45Sy9KQHjgArFj4HdywANNYrSosLMUdcti",
|
||||
"width": 1213,
|
||||
"height": 1213,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "horizen-yuma-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -11,7 +11,8 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://horizen-gobi-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://gobi-testnet.horizenlabs.io/ethv1"
|
||||
"https://gobi-testnet.horizenlabs.io/ethv1",
|
||||
"https://rpc.ankr.com/horizen_testnet_evm"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Peperium Chain Testnet",
|
||||
"chain": "PERIUM",
|
||||
"rpc": [
|
||||
"https://peperium-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-testnet.peperium.io"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Peperium Chain Testnet",
|
||||
"symbol": "PERIUM",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://peperium.io",
|
||||
"shortName": "PERIUM",
|
||||
"chainId": 4001,
|
||||
"networkId": 4001,
|
||||
"icon": {
|
||||
"url": "ipfs://Qmag2hr5DQghRzKPN3oUFBkjWzqd5CndQzZeb5LfoiMCXf",
|
||||
"width": 160,
|
||||
"height": 160,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Peperium Chain Explorer",
|
||||
"url": "https://scan-testnet.peperium.io",
|
||||
"icon": {
|
||||
"url": "ipfs://Qmag2hr5DQghRzKPN3oUFBkjWzqd5CndQzZeb5LfoiMCXf",
|
||||
"width": 160,
|
||||
"height": 160,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "peperium-chain-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,24 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Omega Mainnet",
|
||||
"chain": "OmegaNetwork",
|
||||
"shortName": "OmegaNetwork",
|
||||
"chainId": 408,
|
||||
"testnet": false,
|
||||
"icon": {
|
||||
"format": "png",
|
||||
"url": "ipfs://bafkreig676zxfhwhcx5bvvvjxedx6ftr2wq4iiznrwm3c6ozrprbc4oxwm",
|
||||
"height": 512,
|
||||
"width": 512
|
||||
},
|
||||
"rpc": [
|
||||
"https://omega.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://mainnet-rpc.omtch.com"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Omega Network Coin",
|
||||
"symbol": "OMN",
|
||||
"decimals": 18
|
||||
},
|
||||
"slug": "omega"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "opBNB",
|
||||
"chain": "opBNB",
|
||||
"shortName": "opBNB",
|
||||
"chainId": 5611,
|
||||
"testnet": true,
|
||||
"nativeCurrency": {
|
||||
"name": "Testnet bnb",
|
||||
"symbol": "Tbnb",
|
||||
"decimals": 18
|
||||
},
|
||||
"rpc": [
|
||||
"https://opbnb.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://opbnb-testnet-rpc.bnbchain.org"
|
||||
],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "opBNB Scan",
|
||||
"url": "https://opbnbscan.com/",
|
||||
"standard": ""
|
||||
}
|
||||
],
|
||||
"faucets": [
|
||||
"https://opbnb-testnet-bridge.bnbchain.org/"
|
||||
],
|
||||
"infoURL": "https://docs.bnbchain.org/",
|
||||
"icon": {
|
||||
"url": "ipfs://QmfFvfFsQKby3M32uqr8T55ENBnTHL8bkdeeu6rYVL2n4z/opbnblogo.svg",
|
||||
"height": 512,
|
||||
"width": 512,
|
||||
"format": "svg"
|
||||
},
|
||||
"slug": "opbnb"
|
||||
} as const satisfies Chain;
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chain": "ETH",
|
||||
"rpc": [
|
||||
"https://zora.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.zora.co/"
|
||||
"https://rpc.zora.energy/"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
@@ -12,23 +12,23 @@ export default {
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://zora.co",
|
||||
"shortName": "zora",
|
||||
"chainId": 7777777,
|
||||
"networkId": 7777777,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Zora Network Explorer",
|
||||
"url": "https://explorer.zora.co",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://QmZ6qaRwTPFEZUspwMUjaxC6KhmzcELdRQcQzS3P72Dzts/Vector.svg",
|
||||
"height": 512,
|
||||
"width": 512,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://zora.energy",
|
||||
"shortName": "zora",
|
||||
"chainId": 7777777,
|
||||
"networkId": 7777777,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Zora Network Explorer",
|
||||
"url": "https://explorer.zora.energy",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "zora"
|
||||
} as const satisfies Chain;
|
||||
@@ -2,6 +2,12 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Patex",
|
||||
"chain": "ETH",
|
||||
"icon": {
|
||||
"url": "ipfs://QmTNTSNn3t5WpSEzQmUYbkxYkBKaH6QahyVdVrRKyPHChr",
|
||||
"width": 800,
|
||||
"height": 800,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://patex.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.patex.io/"
|
||||
@@ -12,10 +18,31 @@ export default {
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"infoURL": "https://patex.io/",
|
||||
"shortName": "peth",
|
||||
"chainId": 789,
|
||||
"networkId": 789,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "patexscan",
|
||||
"url": "https://patexscan.io",
|
||||
"icon": {
|
||||
"url": "ipfs://QmTNTSNn3t5WpSEzQmUYbkxYkBKaH6QahyVdVrRKyPHChr",
|
||||
"width": 800,
|
||||
"height": 800,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "patex"
|
||||
} as const satisfies Chain;
|
||||
@@ -1,39 +1,35 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Shardeum Liberty 2.X",
|
||||
"name": "Shardeum Sphinx DApp 1.X",
|
||||
"shortName": "Sphinx",
|
||||
"chain": "Shardeum",
|
||||
"chainId": 8081,
|
||||
"icon": {
|
||||
"url": "ipfs://Qma1bfuubpepKn7DLDy4NPSKDeT3S4VPCNhu6UmdGrb6YD",
|
||||
"width": 609,
|
||||
"height": 533,
|
||||
"height": 1200,
|
||||
"width": 1200,
|
||||
"url": "ipfs://QmQWzHUy4kmk1eGksDREGQL3GWrssdAPBxHt4aKGAFHSfJ",
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://shardeum-liberty-2-x.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://liberty20.shardeum.org/"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.liberty20.shardeum.org"
|
||||
"https://shardeum-sphinx-dapp-1-x.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://dapps.shardeum.org/sphinx"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Shardeum SHM",
|
||||
"name": "Shardeum",
|
||||
"symbol": "SHM",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://docs.shardeum.org/",
|
||||
"shortName": "Liberty20",
|
||||
"chainId": 8081,
|
||||
"networkId": 8081,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Shardeum Scan",
|
||||
"url": "https://explorer-liberty20.shardeum.org",
|
||||
"url": "https://explorer-dapps.shardeum.org",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"redFlags": [
|
||||
"reusedChainId"
|
||||
"faucets": [
|
||||
"https://faucet-dapps.shardeum.org/"
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "shardeum-liberty-2-x"
|
||||
"infoURL": "https://docs.shardeum.org/",
|
||||
"testnet": true,
|
||||
"slug": "shardeum-sphinx-dapp-1-x"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,23 @@
|
||||
// @ts-check
|
||||
/** @typedef { import("../../src/types").Chain } Chain */
|
||||
|
||||
/** @type {Omit<Chain, "slug">} */
|
||||
export default {
|
||||
name: "Omega Mainnet",
|
||||
chain: "OmegaNetwork",
|
||||
shortName: "OmegaNetwork",
|
||||
chainId: 408,
|
||||
testnet: false,
|
||||
icon: {
|
||||
format: "png",
|
||||
url: "ipfs://bafkreig676zxfhwhcx5bvvvjxedx6ftr2wq4iiznrwm3c6ozrprbc4oxwm",
|
||||
height: 512,
|
||||
width: 512,
|
||||
},
|
||||
rpc: ["https://mainnet-rpc.omtch.com"],
|
||||
nativeCurrency: {
|
||||
name: "Omega Network Coin",
|
||||
symbol: "OMN",
|
||||
decimals: 18,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
// @ts-check
|
||||
/** @typedef { import("../../src/types").Chain } Chain */
|
||||
|
||||
/** @type {Omit<Chain, "slug">} */
|
||||
export default {
|
||||
name: "opBNB",
|
||||
chain: "opBNB",
|
||||
shortName: "opBNB",
|
||||
chainId: 5611,
|
||||
testnet: true,
|
||||
nativeCurrency: {
|
||||
name: "Testnet bnb",
|
||||
symbol: "Tbnb",
|
||||
decimals: 18,
|
||||
},
|
||||
rpc: ["https://opbnb-testnet-rpc.bnbchain.org"],
|
||||
explorers: [
|
||||
{
|
||||
name: "opBNB Scan",
|
||||
url: "https://opbnbscan.com/",
|
||||
standard: "",
|
||||
},
|
||||
],
|
||||
faucets: ["https://opbnb-testnet-bridge.bnbchain.org/"],
|
||||
infoURL: "https://docs.bnbchain.org/",
|
||||
icon: {
|
||||
url: "ipfs://QmfFvfFsQKby3M32uqr8T55ENBnTHL8bkdeeu6rYVL2n4z/opbnblogo.svg",
|
||||
height: 512,
|
||||
width: 512,
|
||||
format: "svg",
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
// @ts-check
|
||||
/** @typedef { import("../../src/types").Chain } Chain */
|
||||
|
||||
/** @type {Omit<Chain, "slug">} */
|
||||
export default {
|
||||
name: "Shardeum Sphinx DApp 1.X",
|
||||
shortName: "Sphinx",
|
||||
chain: "Shardeum",
|
||||
chainId: 8081,
|
||||
icon: {
|
||||
height: 1200,
|
||||
width: 1200,
|
||||
url: "ipfs://QmQWzHUy4kmk1eGksDREGQL3GWrssdAPBxHt4aKGAFHSfJ",
|
||||
format: "png",
|
||||
},
|
||||
rpc: ["https://dapps.shardeum.org/sphinx"],
|
||||
nativeCurrency: {
|
||||
name: "Shardeum",
|
||||
symbol: "SHM",
|
||||
decimals: 18,
|
||||
},
|
||||
explorers: [
|
||||
{
|
||||
name: "Shardeum Scan",
|
||||
url: "https://explorer-dapps.shardeum.org",
|
||||
standard: "EIP3091",
|
||||
},
|
||||
],
|
||||
faucets: ["https://faucet-dapps.shardeum.org/"],
|
||||
infoURL: "https://docs.shardeum.org/",
|
||||
testnet: true,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/chains",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.24",
|
||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||
"browser": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,24 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.10.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1240](https://github.com/thirdweb-dev/js/pull/1240) [`1c7264b4`](https://github.com/thirdweb-dev/js/commit/1c7264b40330d068ece67df537a0f5db0f6aedca) Thanks [@Marfuen](https://github.com/Marfuen)! - Small bug fix for updating packages using --nightly
|
||||
|
||||
- Updated dependencies [[`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||
- @thirdweb-dev/sdk@3.10.25
|
||||
- @thirdweb-dev/storage@1.1.5
|
||||
- @thirdweb-dev/chains@0.1.24
|
||||
|
||||
## 0.10.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
|
||||
- @thirdweb-dev/chains@0.1.23
|
||||
- @thirdweb-dev/sdk@3.10.24
|
||||
|
||||
## 0.10.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.10.24",
|
||||
"version": "0.10.26",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as toml from "@iarna/toml";
|
||||
import { PackageManagerType } from "../core/types/ProjectType";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
import { runCommand } from "../create/helpers/run-command";
|
||||
import path from "path";
|
||||
import { PackageManagerType } from "../core/types/ProjectType";
|
||||
import { runCommand } from "../create/helpers/run-command";
|
||||
import { IProcessAppTypeArgs, IProcessContractAppTypeArgs } from "./types";
|
||||
|
||||
export function convertDependenciesToStringFormat(dependenciesObject: object) {
|
||||
@@ -174,7 +174,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
|
||||
case "npm":
|
||||
runner = "npm";
|
||||
installCommand = ["install"];
|
||||
updateCommand = ["update"]
|
||||
updateCommand = ["install", "--legacy-peer-deps"]
|
||||
break;
|
||||
case "yarn":
|
||||
runner = "yarn";
|
||||
@@ -223,7 +223,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
|
||||
}
|
||||
|
||||
if (typeOfAction === "install") {
|
||||
if (!dependenciesToAdd.length) {return;}
|
||||
if (!dependenciesToAdd.length) { return; }
|
||||
const commands = [...installCommand, ...dependenciesToAdd];
|
||||
|
||||
await runCommand(runner, commands, printLogs);
|
||||
@@ -233,7 +233,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
|
||||
}
|
||||
}
|
||||
if (typeOfAction === "update") {
|
||||
if (!dependenciesToUpdate.length) {return;}
|
||||
if (!dependenciesToUpdate.length) { return; }
|
||||
const commands = [...updateCommand, ...dependenciesToUpdate];
|
||||
await runCommand(runner, commands, printLogs);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/contracts-js
|
||||
|
||||
## 1.3.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||
|
||||
## 1.3.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/contracts-js",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.7",
|
||||
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
||||
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
||||
"browser": {
|
||||
@@ -10,7 +10,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
||||
"dependencies": {
|
||||
"@thirdweb-dev/contracts": "3.5.7"
|
||||
"@thirdweb-dev/contracts": "3.5.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = {
|
||||
// import rules
|
||||
"import/first": "error",
|
||||
"import/newline-after-import": "error",
|
||||
"import/no-cycle": "warn",
|
||||
"import/no-cycle": "error",
|
||||
"import/no-useless-path-segments": "error",
|
||||
|
||||
//eslint
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.14.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1235](https://github.com/thirdweb-dev/js/pull/1235) [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Fix required type for address on useSmartWalletsForAddress
|
||||
|
||||
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||
|
||||
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||
- @thirdweb-dev/wallets@0.3.3
|
||||
- @thirdweb-dev/sdk@3.10.25
|
||||
- @thirdweb-dev/storage@1.1.5
|
||||
- @thirdweb-dev/chains@0.1.24
|
||||
|
||||
## 3.14.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1230](https://github.com/thirdweb-dev/js/pull/1230) [`b5e1d3bb`](https://github.com/thirdweb-dev/js/commit/b5e1d3bb2b82785d6d3e5c899d27691bdb638625) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Add useSmartWalletsForAddress hook
|
||||
|
||||
- [#1224](https://github.com/thirdweb-dev/js/pull/1224) [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Better return type for get shared metadata
|
||||
|
||||
- [#1213](https://github.com/thirdweb-dev/js/pull/1213) [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1) Thanks [@iketw](https://github.com/iketw)! - [ReactCore/Wallets] Improve error messages for wc and auth
|
||||
|
||||
- [#1218](https://github.com/thirdweb-dev/js/pull/1218) [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Add get for shared metadata
|
||||
|
||||
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
|
||||
- @thirdweb-dev/chains@0.1.23
|
||||
- @thirdweb-dev/sdk@3.10.24
|
||||
- @thirdweb-dev/wallets@0.3.2
|
||||
|
||||
## 3.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.14.1",
|
||||
"version": "3.14.3",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -52,7 +52,7 @@ function ChangeActiveWalletOnAccountSwitch() {
|
||||
try {
|
||||
await switchAccount(data.address);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
console.debug(
|
||||
`[Auth] Failed to switch account to ${data.address} with error:\n`,
|
||||
err,
|
||||
);
|
||||
@@ -63,7 +63,7 @@ function ChangeActiveWalletOnAccountSwitch() {
|
||||
try {
|
||||
await logout();
|
||||
} catch (err) {
|
||||
console.warn(`[Auth] Failed to logout with error:\n`, err);
|
||||
console.debug(`[Auth] Failed to logout with error:\n`, err);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
useMutation,
|
||||
UseMutationResult,
|
||||
useQueryClient,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
import { Erc1155, QueryAllParams, NFT } from "@thirdweb-dev/sdk";
|
||||
import { BigNumber, BigNumberish, providers } from "ethers";
|
||||
@@ -319,6 +320,44 @@ export function useNFTBalance(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the shared metadata of an Open Edition NFT contract
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: sharedMetadata, isLoading, error } = useSharedMetadata(contract);
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a {@link NFTContract}
|
||||
* @returns a response object that includes the shared metadata of the contract
|
||||
* @twfeature ERC721SharedMetadata
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usesharedmetadata?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useSharedMetadata(
|
||||
contract: RequiredParam<NFTContract>,
|
||||
): UseQueryResult<BasicNFTInput | undefined> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
const { erc721 } = getErcs(contract);
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.nft.sharedMetadata.get(contractAddress),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
if (erc721) {
|
||||
invariant(
|
||||
erc721.sharedMetadata.get,
|
||||
"Contract instance does not support sharedMetadata.get",
|
||||
);
|
||||
return erc721.sharedMetadata.get();
|
||||
}
|
||||
invariant(false, "Unknown NFT type");
|
||||
},
|
||||
{
|
||||
enabled: !!contract,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** **********************/
|
||||
/** WRITE HOOKS **/
|
||||
/** **********************/
|
||||
@@ -605,10 +644,6 @@ export function useAirdropNFT(contract: Erc1155) {
|
||||
);
|
||||
}
|
||||
|
||||
/** **********************/
|
||||
/** WRITE HOOKS **/
|
||||
/** **********************/
|
||||
|
||||
/**
|
||||
* Burn an NFT
|
||||
*
|
||||
|
||||
@@ -14,14 +14,10 @@ import {
|
||||
useQueryClient,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
import type {
|
||||
AccountEvent, SmartContract,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import type { AccountEvent, SmartContract } from "@thirdweb-dev/sdk";
|
||||
import type { BytesLike } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
|
||||
|
||||
/** **********************/
|
||||
/** READ HOOKS **/
|
||||
/** **********************/
|
||||
@@ -41,7 +37,7 @@ import invariant from "tiny-invariant";
|
||||
* @beta
|
||||
*/
|
||||
export function useSmartWallets(
|
||||
contract: RequiredParam<SmartContract>
|
||||
contract: RequiredParam<SmartContract>,
|
||||
): UseQueryResult<AccountEvent[]> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
@@ -49,10 +45,46 @@ export function useSmartWallets(
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.smartWalletFactory.getAllWallets,
|
||||
"Contract instance does not support contract.smartWalletFactory.getAllWallets",
|
||||
contract.smartWalletFactory.getAllAccounts,
|
||||
"Contract instance does not support contract.smartWalletFactory.getAllAccounts",
|
||||
);
|
||||
return contract.smartWalletFactory.getAllWallets();
|
||||
return contract.smartWalletFactory.getAllAccounts();
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all wallets associated with the provided address
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: smartWalletsForAddress, isLoading, error } = useSmartWalletsForAddress(contract, "{{wallet_address}}");
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a smart wallet factory contract
|
||||
* @returns a response object that includes an array of all smart wallets associated with the adress
|
||||
* @twfeature SmartWalletFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usesmartwalletsforaddress?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useSmartWalletsForAddress(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
address: RequiredParam<WalletAddress>,
|
||||
): UseQueryResult<string[]> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.smartWalletFactory.getAllForAddress(
|
||||
contractAddress,
|
||||
address,
|
||||
),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.smartWalletFactory.getAssociatedWallets,
|
||||
"Contract instance does not support contract.smartWalletFactory.getAssociatedWallets",
|
||||
);
|
||||
return contract.smartWalletFactory.getAssociatedWallets(address || "");
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
@@ -79,7 +111,10 @@ export function useIsSmartWalletDeployed(
|
||||
): UseQueryResult<boolean> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(contractAddress, admin),
|
||||
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(
|
||||
contractAddress,
|
||||
admin,
|
||||
),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
@@ -130,9 +165,7 @@ export function useIsSmartWalletDeployed(
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usecreatesmartwallet?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useCreateSmartWallet(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
) {
|
||||
export function useCreateSmartWallet(contract: RequiredParam<SmartContract>) {
|
||||
const activeChainId = useSDKChainId();
|
||||
const contractAddress = contract?.getAddress();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -141,10 +174,7 @@ export function useCreateSmartWallet(
|
||||
async (admin: string, extraData?: BytesLike) => {
|
||||
requiredParamInvariant(contract, "contract is undefined");
|
||||
|
||||
return contract.smartWalletFactory.createWallet(
|
||||
admin,
|
||||
extraData,
|
||||
);
|
||||
return contract.smartWalletFactory.createWallet(admin, extraData);
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
|
||||
@@ -167,6 +167,7 @@ export {
|
||||
useTransferNFT,
|
||||
useAirdropNFT,
|
||||
useBurnNFT,
|
||||
useSharedMetadata,
|
||||
useSetSharedMetadata,
|
||||
} from "./hooks/async/nft";
|
||||
|
||||
@@ -198,6 +199,7 @@ export {
|
||||
useIsSmartWalletDeployed,
|
||||
useSmartWallets,
|
||||
useCreateSmartWallet,
|
||||
useSmartWalletsForAddress,
|
||||
} from "./hooks/async/smart-wallet-factory";
|
||||
|
||||
// thirdweb hooks (work as long as at least `<ThirdwebSdkProvider>` is used)
|
||||
|
||||
@@ -123,6 +123,8 @@ export const cacheKeys = {
|
||||
createContractCacheKey(contractAddress, ["smartWalletFactory"]),
|
||||
isSmartWalletDeployed: (contractAdress: RequiredParam<ContractAddress>, admin: RequiredParam<string>) =>
|
||||
createContractCacheKey(contractAdress, ["isSmartWalletDeployed", admin]),
|
||||
getAllForAddress: (contractAdress: RequiredParam<ContractAddress>, address: RequiredParam<string>) =>
|
||||
createContractCacheKey(contractAdress, ["getAllForAddress", address]),
|
||||
},
|
||||
|
||||
app: {
|
||||
@@ -190,6 +192,14 @@ export const cacheKeys = {
|
||||
]),
|
||||
},
|
||||
},
|
||||
sharedMetadata: {
|
||||
get: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
) =>
|
||||
createContractCacheKey(
|
||||
contractAddress
|
||||
),
|
||||
},
|
||||
drop: {
|
||||
getAllUnclaimed: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.2.22
|
||||
|
||||
## 0.2.21
|
||||
|
||||
## 0.2.20
|
||||
|
||||
## 0.2.19
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.2.20",
|
||||
"version": "0.2.22",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,62 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.2.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1245](https://github.com/thirdweb-dev/js/pull/1245) [`d9fb134a`](https://github.com/thirdweb-dev/js/commit/d9fb134ad40ae067416625eb43cf3708f87db7b5) Thanks [@iketw](https://github.com/iketw)! - [RN]
|
||||
|
||||
- Added the option to import a new wallet in guest mode
|
||||
|
||||
- Added a "Request Testnet Funds" option when on testnets
|
||||
|
||||
- [#1245](https://github.com/thirdweb-dev/js/pull/1245) [`d9fb134a`](https://github.com/thirdweb-dev/js/commit/d9fb134ad40ae067416625eb43cf3708f87db7b5) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Export more components for easy development
|
||||
|
||||
- IconTextButton
|
||||
Component that renders an icon and a text inside a button with border:
|
||||
|
||||
```javascript
|
||||
<IconTextButton
|
||||
mt="xs"
|
||||
text="Switch Accounts"
|
||||
icon={<SwitchIcon height={10} width={10} />}
|
||||
onPress={() => {}}
|
||||
/>
|
||||
```
|
||||
|
||||
- NetworkButton: Used to render a Network
|
||||
|
||||
```javascript
|
||||
<NetworkButton
|
||||
chainIconUrl={chain?.icon?.url || ""}
|
||||
chainName={chain?.name || "Unknown Network"}
|
||||
onPress={onChangeNetworkPress}
|
||||
/>
|
||||
```
|
||||
|
||||
- Exported all icons from the assets folder for external use
|
||||
|
||||
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.2.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1220](https://github.com/thirdweb-dev/js/pull/1220) [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2) Thanks [@iketw](https://github.com/iketw)! - [RN/Wallets] Fix Coinbase wallet connection rejection error
|
||||
|
||||
Unhandled Rejections: We were rethrowing an error in an async function (connect) without any catch block to handle it. We were getting an Unhandled Promise Rejection, which lead to a crash in React Native when rejecting a connection from the Coinbase Wallet.
|
||||
|
||||
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`b5e1d3bb`](https://github.com/thirdweb-dev/js/commit/b5e1d3bb2b82785d6d3e5c899d27691bdb638625), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.2.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.2.20",
|
||||
"version": "0.2.22",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
@@ -24,7 +24,7 @@
|
||||
"android"
|
||||
],
|
||||
"dependencies": {
|
||||
"@coinbase/wallet-mobile-sdk": "^1.0.4",
|
||||
"@coinbase/wallet-mobile-sdk": "1.0.6",
|
||||
"@magic-sdk/provider": "17.2.0",
|
||||
"@magic-sdk/react-native-bare": "^18.3.0",
|
||||
"@shopify/restyle": "^2.4.1",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||
import { WalletDetailsButton } from "./ConnectWalletDetails/WalletDetailsButton";
|
||||
import {
|
||||
ConnectWalletDetailsProps,
|
||||
WalletDetailsButton,
|
||||
} from "./ConnectWalletDetails/WalletDetailsButton";
|
||||
import { useAddress } from "@thirdweb-dev/react-core";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { Animated } from "react-native";
|
||||
import { ConnectWalletButton } from "./ConnectWalletFlow/ConnectWalletButton";
|
||||
import { ConnectWalletButtonProps } from "./ConnectWalletFlow/ConnectWalletButton";
|
||||
@@ -10,7 +13,7 @@ export type ConnectWalletProps = {
|
||||
/**
|
||||
* render a custom button to display the connected wallet details instead of the default button
|
||||
*/
|
||||
detailsButton?: React.ReactElement;
|
||||
detailsButton?: ConnectWalletDetailsProps["detailsButton"];
|
||||
} & ConnectWalletButtonProps;
|
||||
|
||||
export const ConnectWallet = ({
|
||||
|
||||
+15
-1
@@ -1,4 +1,4 @@
|
||||
import { StyleSheet, View } from "react-native";
|
||||
import { Linking, StyleSheet, View } from "react-native";
|
||||
import Box from "../base/Box";
|
||||
import { Toast } from "../base/Toast";
|
||||
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
||||
@@ -22,6 +22,8 @@ import { useModalState } from "../../providers/ui-context-provider";
|
||||
import { CLOSE_MODAL_STATE, WalletDetailsModal } from "../../utils/modalTypes";
|
||||
import { useAppTheme } from "../../styles/hooks";
|
||||
import { LocalWalletImportModal } from "../ConnectWalletFlow/LocalWalletImportModal";
|
||||
import { IconTextButton } from "../base/IconTextButton";
|
||||
import MoneyIcon from "../../assets/money";
|
||||
|
||||
export const ConnectWalletDetailsModal = () => {
|
||||
const theme = useAppTheme();
|
||||
@@ -192,6 +194,18 @@ export const ConnectWalletDetailsModal = () => {
|
||||
chainName={chain?.name || "Unknown Network"}
|
||||
onPress={onChangeNetworkPress}
|
||||
/>
|
||||
{chain?.testnet && chain?.faucets?.length ? (
|
||||
<IconTextButton
|
||||
mt="xs"
|
||||
text="Request Testnet Funds"
|
||||
icon={<MoneyIcon height={10} width={10} />}
|
||||
onPress={() => {
|
||||
if (chain?.faucets?.[0]) {
|
||||
Linking.openURL(chain.faucets[0]);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
{getAdditionalActions()}
|
||||
{addressCopied === true ? (
|
||||
<Toast text={"Address copied to clipboard"} />
|
||||
|
||||
+14
-15
@@ -3,8 +3,7 @@ import BaseButton from "../base/BaseButton";
|
||||
import { ChainIcon } from "../base/ChainIcon";
|
||||
import Text from "../base/Text";
|
||||
import { WalletIcon } from "../base/WalletIcon";
|
||||
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
|
||||
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
|
||||
import { useWallet, useBalance, useChain } from "@thirdweb-dev/react-core";
|
||||
import { StyleSheet } from "react-native";
|
||||
import { LocalWallet } from "@thirdweb-dev/wallets";
|
||||
import { useModalState } from "../../providers/ui-context-provider";
|
||||
@@ -12,7 +11,7 @@ import Box from "../base/Box";
|
||||
|
||||
export type ConnectWalletDetailsProps = {
|
||||
address: string;
|
||||
detailsButton?: React.ReactElement;
|
||||
detailsButton?: React.FC<{ onPress: () => void }>;
|
||||
};
|
||||
|
||||
export const WalletDetailsButton = ({
|
||||
@@ -20,7 +19,7 @@ export const WalletDetailsButton = ({
|
||||
detailsButton,
|
||||
}: ConnectWalletDetailsProps) => {
|
||||
const activeWallet = useWallet();
|
||||
const chain = useActiveChain();
|
||||
const chain = useChain();
|
||||
const balanceQuery = useBalance();
|
||||
const { setModalState } = useModalState();
|
||||
|
||||
@@ -38,15 +37,15 @@ export const WalletDetailsButton = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<BaseButton
|
||||
backgroundColor="background"
|
||||
borderColor="border"
|
||||
style={styles.walletDetails}
|
||||
onPress={onPress}
|
||||
>
|
||||
{detailsButton ? (
|
||||
detailsButton
|
||||
) : (
|
||||
{detailsButton ? (
|
||||
detailsButton({ onPress })
|
||||
) : (
|
||||
<BaseButton
|
||||
backgroundColor="background"
|
||||
borderColor="border"
|
||||
style={styles.walletDetails}
|
||||
onPress={onPress}
|
||||
>
|
||||
<Box flex={1} flexDirection="row" justifyContent="space-between">
|
||||
<ChainIcon size={32} chainIconUrl={chain?.icon?.url} />
|
||||
<Box justifyContent="center" alignItems="flex-start">
|
||||
@@ -70,8 +69,8 @@ export const WalletDetailsButton = ({
|
||||
iconUri={activeWallet?.getMeta().iconURL || ""}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
</BaseButton>
|
||||
</BaseButton>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -39,13 +39,13 @@ export const ConnectWalletFlow = () => {
|
||||
const connectActiveWallet = useCallback(
|
||||
async (wallet: WalletConfig, data?: any) => {
|
||||
setIsConnecting(true);
|
||||
connect(wallet, { ...data })
|
||||
.catch((error) => {
|
||||
console.error("Error connecting to the wallet", error);
|
||||
})
|
||||
.finally(() => {
|
||||
onClose(true);
|
||||
});
|
||||
try {
|
||||
await connect(wallet, { ...data });
|
||||
} catch (error) {
|
||||
console.error("Error connecting to the wallet", error);
|
||||
} finally {
|
||||
onClose(true);
|
||||
}
|
||||
},
|
||||
[connect, onClose],
|
||||
);
|
||||
|
||||
@@ -72,10 +72,10 @@ export class CoinbaseWalletConnector extends WagmiConnector<
|
||||
|
||||
this.emit("message", { type: "connecting" });
|
||||
|
||||
const account = (await provider.request({
|
||||
const accounts: string[] = await provider.request({
|
||||
method: "eth_requestAccounts",
|
||||
params: [],
|
||||
})) as Address;
|
||||
});
|
||||
// Switch to chain if provided
|
||||
let id = await this.getChainId();
|
||||
let unsupported = this.isChainUnsupported(id);
|
||||
@@ -93,7 +93,7 @@ export class CoinbaseWalletConnector extends WagmiConnector<
|
||||
}
|
||||
|
||||
return {
|
||||
account,
|
||||
account: accounts[0],
|
||||
chain: { id, unsupported },
|
||||
provider: new providers.Web3Provider(
|
||||
provider as unknown as providers.ExternalProvider,
|
||||
|
||||
@@ -1,5 +1,68 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.14.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1238](https://github.com/thirdweb-dev/js/pull/1238) [`6e1fe6e5`](https://github.com/thirdweb-dev/js/commit/6e1fe6e582d4178884fc1793b330a9e477df5b4d) Thanks [@iketw](https://github.com/iketw)! - '[React] Adds Rainbow and Trust wallets hooks'
|
||||
|
||||
```javascript
|
||||
import { useRainbowWallet, useTrustWallet } from "@thirdweb-dev/react";
|
||||
|
||||
const connectWithRainbow = useRainbowWallet();
|
||||
|
||||
const connectWithTrust = useTrustWallet();
|
||||
```
|
||||
|
||||
- [#1237](https://github.com/thirdweb-dev/js/pull/1237) [`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b) Thanks [@iketw](https://github.com/iketw)! - [React] Add Rainbow Wallet (implementing the WalletConnect wallet)
|
||||
|
||||
```javascript
|
||||
import { ThirdwebProvider, rainbowWallet } from "@thirdweb-dev/react";
|
||||
|
||||
const activeChain = "ethereum";
|
||||
|
||||
<ThirdwebProvider
|
||||
activeChain={activeChain}
|
||||
supportedWallets={[rainbowWallet()]}
|
||||
>
|
||||
<App />
|
||||
</ThirdwebProvider>;
|
||||
```
|
||||
|
||||
- [#1236](https://github.com/thirdweb-dev/js/pull/1236) [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f) Thanks [@iketw](https://github.com/iketw)! - [Wallets/React] Add Trust Wallet
|
||||
|
||||
```javascript
|
||||
import { ThirdwebProvider, trustWallet } from "@thirdweb-dev/react";
|
||||
|
||||
const activeChain = "mumbai";
|
||||
|
||||
<ThirdwebProvider
|
||||
activeChain={activeChain}
|
||||
autoSwitch={true}
|
||||
supportedWallets={[trustWallet()]}
|
||||
>
|
||||
<App />
|
||||
</ThirdwebProvider>;
|
||||
```
|
||||
|
||||
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 3.14.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1226](https://github.com/thirdweb-dev/js/pull/1226) [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1) Thanks [@MananTank](https://github.com/MananTank)! - Add Magic Connect support
|
||||
|
||||
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`b5e1d3bb`](https://github.com/thirdweb-dev/js/commit/b5e1d3bb2b82785d6d3e5c899d27691bdb638625), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 3.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.14.1",
|
||||
"version": "3.14.3",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useConnect } from "@thirdweb-dev/react-core";
|
||||
import { useCallback } from "react";
|
||||
|
||||
export function useRainbowWallet() {
|
||||
const connect = useConnect();
|
||||
return useCallback(
|
||||
async (connectOptions?: { chainId?: number }) => {
|
||||
const { rainbowWallet } = await import(
|
||||
"../../../wallet/wallets/rainbow/RainbowWallet"
|
||||
);
|
||||
return connect(rainbowWallet(), connectOptions);
|
||||
},
|
||||
[connect],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useConnect } from "@thirdweb-dev/react-core";
|
||||
import { useCallback } from "react";
|
||||
|
||||
export function useTrustWallet() {
|
||||
const connect = useConnect();
|
||||
return useCallback(
|
||||
async (connectOptions?: { chainId?: number }) => {
|
||||
const { trustWallet } = await import(
|
||||
"../../../wallet/wallets/trustWallet/TrustWallet"
|
||||
);
|
||||
return connect(trustWallet(), connectOptions);
|
||||
},
|
||||
[connect],
|
||||
);
|
||||
}
|
||||
@@ -20,6 +20,8 @@ export { ThirdwebProvider } from "./providers/thirdweb-provider";
|
||||
export { useInstalledWallets } from "../wallet/hooks/useInstalledWallets";
|
||||
|
||||
// wallet connection hooks
|
||||
export { useRainbowWallet } from "./hooks/wallets/useRainbowWallet";
|
||||
export { useTrustWallet } from "./hooks/wallets/useTrustWallet";
|
||||
export { useMetamask } from "./hooks/wallets/useMetamask";
|
||||
export { useCoinbaseWallet } from "./hooks/wallets/useCoinbaseWallet";
|
||||
export { useFrameWallet } from "./hooks/wallets/useFrame";
|
||||
|
||||
@@ -4,7 +4,9 @@ export { coinbaseWallet } from "./wallet/wallets/coinbase/coinbaseWallet";
|
||||
export { frameWallet } from "./wallet/wallets/frame/frameWallet";
|
||||
export { metamaskWallet } from "./wallet/wallets/metamask/metamaskWallet";
|
||||
export { paperWallet } from "./wallet/wallets/paperWallet";
|
||||
export { rainbowWallet } from "./wallet/wallets/rainbow/RainbowWallet";
|
||||
export { safeWallet } from "./wallet/wallets/safe/safeWallet";
|
||||
export { trustWallet } from "./wallet/wallets/trustWallet/TrustWallet";
|
||||
export { walletConnect } from "./wallet/wallets/walletConnect";
|
||||
export { walletConnectV1 } from "./wallet/wallets/walletConnectV1";
|
||||
export { smartWallet } from "./wallet/wallets/smartWallet/smartWallet";
|
||||
|
||||
@@ -3,6 +3,7 @@ import { assertWindowEthereum } from "@thirdweb-dev/wallets";
|
||||
export function useInstalledWallets() {
|
||||
let isMetamaskInstalled = false;
|
||||
let isCoinbaseWalletInstalled = false;
|
||||
let isTrustWalletInstalled: boolean | undefined = false;
|
||||
|
||||
if (assertWindowEthereum(globalThis.window)) {
|
||||
isMetamaskInstalled = globalThis.window.ethereum?.isMetaMask;
|
||||
@@ -10,11 +11,13 @@ export function useInstalledWallets() {
|
||||
globalThis.window.ethereum?.isCoinbaseWallet ||
|
||||
globalThis.window.ethereum?.providers?.some((p) => p.isCoinbaseWallet) ||
|
||||
false;
|
||||
isTrustWalletInstalled = globalThis.window.ethereum?.isTrust;
|
||||
}
|
||||
|
||||
const installedWallets = {
|
||||
metamask: !!isMetamaskInstalled,
|
||||
coinbaseWallet: !!isCoinbaseWalletInstalled,
|
||||
trustWallet: !!isTrustWalletInstalled,
|
||||
};
|
||||
|
||||
return installedWallets;
|
||||
|
||||
@@ -14,21 +14,24 @@ import { InputSelectionUI } from "../InputSelectionUI";
|
||||
export function magicLink(
|
||||
config: MagicLinkAdditionalOptions,
|
||||
): ConfiguredMagicLinkWallet {
|
||||
const selectUI = (props: SelectUIProps<MagicLink>) => (
|
||||
<MagicSelectionUI
|
||||
{...props}
|
||||
emailLogin={config.emailLogin !== false}
|
||||
smsLogin={config.smsLogin !== false}
|
||||
/>
|
||||
);
|
||||
|
||||
return {
|
||||
id: MagicLink.id,
|
||||
meta: MagicLink.meta,
|
||||
create: (options: WalletOptions) =>
|
||||
new MagicLink({ ...options, ...config }),
|
||||
connectUI: MagicConnectionUI,
|
||||
selectUI(props) {
|
||||
return (
|
||||
<MagicSelectionUI
|
||||
{...props}
|
||||
emailLogin={config.emailLogin !== false}
|
||||
smsLogin={config.smsLogin !== false}
|
||||
/>
|
||||
);
|
||||
connectUI(props) {
|
||||
return <MagicConnectionUI {...props} type={config.type || "auth"} />;
|
||||
},
|
||||
// select UI only for auth
|
||||
selectUI: config.type === "connect" ? undefined : selectUI,
|
||||
isInstalled() {
|
||||
return false;
|
||||
},
|
||||
@@ -101,13 +104,9 @@ const MagicSelectionUI: React.FC<
|
||||
);
|
||||
};
|
||||
|
||||
const MagicConnectionUI: React.FC<ConnectUIProps<MagicLink>> = ({
|
||||
close,
|
||||
walletConfig,
|
||||
open,
|
||||
selectionData,
|
||||
supportedWallets,
|
||||
}) => {
|
||||
const MagicConnectionUI: React.FC<
|
||||
ConnectUIProps<MagicLink> & { type: "auth" | "connect" }
|
||||
> = ({ close, walletConfig, open, selectionData, supportedWallets, type }) => {
|
||||
const connectPrompted = useRef(false);
|
||||
const singleWallet = supportedWallets.length === 1;
|
||||
const connect = useConnect();
|
||||
@@ -117,14 +116,20 @@ const MagicConnectionUI: React.FC<ConnectUIProps<MagicLink>> = ({
|
||||
return;
|
||||
}
|
||||
connectPrompted.current = true;
|
||||
const isEmail = (selectionData as string).includes("@");
|
||||
const isEmail = selectionData
|
||||
? (selectionData as string).includes("@")
|
||||
: false;
|
||||
|
||||
(async () => {
|
||||
close();
|
||||
try {
|
||||
await connect(
|
||||
walletConfig,
|
||||
isEmail ? { email: selectionData } : { phoneNumber: selectionData },
|
||||
type === "connect"
|
||||
? {}
|
||||
: isEmail
|
||||
? { email: selectionData }
|
||||
: { phoneNumber: selectionData },
|
||||
);
|
||||
} catch (e) {
|
||||
if (!singleWallet) {
|
||||
@@ -133,7 +138,7 @@ const MagicConnectionUI: React.FC<ConnectUIProps<MagicLink>> = ({
|
||||
console.error(e);
|
||||
}
|
||||
})();
|
||||
}, [connect, selectionData, walletConfig, close, open, singleWallet]);
|
||||
}, [connect, selectionData, walletConfig, close, open, singleWallet, type]);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { ConnectUIProps, useConnect } from "@thirdweb-dev/react-core";
|
||||
import { WalletConnect } from "@thirdweb-dev/wallets";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { isMobile } from "../../../evm/utils/isMobile";
|
||||
import { ConnectingScreen } from "../../ConnectWallet/screens/ConnectingScreen";
|
||||
import { GetStartedScreen } from "../../ConnectWallet/screens/GetStartedScreen";
|
||||
import { RainbowScan } from "./RainbowScan";
|
||||
|
||||
export const RainbowConnectUI = (props: ConnectUIProps<WalletConnect>) => {
|
||||
const [screen, setScreen] = useState<
|
||||
"connecting" | "scanning" | "get-started"
|
||||
>("connecting");
|
||||
const { walletConfig, close } = props;
|
||||
const connect = useConnect();
|
||||
|
||||
const { goBack } = props;
|
||||
|
||||
const connectPrompted = useRef(false);
|
||||
useEffect(() => {
|
||||
if (connectPrompted.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if loading
|
||||
(async () => {
|
||||
// on mobile, open rainbow app link
|
||||
if (isMobile()) {
|
||||
window.open("https://rnbwapp.com");
|
||||
} else {
|
||||
// on desktop, show the rainbow scan qr code
|
||||
setScreen("scanning");
|
||||
}
|
||||
})();
|
||||
}, [walletConfig, close, connect, goBack]);
|
||||
|
||||
if (screen === "connecting") {
|
||||
return (
|
||||
<ConnectingScreen
|
||||
onBack={props.goBack}
|
||||
walletName={walletConfig.meta.name}
|
||||
walletIconURL={walletConfig.meta.iconURL}
|
||||
supportLink="https://rainbow.me/"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (screen === "get-started") {
|
||||
return (
|
||||
<GetStartedScreen
|
||||
walletIconURL={walletConfig.meta.iconURL}
|
||||
walletName={walletConfig.meta.name}
|
||||
chromeExtensionLink={walletConfig.meta.urls?.chrome}
|
||||
googlePlayStoreLink={walletConfig.meta.urls?.android}
|
||||
appleStoreLink={walletConfig.meta.urls?.ios}
|
||||
onBack={props.goBack}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (screen === "scanning") {
|
||||
return (
|
||||
<RainbowScan
|
||||
onBack={props.goBack}
|
||||
onConnected={close}
|
||||
onGetStarted={() => {
|
||||
setScreen("get-started");
|
||||
}}
|
||||
walletConfig={walletConfig}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
import { ScanScreen } from "../../ConnectWallet/screens/ScanScreen";
|
||||
import {
|
||||
useCreateWalletInstance,
|
||||
useWalletContext,
|
||||
} from "@thirdweb-dev/react-core";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { WalletConnect } from "@thirdweb-dev/wallets";
|
||||
import type { WalletConfig } from "@thirdweb-dev/react-core";
|
||||
|
||||
export const RainbowScan: React.FC<{
|
||||
onBack: () => void;
|
||||
onGetStarted: () => void;
|
||||
onConnected: () => void;
|
||||
walletConfig: WalletConfig<WalletConnect>;
|
||||
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
|
||||
const createInstance = useCreateWalletInstance();
|
||||
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
|
||||
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
|
||||
useWalletContext();
|
||||
|
||||
const scanStarted = useRef(false);
|
||||
useEffect(() => {
|
||||
if (scanStarted.current) {
|
||||
return;
|
||||
}
|
||||
scanStarted.current = true;
|
||||
|
||||
const rainbow = createInstance(walletConfig);
|
||||
|
||||
setConnectionStatus("connecting");
|
||||
rainbow.connectWithQrCode({
|
||||
chainId: chainToConnect?.chainId,
|
||||
onQrCodeUri(uri) {
|
||||
setQrCodeUri(uri);
|
||||
},
|
||||
onConnected() {
|
||||
setConnectedWallet(rainbow);
|
||||
onConnected();
|
||||
},
|
||||
});
|
||||
}, [
|
||||
createInstance,
|
||||
setConnectedWallet,
|
||||
chainToConnect,
|
||||
onConnected,
|
||||
walletConfig,
|
||||
setConnectionStatus,
|
||||
]);
|
||||
|
||||
return (
|
||||
<ScanScreen
|
||||
onBack={onBack}
|
||||
onGetStarted={onGetStarted}
|
||||
qrCodeUri={qrCodeUri}
|
||||
walletName={walletConfig.meta.name}
|
||||
walletIconURL={walletConfig.meta.iconURL}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
import type { WalletOptions, WalletConfig } from "@thirdweb-dev/react-core";
|
||||
import { WalletConnect } from "@thirdweb-dev/wallets";
|
||||
import { RainbowConnectUI } from "./RainbowConnectUI";
|
||||
|
||||
type RainbowWalletOptions = {
|
||||
/**
|
||||
* When connecting Rainbow using the QR Code - Wallet Connect connector is used which requires a project id.
|
||||
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
|
||||
*
|
||||
* https://docs.walletconnect.com/2.0/web3modal/options#projectid-required
|
||||
*/
|
||||
projectId?: string;
|
||||
};
|
||||
|
||||
export const rainbowWallet = (
|
||||
options?: RainbowWalletOptions,
|
||||
): WalletConfig<WalletConnect> => {
|
||||
return {
|
||||
id: "rainbow",
|
||||
meta: {
|
||||
name: "Rainbow Wallet",
|
||||
iconURL:
|
||||
"ipfs://QmSZn47p4DVVBfzvg9BAX2EqwnPxkT1YAE7rUnrtd9CybQ/rainbow-logo.png",
|
||||
},
|
||||
create: (walletOptions: WalletOptions) => {
|
||||
return new WalletConnect({
|
||||
...walletOptions,
|
||||
walletId: "rainbow",
|
||||
projectId: options?.projectId,
|
||||
qrcode: false,
|
||||
});
|
||||
},
|
||||
connectUI: RainbowConnectUI,
|
||||
isInstalled() {
|
||||
return false;
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
import { ConnectUIProps, useConnect } from "@thirdweb-dev/react-core";
|
||||
import { TrustWallet } from "@thirdweb-dev/wallets";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { isMobile } from "../../../evm/utils/isMobile";
|
||||
import { ConnectingScreen } from "../../ConnectWallet/screens/ConnectingScreen";
|
||||
import { GetStartedScreen } from "../../ConnectWallet/screens/GetStartedScreen";
|
||||
import { TrustScan } from "./TrustScan";
|
||||
|
||||
export const TrustConnectUI = (props: ConnectUIProps<TrustWallet>) => {
|
||||
const [screen, setScreen] = useState<
|
||||
"connecting" | "scanning" | "get-started"
|
||||
>("connecting");
|
||||
const { walletConfig, close } = props;
|
||||
const connect = useConnect();
|
||||
|
||||
const { goBack } = props;
|
||||
|
||||
const connectPrompted = useRef(false);
|
||||
useEffect(() => {
|
||||
if (connectPrompted.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isInstalled = walletConfig.isInstalled
|
||||
? walletConfig.isInstalled()
|
||||
: false;
|
||||
|
||||
// if loading
|
||||
(async () => {
|
||||
if (isInstalled) {
|
||||
try {
|
||||
connectPrompted.current = true;
|
||||
setScreen("connecting");
|
||||
await connect(walletConfig);
|
||||
close();
|
||||
} catch (e) {
|
||||
goBack();
|
||||
}
|
||||
}
|
||||
|
||||
// if trust is not injected
|
||||
else {
|
||||
// on mobile, open trust app link
|
||||
if (isMobile()) {
|
||||
window.open("https://link.trustwallet.com");
|
||||
} else {
|
||||
// on desktop, show the trust scan qr code
|
||||
setScreen("scanning");
|
||||
}
|
||||
}
|
||||
})();
|
||||
}, [walletConfig, close, connect, goBack]);
|
||||
|
||||
if (screen === "connecting") {
|
||||
return (
|
||||
<ConnectingScreen
|
||||
onBack={props.goBack}
|
||||
walletName={walletConfig.meta.name}
|
||||
walletIconURL={walletConfig.meta.iconURL}
|
||||
supportLink="https://community.trustwallet.com/c/helpcenter/8"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (screen === "get-started") {
|
||||
return (
|
||||
<GetStartedScreen
|
||||
walletIconURL={walletConfig.meta.iconURL}
|
||||
walletName={walletConfig.meta.name}
|
||||
chromeExtensionLink={walletConfig.meta.urls?.chrome}
|
||||
googlePlayStoreLink={walletConfig.meta.urls?.android}
|
||||
appleStoreLink={walletConfig.meta.urls?.ios}
|
||||
onBack={props.goBack}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (screen === "scanning") {
|
||||
return (
|
||||
<TrustScan
|
||||
onBack={props.goBack}
|
||||
onConnected={close}
|
||||
onGetStarted={() => {
|
||||
setScreen("get-started");
|
||||
}}
|
||||
walletConfig={walletConfig}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
import { ScanScreen } from "../../ConnectWallet/screens/ScanScreen";
|
||||
import {
|
||||
useCreateWalletInstance,
|
||||
useWalletContext,
|
||||
} from "@thirdweb-dev/react-core";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { TrustWallet } from "@thirdweb-dev/wallets";
|
||||
import type { WalletConfig } from "@thirdweb-dev/react-core";
|
||||
|
||||
export const TrustScan: React.FC<{
|
||||
onBack: () => void;
|
||||
onGetStarted: () => void;
|
||||
onConnected: () => void;
|
||||
walletConfig: WalletConfig<TrustWallet>;
|
||||
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
|
||||
const createInstance = useCreateWalletInstance();
|
||||
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
|
||||
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
|
||||
useWalletContext();
|
||||
|
||||
const scanStarted = useRef(false);
|
||||
useEffect(() => {
|
||||
if (scanStarted.current) {
|
||||
return;
|
||||
}
|
||||
scanStarted.current = true;
|
||||
|
||||
const trust = createInstance(walletConfig);
|
||||
|
||||
setConnectionStatus("connecting");
|
||||
trust.connectWithQrCode({
|
||||
chainId: chainToConnect?.chainId,
|
||||
onQrCodeUri(uri) {
|
||||
setQrCodeUri(uri);
|
||||
},
|
||||
onConnected() {
|
||||
setConnectedWallet(trust);
|
||||
onConnected();
|
||||
},
|
||||
});
|
||||
}, [
|
||||
createInstance,
|
||||
setConnectedWallet,
|
||||
chainToConnect,
|
||||
onConnected,
|
||||
walletConfig,
|
||||
setConnectionStatus,
|
||||
]);
|
||||
|
||||
return (
|
||||
<ScanScreen
|
||||
onBack={onBack}
|
||||
onGetStarted={onGetStarted}
|
||||
qrCodeUri={qrCodeUri}
|
||||
walletName={walletConfig.meta.name}
|
||||
walletIconURL={walletConfig.meta.iconURL}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { WalletOptions, WalletConfig } from "@thirdweb-dev/react-core";
|
||||
import { TrustWallet, assertWindowEthereum } from "@thirdweb-dev/wallets";
|
||||
import { TrustConnectUI } from "./TrustConnectUI";
|
||||
|
||||
type TrustWalletOptions = {
|
||||
/**
|
||||
* When connecting Trust using the QR Code - Wallet Connect connector is used which requires a project id.
|
||||
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
|
||||
*
|
||||
* https://docs.walletconnect.com/2.0/web3modal/options#projectid-required
|
||||
*/
|
||||
projectId?: string;
|
||||
};
|
||||
|
||||
export const trustWallet = (
|
||||
options?: TrustWalletOptions,
|
||||
): WalletConfig<TrustWallet> => {
|
||||
return {
|
||||
id: TrustWallet.id,
|
||||
meta: TrustWallet.meta,
|
||||
create: (walletOptions: WalletOptions) => {
|
||||
return new TrustWallet({
|
||||
...walletOptions,
|
||||
projectId: options?.projectId,
|
||||
qrcode: false,
|
||||
});
|
||||
},
|
||||
connectUI: TrustConnectUI,
|
||||
isInstalled() {
|
||||
if (assertWindowEthereum(globalThis.window)) {
|
||||
return !!globalThis.window.ethereum.isTrust;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -4,6 +4,19 @@ module.exports = {
|
||||
plugins: ["better-tree-shaking"],
|
||||
rules: {
|
||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||
"no-restricted-imports": [
|
||||
"error",
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: "ethers",
|
||||
importNames: ["ethers"],
|
||||
message:
|
||||
"Do not import entire ethers object, Use named imports instead.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
// allow all imports from within tests
|
||||
overrides: [
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 3.10.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1233](https://github.com/thirdweb-dev/js/pull/1233) [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186) Thanks [@nkrishang](https://github.com/nkrishang)! - Fix smartWalletFactory.getAllEvents
|
||||
|
||||
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||
|
||||
- Updated dependencies [[`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||
- @thirdweb-dev/storage@1.1.5
|
||||
- @thirdweb-dev/contracts-js@1.3.7
|
||||
- @thirdweb-dev/chains@0.1.24
|
||||
|
||||
## 3.10.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1222](https://github.com/thirdweb-dev/js/pull/1222) [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Accept string for image/animation_url on shared metadata
|
||||
|
||||
- [#1223](https://github.com/thirdweb-dev/js/pull/1223) [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - fix maxId in getAll for Open Edition contracts
|
||||
|
||||
- [#1224](https://github.com/thirdweb-dev/js/pull/1224) [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Better return type for get shared metadata
|
||||
|
||||
- [#1218](https://github.com/thirdweb-dev/js/pull/1218) [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Add get for shared metadata
|
||||
|
||||
- [#1225](https://github.com/thirdweb-dev/js/pull/1225) [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Fix namespace for platform fees
|
||||
|
||||
- [#1216](https://github.com/thirdweb-dev/js/pull/1216) [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix claim counts for Open Edition contracts
|
||||
|
||||
- [#1188](https://github.com/thirdweb-dev/js/pull/1188) [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1) Thanks [@kienngo98](https://github.com/kienngo98)! - Abstract duplicated code; treeshake ethers.js imports
|
||||
|
||||
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052)]:
|
||||
- @thirdweb-dev/chains@0.1.23
|
||||
|
||||
## 3.10.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "3.10.23",
|
||||
"version": "3.10.25",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BytesLike, ethers } from "ethers";
|
||||
import { type BytesLike, utils } from "ethers";
|
||||
import { getSaltHash } from "./getSaltHash";
|
||||
|
||||
/**
|
||||
@@ -15,27 +15,27 @@ export function computeDeploymentAddress(
|
||||
create2FactoryAddress: string,
|
||||
salt?: string,
|
||||
): string {
|
||||
const saltHash = salt ? ethers.utils.id(salt) : getSaltHash(bytecode);
|
||||
const saltHash = salt ? utils.id(salt) : getSaltHash(bytecode);
|
||||
|
||||
// 1. create init bytecode hash with contract's bytecode and encoded args
|
||||
const initBytecode = ethers.utils.solidityPack(
|
||||
const initBytecode = utils.solidityPack(
|
||||
["bytes", "bytes"],
|
||||
[bytecode, encodedArgs],
|
||||
);
|
||||
|
||||
// 2. abi-encode pack the deployer address, salt, and bytecode hash
|
||||
const deployInfoPacked = ethers.utils.solidityPack(
|
||||
const deployInfoPacked = utils.solidityPack(
|
||||
["bytes1", "address", "bytes32", "bytes32"],
|
||||
[
|
||||
"0xff",
|
||||
create2FactoryAddress,
|
||||
saltHash,
|
||||
ethers.utils.solidityKeccak256(["bytes"], [initBytecode]),
|
||||
utils.solidityKeccak256(["bytes"], [initBytecode]),
|
||||
],
|
||||
);
|
||||
|
||||
// 3. hash the packed deploy info
|
||||
const hashedDeployInfo = ethers.utils.solidityKeccak256(
|
||||
const hashedDeployInfo = utils.solidityKeccak256(
|
||||
["bytes"],
|
||||
[deployInfoPacked],
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { fetchAndCacheDeployMetadata } from "./fetchAndCacheDeployMetadata";
|
||||
import { isContractDeployed } from "./isContractDeployed";
|
||||
import { getInitBytecodeWithSalt } from "./getInitBytecodeWithSalt";
|
||||
import { computeDeploymentAddress } from "./computeDeploymentAddress";
|
||||
import { BytesLike, ethers } from "ethers";
|
||||
import { type BytesLike, utils, constants } from "ethers";
|
||||
import { getNativeTokenByChainId } from "../../constants/currency";
|
||||
import { PreDeployMetadataFetched } from "../../schema/contracts/custom";
|
||||
import { ConstructorParamMap } from "../../types/any-evm/deploy-data";
|
||||
@@ -113,7 +113,7 @@ export async function encodeConstructorParamsForImplementation(
|
||||
);
|
||||
let constructorParamTypes = constructorParams.map((p) => {
|
||||
if (p.type === "tuple[]") {
|
||||
return ethers.utils.ParamType.from(p);
|
||||
return utils.ParamType.from(p);
|
||||
} else {
|
||||
return p.type;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ export async function encodeConstructorParamsForImplementation(
|
||||
let nativeTokenWrapperAddress =
|
||||
getNativeTokenByChainId(chainId).wrapped.address;
|
||||
|
||||
if (nativeTokenWrapperAddress === ethers.constants.AddressZero) {
|
||||
if (nativeTokenWrapperAddress === constants.AddressZero) {
|
||||
const deploymentInfo = await computeDeploymentInfo(
|
||||
"infra",
|
||||
provider,
|
||||
@@ -194,7 +194,7 @@ export async function encodeConstructorParamsForImplementation(
|
||||
}),
|
||||
);
|
||||
|
||||
const encodedArgs = ethers.utils.defaultAbiCoder.encode(
|
||||
const encodedArgs = utils.defaultAbiCoder.encode(
|
||||
constructorParamTypes,
|
||||
constructorParamValues,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BigNumber, ethers } from "ethers";
|
||||
import { BigNumber, utils } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
export function convertParamValues(
|
||||
@@ -21,14 +21,14 @@ export function convertParamValues(
|
||||
}
|
||||
if (p === "bytes32") {
|
||||
invariant(
|
||||
ethers.utils.isHexString(constructorParamValues[index]),
|
||||
utils.isHexString(constructorParamValues[index]),
|
||||
`Could not parse bytes32 value. Expected valid hex string but got "${constructorParamValues[index]}".`,
|
||||
);
|
||||
return ethers.utils.hexZeroPad(constructorParamValues[index], 32);
|
||||
return utils.hexZeroPad(constructorParamValues[index], 32);
|
||||
}
|
||||
if (p.startsWith("bytes")) {
|
||||
invariant(
|
||||
ethers.utils.isHexString(constructorParamValues[index]),
|
||||
utils.isHexString(constructorParamValues[index]),
|
||||
`Could not parse bytes value. Expected valid hex string but got "${constructorParamValues[index]}".`,
|
||||
);
|
||||
return constructorParamValues[index];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BigNumber, ethers, Signer } from "ethers";
|
||||
import { BigNumber, type PopulatedTransaction, type Signer } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
import { PrecomputedDeploymentTransaction } from "../../types/any-evm/deploy-data";
|
||||
import type { DeployOptions } from "../../types/deploy";
|
||||
@@ -33,7 +33,7 @@ export async function deployContractDeterministic(
|
||||
`deploying contract via create2 factory at: ${transaction.predictedAddress}`,
|
||||
);
|
||||
|
||||
let tx: ethers.PopulatedTransaction = {
|
||||
let tx: PopulatedTransaction = {
|
||||
to: transaction.to,
|
||||
data: transaction.data,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { BigNumber, BytesLike, ethers, Signer } from "ethers";
|
||||
import {
|
||||
BigNumber,
|
||||
type BytesLike,
|
||||
type PopulatedTransaction,
|
||||
type Signer,
|
||||
} from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
import type { DeployOptions } from "../../types/deploy";
|
||||
import { isContractDeployed } from "./isContractDeployed";
|
||||
@@ -10,7 +15,7 @@ import { getInitBytecodeWithSalt } from "./getInitBytecodeWithSalt";
|
||||
*
|
||||
* @public
|
||||
*
|
||||
* @param signer
|
||||
* @param type signer
|
||||
* @param bytecode
|
||||
* @param encodedArgs
|
||||
* @param create2FactoryAddress
|
||||
@@ -36,7 +41,7 @@ export async function deployContractDeterministicRaw(
|
||||
);
|
||||
const initBytecodeWithSalt = getInitBytecodeWithSalt(bytecode, encodedArgs);
|
||||
|
||||
let tx: ethers.PopulatedTransaction = {
|
||||
let tx: PopulatedTransaction = {
|
||||
to: create2FactoryAddress,
|
||||
data: initBytecodeWithSalt,
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
BigNumber,
|
||||
PopulatedTransaction,
|
||||
Signer,
|
||||
ethers,
|
||||
providers,
|
||||
type PopulatedTransaction,
|
||||
type Signer,
|
||||
utils,
|
||||
type providers,
|
||||
} from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
import { isContractDeployed } from "./isContractDeployed";
|
||||
@@ -56,7 +56,7 @@ export async function directDeployDeterministic(
|
||||
constructorParamTypes,
|
||||
constructorArgs,
|
||||
);
|
||||
const encodedArgs = ethers.utils.defaultAbiCoder.encode(
|
||||
const encodedArgs = utils.defaultAbiCoder.encode(
|
||||
constructorParamTypes,
|
||||
paramValues,
|
||||
);
|
||||
@@ -159,7 +159,7 @@ export async function predictAddressDeterministic(
|
||||
constructorParamTypes,
|
||||
constructorArgs,
|
||||
);
|
||||
const encodedArgs = ethers.utils.defaultAbiCoder.encode(
|
||||
const encodedArgs = utils.defaultAbiCoder.encode(
|
||||
constructorParamTypes,
|
||||
paramValues,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ethers, Signer } from "ethers";
|
||||
import { ContractFactory, type Signer } from "ethers";
|
||||
import { PrecomputedDeploymentTransaction } from "../../types/any-evm/deploy-data";
|
||||
import type { DeployOptions } from "../../types/deploy";
|
||||
import { DEPLOYER_ABI, DEPLOYER_BYTECODE } from "./constants";
|
||||
@@ -18,10 +18,7 @@ export async function deployWithThrowawayDeployer(
|
||||
const deployTxns = await Promise.all(
|
||||
transactionBatches.map((txBatch) => {
|
||||
// Using the deployer contract, send the deploy transactions to common factory with a signer
|
||||
const deployer = new ethers.ContractFactory(
|
||||
DEPLOYER_ABI,
|
||||
DEPLOYER_BYTECODE,
|
||||
)
|
||||
const deployer = new ContractFactory(DEPLOYER_ABI, DEPLOYER_BYTECODE)
|
||||
.connect(signer)
|
||||
.deploy(txBatch);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ethers } from "ethers";
|
||||
import { utils } from "ethers";
|
||||
|
||||
export function estimateGasForDeploy(initCode: string) {
|
||||
let gasLimit =
|
||||
ethers.utils
|
||||
utils
|
||||
.arrayify(initCode)
|
||||
.map((x) => (x === 0 ? 4 : 16))
|
||||
.reduce((sum, x) => sum + x) +
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ethers } from "ethers";
|
||||
import { utils } from "ethers";
|
||||
import { KeylessDeploymentInfo } from "../../types/any-evm/deploy-data";
|
||||
import { SIGNATURE, CREATE2_FACTORY_BYTECODE } from "./constants";
|
||||
import { getKeylessTxn } from "./getKeylessTxn";
|
||||
@@ -13,7 +13,7 @@ export function getCreate2FactoryDeploymentInfo(
|
||||
chainId: number,
|
||||
gasPrice?: number,
|
||||
): KeylessDeploymentInfo {
|
||||
const signature = ethers.utils.joinSignature(SIGNATURE);
|
||||
const signature = utils.joinSignature(SIGNATURE);
|
||||
const deploymentTransaction = getKeylessTxn(
|
||||
{
|
||||
gasPrice: gasPrice ? gasPrice : 100 * 10 ** 9,
|
||||
@@ -24,7 +24,7 @@ export function getCreate2FactoryDeploymentInfo(
|
||||
},
|
||||
signature,
|
||||
);
|
||||
const create2FactoryAddress = ethers.utils.getContractAddress({
|
||||
const create2FactoryAddress = utils.getContractAddress({
|
||||
from: deploymentTransaction.signer,
|
||||
nonce: 0,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BytesLike, ethers } from "ethers";
|
||||
import { type BytesLike, utils } from "ethers";
|
||||
import { getSaltHash } from "./getSaltHash";
|
||||
|
||||
/**
|
||||
@@ -15,9 +15,9 @@ export function getInitBytecodeWithSalt(
|
||||
encodedArgs: BytesLike,
|
||||
salt?: string,
|
||||
): string {
|
||||
const saltHash = salt ? ethers.utils.id(salt) : getSaltHash(bytecode);
|
||||
const saltHash = salt ? utils.id(salt) : getSaltHash(bytecode);
|
||||
|
||||
const initBytecodeWithSalt = ethers.utils.solidityPack(
|
||||
const initBytecodeWithSalt = utils.solidityPack(
|
||||
["bytes32", "bytes", "bytes"],
|
||||
[saltHash, bytecode, encodedArgs],
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ethers } from "ethers";
|
||||
import { utils, type UnsignedTransaction } from "ethers";
|
||||
import { KeylessTransaction } from "../../types/any-evm/deploy-data";
|
||||
|
||||
/**
|
||||
@@ -9,20 +9,20 @@ import { KeylessTransaction } from "../../types/any-evm/deploy-data";
|
||||
* @param signature: Signature bytes
|
||||
*/
|
||||
export function getKeylessTxn(
|
||||
transaction: ethers.UnsignedTransaction,
|
||||
transaction: UnsignedTransaction,
|
||||
signature: string,
|
||||
): KeylessTransaction {
|
||||
// 1. Create serialized txn string
|
||||
const digest = ethers.utils.arrayify(
|
||||
ethers.utils.keccak256(ethers.utils.serializeTransaction(transaction)),
|
||||
const digest = utils.arrayify(
|
||||
utils.keccak256(utils.serializeTransaction(transaction)),
|
||||
);
|
||||
|
||||
// 2. Determine signer address from custom signature + txn
|
||||
const signer = ethers.utils.recoverAddress(digest, signature);
|
||||
const signer = utils.recoverAddress(digest, signature);
|
||||
|
||||
// 3. Create the signed serialized txn string.
|
||||
// To be sent directly to the chain using a provider.
|
||||
const signedSerializedTx = ethers.utils.serializeTransaction(
|
||||
const signedSerializedTx = utils.serializeTransaction(
|
||||
transaction,
|
||||
signature,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ethers } from "ethers";
|
||||
import { utils } from "ethers";
|
||||
|
||||
/**
|
||||
* Generate salt for deployment with Create2
|
||||
@@ -8,9 +8,9 @@ import { ethers } from "ethers";
|
||||
* @param bytecode: Creation bytecode of the contract to deploy
|
||||
*/
|
||||
export function getSaltHash(bytecode: string): string {
|
||||
const bytecodeHash = ethers.utils.id(bytecode);
|
||||
const bytecodeHash = utils.id(bytecode);
|
||||
const salt = `tw.${bytecodeHash}`;
|
||||
const saltHash = ethers.utils.id(salt);
|
||||
const saltHash = utils.id(salt);
|
||||
|
||||
return saltHash;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Quantity } from "../../../core/schema/shared";
|
||||
import { ethers } from "ethers";
|
||||
import { utils, constants } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -11,8 +11,8 @@ export function convertQuantityToBigNumber(
|
||||
tokenDecimals: number,
|
||||
) {
|
||||
if (quantity === "unlimited") {
|
||||
return ethers.constants.MaxUint256;
|
||||
return constants.MaxUint256;
|
||||
} else {
|
||||
return ethers.utils.parseUnits(quantity, tokenDecimals);
|
||||
return utils.parseUnits(quantity, tokenDecimals);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BigNumberish, ethers } from "ethers";
|
||||
import { type BigNumberish, constants, utils } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -9,9 +9,9 @@ export function convertToReadableQuantity(
|
||||
bn: BigNumberish,
|
||||
tokenDecimals: number,
|
||||
) {
|
||||
if (bn.toString() === ethers.constants.MaxUint256.toString()) {
|
||||
if (bn.toString() === constants.MaxUint256.toString()) {
|
||||
return "unlimited";
|
||||
} else {
|
||||
return ethers.utils.formatUnits(bn, tokenDecimals);
|
||||
return utils.formatUnits(bn, tokenDecimals);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
SnapshotFormatVersion,
|
||||
} from "../sharded-merkle-tree";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers } from "ethers";
|
||||
import type { providers } from "ethers";
|
||||
|
||||
export async function fetchSnapshotEntryForAddress(
|
||||
address: string,
|
||||
merkleRoot: string,
|
||||
merkleMetadata: Record<string, string> | undefined,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
snapshotFormatVersion: SnapshotFormatVersion,
|
||||
): Promise<SnapshotEntryWithProof | null> {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
} from "../../types/claim-conditions/claim-conditions";
|
||||
import { SnapshotFormatVersion } from "../sharded-merkle-tree";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants, ethers, utils } from "ethers";
|
||||
import { BigNumber, type BigNumberish, constants, utils } from "ethers";
|
||||
import { approveErc20Allowance } from "../currency/approveErc20Allowance";
|
||||
import { isNativeToken } from "../currency/isNativeToken";
|
||||
import { normalizePriceValue } from "../currency/normalizePriceValue";
|
||||
@@ -54,22 +54,19 @@ export async function prepareClaim(
|
||||
// override only if not default values (unlimited for quantity, zero addr for currency)
|
||||
maxClaimable =
|
||||
snapshotEntry.maxClaimable === "unlimited"
|
||||
? ethers.constants.MaxUint256
|
||||
: ethers.utils.parseUnits(
|
||||
snapshotEntry.maxClaimable,
|
||||
tokenDecimals,
|
||||
);
|
||||
? constants.MaxUint256
|
||||
: utils.parseUnits(snapshotEntry.maxClaimable, tokenDecimals);
|
||||
priceInProof =
|
||||
snapshotEntry.price === undefined ||
|
||||
snapshotEntry.price === "unlimited"
|
||||
? ethers.constants.MaxUint256
|
||||
? constants.MaxUint256
|
||||
: await normalizePriceValue(
|
||||
contractWrapper.getProvider(),
|
||||
snapshotEntry.price,
|
||||
snapshotEntry.currencyAddress || ethers.constants.AddressZero,
|
||||
snapshotEntry.currencyAddress || constants.AddressZero,
|
||||
);
|
||||
currencyAddressInProof =
|
||||
snapshotEntry.currencyAddress || ethers.constants.AddressZero;
|
||||
snapshotEntry.currencyAddress || constants.AddressZero;
|
||||
} else {
|
||||
// if no snapshot entry, and it's a v1 format (exclusive allowlist) then address can't claim
|
||||
if (snapshotFormatVersion === SnapshotFormatVersion.V1) {
|
||||
@@ -95,19 +92,19 @@ export async function prepareClaim(
|
||||
// if proof price is unlimited, then we use the price from the claim condition
|
||||
// this mimics the contract behavior
|
||||
const pricePerToken =
|
||||
priceInProof.toString() !== ethers.constants.MaxUint256.toString()
|
||||
priceInProof.toString() !== constants.MaxUint256.toString()
|
||||
? priceInProof
|
||||
: activeClaimCondition.price;
|
||||
// same for currency address
|
||||
const currencyAddress =
|
||||
currencyAddressInProof !== ethers.constants.AddressZero
|
||||
currencyAddressInProof !== constants.AddressZero
|
||||
? currencyAddressInProof
|
||||
: activeClaimCondition.currencyAddress;
|
||||
if (pricePerToken.gt(0)) {
|
||||
if (isNativeToken(currencyAddress)) {
|
||||
overrides["value"] = BigNumber.from(pricePerToken)
|
||||
.mul(quantity)
|
||||
.div(ethers.utils.parseUnits("1", tokenDecimals));
|
||||
.div(utils.parseUnits("1", tokenDecimals));
|
||||
} else if (checkERC20Allowance) {
|
||||
await approveErc20Allowance(
|
||||
contractWrapper,
|
||||
|
||||
@@ -13,10 +13,9 @@ import { createSnapshot } from "../snapshots";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
BigNumber,
|
||||
BigNumberish,
|
||||
type BigNumberish,
|
||||
constants,
|
||||
ethers,
|
||||
providers,
|
||||
type providers,
|
||||
utils,
|
||||
} from "ethers";
|
||||
import { normalizePriceValue } from "../currency/normalizePriceValue";
|
||||
@@ -46,7 +45,7 @@ function compare(a: BigNumberish, b: BigNumberish) {
|
||||
export async function processSnapshotData(
|
||||
claimConditionInputs: ClaimConditionInput[],
|
||||
tokenDecimals: number,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
snapshotFormatVersion: SnapshotFormatVersion,
|
||||
) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
ClaimConditionInput,
|
||||
ClaimCondition,
|
||||
} from "../../types/claim-conditions/claim-conditions";
|
||||
import { ethers } from "ethers";
|
||||
import { utils } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -27,7 +27,7 @@ export async function updateExistingClaimConditions(
|
||||
// merge input with existing claim condition
|
||||
const priceDecimals = existingConditions[index].currencyMetadata.decimals;
|
||||
const priceInWei = existingConditions[index].price;
|
||||
const priceInTokens = ethers.utils.formatUnits(priceInWei, priceDecimals);
|
||||
const priceInTokens = utils.formatUnits(priceInWei, priceDecimals);
|
||||
|
||||
// merge existing (output format) with incoming (input format)
|
||||
const newConditionParsed = await ClaimConditionInputSchema.parseAsync({
|
||||
@@ -49,7 +49,7 @@ export async function updateExistingClaimConditions(
|
||||
} else {
|
||||
newConditionAtIndex = existingOutput;
|
||||
}
|
||||
const formattedPrice = ethers.utils.formatUnits(
|
||||
const formattedPrice = utils.formatUnits(
|
||||
newConditionAtIndex.price,
|
||||
priceDecimals,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { BigNumber, BigNumberish, ethers } from "ethers";
|
||||
import { BigNumber, type BigNumberish, utils } from "ethers";
|
||||
|
||||
export async function approveErc20Allowance(
|
||||
contractToApprove: ContractWrapper<any>,
|
||||
@@ -23,7 +23,7 @@ export async function approveErc20Allowance(
|
||||
const allowance = await erc20.readContract.allowance(owner, spender);
|
||||
const totalPrice = BigNumber.from(price)
|
||||
.mul(BigNumber.from(quantity))
|
||||
.div(ethers.utils.parseUnits("1", tokenDecimals));
|
||||
.div(utils.parseUnits("1", tokenDecimals));
|
||||
if (allowance.lt(totalPrice)) {
|
||||
await erc20.sendTransaction("approve", [
|
||||
spender,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { SUPPORTED_CHAIN_ID } from "../constants/chains/SUPPORTED_CHAIN_ID";
|
||||
import { NATIVE_TOKENS } from "../constants/currency";
|
||||
import { Feature } from "../constants/contract-features";
|
||||
import { ContractSource } from "../schema/contracts/custom";
|
||||
import { BigNumber, BigNumberish, ethers, providers } from "ethers";
|
||||
import { BigNumber, type BigNumberish, utils, type providers } from "ethers";
|
||||
|
||||
/**
|
||||
* Error that may get thrown if IPFS returns nothing for a given uri.
|
||||
@@ -320,7 +320,7 @@ export class TransactionError extends Error {
|
||||
if (info.value && info.value.gt(0)) {
|
||||
errorMessage += withSpaces(
|
||||
"value",
|
||||
`${ethers.utils.formatEther(info.value)} ${
|
||||
`${utils.formatEther(info.value)} ${
|
||||
NATIVE_TOKENS[info.network.chainId as SUPPORTED_CHAIN_ID]?.symbol ||
|
||||
""
|
||||
}`,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { BaseContract } from "ethers";
|
||||
import type { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import type { BaseContract } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
||||
@@ -21,7 +21,13 @@ import type {
|
||||
ThirdwebStorage,
|
||||
UploadProgressEvent,
|
||||
} from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, Contract, ethers, providers } from "ethers";
|
||||
import {
|
||||
BigNumber,
|
||||
type BigNumberish,
|
||||
Contract,
|
||||
utils,
|
||||
type providers,
|
||||
} from "ethers";
|
||||
|
||||
export const FALLBACK_METADATA = {
|
||||
name: "Failed to load NFT metadata",
|
||||
@@ -42,7 +48,7 @@ export async function fetchTokenMetadata(
|
||||
): Promise<NFTMetadata> {
|
||||
const parsedUri = tokenUri.replace(
|
||||
"{id}",
|
||||
ethers.utils.hexZeroPad(BigNumber.from(tokenId).toHexString(), 32).slice(2),
|
||||
utils.hexZeroPad(BigNumber.from(tokenId).toHexString(), 32).slice(2),
|
||||
);
|
||||
let jsonMetadata;
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,14 @@ import {
|
||||
EIP712StandardDomain,
|
||||
signTypedDataInternal,
|
||||
} from "./sign";
|
||||
import { BigNumber, BigNumberish, Contract, ethers, Signer } from "ethers";
|
||||
import {
|
||||
BigNumber,
|
||||
type BigNumberish,
|
||||
Contract,
|
||||
utils,
|
||||
constants,
|
||||
type Signer,
|
||||
} from "ethers";
|
||||
|
||||
const NAME_ABI = [
|
||||
{
|
||||
@@ -99,14 +106,11 @@ async function getChainDomainSeperator(
|
||||
name: domain.name,
|
||||
version: domain.version,
|
||||
verifyingContract: domain.verifyingContract,
|
||||
salt: ethers.utils.hexZeroPad(
|
||||
BigNumber.from(domain.chainId).toHexString(),
|
||||
32,
|
||||
),
|
||||
salt: utils.hexZeroPad(BigNumber.from(domain.chainId).toHexString(), 32),
|
||||
};
|
||||
|
||||
if (
|
||||
ethers.utils._TypedDataEncoder.hashDomain(polygonDomain) ===
|
||||
utils._TypedDataEncoder.hashDomain(polygonDomain) ===
|
||||
contractDomainSeparator
|
||||
) {
|
||||
return polygonDomain;
|
||||
@@ -135,7 +139,7 @@ export async function signDAIPermit(
|
||||
});
|
||||
|
||||
nonce = nonce || (await getSignerNonce(signer, currencyAddress)).toString();
|
||||
deadline = deadline || ethers.constants.MaxUint256;
|
||||
deadline = deadline || constants.MaxUint256;
|
||||
|
||||
const message = {
|
||||
owner,
|
||||
@@ -190,7 +194,7 @@ export async function signEIP2612Permit(
|
||||
});
|
||||
|
||||
nonce = nonce || (await getSignerNonce(signer, currencyAddress)).toString();
|
||||
deadline = deadline || ethers.constants.MaxUint256;
|
||||
deadline = deadline || constants.MaxUint256;
|
||||
|
||||
const message = {
|
||||
owner,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Abi } from "../../schema/contracts/custom";
|
||||
import { ethers } from "ethers";
|
||||
import { utils } from "ethers";
|
||||
import { Plugin } from "../../types/plugins";
|
||||
|
||||
function getFunctionSignature(fnInputs: any): string {
|
||||
@@ -18,7 +18,7 @@ export function generatePluginFunctions(
|
||||
pluginAddress: string,
|
||||
pluginAbi: Abi,
|
||||
): Plugin[] {
|
||||
const pluginInterface = new ethers.utils.Interface(pluginAbi);
|
||||
const pluginInterface = new utils.Interface(pluginAbi);
|
||||
const pluginFunctions: Plugin[] = [];
|
||||
// TODO - filter out common functions like _msgSender(), contractType(), etc.
|
||||
for (const fnFragment of Object.values(pluginInterface.functions)) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BytesLike, ethers } from "ethers";
|
||||
import { type BytesLike, utils } from "ethers";
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -31,7 +31,7 @@ export const ALL_ROLES = /* @__PURE__ */ Object.keys(roleMap) as Role[];
|
||||
*/
|
||||
export function getRoleHash(role: Role): BytesLike {
|
||||
if (role === "admin") {
|
||||
return ethers.utils.hexZeroPad([0], 32);
|
||||
return utils.hexZeroPad([0], 32);
|
||||
}
|
||||
return ethers.utils.id(roleMap[role]);
|
||||
return utils.id(roleMap[role]);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { SnapshotInput } from "../types/claim-conditions/claim-conditions";
|
||||
import { convertQuantityToBigNumber } from "./claim-conditions/convertQuantityToBigNumber";
|
||||
import { fetchCurrencyMetadata } from "./currency/fetchCurrencyMetadata";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers, utils } from "ethers";
|
||||
import { constants, utils, type providers } from "ethers";
|
||||
import { MerkleTree } from "merkletreejs";
|
||||
import { parseSnapshotInputs } from "./parseSnapshotInputs";
|
||||
|
||||
@@ -105,7 +105,7 @@ export class ShardedMerkleTree {
|
||||
entry.price || "unlimited",
|
||||
currencyDecimals,
|
||||
),
|
||||
entry.currencyAddress || ethers.constants.AddressZero,
|
||||
entry.currencyAddress || constants.AddressZero,
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class ShardedMerkleTree {
|
||||
|
||||
static async fetchAndCacheDecimals(
|
||||
cache: Record<string, number>,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
currencyAddress?: string,
|
||||
): Promise<number> {
|
||||
if (!currencyAddress) {
|
||||
@@ -135,7 +135,7 @@ export class ShardedMerkleTree {
|
||||
static async buildAndUpload(
|
||||
snapshotInput: SnapshotInput,
|
||||
tokenDecimals: number,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
snapshotFormatVersion: SnapshotFormatVersion,
|
||||
shardNybbles = SHARD_NYBBLES,
|
||||
@@ -226,7 +226,7 @@ export class ShardedMerkleTree {
|
||||
|
||||
public async getProof(
|
||||
address: string,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
snapshotFormatVersion: SnapshotFormatVersion,
|
||||
): Promise<SnapshotEntryWithProof | null> {
|
||||
const shardId = address.slice(2, 2 + this.shardNybbles).toLowerCase();
|
||||
|
||||
@@ -95,7 +95,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
openzeppelinForwarderEOA: "0x4f247c69184ad61036EC2Bb3213b69F10FbEDe1F",
|
||||
biconomyForwarder: "0xfe0fa3C06d03bDC7fb49c892BbB39113B534fB57",
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: AddressZero,
|
||||
},
|
||||
|
||||
@@ -104,7 +104,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
openzeppelinForwarderEOA: "0x119704314Ef304EaAAE4b3c7C9ABd59272A28310",
|
||||
biconomyForwarder: AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: AddressZero,
|
||||
},
|
||||
[ChainId.Optimism]: {
|
||||
@@ -112,7 +112,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
openzeppelinForwarderEOA: "0x7e80648EB2071E26937F9D42A513ccf4815fc702",
|
||||
biconomyForwarder: "0xefba8a2a82ec1fb1273806174f5e28fbb917cf95",
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: AddressZero,
|
||||
},
|
||||
|
||||
@@ -121,7 +121,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
openzeppelinForwarderEOA: "0x119704314Ef304EaAAE4b3c7C9ABd59272A28310",
|
||||
biconomyForwarder: AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: AddressZero,
|
||||
},
|
||||
[ChainId.BinanceSmartChainMainnet]: {
|
||||
@@ -130,7 +130,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
biconomyForwarder: "0x86C80a8aa58e0A4fa09A69624c31Ab2a6CAD56b8",
|
||||
twBYOCRegistry: AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twRegistry: TWRegistry_address,
|
||||
},
|
||||
[ChainId.BinanceSmartChainTestnet]: {
|
||||
openzeppelinForwarder: "0x44bE9D54B9C8b5e57a3325E8Ec9154640e7c6955",
|
||||
@@ -138,7 +138,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
biconomyForwarder: "0x61456BF1715C1415730076BB79ae118E806E74d2",
|
||||
twBYOCRegistry: AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twRegistry: TWRegistry_address,
|
||||
},
|
||||
[ChainId.Hardhat]: {
|
||||
openzeppelinForwarder: AddressZero,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { NativeToken } from "../types/currency";
|
||||
import { ChainId } from "./chains/ChainId";
|
||||
import { getSupportedChains } from "./chains/supportedChains";
|
||||
import { ethers } from "ethers";
|
||||
import { constants } from "ethers";
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -221,7 +221,7 @@ export function getNativeTokenByChainId(chainId: ChainId): NativeToken {
|
||||
symbol: chain.nativeCurrency.symbol,
|
||||
decimals: 18,
|
||||
wrapped: {
|
||||
address: ethers.constants.AddressZero,
|
||||
address: constants.AddressZero,
|
||||
name: `Wrapped ${chain.nativeCurrency.name}`,
|
||||
symbol: `W${chain.nativeCurrency.symbol}`,
|
||||
},
|
||||
@@ -233,7 +233,7 @@ export function getNativeTokenByChainId(chainId: ChainId): NativeToken {
|
||||
symbol: "ETH",
|
||||
decimals: 18,
|
||||
wrapped: {
|
||||
address: ethers.constants.AddressZero,
|
||||
address: constants.AddressZero,
|
||||
name: "Wrapped Ether",
|
||||
symbol: "WETH",
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ import MulticallAbi from "@thirdweb-dev/contracts-js/dist/abis/IMulticall.json";
|
||||
import SignatureMintERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/ISignatureMintERC721.json";
|
||||
import SignatureMintERC721_V1Abi from "@thirdweb-dev/contracts-js/dist/abis/ISignatureMintERC721_V1.json";
|
||||
import TieredDropAbi from "@thirdweb-dev/contracts-js/dist/abis/LazyMintWithTier.json";
|
||||
import SharedMetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/ISharedMetadata.json";
|
||||
import SharedMetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/SharedMetadata.json";
|
||||
import zora_IDropERC721 from "@thirdweb-dev/contracts-js/dist/abis/zora_IERC721Drop.json";
|
||||
|
||||
export const FEATURE_NFT_BURNABLE = {
|
||||
@@ -205,7 +205,7 @@ export const FEATURE_NFT_SHARED_METADATA = /* @__PURE__ */ {
|
||||
namespace: "nft.sharedmetadata",
|
||||
docLinks: {
|
||||
sdk: "sdk.sharedmetadata",
|
||||
contracts: "ISharedMetadata",
|
||||
contracts: "SharedMetadata",
|
||||
},
|
||||
abis: [Erc721Abi, SharedMetadataAbi],
|
||||
features: {},
|
||||
|
||||
@@ -128,7 +128,7 @@ export const FEATURE_PRIMARY_SALE = {
|
||||
|
||||
export const FEATURE_PLATFORM_FEE = {
|
||||
name: "PlatformFee",
|
||||
namespace: "platformFee",
|
||||
namespace: "platformFees",
|
||||
docLinks: {
|
||||
sdk: "sdk.platformfee",
|
||||
contracts: "platformfee",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
export const ADMIN_ROLE = ['admin'] as const;
|
||||
|
||||
export const NFT_BASE_CONTRACT_ROLES = ["admin", "minter", "transfer"] as const;
|
||||
|
||||
export const MARKETPLACE_CONTRACT_ROLES = ["admin", "lister", "asset"] as const;
|
||||
|
||||
export const PACK_CONTRACT_ROLES = ["admin", "minter", "asset", "transfer"] as const;
|
||||
|
||||
export const TOKEN_DROP_CONTRACT_ROLES = ["admin", "transfer"] as const;
|
||||
|
||||
export const MULTIWRAP_CONTRACT_ROLES = ["admin", "transfer", "minter", "unwrap", "asset"] as const
|
||||
@@ -19,10 +19,18 @@ import { Abi, AbiSchema } from "../schema/contracts/custom";
|
||||
import { DropErc20ContractSchema } from "../schema/contracts/drop-erc20";
|
||||
import { MultiwrapContractSchema } from "../schema/contracts/multiwrap";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers } from "ethers";
|
||||
import type { providers } from "ethers";
|
||||
import type { SmartContract as SmartContractType } from "./smart-contract";
|
||||
import { getCompositeABIfromRelease } from "../common/plugin/getCompositeABIfromRelease";
|
||||
import { getCompositePluginABI } from "../common/plugin/getCompositePluginABI";
|
||||
import {
|
||||
ADMIN_ROLE,
|
||||
MARKETPLACE_CONTRACT_ROLES,
|
||||
MULTIWRAP_CONTRACT_ROLES,
|
||||
NFT_BASE_CONTRACT_ROLES,
|
||||
PACK_CONTRACT_ROLES,
|
||||
TOKEN_DROP_CONTRACT_ROLES,
|
||||
} from "./contractRoles";
|
||||
|
||||
const prebuiltContractTypes = {
|
||||
vote: "vote",
|
||||
@@ -53,7 +61,7 @@ export const EditionDropInitializer = {
|
||||
name: "DropERC1155" as const,
|
||||
contractType: prebuiltContractTypes["edition-drop"],
|
||||
schema: DropErc1155ContractSchema,
|
||||
roles: ["admin", "minter", "transfer"] as const,
|
||||
roles: NFT_BASE_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -75,7 +83,7 @@ export const EditionDropInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -99,7 +107,7 @@ export const EditionInitializer = {
|
||||
name: "TokenERC1155" as const,
|
||||
contractType: prebuiltContractTypes["edition"],
|
||||
schema: TokenErc1155ContractSchema,
|
||||
roles: ["admin", "minter", "transfer"] as const,
|
||||
roles: NFT_BASE_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -121,7 +129,7 @@ export const EditionInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -139,7 +147,7 @@ export const MarketplaceInitializer = {
|
||||
name: "Marketplace" as const,
|
||||
contractType: prebuiltContractTypes.marketplace,
|
||||
schema: MarketplaceContractSchema,
|
||||
roles: ["admin", "lister", "asset"] as const,
|
||||
roles: MARKETPLACE_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -161,7 +169,7 @@ export const MarketplaceInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -180,7 +188,7 @@ export const MarketplaceV3Initializer = {
|
||||
name: "MarketplaceV3" as const,
|
||||
contractType: prebuiltContractTypes["marketplace-v3"],
|
||||
schema: MarketplaceContractSchema,
|
||||
roles: ["admin", "lister", "asset"] as const,
|
||||
roles: MARKETPLACE_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -202,7 +210,7 @@ export const MarketplaceV3Initializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const chainId = (await provider.getNetwork()).chainId;
|
||||
@@ -240,7 +248,7 @@ export const MultiwrapInitializer = {
|
||||
name: "Multiwrap" as const,
|
||||
contractType: prebuiltContractTypes.multiwrap,
|
||||
schema: MultiwrapContractSchema,
|
||||
roles: ["admin", "transfer", "minter", "unwrap", "asset"] as const,
|
||||
roles: MULTIWRAP_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -262,7 +270,7 @@ export const MultiwrapInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -279,7 +287,7 @@ export const NFTCollectionInitializer = {
|
||||
name: "TokenERC721" as const,
|
||||
contractType: prebuiltContractTypes["nft-collection"],
|
||||
schema: TokenErc721ContractSchema,
|
||||
roles: ["admin", "minter", "transfer"] as const,
|
||||
roles: NFT_BASE_CONTRACT_ROLES,
|
||||
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
@@ -302,7 +310,7 @@ export const NFTCollectionInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -320,7 +328,7 @@ export const NFTDropInitializer = {
|
||||
name: "DropERC721" as const,
|
||||
contractType: prebuiltContractTypes["nft-drop"],
|
||||
schema: DropErc721ContractSchema,
|
||||
roles: ["admin", "minter", "transfer"] as const,
|
||||
roles: NFT_BASE_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -342,7 +350,7 @@ export const NFTDropInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -366,7 +374,7 @@ export const PackInitializer = {
|
||||
name: "Pack" as const,
|
||||
contractType: prebuiltContractTypes["pack"],
|
||||
schema: PackContractSchema,
|
||||
roles: ["admin", "minter", "asset", "transfer"] as const,
|
||||
roles: PACK_CONTRACT_ROLES,
|
||||
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
@@ -389,7 +397,7 @@ export const PackInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
): Promise<Abi> => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -408,7 +416,7 @@ export const SignatureDropInitializer = {
|
||||
name: "SignatureDrop" as const,
|
||||
contractType: prebuiltContractTypes["signature-drop"],
|
||||
schema: DropErc721ContractSchema,
|
||||
roles: ["admin", "minter", "transfer"] as const,
|
||||
roles: NFT_BASE_CONTRACT_ROLES,
|
||||
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
@@ -431,7 +439,7 @@ export const SignatureDropInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -458,7 +466,7 @@ export const SplitInitializer = {
|
||||
name: "Split" as const,
|
||||
contractType: prebuiltContractTypes["split"],
|
||||
schema: SplitsContractSchema,
|
||||
roles: ["admin"] as const,
|
||||
roles: ADMIN_ROLE,
|
||||
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
@@ -481,7 +489,7 @@ export const SplitInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -498,7 +506,7 @@ export const TokenDropInitializer = {
|
||||
name: "DropERC20" as const,
|
||||
contractType: prebuiltContractTypes["token-drop"],
|
||||
schema: DropErc20ContractSchema,
|
||||
roles: ["admin", "transfer"] as const,
|
||||
roles: TOKEN_DROP_CONTRACT_ROLES,
|
||||
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
@@ -521,7 +529,7 @@ export const TokenDropInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -542,7 +550,7 @@ export const TokenInitializer = {
|
||||
name: "TokenERC20" as const,
|
||||
contractType: prebuiltContractTypes.token,
|
||||
schema: TokenErc20ContractSchema,
|
||||
roles: ["admin", "minter", "transfer"] as const,
|
||||
roles: NFT_BASE_CONTRACT_ROLES,
|
||||
initialize: async (
|
||||
...[network, address, storage, options]: InitalizeParams
|
||||
) => {
|
||||
@@ -564,7 +572,7 @@ export const TokenInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -605,7 +613,7 @@ export const VoteInitializer = {
|
||||
},
|
||||
getAbi: async (
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
provider: providers.Provider,
|
||||
storage: ThirdwebStorage,
|
||||
) => {
|
||||
const abi = await fetchAbiFromAddress(address, provider, storage);
|
||||
@@ -618,10 +626,7 @@ export const VoteInitializer = {
|
||||
},
|
||||
};
|
||||
|
||||
async function getContractInfo(
|
||||
address: Address,
|
||||
provider: ethers.providers.Provider,
|
||||
) {
|
||||
async function getContractInfo(address: Address, provider: providers.Provider) {
|
||||
try {
|
||||
return await getPrebuiltInfo(address, provider);
|
||||
} catch (e) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import { SDKOptions } from "../../schema/sdk-options";
|
||||
import { PrebuiltEditionDrop } from "../../types/eips";
|
||||
import { ThirdwebStorage, UploadProgressEvent } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Setup a collection of NFTs with a customizable number of each NFT that are minted as users claim them.
|
||||
@@ -44,7 +45,7 @@ import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
* @public
|
||||
*/
|
||||
export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
private static contractRoles = ["admin", "minter", "transfer"] as const;
|
||||
private static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public sales: ContractPrimarySale<PrebuiltEditionDrop>;
|
||||
|
||||
@@ -27,6 +27,7 @@ import { EditionMetadataOrUri } from "../../schema/tokens/edition";
|
||||
import type { TokenERC1155 } from "@thirdweb-dev/contracts-js";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create a collection of NFTs that lets you mint multiple copies of each NFT.
|
||||
@@ -43,7 +44,7 @@ import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
* @public
|
||||
*/
|
||||
export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
static contractRoles = ["admin", "minter", "transfer"] as const;
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public metadata: ContractMetadata<
|
||||
|
||||
@@ -34,6 +34,7 @@ import { NewOfferEventObject } from "@thirdweb-dev/contracts-js/dist/declaration
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
import { MARKETPLACE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create your own whitelabel marketplace that enables users to buy and sell any digital assets.
|
||||
@@ -50,7 +51,7 @@ import invariant from "tiny-invariant";
|
||||
* @public
|
||||
*/
|
||||
export class Marketplace implements UpdateableNetwork {
|
||||
static contractRoles = ["admin", "lister", "asset"] as const;
|
||||
static contractRoles = MARKETPLACE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
private contractWrapper: ContractWrapper<MarketplaceContract>;
|
||||
|
||||
@@ -32,6 +32,7 @@ import type {
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { CallOverrides } from "ethers";
|
||||
import { MARKETPLACE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create your own whitelabel marketplace that enables users to buy and sell any digital assets.
|
||||
@@ -48,7 +49,7 @@ import { CallOverrides } from "ethers";
|
||||
* @public
|
||||
*/
|
||||
export class MarketplaceV3 implements UpdateableNetwork {
|
||||
static contractRoles = ["admin", "lister", "asset"] as const;
|
||||
static contractRoles = MARKETPLACE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
private contractWrapper: ContractWrapper<MarketplaceV3Contract>;
|
||||
|
||||
@@ -32,10 +32,11 @@ import {
|
||||
TokensWrappedEvent,
|
||||
} from "@thirdweb-dev/contracts-js/dist/declarations/src/Multiwrap";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumberish, CallOverrides, ethers } from "ethers";
|
||||
import { type BigNumberish, type CallOverrides, utils } from "ethers";
|
||||
import { fetchCurrencyMetadata } from "../../common/currency/fetchCurrencyMetadata";
|
||||
import { hasERC20Allowance } from "../../common/currency/hasERC20Allowance";
|
||||
import { normalizePriceValue } from "../../common/currency/normalizePriceValue";
|
||||
import { MULTIWRAP_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Multiwrap lets you wrap any number of ERC20, ERC721 and ERC1155 tokens you own into a single wrapped token bundle.
|
||||
@@ -52,13 +53,7 @@ import { normalizePriceValue } from "../../common/currency/normalizePriceValue";
|
||||
* @beta
|
||||
*/
|
||||
export class Multiwrap extends StandardErc721<MultiwrapContract> {
|
||||
static contractRoles = [
|
||||
"admin",
|
||||
"transfer",
|
||||
"minter",
|
||||
"unwrap",
|
||||
"asset",
|
||||
] as const;
|
||||
static contractRoles = MULTIWRAP_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public encoder: ContractEncoder<MultiwrapContract>;
|
||||
@@ -171,7 +166,7 @@ export class Multiwrap extends StandardErc721<MultiwrapContract> {
|
||||
);
|
||||
erc20Tokens.push({
|
||||
contractAddress: token.assetContract,
|
||||
quantity: ethers.utils.formatUnits(
|
||||
quantity: utils.formatUnits(
|
||||
token.totalAmount,
|
||||
tokenMetadata.decimals,
|
||||
),
|
||||
|
||||
@@ -25,6 +25,7 @@ import { SDKOptions } from "../../schema/sdk-options";
|
||||
import type { TokenERC721 } from "@thirdweb-dev/contracts-js";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumberish, CallOverrides, constants } from "ethers";
|
||||
import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create a collection of one-of-one NFTs.
|
||||
@@ -41,7 +42,7 @@ import { BigNumberish, CallOverrides, constants } from "ethers";
|
||||
* @public
|
||||
*/
|
||||
export class NFTCollection extends StandardErc721<TokenERC721> {
|
||||
static contractRoles = ["admin", "minter", "transfer"] as const;
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public metadata: ContractMetadata<
|
||||
|
||||
@@ -33,6 +33,7 @@ import { PrebuiltNFTDrop } from "../../types/eips";
|
||||
import { UploadProgressEvent } from "../../types/events";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Setup a collection of one-of-one NFTs that are minted as users claim them.
|
||||
@@ -49,7 +50,7 @@ import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
* @public
|
||||
*/
|
||||
export class NFTDrop extends StandardErc721<PrebuiltNFTDrop> {
|
||||
static contractRoles = ["admin", "minter", "transfer"] as const;
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public encoder: ContractEncoder<PrebuiltNFTDrop>;
|
||||
|
||||
@@ -45,10 +45,17 @@ import {
|
||||
PackOpenedEvent,
|
||||
} from "@thirdweb-dev/contracts-js/dist/declarations/src/Pack";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, CallOverrides, ethers } from "ethers";
|
||||
import {
|
||||
BigNumber,
|
||||
type BigNumberish,
|
||||
type CallOverrides,
|
||||
constants,
|
||||
utils,
|
||||
} from "ethers";
|
||||
import { fetchCurrencyMetadata } from "../../common/currency/fetchCurrencyMetadata";
|
||||
import { hasERC20Allowance } from "../../common/currency/hasERC20Allowance";
|
||||
import { normalizePriceValue } from "../../common/currency/normalizePriceValue";
|
||||
import { PACK_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create lootboxes of NFTs with rarity based open mechanics.
|
||||
@@ -65,7 +72,7 @@ import { normalizePriceValue } from "../../common/currency/normalizePriceValue";
|
||||
* @public
|
||||
*/
|
||||
export class Pack extends StandardErc1155<PackContract> {
|
||||
static contractRoles = ["admin", "minter", "asset", "transfer"] as const;
|
||||
static contractRoles = PACK_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public metadata: ContractMetadata<PackContract, typeof PackContractSchema>;
|
||||
@@ -243,7 +250,7 @@ export class Pack extends StandardErc1155<PackContract> {
|
||||
public async isTransferRestricted(): Promise<boolean> {
|
||||
const anyoneCanTransfer = await this.contractWrapper.readContract.hasRole(
|
||||
getRoleHash("transfer"),
|
||||
ethers.constants.AddressZero,
|
||||
constants.AddressZero,
|
||||
);
|
||||
return !anyoneCanTransfer;
|
||||
}
|
||||
@@ -283,11 +290,11 @@ export class Pack extends StandardErc1155<PackContract> {
|
||||
this.contractWrapper.getProvider(),
|
||||
reward.assetContract,
|
||||
);
|
||||
const quantityPerReward = ethers.utils.formatUnits(
|
||||
const quantityPerReward = utils.formatUnits(
|
||||
amount,
|
||||
tokenMetadata.decimals,
|
||||
);
|
||||
const totalRewards = ethers.utils.formatUnits(
|
||||
const totalRewards = utils.formatUnits(
|
||||
BigNumber.from(reward.totalAmount).div(amount),
|
||||
tokenMetadata.decimals,
|
||||
);
|
||||
@@ -619,7 +626,7 @@ export class Pack extends StandardErc1155<PackContract> {
|
||||
);
|
||||
erc20Rewards.push({
|
||||
contractAddress: reward.assetContract,
|
||||
quantityPerReward: ethers.utils
|
||||
quantityPerReward: utils
|
||||
.formatUnits(reward.totalAmount, tokenMetadata.decimals)
|
||||
.toString(),
|
||||
});
|
||||
|
||||
@@ -35,6 +35,7 @@ import { UploadProgressEvent } from "../../types/events";
|
||||
import type { SignatureDrop as SignatureDropContract } from "@thirdweb-dev/contracts-js";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
import { NFT_BASE_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Setup a collection of NFTs where when it comes to minting, you can authorize
|
||||
@@ -53,7 +54,7 @@ import { BigNumber, BigNumberish, CallOverrides, constants } from "ethers";
|
||||
* @public
|
||||
*/
|
||||
export class SignatureDrop extends StandardErc721<SignatureDropContract> {
|
||||
static contractRoles = ["admin", "minter", "transfer"] as const;
|
||||
static contractRoles = NFT_BASE_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public owner: ContractOwner<SignatureDropContract>;
|
||||
|
||||
@@ -26,6 +26,7 @@ import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, CallOverrides, Contract } from "ethers";
|
||||
import { fetchCurrencyValue } from "../../common/currency/fetchCurrencyValue";
|
||||
import { ADMIN_ROLE } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create custom royalty splits to distribute funds.
|
||||
@@ -42,7 +43,7 @@ import { fetchCurrencyValue } from "../../common/currency/fetchCurrencyValue";
|
||||
* @public
|
||||
*/
|
||||
export class Split implements UpdateableNetwork {
|
||||
static contractRoles = ["admin"] as const;
|
||||
static contractRoles = ADMIN_ROLE;
|
||||
|
||||
private contractWrapper: ContractWrapper<SplitContract>;
|
||||
private storage: ThirdwebStorage;
|
||||
|
||||
@@ -24,6 +24,7 @@ import type { CurrencyValue, Amount } from "../../types/currency";
|
||||
import { PrebuiltTokenDrop } from "../../types/eips";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { CallOverrides, constants } from "ethers";
|
||||
import { TOKEN_DROP_CONTRACT_ROLES } from "../contractRoles";
|
||||
|
||||
/**
|
||||
* Create a Drop contract for a standard crypto token or cryptocurrency.
|
||||
@@ -39,7 +40,7 @@ import { CallOverrides, constants } from "ethers";
|
||||
*
|
||||
*/
|
||||
export class TokenDrop extends StandardErc20<PrebuiltTokenDrop> {
|
||||
static contractRoles = ["admin", "transfer"] as const;
|
||||
static contractRoles = TOKEN_DROP_CONTRACT_ROLES;
|
||||
|
||||
public abi: Abi;
|
||||
public metadata: ContractMetadata<
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user