Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ce366f59e | ||
|
|
8a2d92046a | ||
|
|
45ae105ed3 | ||
|
|
23d61cfeff | ||
|
|
990c665de9 | ||
|
|
08eaefcf0b | ||
|
|
3d62278aba | ||
|
|
3ab7d1e975 | ||
|
|
c6f44722f9 | ||
|
|
e0ce4a3759 | ||
|
|
04416e7c93 | ||
|
|
5166b24a48 | ||
|
|
bb7ca20e49 | ||
|
|
f41f1a2958 | ||
|
|
d9b7360d1d | ||
|
|
8941b22682 |
@@ -59,9 +59,15 @@ To begin:
|
||||
```
|
||||
pnpm install
|
||||
```
|
||||
If you are on windows, use the `--ignore-scripts` flag
|
||||
```
|
||||
pnpm install --ignore-scripts
|
||||
```
|
||||
|
||||
Now you have got the repo on your local machine, and you're ready to start making your changes!
|
||||
|
||||
<br/>
|
||||
|
||||
### Test Your Changes
|
||||
|
||||
We use [yalc](https://github.com/wclr/yalc) to test changes locally.
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 3.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939)]:
|
||||
- @thirdweb-dev/wallets@0.3.1
|
||||
|
||||
## 3.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/chains
|
||||
|
||||
## 0.1.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1192](https://github.com/thirdweb-dev/js/pull/1192) [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89) Thanks [@jnsdls](https://github.com/jnsdls)! - fix arbitrum goerli infura url
|
||||
|
||||
## 0.1.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -19,8 +19,8 @@ export default {
|
||||
"networkId": 1,
|
||||
"icon": {
|
||||
"url": "ipfs://QmT7PSXBiVBma6E15hNkivmstqLu3JSnG1jXN5pTmcCGRC",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"width": 180,
|
||||
"height": 180,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
|
||||
@@ -2,12 +2,6 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Metaplayerone Dubai Testnet",
|
||||
"chain": "MP1 Dubai-Testnet",
|
||||
"icon": {
|
||||
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
|
||||
"width": 42,
|
||||
"height": 23,
|
||||
"format": "svg"
|
||||
},
|
||||
"rpc": [
|
||||
"https://metaplayerone-dubai-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-dubai.mp1network.com/"
|
||||
@@ -26,12 +20,6 @@ export default {
|
||||
{
|
||||
"name": "MP1Scan",
|
||||
"url": "https://dubai.mp1scan.io",
|
||||
"icon": {
|
||||
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
|
||||
"width": 42,
|
||||
"height": 23,
|
||||
"format": "svg"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -21,8 +21,8 @@ export default {
|
||||
"networkId": 1,
|
||||
"icon": {
|
||||
"url": "ipfs://QmT7PSXBiVBma6E15hNkivmstqLu3JSnG1jXN5pTmcCGRC",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"width": 180,
|
||||
"height": 180,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
|
||||
@@ -24,22 +24,10 @@ export default {
|
||||
"shortName": "ncnt",
|
||||
"chainId": 303,
|
||||
"networkId": 303,
|
||||
"icon": {
|
||||
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||
"width": 62,
|
||||
"height": 59,
|
||||
"format": "svg"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "neuroscan",
|
||||
"url": "https://testnet.ncnscan.com",
|
||||
"icon": {
|
||||
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||
"width": 62,
|
||||
"height": 59,
|
||||
"format": "svg"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -25,22 +25,10 @@ export default {
|
||||
"shortName": "ncn",
|
||||
"chainId": 313,
|
||||
"networkId": 313,
|
||||
"icon": {
|
||||
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||
"width": 62,
|
||||
"height": 59,
|
||||
"format": "svg"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "neuroscan",
|
||||
"url": "https://ncnscan.com",
|
||||
"icon": {
|
||||
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||
"width": 62,
|
||||
"height": 59,
|
||||
"format": "svg"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
"rpc": [
|
||||
"https://arbitrum-goerli.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://goerli-rollup.arbitrum.io/rpc/"
|
||||
],
|
||||
"faucets": [],
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
format: "png",
|
||||
},
|
||||
rpc: [
|
||||
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/chains",
|
||||
"version": "0.1.21",
|
||||
"version": "0.1.22",
|
||||
"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,13 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.10.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
|
||||
- @thirdweb-dev/sdk@3.10.23
|
||||
- @thirdweb-dev/chains@0.1.22
|
||||
|
||||
## 0.10.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.10.23",
|
||||
"version": "0.10.24",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @thirdweb-dev/contracts-js
|
||||
|
||||
## 1.3.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1197](https://github.com/thirdweb-dev/js/pull/1197) [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added Zora drop ABI
|
||||
|
||||
- [#1134](https://github.com/thirdweb-dev/js/pull/1134) [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94) Thanks [@nkrishang](https://github.com/nkrishang)! - Introduce SmartWallet sdk class
|
||||
|
||||
## 1.3.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/contracts-js",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"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.5"
|
||||
"@thirdweb-dev/contracts": "3.5.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
@@ -41,7 +41,7 @@
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"clean": "rm -rf dist/",
|
||||
"typechain": "rm -rf ./src && typechain --target ethers-v5 --out-dir src './node_modules/@thirdweb-dev/contracts/abi/*.json'",
|
||||
"typechain": "rm -rf ./src && cp ./external_abis/*.json ./node_modules/@thirdweb-dev/contracts/abi && typechain --target ethers-v5 --out-dir src './node_modules/@thirdweb-dev/contracts/abi/*.json'",
|
||||
"extract-abi": "node ./scripts/extract-abis.mjs",
|
||||
"build": "pnpm typechain && tsc && pnpm preconstruct build && pnpm extract-abi",
|
||||
"push": "yalc push"
|
||||
|
||||
@@ -9,15 +9,20 @@ import {
|
||||
import { basename, join, resolve } from "path";
|
||||
|
||||
const main = () => {
|
||||
const libFolder = resolve(
|
||||
const sourceFolders = [];
|
||||
sourceFolders.push(resolve(
|
||||
"node_modules",
|
||||
"@thirdweb-dev/contracts/abi",
|
||||
);
|
||||
));
|
||||
sourceFolders.push(resolve(
|
||||
"external_abis",
|
||||
));
|
||||
const destinationFolder = "./dist/abis";
|
||||
if (existsSync(destinationFolder)) {
|
||||
rmSync(destinationFolder, { recursive: true });
|
||||
}
|
||||
mkdirSync(destinationFolder);
|
||||
for(const libFolder of sourceFolders) {
|
||||
const abiFiles = readdirSync(libFolder);
|
||||
for (const abiFile of abiFiles) {
|
||||
const contractJsonFile = readFileSync(join(libFolder, abiFile), "utf-8");
|
||||
@@ -28,6 +33,7 @@ const main = () => {
|
||||
JSON.stringify(abi, null, 2),
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["thirdweb"],
|
||||
plugins: ["better-tree-shaking"],
|
||||
rules: {
|
||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1206](https://github.com/thirdweb-dev/js/pull/1206) [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939) Thanks [@MananTank](https://github.com/MananTank)! - Add eslint-plugin-better-tree-shaking
|
||||
|
||||
- [#1193](https://github.com/thirdweb-dev/js/pull/1193) [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a) Thanks [@jnsdls](https://github.com/jnsdls)! - add shared metadata extension (open edition)
|
||||
|
||||
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
|
||||
- @thirdweb-dev/sdk@3.10.23
|
||||
- @thirdweb-dev/wallets@0.3.1
|
||||
- @thirdweb-dev/chains@0.1.22
|
||||
|
||||
## 3.14.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.14.0",
|
||||
"version": "3.14.1",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
@@ -87,6 +87,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-config-thirdweb": "workspace:*",
|
||||
"eslint-plugin-better-tree-shaking": "0.0.3",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars, better-tree-shaking/no-top-level-side-effects
|
||||
export const __DEV__ = process.env.NODE_ENV !== "production";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
export const ThirdwebThemeContext = createContext<"light" | "dark" | undefined>(
|
||||
undefined,
|
||||
);
|
||||
export const ThirdwebThemeContext = /* @__PURE__ */ createContext<
|
||||
"light" | "dark" | undefined
|
||||
>(undefined);
|
||||
|
||||
@@ -88,7 +88,7 @@ type ThirdwebWalletContextData = {
|
||||
getWalletConfig: (walletInstance: WalletInstance) => WalletConfig | undefined;
|
||||
};
|
||||
|
||||
const ThirdwebWalletContext = createContext<
|
||||
const ThirdwebWalletContext = /* @__PURE__ */ createContext<
|
||||
ThirdwebWalletContextData | undefined
|
||||
>(undefined);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export interface ThirdwebAuthConfig {
|
||||
|
||||
export interface ThirdwebAuthContext extends ThirdwebAuthConfig {}
|
||||
|
||||
export const ThirdwebAuthContext = createContext<
|
||||
export const ThirdwebAuthContext = /* @__PURE__ */ createContext<
|
||||
ThirdwebAuthContext | undefined
|
||||
>(undefined);
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@ interface ThirdwebConfigContext {
|
||||
infuraApiKey?: string;
|
||||
}
|
||||
|
||||
const ThirdwebConfigContext = createContext<ThirdwebConfigContext>({
|
||||
chains: defaultChains,
|
||||
});
|
||||
const ThirdwebConfigContext =
|
||||
/* @__PURE__ */ createContext<ThirdwebConfigContext>({
|
||||
chains: defaultChains,
|
||||
});
|
||||
|
||||
export const ThirdwebConfigProvider: React.FC<
|
||||
PropsWithChildren<{
|
||||
|
||||
@@ -26,7 +26,9 @@ const INITIAL_CONTEXT_VALUE: ThirdwebConnectedWalletContext = {
|
||||
};
|
||||
|
||||
const ThirdwebConnectedWalletContext =
|
||||
createContext<ThirdwebConnectedWalletContext>(INITIAL_CONTEXT_VALUE);
|
||||
/* @__PURE__ */ createContext<ThirdwebConnectedWalletContext>(
|
||||
INITIAL_CONTEXT_VALUE,
|
||||
);
|
||||
|
||||
export const ThirdwebConnectedWalletProvider: React.FC<
|
||||
PropsWithChildren<{ signer?: Signer }>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { BasicNFTInput } from "@thirdweb-dev/sdk/dist/declarations/src/core/schema/nft";
|
||||
import {
|
||||
requiredParamInvariant,
|
||||
RequiredParam,
|
||||
@@ -676,3 +677,34 @@ export function useBurnNFT<TContract extends NFTContract>(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set shared metadata
|
||||
* TODO add docs
|
||||
* @private
|
||||
*/
|
||||
export function useSetSharedMetadata<TContract extends NFTContract>(
|
||||
contract: RequiredParam<TContract>,
|
||||
) {
|
||||
const activeChainId = useSDKChainId();
|
||||
const contractAddress = contract?.getAddress();
|
||||
const queryClient = useQueryClient();
|
||||
const { erc721 } = getErcs(contract);
|
||||
|
||||
return useMutation(
|
||||
async (data: BasicNFTInput) => {
|
||||
if (erc721) {
|
||||
return await erc721.sharedMetadata.set(data);
|
||||
}
|
||||
invariant(false, "Unknown NFT type");
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
invalidateContractAndBalances(
|
||||
queryClient,
|
||||
contractAddress,
|
||||
activeChainId,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ export {
|
||||
useTransferNFT,
|
||||
useAirdropNFT,
|
||||
useBurnNFT,
|
||||
useSetSharedMetadata,
|
||||
} from "./hooks/async/nft";
|
||||
|
||||
// roles
|
||||
|
||||
@@ -14,7 +14,7 @@ interface TWSDKContext {
|
||||
_inProvider?: true;
|
||||
}
|
||||
|
||||
const ThirdwebSDKContext = createContext<TWSDKContext>({});
|
||||
const ThirdwebSDKContext = /* @__PURE__ */ createContext<TWSDKContext>({});
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -21,9 +21,9 @@ export interface ThirdwebAuthConfig {
|
||||
|
||||
interface ThirdwebAuthContext extends ThirdwebAuthConfig {}
|
||||
|
||||
const ThirdwebAuthContext = createContext<ThirdwebAuthContext | undefined>(
|
||||
undefined,
|
||||
);
|
||||
const ThirdwebAuthContext = /* @__PURE__ */ createContext<
|
||||
ThirdwebAuthContext | undefined
|
||||
>(undefined);
|
||||
|
||||
export const ThirdwebAuthProvider: React.FC<
|
||||
PropsWithChildren<{ value?: ThirdwebAuthConfig }>
|
||||
|
||||
@@ -94,7 +94,7 @@ interface ThirdwebSDKContext {
|
||||
desiredNetwork: string;
|
||||
_inProvider?: true;
|
||||
}
|
||||
const ThirdwebSDKContext = createContext<ThirdwebSDKContext>({
|
||||
const ThirdwebSDKContext = /* @__PURE__ */ createContext<ThirdwebSDKContext>({
|
||||
sdk: null,
|
||||
desiredNetwork: "unknown",
|
||||
});
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.2.20
|
||||
|
||||
## 0.2.19
|
||||
|
||||
## 0.2.18
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.2.19",
|
||||
"version": "0.2.20",
|
||||
"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,45 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.2.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1202](https://github.com/thirdweb-dev/js/pull/1202) [`04416e7c`](https://github.com/thirdweb-dev/js/commit/04416e7c93d3b090fe0145ada6de5dbec211e29d) Thanks [@iketw](https://github.com/iketw)! - [RN] Return connection Promise in wallets hooks for better error handling
|
||||
|
||||
- [#1205](https://github.com/thirdweb-dev/js/pull/1205) [`3ab7d1e9`](https://github.com/thirdweb-dev/js/commit/3ab7d1e97541ad5ff4f58ec2885fda9f9ab1a7c6) Thanks [@iketw](https://github.com/iketw)! - [RN] Added the option to import a new wallet in guest mode
|
||||
|
||||
- [#1205](https://github.com/thirdweb-dev/js/pull/1205) [`3ab7d1e9`](https://github.com/thirdweb-dev/js/commit/3ab7d1e97541ad5ff4f58ec2885fda9f9ab1a7c6) 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 [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.2.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.2.19",
|
||||
"version": "0.2.20",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
export * from "./back";
|
||||
export * from "./close";
|
||||
export * from "./copy";
|
||||
export * from "./disconnect";
|
||||
export * from "./down-arrow";
|
||||
export * from "./eye-closed";
|
||||
export * from "./eye-opened";
|
||||
export * from "./qr-code";
|
||||
export * from "./right-arrow";
|
||||
export * from "./wallet";
|
||||
export * from "./money";
|
||||
export * from "./switch";
|
||||
@@ -0,0 +1,22 @@
|
||||
import Svg, { Circle, Path } from "react-native-svg";
|
||||
import { IconStyleProp } from "./types";
|
||||
|
||||
const MoneyIcon = ({ width, height, color }: IconStyleProp) => {
|
||||
return (
|
||||
<Svg width={width} height={height} viewBox="0 0 16 16" fill="none">
|
||||
<Circle
|
||||
cx="8"
|
||||
cy="8"
|
||||
r="6.335"
|
||||
stroke={color || "#646D7A"}
|
||||
stroke-width="1.33"
|
||||
/>
|
||||
<Path
|
||||
d="M7.82244 11.7273V4.45455H8.28835V11.7273H7.82244ZM8.9446 6.92614C8.92566 6.7178 8.84138 6.55587 8.69176 6.44034C8.54403 6.32292 8.33286 6.2642 8.05824 6.2642C7.87642 6.2642 7.72491 6.28788 7.60369 6.33523C7.48248 6.38258 7.39157 6.44792 7.33097 6.53125C7.27036 6.61269 7.23911 6.70644 7.23722 6.8125C7.23343 6.89962 7.25047 6.97633 7.28835 7.04261C7.32813 7.1089 7.38494 7.16761 7.45881 7.21875C7.53456 7.26799 7.62547 7.31155 7.73153 7.34943C7.83759 7.38731 7.95691 7.42045 8.08949 7.44886L8.58949 7.5625C8.87737 7.625 9.13116 7.70833 9.35085 7.8125C9.57244 7.91667 9.75805 8.04072 9.90767 8.18466C10.0592 8.3286 10.1738 8.49432 10.2514 8.68182C10.3291 8.86932 10.3688 9.07955 10.3707 9.3125C10.3688 9.67992 10.276 9.99527 10.0923 10.2585C9.90862 10.5218 9.64441 10.7235 9.29972 10.8636C8.95691 11.0038 8.54309 11.0739 8.05824 11.0739C7.5715 11.0739 7.14725 11.0009 6.78551 10.8551C6.42377 10.7093 6.14252 10.4877 5.94176 10.1903C5.741 9.89299 5.63778 9.51705 5.6321 9.0625H6.97869C6.99006 9.25 7.04025 9.40625 7.12926 9.53125C7.21828 9.65625 7.34044 9.75095 7.49574 9.81534C7.65294 9.87973 7.83475 9.91193 8.04119 9.91193C8.23059 9.91193 8.39157 9.88636 8.52415 9.83523C8.65862 9.78409 8.76184 9.71307 8.83381 9.62216C8.90578 9.53125 8.94271 9.42708 8.9446 9.30966C8.94271 9.19981 8.90862 9.10606 8.84233 9.02841C8.77604 8.94886 8.67377 8.88068 8.53551 8.82386C8.39915 8.76515 8.22491 8.71117 8.01278 8.66193L7.40483 8.51989C6.90104 8.40436 6.50426 8.2178 6.21449 7.96023C5.92472 7.70076 5.78078 7.35038 5.78267 6.90909C5.78078 6.54924 5.87737 6.2339 6.07244 5.96307C6.26752 5.69223 6.53741 5.48106 6.8821 5.32955C7.2268 5.17803 7.61979 5.10227 8.06108 5.10227C8.51184 5.10227 8.90294 5.17898 9.23438 5.33239C9.56771 5.4839 9.82623 5.69697 10.0099 5.97159C10.1937 6.24621 10.2874 6.56439 10.2912 6.92614H8.9446Z"
|
||||
fill={color || "#646D7A"}
|
||||
/>
|
||||
</Svg>
|
||||
);
|
||||
};
|
||||
|
||||
export default MoneyIcon;
|
||||
@@ -0,0 +1,18 @@
|
||||
import Svg, { Path } from "react-native-svg";
|
||||
import { IconStyleProp } from "./types";
|
||||
|
||||
const SwitchIcon = ({ width, height, color }: IconStyleProp) => {
|
||||
return (
|
||||
<Svg width={width} height={height} viewBox="0 0 12 12" fill="none">
|
||||
<Path
|
||||
d="M7.99967 0.666626H10.6663M10.6663 0.666626V3.33329M10.6663 0.666626L7.83301 4.16663M1.33301 10.6666L3.99967 7.99996M7.99967 10.6666H10.6663M10.6663 10.6666V7.99996M10.6663 10.6666L1.33301 1.33329"
|
||||
stroke={color || "#646D7A"}
|
||||
stroke-width="1.33333"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</Svg>
|
||||
);
|
||||
};
|
||||
|
||||
export default SwitchIcon;
|
||||
@@ -1,8 +1,9 @@
|
||||
import Svg, { Path } from "react-native-svg";
|
||||
import { IconStyleProp } from "./types";
|
||||
|
||||
const PocketWalletIcon = ({ size }: { size: number }) => {
|
||||
const PocketWalletIcon = ({ width, height }: IconStyleProp) => {
|
||||
return (
|
||||
<Svg width={size} height={size} viewBox="0 0 16 16" fill="none">
|
||||
<Svg width={width} height={height} viewBox="0 0 16 16" fill="none">
|
||||
<Path
|
||||
d="M13.3337 7.99996V5.33329H4.00033C3.6467 5.33329 3.30756 5.19282 3.05752 4.94277C2.80747 4.69272 2.66699 4.35358 2.66699 3.99996C2.66699 3.26663 3.26699 2.66663 4.00033 2.66663H12.0003V5.33329"
|
||||
stroke="#646D7A"
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ import { StyleSheet, View } from "react-native";
|
||||
import Box from "../base/Box";
|
||||
import { Toast } from "../base/Toast";
|
||||
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
||||
import { NetworkButton } from "./NetworkButton";
|
||||
import { NetworkButton } from "../base/NetworkButton";
|
||||
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
|
||||
import {
|
||||
useActiveChain,
|
||||
@@ -113,7 +113,7 @@ export const ConnectWalletDetailsModal = () => {
|
||||
onPress={onExportLocalWalletPress}
|
||||
>
|
||||
<>
|
||||
<PocketWalletIcon size={16} />
|
||||
<PocketWalletIcon width={16} height={16} />
|
||||
<View style={styles.exportWalletInfo}>
|
||||
<Text variant="bodySmall">Backup wallet</Text>
|
||||
</View>
|
||||
@@ -134,7 +134,7 @@ export const ConnectWalletDetailsModal = () => {
|
||||
onPress={onImportLocalWalletPress}
|
||||
>
|
||||
<>
|
||||
<PocketWalletIcon size={16} />
|
||||
<PocketWalletIcon width={16} height={16} />
|
||||
<View style={styles.exportWalletInfo}>
|
||||
<Text variant="bodySmall">Import wallet</Text>
|
||||
</View>
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ export const SmartWalletAdditionalActions = ({
|
||||
onPress={onExportPress}
|
||||
>
|
||||
<>
|
||||
<PocketWalletIcon size={16} />
|
||||
<PocketWalletIcon width={16} height={16} />
|
||||
<View style={styles.exportWalletInfo}>
|
||||
<Text variant="bodySmall">
|
||||
{wallet?.walletId === walletIds.localWallet
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import { ReactNode } from "react";
|
||||
import { Theme } from "../../styles/theme";
|
||||
import BaseButton from "./BaseButton";
|
||||
import ImageSvgUri from "./ImageSvgUri";
|
||||
import Text from "./Text";
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
type IconTextProps = {
|
||||
icon?:
|
||||
| { iconUrl?: string; iconWidth?: number; iconHeight?: number }
|
||||
| ReactNode;
|
||||
text: string;
|
||||
padding?: keyof Theme["spacing"];
|
||||
onPress: () => void;
|
||||
} & (typeof BaseButton)["arguments"];
|
||||
|
||||
export const IconTextButton = ({
|
||||
icon,
|
||||
onPress,
|
||||
text,
|
||||
p,
|
||||
...args
|
||||
}: IconTextProps) => {
|
||||
return (
|
||||
<BaseButton
|
||||
p={p || "md"}
|
||||
backgroundColor="background"
|
||||
style={styles.networkContainer}
|
||||
onPress={onPress}
|
||||
borderColor="border"
|
||||
{...args}
|
||||
>
|
||||
{icon && icon.iconUrl ? (
|
||||
<ImageSvgUri
|
||||
imageUrl={icon.iconUrl}
|
||||
height={icon.iconHeight}
|
||||
width={icon.iconWidth}
|
||||
/>
|
||||
) : (
|
||||
icon
|
||||
)}
|
||||
<Text variant="bodySmall" style={styles.networkText}>
|
||||
{text}
|
||||
</Text>
|
||||
{/* <RightArrowIcon size={10} /> */}
|
||||
</BaseButton>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
networkText: {
|
||||
marginLeft: 16,
|
||||
},
|
||||
networkContainer: {
|
||||
borderRadius: 8,
|
||||
borderWidth: 0.5,
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
},
|
||||
});
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { Theme } from "../../styles/theme";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import { ChainIcon } from "../base/ChainIcon";
|
||||
import Text from "../base/Text";
|
||||
import BaseButton from "./BaseButton";
|
||||
import { ChainIcon } from "./ChainIcon";
|
||||
import Text from "./Text";
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
interface NetworkButtonProps {
|
||||
@@ -1,3 +1,4 @@
|
||||
export { IconTextButton } from "./IconTextButton";
|
||||
export { ActiveDot } from "./ActiveDot";
|
||||
export { AddressDisplay } from "./AddressDisplay";
|
||||
export { default as BaseButton } from "./BaseButton";
|
||||
@@ -11,3 +12,7 @@ export { TextInput } from "./TextInput";
|
||||
export { Toast } from "./Toast";
|
||||
export { WalletButton } from "./WalletButton";
|
||||
export { WalletIcon } from "./WalletIcon";
|
||||
export { NetworkButton } from "./NetworkButton";
|
||||
export { TWModal } from "./modal/TWModal";
|
||||
export { ModalFooter } from "./modal/ModalFooter";
|
||||
export { ModalHeaderTextClose } from "./modal/ModalHeaderTextClose";
|
||||
|
||||
@@ -39,6 +39,9 @@ export { createSecureStorage } from "../core/SecureStorage";
|
||||
// ui components
|
||||
export * from "./components/base";
|
||||
|
||||
// assets / icons
|
||||
export * from "./assets";
|
||||
|
||||
// providers
|
||||
// export * from "./providers/full";
|
||||
export * from "./providers/thirdweb-provider";
|
||||
|
||||
@@ -18,8 +18,11 @@ export function useCoinbaseWallet(callbackURL: string) {
|
||||
return useCallback(
|
||||
async (connectOptions?: { chainId?: number; callbackURL: string }) => {
|
||||
const { coinbaseWallet } = await import("../wallets/coinbase-wallet");
|
||||
// @ts-ignore
|
||||
connect(coinbaseWallet({ callbackURL: callbackURL }), connectOptions);
|
||||
return connect(
|
||||
// @ts-ignore
|
||||
coinbaseWallet({ callbackURL: callbackURL }),
|
||||
connectOptions,
|
||||
);
|
||||
},
|
||||
[connect, callbackURL],
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ export function useMetaMaskWallet() {
|
||||
return useCallback(
|
||||
async (connectOptions?: { chainId?: number }) => {
|
||||
const { metamaskWallet } = await import("../wallets/metamask-wallet");
|
||||
connect(metamaskWallet(), connectOptions);
|
||||
return connect(metamaskWallet(), connectOptions);
|
||||
},
|
||||
[connect],
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ export function useRainbowWallet() {
|
||||
return useCallback(
|
||||
async (connectOptions?: { chainId?: number }) => {
|
||||
const { rainbowWallet } = await import("../wallets/rainbow-wallet");
|
||||
connect(rainbowWallet(), connectOptions);
|
||||
return connect(rainbowWallet(), connectOptions);
|
||||
},
|
||||
[connect],
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ export function useTrustWallet() {
|
||||
return useCallback(
|
||||
async (connectOptions?: { chainId?: number }) => {
|
||||
const { trustWallet } = await import("../wallets/trust-wallet");
|
||||
connect(trustWallet(), connectOptions);
|
||||
return connect(trustWallet(), connectOptions);
|
||||
},
|
||||
[connect],
|
||||
);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["thirdweb"],
|
||||
plugins: ["better-tree-shaking"],
|
||||
rules: {
|
||||
"@next/next/no-img-element": "off",
|
||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1206](https://github.com/thirdweb-dev/js/pull/1206) [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939) Thanks [@MananTank](https://github.com/MananTank)! - Add eslint-plugin-better-tree-shaking
|
||||
|
||||
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
|
||||
- @thirdweb-dev/sdk@3.10.23
|
||||
- @thirdweb-dev/react-core@3.14.1
|
||||
- @thirdweb-dev/wallets@0.3.1
|
||||
- @thirdweb-dev/chains@0.1.22
|
||||
|
||||
## 3.14.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.14.0",
|
||||
"version": "3.14.1",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
@@ -107,6 +107,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-config-thirdweb": "workspace:*",
|
||||
"eslint-plugin-better-tree-shaking": "0.0.3",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
|
||||
@@ -3,7 +3,7 @@ import styled from "@emotion/styled";
|
||||
import { Chain } from "@thirdweb-dev/chains";
|
||||
import { resolveIpfsUri } from "@thirdweb-dev/react-core";
|
||||
|
||||
const defaultChainIcon = resolveIpfsUri(
|
||||
const defaultChainIcon = /* @__PURE__ */ resolveIpfsUri(
|
||||
"ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
|
||||
);
|
||||
|
||||
|
||||
@@ -28,6 +28,6 @@ export const CopyIcon: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
const CheckIconStyled = styled(CheckIcon)<{ theme?: Theme }>`
|
||||
const CheckIconStyled = /* @__PURE__ */ styled(CheckIcon)<{ theme?: Theme }>`
|
||||
color: ${(p) => p.theme.icon.success};
|
||||
`;
|
||||
|
||||
@@ -117,7 +117,9 @@ export const DragNDrop: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
const UploadIconSecondary = styled(UploadIcon)<{ theme?: Theme }>`
|
||||
const UploadIconSecondary = /* @__PURE__ */ styled(UploadIcon)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
color: ${(props) => props.theme.text.secondary};
|
||||
transition: transform 200ms ease, color 200ms ease;
|
||||
`;
|
||||
|
||||
@@ -152,7 +152,9 @@ const DialogContent = styled.div<{ theme?: Theme }>`
|
||||
}
|
||||
`;
|
||||
|
||||
const DialogTitle = styled(Dialog.Title)<{ theme?: Theme }>`
|
||||
const DialogTitle = /* @__PURE__ */ styled(/* @__PURE__ */ Dialog.Title)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
color: ${(p) => p.theme.text.neutral};
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { fontSize, radius, shadow, spacing, type Theme } from "../design-system";
|
||||
import {
|
||||
fontSize,
|
||||
radius,
|
||||
shadow,
|
||||
spacing,
|
||||
type Theme,
|
||||
} from "../design-system";
|
||||
import { keyframes } from "@emotion/react";
|
||||
import styled from "@emotion/styled";
|
||||
import * as RXPopover from "@radix-ui/react-popover";
|
||||
@@ -35,7 +41,9 @@ from {
|
||||
}
|
||||
`;
|
||||
|
||||
const PopoverContent = styled(RXPopover.Content)<{ theme?: Theme }>`
|
||||
const PopoverContent = /* @__PURE__ */ styled(
|
||||
/* @__PURE__ */ RXPopover.Content,
|
||||
)<{ theme?: Theme }>`
|
||||
border-radius: ${radius.sm};
|
||||
padding: ${spacing.sm} ${spacing.md};
|
||||
background-color: ${(p) => p.theme.bg.inverted};
|
||||
@@ -48,7 +56,9 @@ const PopoverContent = styled(RXPopover.Content)<{ theme?: Theme }>`
|
||||
font-size: ${fontSize.md};
|
||||
`;
|
||||
|
||||
const PopoverArrow = styled(RXPopover.Arrow)<{ theme?: Theme }>`
|
||||
const PopoverArrow = /* @__PURE__ */ styled(/* @__PURE__ */ RXPopover.Arrow)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
fill: ${(p) => p.theme.bg.inverted};
|
||||
`;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ const QRCodeContainer = styled.div`
|
||||
box-shadow: ${shadow.md};
|
||||
`;
|
||||
|
||||
const StyledReactQrCode = styled(ReactQrCode)`
|
||||
const StyledReactQrCode = /* @__PURE__ */ styled(ReactQrCode)`
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: ${radius.md};
|
||||
@@ -67,7 +67,7 @@ const StyledReactQrCode = styled(ReactQrCode)`
|
||||
}
|
||||
`;
|
||||
|
||||
const QRSkeleton = styled(Skeleton)`
|
||||
const QRSkeleton = /* @__PURE__ */ styled(Skeleton)`
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: ${radius.md};
|
||||
|
||||
@@ -40,7 +40,11 @@ to {
|
||||
}
|
||||
`;
|
||||
|
||||
const TooltipContent = styled(RadixTooltip.Content)<{ theme?: Theme }>`
|
||||
const TooltipContent = /* @__PURE__ */ styled(
|
||||
/* @__PURE__ */ RadixTooltip.Content,
|
||||
)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
background: ${(p) => p.theme.tooltip.bg};
|
||||
color: ${(p) => p.theme.tooltip.text};
|
||||
border-radius: ${radius.sm};
|
||||
@@ -56,6 +60,10 @@ const TooltipContent = styled(RadixTooltip.Content)<{ theme?: Theme }>`
|
||||
line-height: 1.5;
|
||||
`;
|
||||
|
||||
const TooltipArrow = styled(RadixTooltip.Arrow)<{ theme?: Theme }>`
|
||||
const TooltipArrow = /* @__PURE__ */ styled(
|
||||
/* @__PURE__ */ RadixTooltip.Arrow,
|
||||
)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
fill: ${(p) => p.theme.tooltip.bg};
|
||||
`;
|
||||
|
||||
@@ -5,7 +5,7 @@ import styled from "@emotion/styled";
|
||||
import { Title } from "@radix-ui/react-dialog";
|
||||
import { ChevronLeftIcon } from "@radix-ui/react-icons";
|
||||
|
||||
export const ModalTitle = styled(Title)<{
|
||||
export const ModalTitle = /* @__PURE__ */ styled(Title)<{
|
||||
theme?: Theme;
|
||||
centerOnMobile?: boolean;
|
||||
}>`
|
||||
|
||||
@@ -22,7 +22,7 @@ import React, {
|
||||
} from "react";
|
||||
import type { MediaRendererProps } from "./types";
|
||||
|
||||
const ModelViewer = lazy(() => import("./ModelViewer"));
|
||||
const ModelViewer = /* @__PURE__ */ lazy(() => import("./ModelViewer"));
|
||||
|
||||
interface PlayButtonProps {
|
||||
onClick: () => void;
|
||||
@@ -76,7 +76,10 @@ const PlayButton: React.FC<PlayButtonProps> = ({ onClick, isPlaying }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const VideoPlayer = React.forwardRef<HTMLVideoElement, MediaRendererProps>(
|
||||
const VideoPlayer = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLVideoElement,
|
||||
MediaRendererProps
|
||||
>(
|
||||
(
|
||||
{
|
||||
src,
|
||||
@@ -176,186 +179,189 @@ const VideoPlayer = React.forwardRef<HTMLVideoElement, MediaRendererProps>(
|
||||
|
||||
VideoPlayer.displayName = "VideoPlayer";
|
||||
|
||||
const AudioPlayer = React.forwardRef<HTMLAudioElement, MediaRendererProps>(
|
||||
({ src, alt, poster, style, height, width, ...restProps }, ref) => {
|
||||
const audioRef = useRef<HTMLAudioElement>(null);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const [muted, setMuted] = useState(true);
|
||||
const AudioPlayer = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLAudioElement,
|
||||
MediaRendererProps
|
||||
>(({ src, alt, poster, style, height, width, ...restProps }, ref) => {
|
||||
const audioRef = useRef<HTMLAudioElement>(null);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const [muted, setMuted] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (audioRef.current) {
|
||||
if (playing) {
|
||||
audioRef.current.play();
|
||||
} else {
|
||||
audioRef.current.pause();
|
||||
audioRef.current.currentTime = 0;
|
||||
}
|
||||
useEffect(() => {
|
||||
if (audioRef.current) {
|
||||
if (playing) {
|
||||
audioRef.current.play();
|
||||
} else {
|
||||
audioRef.current.pause();
|
||||
audioRef.current.currentTime = 0;
|
||||
}
|
||||
}, [playing]);
|
||||
}
|
||||
}, [playing]);
|
||||
|
||||
return (
|
||||
<div style={{ position: "relative", ...style }} {...restProps}>
|
||||
{poster ? (
|
||||
<img
|
||||
height={height}
|
||||
width={width}
|
||||
src={poster}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
pointerEvents: "none",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
alt={alt}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "grid",
|
||||
placeItems: "center",
|
||||
pointerEvents: "none",
|
||||
backgroundColor: "#fff",
|
||||
color: "rgb(138, 147, 155)",
|
||||
}}
|
||||
>
|
||||
<CarbonDocumentAudio style={{ height: "64px", width: "64px" }} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<PlayButton
|
||||
onClick={() => {
|
||||
setPlaying((prev) => !prev);
|
||||
setMuted(false);
|
||||
}}
|
||||
isPlaying={playing}
|
||||
/>
|
||||
<audio
|
||||
ref={mergeRefs([audioRef, ref])}
|
||||
src={src ?? undefined}
|
||||
loop
|
||||
playsInline
|
||||
muted={muted}
|
||||
preload="none"
|
||||
controlsList="nodownload"
|
||||
return (
|
||||
<div style={{ position: "relative", ...style }} {...restProps}>
|
||||
{poster ? (
|
||||
<img
|
||||
height={height}
|
||||
width={width}
|
||||
src={poster}
|
||||
style={{
|
||||
position: "absolute",
|
||||
opacity: 0,
|
||||
pointerEvents: "none",
|
||||
zIndex: -1,
|
||||
visibility: "hidden",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
AudioPlayer.displayName = "AudioPlayer";
|
||||
|
||||
const IframePlayer = React.forwardRef<HTMLIFrameElement, MediaRendererProps>(
|
||||
({ src, alt, poster, requireInteraction, style, ...restProps }, ref) => {
|
||||
const [playing, setPlaying] = useState(!requireInteraction);
|
||||
|
||||
return (
|
||||
<div style={{ position: "relative", ...style }} {...restProps}>
|
||||
<iframe
|
||||
src={playing ? src ?? undefined : undefined}
|
||||
ref={ref}
|
||||
style={{
|
||||
objectFit: "contain",
|
||||
zIndex: 1,
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
transition: "opacity .5s",
|
||||
opacity: !poster ? 1 : playing ? 1 : 0,
|
||||
pointerEvents: "none",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
sandbox="allow-scripts"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
alt={alt}
|
||||
/>
|
||||
{poster && (
|
||||
<img
|
||||
src={poster}
|
||||
style={{
|
||||
objectFit: "contain",
|
||||
pointerEvents: "none",
|
||||
position: "absolute",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
zIndex: 2,
|
||||
transition: "opacity .5s",
|
||||
opacity: playing ? 0 : 1,
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}}
|
||||
alt={alt}
|
||||
/>
|
||||
)}
|
||||
<PlayButton
|
||||
onClick={() => {
|
||||
setPlaying((prev) => !prev);
|
||||
}}
|
||||
isPlaying={playing}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
IframePlayer.displayName = "IframePlayer";
|
||||
|
||||
const LinkPlayer = React.forwardRef<HTMLAnchorElement, MediaRendererProps>(
|
||||
({ src, alt, style, ...restProps }, ref) => {
|
||||
return (
|
||||
<div style={{ position: "relative", ...style }} {...restProps}>
|
||||
) : (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "grid",
|
||||
placeItems: "center",
|
||||
pointerEvents: "none",
|
||||
backgroundColor: "#fff",
|
||||
color: "rgb(138, 147, 155)",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
<CarbonDocumentAudio style={{ height: "64px", width: "64px" }} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<PlayButton
|
||||
onClick={() => {
|
||||
setPlaying((prev) => !prev);
|
||||
setMuted(false);
|
||||
}}
|
||||
isPlaying={playing}
|
||||
/>
|
||||
<audio
|
||||
ref={mergeRefs([audioRef, ref])}
|
||||
src={src ?? undefined}
|
||||
loop
|
||||
playsInline
|
||||
muted={muted}
|
||||
preload="none"
|
||||
controlsList="nodownload"
|
||||
style={{
|
||||
position: "absolute",
|
||||
opacity: 0,
|
||||
pointerEvents: "none",
|
||||
zIndex: -1,
|
||||
visibility: "hidden",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
AudioPlayer.displayName = "AudioPlayer";
|
||||
|
||||
const IframePlayer = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLIFrameElement,
|
||||
MediaRendererProps
|
||||
>(({ src, alt, poster, requireInteraction, style, ...restProps }, ref) => {
|
||||
const [playing, setPlaying] = useState(!requireInteraction);
|
||||
|
||||
return (
|
||||
<div style={{ position: "relative", ...style }} {...restProps}>
|
||||
<iframe
|
||||
src={playing ? src ?? undefined : undefined}
|
||||
ref={ref}
|
||||
style={{
|
||||
objectFit: "contain",
|
||||
zIndex: 1,
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
transition: "opacity .5s",
|
||||
opacity: !poster ? 1 : playing ? 1 : 0,
|
||||
}}
|
||||
sandbox="allow-scripts"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
/>
|
||||
{poster && (
|
||||
<img
|
||||
src={poster}
|
||||
style={{
|
||||
objectFit: "contain",
|
||||
pointerEvents: "none",
|
||||
position: "absolute",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
zIndex: 2,
|
||||
transition: "opacity .5s",
|
||||
opacity: playing ? 0 : 1,
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}}
|
||||
alt={alt}
|
||||
/>
|
||||
)}
|
||||
<PlayButton
|
||||
onClick={() => {
|
||||
setPlaying((prev) => !prev);
|
||||
}}
|
||||
isPlaying={playing}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
IframePlayer.displayName = "IframePlayer";
|
||||
|
||||
const LinkPlayer = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLAnchorElement,
|
||||
MediaRendererProps
|
||||
>(({ src, alt, style, ...restProps }, ref) => {
|
||||
return (
|
||||
<div style={{ position: "relative", ...style }} {...restProps}>
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "grid",
|
||||
placeItems: "center",
|
||||
backgroundColor: "#fff",
|
||||
color: "rgb(138, 147, 155)",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "8px",
|
||||
alignItems: "center",
|
||||
flexWrap: "nowrap",
|
||||
}}
|
||||
>
|
||||
<CarbonDocumentUnknown
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "8px",
|
||||
alignItems: "center",
|
||||
flexWrap: "nowrap",
|
||||
maxWidth: "128px",
|
||||
minWidth: "48px",
|
||||
width: "50%",
|
||||
aspectRatio: "1",
|
||||
}}
|
||||
/>
|
||||
<a
|
||||
rel="noopener noreferrer"
|
||||
style={{
|
||||
textDecoration: "underline",
|
||||
color: "rgb(138, 147, 155)",
|
||||
}}
|
||||
href={src ?? undefined}
|
||||
target="_blank"
|
||||
ref={ref as unknown as React.LegacyRef<HTMLAnchorElement>}
|
||||
>
|
||||
<CarbonDocumentUnknown
|
||||
style={{
|
||||
maxWidth: "128px",
|
||||
minWidth: "48px",
|
||||
width: "50%",
|
||||
aspectRatio: "1",
|
||||
}}
|
||||
/>
|
||||
<a
|
||||
rel="noopener noreferrer"
|
||||
style={{
|
||||
textDecoration: "underline",
|
||||
color: "rgb(138, 147, 155)",
|
||||
}}
|
||||
href={src ?? undefined}
|
||||
target="_blank"
|
||||
ref={ref as unknown as React.LegacyRef<HTMLAnchorElement>}
|
||||
>
|
||||
{alt || "File"}
|
||||
</a>
|
||||
</div>
|
||||
{alt || "File"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
);
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
LinkPlayer.displayName = "LinkPlayer";
|
||||
|
||||
@@ -380,7 +386,7 @@ LinkPlayer.displayName = "LinkPlayer";
|
||||
*
|
||||
* You can try switching out the `src` prop to different types of URLs and media types to explore the possibilities.
|
||||
*/
|
||||
export const MediaRenderer = React.forwardRef<
|
||||
export const MediaRenderer = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLMediaElement,
|
||||
MediaRendererProps
|
||||
>(
|
||||
|
||||
@@ -11,23 +11,24 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
export const ModelViewer = React.forwardRef<HTMLDivElement, MediaRendererProps>(
|
||||
({ src, alt, poster, style }, ref) => {
|
||||
return (
|
||||
<div style={{ ...style }} ref={ref}>
|
||||
{src ? (
|
||||
<model-viewer
|
||||
src={src}
|
||||
alt={alt || "3D Model"}
|
||||
camera-controls
|
||||
poster={poster ? poster : null}
|
||||
style={{ width: "100%", height: "100%" } as CSSStyleDeclaration}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
);
|
||||
export const ModelViewer = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLDivElement,
|
||||
MediaRendererProps
|
||||
>(({ src, alt, poster, style }, ref) => {
|
||||
return (
|
||||
<div style={{ ...style }} ref={ref}>
|
||||
{src ? (
|
||||
<model-viewer
|
||||
src={src}
|
||||
alt={alt || "3D Model"}
|
||||
camera-controls
|
||||
poster={poster ? poster : null}
|
||||
style={{ width: "100%", height: "100%" } as CSSStyleDeclaration}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
ModelViewer.displayName = "ModelViewer";
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export interface ThirdwebNftMediaProps extends SharedMediaProps {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export const ThirdwebNftMedia = React.forwardRef<
|
||||
export const ThirdwebNftMedia = /* @__PURE__ */ React.forwardRef<
|
||||
HTMLMediaElement,
|
||||
ThirdwebNftMediaProps
|
||||
>(({ metadata, width = "300px", height = "300px", style, ...props }, ref) => {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars, better-tree-shaking/no-top-level-side-effects
|
||||
export const __DEV__ = process.env.NODE_ENV !== "production";
|
||||
|
||||
@@ -26,7 +26,9 @@ function useForceUpdate() {
|
||||
}, []);
|
||||
}
|
||||
|
||||
const useIsomorphicLayoutEffect = canUseDOM() ? useLayoutEffect : useEffect;
|
||||
const useIsomorphicLayoutEffect = /* @__PURE__ */ canUseDOM()
|
||||
? useLayoutEffect
|
||||
: useEffect;
|
||||
|
||||
/**
|
||||
* Portal from `@reach/portal`
|
||||
|
||||
@@ -8,16 +8,18 @@ type ModalConfig = {
|
||||
data: any;
|
||||
};
|
||||
|
||||
const WalletModalOpen = createContext(false);
|
||||
const SetWalletModalOpen = createContext<BoolSetter | undefined>(undefined);
|
||||
const WalletModalOpen = /* @__PURE__ */ createContext(false);
|
||||
const SetWalletModalOpen = /* @__PURE__ */ createContext<
|
||||
BoolSetter | undefined
|
||||
>(undefined);
|
||||
|
||||
export const ModalConfigCtx = createContext<ModalConfig>({
|
||||
export const ModalConfigCtx = /* @__PURE__ */ createContext<ModalConfig>({
|
||||
title: "",
|
||||
theme: "dark",
|
||||
data: undefined,
|
||||
});
|
||||
|
||||
export const SetModalConfigCtx = createContext<
|
||||
export const SetModalConfigCtx = /* @__PURE__ */ createContext<
|
||||
React.Dispatch<React.SetStateAction<ModalConfig>>
|
||||
>(() => {});
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = (props) => {
|
||||
});
|
||||
setIsWalletModalOpen(true);
|
||||
}}
|
||||
data-test="connect-wallet-button"
|
||||
data-test="connect-wallet-button"
|
||||
>
|
||||
{isLoading ? <Spinner size="sm" color="inverted" /> : btnTitle}
|
||||
</AnimatedButton>
|
||||
@@ -175,6 +175,6 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const AnimatedButton = styled(Button)`
|
||||
const AnimatedButton = /* @__PURE__ */ styled(Button)`
|
||||
animation: ${fadeInAnimation} 300ms ease;
|
||||
`;
|
||||
|
||||
@@ -108,7 +108,7 @@ export const ConnectedWalletDetails: React.FC<{
|
||||
className={`${TW_CONNECTED_WALLET} ${props.className || ""}`}
|
||||
data-theme={props.theme}
|
||||
style={props.style}
|
||||
data-test="connected-wallet-details"
|
||||
data-test="connected-wallet-details"
|
||||
>
|
||||
<ChainIcon
|
||||
chain={chain}
|
||||
@@ -458,7 +458,9 @@ const dropdownContentFade = keyframes`
|
||||
}
|
||||
`;
|
||||
|
||||
const DropDownContent = styled(DropdownMenu.Content)<{ theme?: Theme }>`
|
||||
const DropDownContent = /* @__PURE__ */ styled(
|
||||
/* @__PURE__ */ DropdownMenu.Content,
|
||||
)<{ theme?: Theme }>`
|
||||
width: 360px;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
@@ -576,19 +578,25 @@ const MenuButton = styled.button<{ theme?: Theme }>`
|
||||
}
|
||||
`;
|
||||
|
||||
const MenuLink = MenuButton.withComponent("a");
|
||||
const MenuLink = /* @__PURE__ */ MenuButton.withComponent("a");
|
||||
|
||||
export const DropdownMenuItem = styled(DropdownMenu.Item)<{ theme?: Theme }>`
|
||||
export const DropdownMenuItem = /* @__PURE__ */ styled(
|
||||
/* @__PURE__ */ DropdownMenu.Item,
|
||||
)<{ theme?: Theme }>`
|
||||
outline: none;
|
||||
`;
|
||||
|
||||
export const StyledChevronRightIcon = styled(ChevronRightIcon)<{
|
||||
export const StyledChevronRightIcon = /* @__PURE__ */ styled(
|
||||
/* @__PURE__ */ ChevronRightIcon,
|
||||
)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
color: ${(props) => props.theme.text.secondary};
|
||||
`;
|
||||
|
||||
const DisconnectIconButton = styled(IconButton)<{ theme?: Theme }>`
|
||||
const DisconnectIconButton = /* @__PURE__ */ styled(IconButton)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
margin-right: -${spacing.xxs};
|
||||
margin-left: auto;
|
||||
color: ${(props) => props.theme.icon.secondary};
|
||||
|
||||
@@ -374,7 +374,7 @@ const NetworkTab = (props: {
|
||||
);
|
||||
};
|
||||
|
||||
const NetworkList = memo(function NetworkList(props: {
|
||||
const NetworkList = /* @__PURE__ */ memo(function NetworkList(props: {
|
||||
chains: Chain[];
|
||||
onSwitch: (chain: Chain) => void;
|
||||
renderChain?: RenderChain;
|
||||
@@ -503,7 +503,9 @@ const NetworkList = memo(function NetworkList(props: {
|
||||
);
|
||||
});
|
||||
|
||||
const TabButton = styled(Tabs.Trigger)<{ theme?: Theme }>`
|
||||
const TabButton = /* @__PURE__ */ styled(/* @__PURE__ */ Tabs.Trigger)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
all: unset;
|
||||
font-size: ${fontSize.md};
|
||||
font-weight: 500;
|
||||
@@ -575,7 +577,7 @@ const NetworkButton = styled.button<{ theme?: Theme }>`
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledMagnifyingGlassIcon = styled(MagnifyingGlassIcon)<{
|
||||
const StyledMagnifyingGlassIcon = /* @__PURE__ */ styled(MagnifyingGlassIcon)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
color: ${(p) => p.theme.text.secondary};
|
||||
@@ -583,7 +585,7 @@ const StyledMagnifyingGlassIcon = styled(MagnifyingGlassIcon)<{
|
||||
left: 18px;
|
||||
`;
|
||||
|
||||
const SearchInput = styled(Input)<{ theme?: Theme }>`
|
||||
const SearchInput = /* @__PURE__ */ styled(Input)<{ theme?: Theme }>`
|
||||
padding: ${spacing.sm} ${spacing.md} ${spacing.sm} 60px;
|
||||
`;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ const TitleContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const Desc = styled(ModalDescription)`
|
||||
const Desc = /* @__PURE__ */ styled(ModalDescription)`
|
||||
${media.mobile} {
|
||||
max-width: 240px;
|
||||
margin: 0 auto;
|
||||
|
||||
@@ -65,7 +65,7 @@ const IconContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const Desc = styled(ModalDescription)`
|
||||
const Desc = /* @__PURE__ */ styled(ModalDescription)`
|
||||
${media.mobile} {
|
||||
padding: 0 ${spacing.lg};
|
||||
}
|
||||
|
||||
@@ -105,7 +105,9 @@ export function InputSelectionUI(props: {
|
||||
);
|
||||
}
|
||||
|
||||
const CircleInputButton = styled(InputButton)<{ theme?: Theme }>`
|
||||
const CircleInputButton = /* @__PURE__ */ styled(InputButton)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
background: ${(p) => p.theme.bg.highlighted};
|
||||
border-radius: 50%;
|
||||
padding: ${spacing.xxs};
|
||||
|
||||
@@ -3,8 +3,8 @@ import { coinbaseWallet } from "./coinbase/coinbaseWallet";
|
||||
import { metamaskWallet } from "./metamask/metamaskWallet";
|
||||
import { walletConnectV1 } from "./walletConnectV1";
|
||||
|
||||
export const defaultWallets: WalletConfig<any>[] = [
|
||||
export const defaultWallets: WalletConfig<any>[] = /* @__PURE__ */ (() => [
|
||||
metamaskWallet(),
|
||||
coinbaseWallet(),
|
||||
walletConnectV1(),
|
||||
];
|
||||
])();
|
||||
|
||||
@@ -395,6 +395,8 @@ const NetworkSelect = styled.select<{ theme?: Theme }>`
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledChevronDownIcon = styled(ChevronDownIcon)<{ theme?: Theme }>`
|
||||
const StyledChevronDownIcon = /* @__PURE__ */ styled(ChevronDownIcon)<{
|
||||
theme?: Theme;
|
||||
}>`
|
||||
color: ${(p) => p.theme.icon.secondary};
|
||||
`;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["thirdweb"],
|
||||
plugins: ["better-tree-shaking"],
|
||||
rules: {
|
||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||
},
|
||||
// allow all imports from within tests
|
||||
overrides: [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 3.10.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1196](https://github.com/thirdweb-dev/js/pull/1196) [`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c) Thanks [@MananTank](https://github.com/MananTank)! - refactor erc-721.ts, erc-1155.ts, erc-20.ts
|
||||
|
||||
- [#1208](https://github.com/thirdweb-dev/js/pull/1208) [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175) Thanks [@sebas5384](https://github.com/sebas5384)! - Updated gas station URL
|
||||
|
||||
- [#1134](https://github.com/thirdweb-dev/js/pull/1134) [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94) Thanks [@nkrishang](https://github.com/nkrishang)! - Introduce SmartWallet sdk class
|
||||
|
||||
- [#1199](https://github.com/thirdweb-dev/js/pull/1199) [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c) Thanks [@MananTank](https://github.com/MananTank)! - Add eslint-plugin-better-tree-shaking for improved tree-shaking
|
||||
|
||||
- [#1191](https://github.com/thirdweb-dev/js/pull/1191) [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7) Thanks [@kumaryash90](https://github.com/kumaryash90)! - OZ minimal forwarder addresses for zksync testnet and mainnet
|
||||
|
||||
- [#1198](https://github.com/thirdweb-dev/js/pull/1198) [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9) Thanks [@MananTank](https://github.com/MananTank)! - Better PURE annotations for tree shaking
|
||||
|
||||
- [#1193](https://github.com/thirdweb-dev/js/pull/1193) [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a) Thanks [@jnsdls](https://github.com/jnsdls)! - add shared metadata extension (open edition)
|
||||
|
||||
- [#1189](https://github.com/thirdweb-dev/js/pull/1189) [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf) Thanks [@MananTank](https://github.com/MananTank)! - Add PURE annotations to improve tree-shaking
|
||||
|
||||
- [#1197](https://github.com/thirdweb-dev/js/pull/1197) [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - contract.erc721.claim(quantity) now supports Zora contracts
|
||||
|
||||
- Updated dependencies [[`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89)]:
|
||||
- @thirdweb-dev/contracts-js@1.3.6
|
||||
- @thirdweb-dev/chains@0.1.22
|
||||
|
||||
## 3.10.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "3.10.22",
|
||||
"version": "3.10.23",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
@@ -127,6 +127,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-config-thirdweb": "workspace:*",
|
||||
"eslint-plugin-better-tree-shaking": "0.0.3",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
|
||||
@@ -5,15 +5,16 @@ import { z } from "zod";
|
||||
*/
|
||||
export const DEFAULT_QUERY_ALL_COUNT = 100;
|
||||
|
||||
export const QueryAllParamsSchema = z
|
||||
.object({
|
||||
start: z.number().default(0),
|
||||
count: z.number().default(DEFAULT_QUERY_ALL_COUNT),
|
||||
})
|
||||
.default({
|
||||
start: 0,
|
||||
count: DEFAULT_QUERY_ALL_COUNT,
|
||||
});
|
||||
export const QueryAllParamsSchema = /* @__PURE__ */ (() =>
|
||||
z
|
||||
.object({
|
||||
start: z.number().default(0),
|
||||
count: z.number().default(DEFAULT_QUERY_ALL_COUNT),
|
||||
})
|
||||
.default({
|
||||
start: 0,
|
||||
count: DEFAULT_QUERY_ALL_COUNT,
|
||||
}))();
|
||||
|
||||
/**
|
||||
* Pagination Parameters
|
||||
|
||||
@@ -9,47 +9,63 @@ import { z } from "zod";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CommonNFTInput = z
|
||||
.object({
|
||||
export const BasicNFTInput = /* @__PURE__ */ (() =>
|
||||
z.object({
|
||||
name: z.union([z.string(), z.number()]).optional().nullable(),
|
||||
description: z.string().nullable().optional().nullable(),
|
||||
image: FileOrBufferOrStringSchema.nullable().optional(),
|
||||
external_url: FileOrBufferOrStringSchema.nullable().optional(),
|
||||
|
||||
animation_url: FileOrBufferOrStringSchema.optional().nullable(),
|
||||
}))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CommonNFTInput = /* @__PURE__ */ (() =>
|
||||
BasicNFTInput.extend({
|
||||
external_url: FileOrBufferOrStringSchema.nullable().optional(),
|
||||
background_color: HexColor.optional().nullable(),
|
||||
properties: OptionalPropertiesInput,
|
||||
attributes: OptionalPropertiesInput,
|
||||
})
|
||||
.catchall(z.union([BigNumberTransformSchema, z.unknown()]));
|
||||
}).catchall(z.union([BigNumberTransformSchema, z.unknown()])))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const NFTInputOrUriSchema = z.union([CommonNFTInput, z.string()]);
|
||||
export const NFTInputOrUriSchema = /* @__PURE__ */ (() =>
|
||||
z.union([CommonNFTInput, z.string()]))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CommonNFTOutput = CommonNFTInput.extend({
|
||||
id: z.string(),
|
||||
uri: z.string(),
|
||||
image: z.string().nullable().optional(),
|
||||
external_url: z.string().nullable().optional(),
|
||||
animation_url: z.string().nullable().optional(),
|
||||
});
|
||||
export const CommonNFTOutput = /* @__PURE__ */ (() =>
|
||||
CommonNFTInput.extend({
|
||||
id: z.string(),
|
||||
uri: z.string(),
|
||||
image: z.string().nullable().optional(),
|
||||
external_url: z.string().nullable().optional(),
|
||||
animation_url: z.string().nullable().optional(),
|
||||
}))();
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type NFTMetadataInput = z.input<typeof CommonNFTInput>;
|
||||
export type BasicNFTInput = /* @__PURE__ */ z.input<typeof BasicNFTInput>;
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type NFTMetadataOrUri = z.input<typeof NFTInputOrUriSchema>;
|
||||
export type NFTMetadataInput = /* @__PURE__ */ z.input<typeof CommonNFTInput>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type NFTMetadata = z.output<typeof CommonNFTOutput>;
|
||||
export type NFTMetadataOrUri = /* @__PURE__ */ z.input<
|
||||
typeof NFTInputOrUriSchema
|
||||
>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type NFTMetadata = /* @__PURE__ */ z.output<typeof CommonNFTOutput>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { BigNumberTransformSchema } from "./shared";
|
||||
import { z } from "zod";
|
||||
|
||||
const PropertiesInput = z
|
||||
.object({})
|
||||
.catchall(z.union([BigNumberTransformSchema, z.unknown()]));
|
||||
const PropertiesInput = /* @__PURE__ */ (() =>
|
||||
z.object({}).catchall(z.union([BigNumberTransformSchema, z.unknown()])))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const OptionalPropertiesInput = z
|
||||
.union([z.array(PropertiesInput), PropertiesInput])
|
||||
.optional()
|
||||
.nullable();
|
||||
export const OptionalPropertiesInput = /* @__PURE__ */ (() =>
|
||||
z
|
||||
.union([z.array(PropertiesInput), PropertiesInput])
|
||||
.optional()
|
||||
.nullable())();
|
||||
|
||||
@@ -9,98 +9,104 @@ export const isBrowser = () => typeof window !== "undefined";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferUnionSchema = isBrowser()
|
||||
? (z.instanceof(File) as z.ZodType<InstanceType<typeof File>>)
|
||||
: (z.instanceof(Buffer) as z.ZodTypeAny); // @fixme, this is a hack to make browser happy for now
|
||||
export const FileOrBufferUnionSchema = /* @__PURE__ */ (() =>
|
||||
isBrowser()
|
||||
? (z.instanceof(File) as z.ZodType<InstanceType<typeof File>>)
|
||||
: // @fixme, this is a hack to make browser happy for now
|
||||
(z.instanceof(Buffer) as z.ZodTypeAny))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferSchema = z.union([
|
||||
FileOrBufferUnionSchema,
|
||||
z.object({
|
||||
data: z.union([FileOrBufferUnionSchema, z.string()]),
|
||||
name: z.string(),
|
||||
}),
|
||||
]);
|
||||
export const FileOrBufferSchema = /* @__PURE__ */ (() =>
|
||||
z.union([
|
||||
FileOrBufferUnionSchema,
|
||||
z.object({
|
||||
data: z.union([FileOrBufferUnionSchema, z.string()]),
|
||||
name: z.string(),
|
||||
}),
|
||||
]))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferOrStringSchema = z.union([
|
||||
FileOrBufferSchema,
|
||||
z.string(),
|
||||
]);
|
||||
export const FileOrBufferOrStringSchema = /* @__PURE__ */ (() =>
|
||||
z.union([FileOrBufferSchema, z.string()]))();
|
||||
|
||||
export const MAX_BPS = 10000;
|
||||
|
||||
export const BytesLikeSchema = z.union([z.array(z.number()), z.string()]);
|
||||
export const BytesLikeSchema = /* @__PURE__ */ (() =>
|
||||
z.union([z.array(z.number()), z.string()]))();
|
||||
|
||||
export const BigNumberSchema = z
|
||||
.union([
|
||||
z.string(),
|
||||
z.number(),
|
||||
z.bigint(),
|
||||
z.custom<BigNumber>((data) => {
|
||||
return BigNumber.isBigNumber(data);
|
||||
}),
|
||||
z.custom<BN>((data) => {
|
||||
return BN.isBN(data);
|
||||
}),
|
||||
])
|
||||
.transform((arg) => {
|
||||
let str = BN.isBN(arg)
|
||||
? new BN(arg).toString()
|
||||
: BigNumber.from(arg).toString();
|
||||
return BigNumber.from(str);
|
||||
});
|
||||
export const BigNumberSchema = /* @__PURE__ */ (() =>
|
||||
z
|
||||
.union([
|
||||
z.string(),
|
||||
z.number(),
|
||||
z.bigint(),
|
||||
z.custom<BigNumber>((data) => {
|
||||
return BigNumber.isBigNumber(data);
|
||||
}),
|
||||
z.custom<BN>((data) => {
|
||||
return BN.isBN(data);
|
||||
}),
|
||||
])
|
||||
.transform((arg) => {
|
||||
let str = BN.isBN(arg)
|
||||
? new BN(arg).toString()
|
||||
: BigNumber.from(arg).toString();
|
||||
return BigNumber.from(str);
|
||||
}))();
|
||||
|
||||
export const BigNumberishSchema = BigNumberSchema.transform((arg) =>
|
||||
arg.toString(),
|
||||
export const BigNumberishSchema = /* @__PURE__ */ BigNumberSchema.transform(
|
||||
(arg) => arg.toString(),
|
||||
);
|
||||
|
||||
export const BigNumberTransformSchema = z
|
||||
.union([
|
||||
z.bigint(),
|
||||
z.custom<BigNumber>((data) => {
|
||||
return BigNumber.isBigNumber(data);
|
||||
}),
|
||||
z.custom<BN>((data) => {
|
||||
return BN.isBN(data);
|
||||
}),
|
||||
])
|
||||
.transform((arg) => {
|
||||
if (BN.isBN(arg)) {
|
||||
return new BN(arg).toString();
|
||||
}
|
||||
return BigNumber.from(arg).toString();
|
||||
});
|
||||
export const BigNumberTransformSchema = /* @__PURE__ */ (() =>
|
||||
z
|
||||
.union([
|
||||
z.bigint(),
|
||||
z.custom<BigNumber>((data) => {
|
||||
return BigNumber.isBigNumber(data);
|
||||
}),
|
||||
z.custom<BN>((data) => {
|
||||
return BN.isBN(data);
|
||||
}),
|
||||
])
|
||||
.transform((arg) => {
|
||||
if (BN.isBN(arg)) {
|
||||
return new BN(arg).toString();
|
||||
}
|
||||
return BigNumber.from(arg).toString();
|
||||
}))();
|
||||
|
||||
export const BasisPointsSchema = z
|
||||
export const BasisPointsSchema = /* @__PURE__ */ z
|
||||
.number()
|
||||
.max(MAX_BPS, "Cannot exceed 100%")
|
||||
.min(0, "Cannot be below 0%");
|
||||
|
||||
export const PercentSchema = z
|
||||
export const PercentSchema = /* @__PURE__ */ z
|
||||
.number()
|
||||
.max(100, "Cannot exceed 100%")
|
||||
.min(0, "Cannot be below 0%");
|
||||
|
||||
export const HexColor = z.union([
|
||||
z.string().regex(/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, "Invalid hex color"),
|
||||
z
|
||||
.string()
|
||||
.regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, "Invalid hex color")
|
||||
.transform((val) => val.replace("#", "")),
|
||||
z.string().length(0),
|
||||
]);
|
||||
export const HexColor = /* @__PURE__ */ (() =>
|
||||
z.union([
|
||||
z.string().regex(/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, "Invalid hex color"),
|
||||
z
|
||||
.string()
|
||||
.regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, "Invalid hex color")
|
||||
.transform((val) => val.replace("#", "")),
|
||||
z.string().length(0),
|
||||
]))();
|
||||
|
||||
export const AmountSchema = z
|
||||
.union([
|
||||
z.string().regex(/^([0-9]+\.?[0-9]*|\.[0-9]+)$/, "Invalid amount"),
|
||||
z.number().min(0, "Amount cannot be negative"),
|
||||
])
|
||||
.transform((arg) => (typeof arg === "number" ? arg.toString() : arg));
|
||||
export const AmountSchema = /* @__PURE__ */ (() =>
|
||||
z
|
||||
.union([
|
||||
z.string().regex(/^([0-9]+\.?[0-9]*|\.[0-9]+)$/, "Invalid amount"),
|
||||
z.number().min(0, "Amount cannot be negative"),
|
||||
])
|
||||
.transform((arg) => (typeof arg === "number" ? arg.toString() : arg)))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -110,24 +116,25 @@ export type Amount = z.input<typeof AmountSchema>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const QuantitySchema = z
|
||||
.union([AmountSchema, z.literal("unlimited")])
|
||||
.default("unlimited");
|
||||
export const QuantitySchema = /* @__PURE__ */ (() =>
|
||||
z.union([AmountSchema, z.literal("unlimited")]).default("unlimited"))();
|
||||
|
||||
export type Quantity = z.output<typeof QuantitySchema>;
|
||||
|
||||
export const RawDateSchema = z.date().transform((i) => {
|
||||
export const RawDateSchema = /* @__PURE__ */ z.date().transform((i) => {
|
||||
return BigNumber.from(Math.floor(i.getTime() / 1000));
|
||||
});
|
||||
|
||||
/**
|
||||
* Default to now
|
||||
*/
|
||||
export const StartDateSchema = RawDateSchema.default(new Date(0));
|
||||
export const StartDateSchema = /* @__PURE__ */ (() =>
|
||||
RawDateSchema.default(new Date(0)))();
|
||||
|
||||
/**
|
||||
* Default to 10 years from now
|
||||
*/
|
||||
export const EndDateSchema = RawDateSchema.default(
|
||||
new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 10),
|
||||
);
|
||||
export const EndDateSchema = /* @__PURE__ */ (() =>
|
||||
RawDateSchema.default(
|
||||
new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 10),
|
||||
))();
|
||||
|
||||
@@ -4,22 +4,24 @@ import { z } from "zod";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CommonTokenInputSchema = z.object({
|
||||
name: z.string(),
|
||||
symbol: z.string(),
|
||||
decimals: z.number(),
|
||||
description: z.string().optional(),
|
||||
image: FileOrBufferOrStringSchema.optional(),
|
||||
external_link: z.string().url().optional(),
|
||||
});
|
||||
export const CommonTokenInputSchema = /* @__PURE__ */ (() =>
|
||||
z.object({
|
||||
name: z.string(),
|
||||
symbol: z.string(),
|
||||
decimals: z.number(),
|
||||
description: z.string().optional(),
|
||||
image: FileOrBufferOrStringSchema.optional(),
|
||||
external_link: z.string().url().optional(),
|
||||
}))();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CurrencyValueSchema = z.object({
|
||||
value: z.string(),
|
||||
displayValue: z.string(),
|
||||
});
|
||||
export const CurrencyValueSchema = /* @__PURE__ */ (() =>
|
||||
z.object({
|
||||
value: z.string(),
|
||||
displayValue: z.string(),
|
||||
}))();
|
||||
|
||||
/**
|
||||
* Currency value and display value
|
||||
@@ -30,10 +32,11 @@ export type CurrencyValue = z.input<typeof CurrencyValueSchema>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const CommonTokenOutputSchema = CommonTokenInputSchema.extend({
|
||||
image: z.string().optional(),
|
||||
supply: CurrencyValueSchema,
|
||||
}).catchall(z.unknown());
|
||||
export const CommonTokenOutputSchema = /* @__PURE__ */ (() =>
|
||||
CommonTokenInputSchema.extend({
|
||||
image: z.string().optional(),
|
||||
supply: CurrencyValueSchema,
|
||||
}).catchall(z.unknown()))();
|
||||
|
||||
/**
|
||||
* Metadata for a token
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChainId } from "../constants/chains/ChainId";
|
||||
import fetch from "cross-fetch";
|
||||
import { BigNumber, ethers } from "ethers";
|
||||
import { BigNumber, utils } from "ethers";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -8,14 +8,15 @@ import { BigNumber, ethers } from "ethers";
|
||||
function getGasStationUrl(chainId: ChainId.Polygon | ChainId.Mumbai): string {
|
||||
switch (chainId) {
|
||||
case ChainId.Polygon:
|
||||
return "https://gasstation-mainnet.matic.network/v2";
|
||||
return "https://gasstation.polygon.technology/v2";
|
||||
case ChainId.Mumbai:
|
||||
return "https://gasstation-mumbai.matic.today/v2";
|
||||
return "https://gasstation-testnet.polygon.technology/v2";
|
||||
}
|
||||
}
|
||||
|
||||
const MIN_POLYGON_GAS_PRICE = ethers.utils.parseUnits("31", "gwei");
|
||||
const MIN_MUMBAI_GAS_PRICE = ethers.utils.parseUnits("1", "gwei");
|
||||
const MIN_POLYGON_GAS_PRICE = /* @__PURE__ */ utils.parseUnits("31", "gwei");
|
||||
|
||||
const MIN_MUMBAI_GAS_PRICE = /* @__PURE__ */ utils.parseUnits("1", "gwei");
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -46,7 +47,7 @@ export async function getPolygonGasPriorityFee(
|
||||
const priorityFee = data["fast"]["maxPriorityFee"];
|
||||
if (priorityFee > 0) {
|
||||
const fixedFee = parseFloat(priorityFee).toFixed(9);
|
||||
return ethers.utils.parseUnits(fixedFee, "gwei");
|
||||
return utils.parseUnits(fixedFee, "gwei");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("failed to fetch gas", e);
|
||||
|
||||
@@ -21,7 +21,7 @@ export const EOAForwarder = {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const INFRA_CONTRACTS_MAP = {
|
||||
export const INFRA_CONTRACTS_MAP = /* @__PURE__ */ {
|
||||
[NativeTokenWrapper.contractType]: NativeTokenWrapper,
|
||||
[Forwarder.contractType]: Forwarder,
|
||||
[EOAForwarder.contractType]: EOAForwarder,
|
||||
|
||||
@@ -24,7 +24,7 @@ export type Role = keyof typeof roleMap;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const ALL_ROLES = Object.keys(roleMap) as Role[];
|
||||
export const ALL_ROLES = /* @__PURE__ */ Object.keys(roleMap) as Role[];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
||||
@@ -11,7 +11,7 @@ type DropContract = Extract<
|
||||
export const APPROVED_IMPLEMENTATIONS: Record<
|
||||
SUPPORTED_CHAIN_ID,
|
||||
Record<DropContract, string>
|
||||
> = {
|
||||
> = /* @__PURE__ */ {
|
||||
[ChainId.Mainnet]: {
|
||||
"nft-drop": "0x60fF9952e0084A6DEac44203838cDC91ABeC8736",
|
||||
"edition-drop": "0x74af262d0671F378F97a1EDC3d0970Dbe8A1C550",
|
||||
|
||||
@@ -24,7 +24,7 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
twRegistry: string;
|
||||
twBYOCRegistry: string;
|
||||
}
|
||||
> = {
|
||||
> = /* @__PURE__ */ {
|
||||
[ChainId.Mainnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
openzeppelinForwarderEOA: "0x76ce2CB1Ae48Fa067f4fb8c5f803111AE0B24BEA",
|
||||
|
||||
@@ -27,6 +27,8 @@ import {
|
||||
FEATURE_NFT_CLAIM_PHASES_V1,
|
||||
FEATURE_NFT_SIGNATURE_MINTABLE_V1,
|
||||
FEATURE_NFT_SIGNATURE_MINTABLE_V2,
|
||||
FEATURE_NFT_SHARED_METADATA,
|
||||
FEATURE_NFT_CLAIM_ZORA,
|
||||
} from "./erc721-features";
|
||||
import {
|
||||
FEATURE_EDITION,
|
||||
@@ -85,6 +87,7 @@ export type Feature =
|
||||
| typeof FEATURE_NFT_BATCH_MINTABLE
|
||||
| typeof FEATURE_NFT_LAZY_MINTABLE
|
||||
| typeof FEATURE_NFT_CLAIM_CUSTOM
|
||||
| typeof FEATURE_NFT_CLAIM_ZORA
|
||||
| typeof FEATURE_NFT_CLAIM_CONDITIONS_V1
|
||||
| typeof FEATURE_NFT_CLAIM_CONDITIONS_V2
|
||||
| typeof FEATURE_NFT_CLAIM_PHASES_V1
|
||||
@@ -94,6 +97,7 @@ export type Feature =
|
||||
| typeof FEATURE_NFT_SIGNATURE_MINTABLE_V2
|
||||
| typeof FEATURE_NFT_BURNABLE
|
||||
| typeof FEATURE_NFT_TIERED_DROP
|
||||
| typeof FEATURE_NFT_SHARED_METADATA
|
||||
| typeof FEATURE_EDITION
|
||||
| typeof FEATURE_EDITION_ENUMERABLE
|
||||
| typeof FEATURE_EDITION_MINTABLE
|
||||
@@ -125,6 +129,7 @@ export type Feature =
|
||||
| typeof FEATURE_OFFERS
|
||||
| typeof FEATURE_SMART_WALLET
|
||||
| typeof FEATURE_SMART_WALLET_FACTORY;
|
||||
|
||||
export type Extension = Feature;
|
||||
|
||||
/**
|
||||
@@ -147,7 +152,7 @@ export type ExtensionWithEnabled = Extension & {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const SUPPORTED_FEATURES: Record<string, Feature> = {
|
||||
export const SUPPORTED_FEATURES: Record<string, Feature> = /* @__PURE__ */ {
|
||||
[FEATURE_TOKEN.name]: FEATURE_TOKEN,
|
||||
[FEATURE_NFT.name]: FEATURE_NFT,
|
||||
[FEATURE_EDITION.name]: FEATURE_EDITION,
|
||||
|
||||
@@ -6,9 +6,10 @@ import { utils } from "ethers";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const InterfaceId_IERC721 = utils.arrayify("0x80ac58cd");
|
||||
export const InterfaceId_IERC721 = /* @__PURE__ */ utils.arrayify("0x80ac58cd");
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const InterfaceId_IERC1155 = utils.arrayify("0xd9b67a26");
|
||||
export const InterfaceId_IERC1155 =
|
||||
/* @__PURE__ */ utils.arrayify("0xd9b67a26");
|
||||
|
||||
@@ -12,7 +12,7 @@ export const NATIVE_TOKEN_ADDRESS =
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const NATIVE_TOKENS: Record<number, NativeToken> = {
|
||||
export const NATIVE_TOKENS: Record<number, NativeToken> = /* @__PURE__ */ {
|
||||
[ChainId.Mainnet]: {
|
||||
name: "Ether",
|
||||
symbol: "ETH",
|
||||
@@ -241,7 +241,7 @@ export function getNativeTokenByChainId(chainId: ChainId): NativeToken {
|
||||
);
|
||||
}
|
||||
|
||||
export const LINK_TOKEN_ADDRESS: Record<number, string> = {
|
||||
export const LINK_TOKEN_ADDRESS: Record<number, string> = /* @__PURE__ */ {
|
||||
[ChainId.Mainnet]: "0x514910771AF9Ca656af840dff83E8264EcF986CA",
|
||||
[ChainId.Goerli]: "0x326C977E6efc84E512bB9C30f76E30c160eD06FB",
|
||||
[ChainId.BinanceSmartChainMainnet]:
|
||||
|
||||
@@ -89,7 +89,7 @@ export const FEATURE_EDITION_REVEALABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_EDITION_LAZY_MINTABLE_V2 = {
|
||||
export const FEATURE_EDITION_LAZY_MINTABLE_V2 = /* @__PURE__ */ {
|
||||
name: "ERC1155LazyMintableV2",
|
||||
namespace: "edition.drop",
|
||||
docLinks: {
|
||||
@@ -102,7 +102,7 @@ export const FEATURE_EDITION_LAZY_MINTABLE_V2 = {
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_EDITION_LAZY_MINTABLE_V1 = {
|
||||
export const FEATURE_EDITION_LAZY_MINTABLE_V1 = /* @__PURE__ */ {
|
||||
name: "ERC1155LazyMintableV1",
|
||||
namespace: "edition.drop",
|
||||
docLinks: {
|
||||
@@ -148,7 +148,7 @@ export const FEATURE_EDITION_BATCH_MINTABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_EDITION_MINTABLE = {
|
||||
export const FEATURE_EDITION_MINTABLE = /* @__PURE__ */ {
|
||||
name: "ERC1155Mintable",
|
||||
namespace: "edition.mint",
|
||||
docLinks: {
|
||||
@@ -172,7 +172,7 @@ export const FEATURE_EDITION_ENUMERABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_EDITION = {
|
||||
export const FEATURE_EDITION = /* @__PURE__ */ {
|
||||
name: "ERC1155",
|
||||
namespace: "edition",
|
||||
docLinks: {
|
||||
|
||||
@@ -86,7 +86,7 @@ export const FEATURE_TOKEN_BATCH_MINTABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_TOKEN_MINTABLE = {
|
||||
export const FEATURE_TOKEN_MINTABLE = /* @__PURE__ */ {
|
||||
name: "ERC20Mintable",
|
||||
namespace: "token.mint",
|
||||
docLinks: {
|
||||
@@ -110,7 +110,7 @@ export const FEATURE_TOKEN_PERMIT = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_TOKEN = {
|
||||
export const FEATURE_TOKEN = /* @__PURE__ */ {
|
||||
name: "ERC20",
|
||||
namespace: "token",
|
||||
docLinks: {
|
||||
|
||||
@@ -14,6 +14,8 @@ 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 zora_IDropERC721 from "@thirdweb-dev/contracts-js/dist/abis/zora_IERC721Drop.json";
|
||||
|
||||
export const FEATURE_NFT_BURNABLE = {
|
||||
name: "ERC721Burnable",
|
||||
@@ -104,7 +106,18 @@ export const FEATURE_NFT_CLAIM_CUSTOM = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_NFT_LAZY_MINTABLE = {
|
||||
export const FEATURE_NFT_CLAIM_ZORA = {
|
||||
name: "ERC721ClaimZora",
|
||||
namespace: "nft.drop.claim",
|
||||
docLinks: {
|
||||
sdk: "sdk.erc721claimable",
|
||||
contracts: "erc721claimzora",
|
||||
},
|
||||
abis: [Erc721Abi, zora_IDropERC721],
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_NFT_LAZY_MINTABLE = /* @__PURE__ */ {
|
||||
name: "ERC721LazyMintable",
|
||||
namespace: "nft.drop",
|
||||
docLinks: {
|
||||
@@ -128,7 +141,7 @@ export const FEATURE_NFT_BATCH_MINTABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_NFT_MINTABLE = {
|
||||
export const FEATURE_NFT_MINTABLE = /* @__PURE__ */ {
|
||||
name: "ERC721Mintable",
|
||||
namespace: "nft.mint",
|
||||
docLinks: {
|
||||
@@ -174,7 +187,7 @@ export const FEATURE_NFT_ENUMERABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_NFT_SUPPLY = {
|
||||
export const FEATURE_NFT_SUPPLY = /* @__PURE__ */ {
|
||||
name: "ERC721Supply",
|
||||
namespace: "nft.query",
|
||||
docLinks: {
|
||||
@@ -187,7 +200,18 @@ export const FEATURE_NFT_SUPPLY = {
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_NFT = {
|
||||
export const FEATURE_NFT_SHARED_METADATA = /* @__PURE__ */ {
|
||||
name: "ERC721SharedMetadata",
|
||||
namespace: "nft.sharedmetadata",
|
||||
docLinks: {
|
||||
sdk: "sdk.sharedmetadata",
|
||||
contracts: "ISharedMetadata",
|
||||
},
|
||||
abis: [Erc721Abi, SharedMetadataAbi],
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_NFT = /* @__PURE__ */ {
|
||||
name: "ERC721",
|
||||
namespace: "nft",
|
||||
docLinks: {
|
||||
@@ -204,9 +228,11 @@ export const FEATURE_NFT = {
|
||||
[FEATURE_NFT_SIGNATURE_MINTABLE_V2.name]: FEATURE_NFT_SIGNATURE_MINTABLE_V2,
|
||||
[FEATURE_NFT_TIERED_DROP.name]: FEATURE_NFT_TIERED_DROP,
|
||||
[FEATURE_NFT_CLAIM_CUSTOM.name]: FEATURE_NFT_CLAIM_CUSTOM,
|
||||
[FEATURE_NFT_CLAIM_ZORA.name]: FEATURE_NFT_CLAIM_ZORA,
|
||||
[FEATURE_NFT_CLAIM_CONDITIONS_V1.name]: FEATURE_NFT_CLAIM_CONDITIONS_V1,
|
||||
[FEATURE_NFT_CLAIM_CONDITIONS_V2.name]: FEATURE_NFT_CLAIM_CONDITIONS_V2,
|
||||
[FEATURE_NFT_CLAIM_PHASES_V1.name]: FEATURE_NFT_CLAIM_PHASES_V1,
|
||||
[FEATURE_NFT_CLAIM_PHASES_V2.name]: FEATURE_NFT_CLAIM_PHASES_V2,
|
||||
[FEATURE_NFT_SHARED_METADATA.name]: FEATURE_NFT_SHARED_METADATA,
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -12,7 +12,7 @@ import IThirdwebPrimarySaleAbi from "@thirdweb-dev/contracts-js/dist/abis/IPrima
|
||||
import IThirdwebRoyaltyAbi from "@thirdweb-dev/contracts-js/dist/abis/IRoyalty.json";
|
||||
import IOwnableAbi from "@thirdweb-dev/contracts-js/dist/abis/Ownable.json";
|
||||
import IAccountFactory from "@thirdweb-dev/contracts-js/dist/abis/IAccountFactory.json";
|
||||
import IAccount from "@thirdweb-dev/contracts-js/dist/abis/IAccount.json";
|
||||
import IAccountCore from "@thirdweb-dev/contracts-js/dist/abis/IAccountCore.json";
|
||||
|
||||
export const getAllPluginsAbi = [
|
||||
{
|
||||
@@ -148,7 +148,7 @@ export const FEATURE_PERMISSIONS_ENUMERABLE = {
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
export const FEATURE_PERMISSIONS = {
|
||||
export const FEATURE_PERMISSIONS = /* @__PURE__ */ {
|
||||
name: "Permissions",
|
||||
namespace: "roles",
|
||||
docLinks: {
|
||||
@@ -299,6 +299,6 @@ export const FEATURE_SMART_WALLET = {
|
||||
sdk: "",
|
||||
contracts: "",
|
||||
},
|
||||
abis: [IAccount],
|
||||
abis: [IAccountCore],
|
||||
features: {},
|
||||
} as const;
|
||||
|
||||
@@ -633,7 +633,7 @@ async function getContractInfo(
|
||||
* a map from contractType -> contract metadata
|
||||
* @internal
|
||||
*/
|
||||
export const PREBUILT_CONTRACTS_MAP = {
|
||||
export const PREBUILT_CONTRACTS_MAP = /* @__PURE__ */ {
|
||||
[prebuiltContractTypes["edition-drop"]]: EditionDropInitializer,
|
||||
[prebuiltContractTypes.edition]: EditionInitializer,
|
||||
[prebuiltContractTypes.marketplace]: MarketplaceInitializer,
|
||||
@@ -649,7 +649,7 @@ export const PREBUILT_CONTRACTS_MAP = {
|
||||
[prebuiltContractTypes.vote]: VoteInitializer,
|
||||
} as const;
|
||||
|
||||
export const PREBUILT_CONTRACTS_APPURI_MAP = {
|
||||
export const PREBUILT_CONTRACTS_APPURI_MAP = /* @__PURE__ */ {
|
||||
[prebuiltContractTypes["edition-drop"]]:
|
||||
"ipfs://QmNm3wRzpKYWo1SRtJfgfxtvudp5p2nXD6EttcsQJHwTmk",
|
||||
[prebuiltContractTypes.edition]: "",
|
||||
@@ -678,7 +678,7 @@ const SmartContract = {
|
||||
roles: ALL_ROLES,
|
||||
};
|
||||
|
||||
export const CONTRACTS_MAP = {
|
||||
export const CONTRACTS_MAP = /* @__PURE__ */ {
|
||||
...PREBUILT_CONTRACTS_MAP,
|
||||
[SmartContract.contractType]: SmartContract,
|
||||
} as const;
|
||||
|
||||
@@ -268,7 +268,7 @@ export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
* @param metadatas - The metadata to include in the batch.
|
||||
* @param options - optional upload progress callback
|
||||
*/
|
||||
createBatch = buildTransactionFunction(
|
||||
createBatch = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
metadatas: NFTMetadataOrUri[],
|
||||
options?: {
|
||||
@@ -327,7 +327,7 @@ export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
*
|
||||
* @returns - Receipt for the transaction
|
||||
*/
|
||||
claimTo = buildTransactionFunction(
|
||||
claimTo = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
destinationAddress: AddressOrEns,
|
||||
tokenId: BigNumberish,
|
||||
@@ -357,7 +357,7 @@ export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
*
|
||||
* @returns - Receipt for the transaction
|
||||
*/
|
||||
claim = buildTransactionFunction(
|
||||
claim = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
tokenId: BigNumberish,
|
||||
quantity: BigNumberish,
|
||||
@@ -384,7 +384,7 @@ export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
|
||||
* const result = await contract.burnTokens(tokenId, amount);
|
||||
* ```
|
||||
*/
|
||||
burnTokens = buildTransactionFunction(
|
||||
burnTokens = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (tokenId: BigNumberish, amount: BigNumberish) => {
|
||||
return this.erc1155.burn.prepare(tokenId, amount);
|
||||
},
|
||||
|
||||
@@ -221,7 +221,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
*
|
||||
* @remarks See {@link Edition.mintTo}
|
||||
*/
|
||||
mint = buildTransactionFunction(
|
||||
mint = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
metadataWithSupply: EditionMetadataOrUri,
|
||||
): Promise<Transaction<TransactionResultWithId<NFT>>> => {
|
||||
@@ -257,7 +257,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
* const nft = await tx.data(); // (optional) fetch details of minted NFT
|
||||
* ```
|
||||
*/
|
||||
mintTo = buildTransactionFunction(
|
||||
mintTo = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
to: AddressOrEns,
|
||||
metadataWithSupply: EditionMetadataOrUri,
|
||||
@@ -287,7 +287,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
* @param tokenId - the token id of the NFT to increase supply of
|
||||
* @param additionalSupply - the additional amount to mint
|
||||
*/
|
||||
mintAdditionalSupply = buildTransactionFunction(
|
||||
mintAdditionalSupply = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
tokenId: BigNumberish,
|
||||
additionalSupply: BigNumberish,
|
||||
@@ -306,7 +306,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
* @param tokenId - the token id of the NFT to increase supply of
|
||||
* @param additionalSupply - the additional amount to mint
|
||||
*/
|
||||
mintAdditionalSupplyTo = buildTransactionFunction(
|
||||
mintAdditionalSupplyTo = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
to: AddressOrEns,
|
||||
tokenId: BigNumberish,
|
||||
@@ -325,7 +325,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
*
|
||||
* @remarks See {@link Edition.mintBatchTo}
|
||||
*/
|
||||
mintBatch = buildTransactionFunction(
|
||||
mintBatch = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
metadatas: EditionMetadataOrUri[],
|
||||
): Promise<Transaction<TransactionResultWithId<NFT>[]>> => {
|
||||
@@ -366,7 +366,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
* const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
|
||||
* ```
|
||||
*/
|
||||
mintBatchTo = buildTransactionFunction(
|
||||
mintBatchTo = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
to: AddressOrEns,
|
||||
metadataWithSupply: EditionMetadataOrUri[],
|
||||
@@ -386,7 +386,7 @@ export class Edition extends StandardErc1155<TokenERC1155> {
|
||||
* const result = await contract.burnTokens(tokenId, amount);
|
||||
* ```
|
||||
*/
|
||||
burn = buildTransactionFunction(
|
||||
burn = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (tokenId: BigNumberish, amount: BigNumberish) => {
|
||||
return this.erc1155.burn.prepare(tokenId, amount);
|
||||
},
|
||||
|
||||
@@ -383,7 +383,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* @param quantityDesired - the quantity that you want to buy (for ERC1155 tokens)
|
||||
* @param receiver - optional receiver of the bought listing if different from the connected wallet (for direct listings only)
|
||||
*/
|
||||
buyoutListing = buildTransactionFunction(
|
||||
buyoutListing = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
listingId: BigNumberish,
|
||||
quantityDesired?: BigNumberish,
|
||||
@@ -437,7 +437,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
makeOffer = buildTransactionFunction(
|
||||
makeOffer = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
listingId: BigNumberish,
|
||||
pricePerToken: Price,
|
||||
@@ -485,7 +485,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* ```
|
||||
* @param bufferBps - the bps value
|
||||
*/
|
||||
setBidBufferBps = buildTransactionFunction(
|
||||
setBidBufferBps = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (bufferBps: BigNumberish) => {
|
||||
await this.roles.verify(
|
||||
["admin"],
|
||||
@@ -513,7 +513,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* ```
|
||||
* @param bufferInSeconds - the seconds value
|
||||
*/
|
||||
setTimeBufferInSeconds = buildTransactionFunction(
|
||||
setTimeBufferInSeconds = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (bufferInSeconds: BigNumberish) => {
|
||||
await this.roles.verify(
|
||||
["admin"],
|
||||
@@ -535,7 +535,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* It is possible to allow listing from multiple contract addresses.
|
||||
* @param contractAddress - the NFT contract address
|
||||
*/
|
||||
allowListingFromSpecificAssetOnly = buildTransactionFunction(
|
||||
allowListingFromSpecificAssetOnly = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (contractAddress: string) => {
|
||||
const encoded: string[] = [];
|
||||
const members = await this.roles.get("asset");
|
||||
@@ -565,27 +565,29 @@ export class Marketplace implements UpdateableNetwork {
|
||||
/**
|
||||
* Allow listings from any NFT contract
|
||||
*/
|
||||
allowListingFromAnyAsset = buildTransactionFunction(async () => {
|
||||
const encoded: string[] = [];
|
||||
const members = await this.roles.get("asset");
|
||||
for (const addr in members) {
|
||||
allowListingFromAnyAsset = /* @__PURE__ */ buildTransactionFunction(
|
||||
async () => {
|
||||
const encoded: string[] = [];
|
||||
const members = await this.roles.get("asset");
|
||||
for (const addr in members) {
|
||||
encoded.push(
|
||||
this.encoder.encode("revokeRole", [getRoleHash("asset"), addr]),
|
||||
);
|
||||
}
|
||||
encoded.push(
|
||||
this.encoder.encode("revokeRole", [getRoleHash("asset"), addr]),
|
||||
this.encoder.encode("grantRole", [
|
||||
getRoleHash("asset"),
|
||||
constants.AddressZero,
|
||||
]),
|
||||
);
|
||||
}
|
||||
encoded.push(
|
||||
this.encoder.encode("grantRole", [
|
||||
getRoleHash("asset"),
|
||||
constants.AddressZero,
|
||||
]),
|
||||
);
|
||||
|
||||
return Transaction.fromContractWrapper({
|
||||
contractWrapper: this.contractWrapper,
|
||||
method: "multicall",
|
||||
args: [encoded],
|
||||
});
|
||||
});
|
||||
return Transaction.fromContractWrapper({
|
||||
contractWrapper: this.contractWrapper,
|
||||
method: "multicall",
|
||||
args: [encoded],
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
/** ******************************
|
||||
* PRIVATE FUNCTIONS
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user