Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9919026f38 | ||
|
|
c349f44d58 | ||
|
|
fc7c6b6211 | ||
|
|
55b00eff26 | ||
|
|
76d219e6be |
@@ -1,5 +1,12 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.9.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`55b00ef`](https://github.com/thirdweb-dev/js/commit/55b00eff2668eb751b9f907e035b3a0c122d2183)]:
|
||||
- @thirdweb-dev/sdk@3.8.2
|
||||
|
||||
## 0.9.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.9.18",
|
||||
"version": "0.9.19",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/contracts-js
|
||||
|
||||
## 1.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#553](https://github.com/thirdweb-dev/js/pull/553) [`76d219e`](https://github.com/thirdweb-dev/js/commit/76d219e6bea1496b45623b3081152854ce1eaa6e) Thanks [@jnsdls](https://github.com/jnsdls)! - force release
|
||||
|
||||
## 1.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/contracts-js",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
||||
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.8.2
|
||||
|
||||
## 3.8.1
|
||||
|
||||
## 3.8.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.8.1",
|
||||
"version": "3.8.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.8.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @thirdweb-dev/react-core@3.8.2
|
||||
|
||||
## 3.8.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.8.1",
|
||||
"version": "3.8.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 3.8.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#555](https://github.com/thirdweb-dev/js/pull/555) [`55b00ef`](https://github.com/thirdweb-dev/js/commit/55b00eff2668eb751b9f907e035b3a0c122d2183) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Add gas estimators to each marketplace plugin
|
||||
|
||||
- Updated dependencies [[`76d219e`](https://github.com/thirdweb-dev/js/commit/76d219e6bea1496b45623b3081152854ce1eaa6e)]:
|
||||
- @thirdweb-dev/contracts-js@1.3.1
|
||||
- @thirdweb-dev/storage@1.0.8
|
||||
|
||||
## 3.8.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "3.8.1",
|
||||
"version": "3.8.2",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -27,6 +27,7 @@ import { ContractEncoder } from "./contract-encoder";
|
||||
import { ContractEvents } from "./contract-events";
|
||||
import { ContractInterceptor } from "./contract-interceptor";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { GasCostEstimator } from "./gas-cost-estimator";
|
||||
import type {
|
||||
IERC1155,
|
||||
IERC165,
|
||||
@@ -60,6 +61,7 @@ export class MarketplaceV3DirectListings<TContract extends DirectListingsLogic>
|
||||
public events: ContractEvents<DirectListingsLogic>;
|
||||
public interceptor: ContractInterceptor<DirectListingsLogic>;
|
||||
public encoder: ContractEncoder<DirectListingsLogic>;
|
||||
public estimator: GasCostEstimator<DirectListingsLogic>;
|
||||
|
||||
constructor(
|
||||
contractWrapper: ContractWrapper<TContract>,
|
||||
@@ -68,13 +70,10 @@ export class MarketplaceV3DirectListings<TContract extends DirectListingsLogic>
|
||||
this.contractWrapper = contractWrapper;
|
||||
this.storage = storage;
|
||||
|
||||
this.events = new ContractEvents<DirectListingsLogic>(this.contractWrapper);
|
||||
this.encoder = new ContractEncoder<DirectListingsLogic>(
|
||||
this.contractWrapper,
|
||||
);
|
||||
this.interceptor = new ContractInterceptor<DirectListingsLogic>(
|
||||
this.contractWrapper,
|
||||
);
|
||||
this.events = new ContractEvents(this.contractWrapper);
|
||||
this.encoder = new ContractEncoder(this.contractWrapper);
|
||||
this.interceptor = new ContractInterceptor(this.contractWrapper);
|
||||
this.estimator = new GasCostEstimator(this.contractWrapper);
|
||||
}
|
||||
|
||||
getAddress(): string {
|
||||
|
||||
@@ -23,6 +23,7 @@ import { ContractEncoder } from "./contract-encoder";
|
||||
import { ContractEvents } from "./contract-events";
|
||||
import { ContractInterceptor } from "./contract-interceptor";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { GasCostEstimator } from "./gas-cost-estimator";
|
||||
import type {
|
||||
IEnglishAuctions,
|
||||
EnglishAuctionsLogic,
|
||||
@@ -48,6 +49,7 @@ export class MarketplaceV3EnglishAuctions<
|
||||
public events: ContractEvents<EnglishAuctionsLogic>;
|
||||
public interceptor: ContractInterceptor<EnglishAuctionsLogic>;
|
||||
public encoder: ContractEncoder<EnglishAuctionsLogic>;
|
||||
public estimator: GasCostEstimator<EnglishAuctionsLogic>;
|
||||
|
||||
constructor(
|
||||
contractWrapper: ContractWrapper<TContract>,
|
||||
@@ -55,13 +57,10 @@ export class MarketplaceV3EnglishAuctions<
|
||||
) {
|
||||
this.contractWrapper = contractWrapper;
|
||||
this.storage = storage;
|
||||
this.events = new ContractEvents<EnglishAuctionsLogic>(
|
||||
this.contractWrapper,
|
||||
);
|
||||
this.encoder = new ContractEncoder<EnglishAuctionsLogic>(contractWrapper);
|
||||
this.interceptor = new ContractInterceptor<EnglishAuctionsLogic>(
|
||||
this.contractWrapper,
|
||||
);
|
||||
this.events = new ContractEvents(this.contractWrapper);
|
||||
this.encoder = new ContractEncoder(this.contractWrapper);
|
||||
this.interceptor = new ContractInterceptor(this.contractWrapper);
|
||||
this.estimator = new GasCostEstimator(this.contractWrapper);
|
||||
}
|
||||
|
||||
getAddress(): string {
|
||||
@@ -441,7 +440,10 @@ export class MarketplaceV3EnglishAuctions<
|
||||
throw new Error("Cannot make a bid with 0 value");
|
||||
}
|
||||
|
||||
if (normalizedBidAmount.gt(auction.buyoutBidAmount)) {
|
||||
if (
|
||||
BigNumber.from(auction.buyoutBidAmount).gt(0) &&
|
||||
normalizedBidAmount.gt(auction.buyoutBidAmount)
|
||||
) {
|
||||
throw new Error(
|
||||
"Bid amount must be less than or equal to buyoutBidAmount",
|
||||
);
|
||||
|
||||
@@ -21,6 +21,7 @@ import { ContractEncoder } from "./contract-encoder";
|
||||
import { ContractEvents } from "./contract-events";
|
||||
import { ContractInterceptor } from "./contract-interceptor";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { GasCostEstimator } from "./gas-cost-estimator";
|
||||
import type { IERC20, IOffers, OffersLogic } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { NewOfferEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/OffersLogic";
|
||||
@@ -42,6 +43,7 @@ export class MarketplaceV3Offers<TContract extends OffersLogic>
|
||||
public events: ContractEvents<OffersLogic>;
|
||||
public interceptor: ContractInterceptor<OffersLogic>;
|
||||
public encoder: ContractEncoder<OffersLogic>;
|
||||
public estimator: GasCostEstimator<OffersLogic>;
|
||||
|
||||
constructor(
|
||||
contractWrapper: ContractWrapper<TContract>,
|
||||
@@ -50,11 +52,10 @@ export class MarketplaceV3Offers<TContract extends OffersLogic>
|
||||
this.contractWrapper = contractWrapper;
|
||||
this.storage = storage;
|
||||
|
||||
this.events = new ContractEvents<OffersLogic>(this.contractWrapper);
|
||||
this.encoder = new ContractEncoder<OffersLogic>(contractWrapper);
|
||||
this.interceptor = new ContractInterceptor<OffersLogic>(
|
||||
this.contractWrapper,
|
||||
);
|
||||
this.events = new ContractEvents(this.contractWrapper);
|
||||
this.encoder = new ContractEncoder(this.contractWrapper);
|
||||
this.interceptor = new ContractInterceptor(this.contractWrapper);
|
||||
this.estimator = new GasCostEstimator(this.contractWrapper);
|
||||
}
|
||||
|
||||
getAddress(): string {
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
NFTCollectionInitializer,
|
||||
NFTDropInitializer,
|
||||
PackInitializer,
|
||||
resolveContractUriFromAddress,
|
||||
SignatureDropInitializer,
|
||||
SplitInitializer,
|
||||
ThirdwebSDK,
|
||||
@@ -21,8 +20,9 @@ import {
|
||||
VoteInitializer,
|
||||
} from "../../src/evm";
|
||||
import { Plugin } from "../../src/evm/types/plugins";
|
||||
import { MockStorage, mockUploadWithCID } from "./mock/MockStorage";
|
||||
import { MockStorage } from "./mock/MockStorage";
|
||||
import weth from "./mock/WETH9.json";
|
||||
import { deployContractAndUploadMetadata } from "./utils";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import {
|
||||
ContractPublisher,
|
||||
@@ -57,12 +57,8 @@ import {
|
||||
VoteERC20__factory,
|
||||
MarketplaceV3__factory,
|
||||
DirectListingsLogic__factory,
|
||||
DirectListingsLogic,
|
||||
MarketplaceV3,
|
||||
EnglishAuctionsLogic__factory,
|
||||
EnglishAuctionsLogic,
|
||||
OffersLogic__factory,
|
||||
OffersLogic,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers } from "ethers";
|
||||
@@ -313,34 +309,6 @@ const generatePluginFunctions = (
|
||||
return pluginFunctions;
|
||||
};
|
||||
|
||||
const mockUploadContractMetadata = async (address: string, abi: any) => {
|
||||
const ipfsHash = (await resolveContractUriFromAddress(
|
||||
address,
|
||||
defaultProvider,
|
||||
)) as string;
|
||||
|
||||
const metadata = {
|
||||
compiler: {},
|
||||
output: {
|
||||
abi,
|
||||
devdoc: {},
|
||||
userdoc: {},
|
||||
},
|
||||
settings: {
|
||||
compilationTarget: {},
|
||||
evmVersion: {},
|
||||
metadata: {},
|
||||
optimizer: {},
|
||||
remappings: [],
|
||||
},
|
||||
sources: {},
|
||||
version: 1,
|
||||
};
|
||||
const cid = ipfsHash.replace("ipfs://", "");
|
||||
|
||||
await mockUploadWithCID(cid, JSON.stringify(metadata));
|
||||
};
|
||||
|
||||
// Setup multichain registry for tests
|
||||
async function setupMultichainRegistry(
|
||||
trustedForwarderAddress: string,
|
||||
@@ -382,89 +350,57 @@ async function setupMultichainRegistry(
|
||||
|
||||
// Setup marketplace-v3 for tests
|
||||
async function setupMarketplaceV3(): Promise<string> {
|
||||
const nativeTokenWrapperAddress = getNativeTokenByChainId(ChainId.Hardhat)
|
||||
.wrapped.address;
|
||||
// Direct Listings
|
||||
const directListingsLogicDeployer = (await new ethers.ContractFactory(
|
||||
const directListingsPluginAddress = await deployContractAndUploadMetadata(
|
||||
DirectListingsLogic__factory.abi,
|
||||
DirectListingsLogic__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(mock_weth_address)) as DirectListingsLogic;
|
||||
const directListingsLogic = await directListingsLogicDeployer.deployed();
|
||||
await mockUploadContractMetadata(
|
||||
directListingsLogic.address,
|
||||
DirectListingsLogic__factory.abi,
|
||||
signer,
|
||||
[mock_weth_address],
|
||||
);
|
||||
|
||||
const pluginsDirectListings: Plugin[] = generatePluginFunctions(
|
||||
directListingsLogic.address,
|
||||
directListingsPluginAddress,
|
||||
DirectListingsLogic__factory.abi,
|
||||
);
|
||||
|
||||
// English Auctions
|
||||
const englishAuctionsLogicDeployer = (await new ethers.ContractFactory(
|
||||
const englishAuctionPluginAddress = await deployContractAndUploadMetadata(
|
||||
EnglishAuctionsLogic__factory.abi,
|
||||
EnglishAuctionsLogic__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(mock_weth_address)) as EnglishAuctionsLogic;
|
||||
const englishAuctionsLogic = await englishAuctionsLogicDeployer.deployed();
|
||||
await mockUploadContractMetadata(
|
||||
englishAuctionsLogic.address,
|
||||
EnglishAuctionsLogic__factory.abi,
|
||||
signer,
|
||||
[mock_weth_address],
|
||||
);
|
||||
|
||||
const pluginsEnglishAuctions: Plugin[] = generatePluginFunctions(
|
||||
englishAuctionsLogic.address,
|
||||
englishAuctionPluginAddress,
|
||||
EnglishAuctionsLogic__factory.abi,
|
||||
);
|
||||
|
||||
// Offers
|
||||
const offersLogicDeployer = (await new ethers.ContractFactory(
|
||||
const offersLogicPluginAddress = await deployContractAndUploadMetadata(
|
||||
OffersLogic__factory.abi,
|
||||
OffersLogic__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy()) as OffersLogic;
|
||||
const offersLogic = await offersLogicDeployer.deployed();
|
||||
await mockUploadContractMetadata(
|
||||
offersLogic.address,
|
||||
OffersLogic__factory.abi,
|
||||
signer,
|
||||
);
|
||||
|
||||
const pluginsOffers: Plugin[] = generatePluginFunctions(
|
||||
offersLogic.address,
|
||||
offersLogicPluginAddress,
|
||||
OffersLogic__factory.abi,
|
||||
);
|
||||
|
||||
// console.log([
|
||||
// ...pluginsDirectListings,
|
||||
// ...pluginsEnglishAuctions,
|
||||
// ...pluginsOffers,
|
||||
// ]);
|
||||
|
||||
const pluginMapDeployer = (await new ethers.ContractFactory(
|
||||
// Map
|
||||
const pluginMapAddress = await deployContractAndUploadMetadata(
|
||||
PluginMap__factory.abi,
|
||||
PluginMap__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy([
|
||||
...pluginsDirectListings,
|
||||
...pluginsEnglishAuctions,
|
||||
...pluginsOffers,
|
||||
])) as PluginMap;
|
||||
const pluginMap = await pluginMapDeployer.deployed();
|
||||
signer,
|
||||
[[...pluginsDirectListings, ...pluginsEnglishAuctions, ...pluginsOffers]],
|
||||
);
|
||||
|
||||
const marketplaceV3Deployer = (await new ethers.ContractFactory(
|
||||
// Router
|
||||
const marketplaceV3Address = await deployContractAndUploadMetadata(
|
||||
MarketplaceV3__factory.abi,
|
||||
MarketplaceV3__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(pluginMap.address)) as MarketplaceV3;
|
||||
const marketplaceV3 = await marketplaceV3Deployer.deployed();
|
||||
|
||||
return marketplaceV3.address;
|
||||
signer,
|
||||
[pluginMapAddress],
|
||||
);
|
||||
return marketplaceV3Address;
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
import { resolveContractUriFromAddress } from "../../src/evm";
|
||||
import { defaultProvider } from "./before-setup";
|
||||
import { mockUploadWithCID } from "./mock/MockStorage";
|
||||
import { ContractInterface, ethers } from "ethers";
|
||||
|
||||
export const deployContractAndUploadMetadata = async (
|
||||
abi: ContractInterface,
|
||||
bytecode: string,
|
||||
signer: ethers.Signer,
|
||||
args: any[] = [],
|
||||
) => {
|
||||
const deployer = await new ethers.ContractFactory(abi, bytecode)
|
||||
.connect(signer)
|
||||
.deploy(...args);
|
||||
const deployed = await deployer.deployed();
|
||||
await mockUploadContractMetadata(deployed.address, abi);
|
||||
return deployed.address;
|
||||
};
|
||||
|
||||
const mockUploadContractMetadata = async (address: string, abi: any) => {
|
||||
const ipfsHash = (await resolveContractUriFromAddress(
|
||||
address,
|
||||
defaultProvider,
|
||||
)) as string;
|
||||
|
||||
const metadata = {
|
||||
compiler: {},
|
||||
output: {
|
||||
abi,
|
||||
devdoc: {},
|
||||
userdoc: {},
|
||||
},
|
||||
settings: {
|
||||
compilationTarget: {},
|
||||
evmVersion: {},
|
||||
metadata: {},
|
||||
optimizer: {},
|
||||
remappings: [],
|
||||
},
|
||||
sources: {},
|
||||
version: 1,
|
||||
};
|
||||
const cid = ipfsHash.replace("ipfs://", "");
|
||||
|
||||
await mockUploadWithCID(cid, JSON.stringify(metadata));
|
||||
};
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/storage
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#553](https://github.com/thirdweb-dev/js/pull/553) [`76d219e`](https://github.com/thirdweb-dev/js/commit/76d219e6bea1496b45623b3081152854ce1eaa6e) Thanks [@jnsdls](https://github.com/jnsdls)! - force release
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/storage",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"main": "dist/thirdweb-dev-storage.cjs.js",
|
||||
"module": "dist/thirdweb-dev-storage.esm.js",
|
||||
"exports": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @thirdweb-dev/unity-js-bridge
|
||||
|
||||
## 0.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`55b00ef`](https://github.com/thirdweb-dev/js/commit/55b00eff2668eb751b9f907e035b3a0c122d2183), [`76d219e`](https://github.com/thirdweb-dev/js/commit/76d219e6bea1496b45623b3081152854ce1eaa6e)]:
|
||||
- @thirdweb-dev/sdk@3.8.2
|
||||
- @thirdweb-dev/storage@1.0.8
|
||||
|
||||
## 0.2.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/unity-js-bridge",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"main": "dist/thirdweb-unity-bridge.js",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
Reference in New Issue
Block a user