Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Constructs a new instance of the `Erc721WithQuantitySignatureMintable` class
<b>Signature:</b>

```typescript
constructor(contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>, storage: IStorage, roles?: ContractRoles<TokenERC721, typeof NFTCollection.contractRoles[number]>);
constructor(contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>, storage: IStorage);
```

## Parameters
Expand All @@ -18,5 +18,4 @@ constructor(contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>,
| --- | --- | --- |
| contractWrapper | ContractWrapper&lt;SignatureMintERC721 \| TokenERC721&gt; | |
| storage | [IStorage](./sdk.istorage.md) | |
| roles | [ContractRoles](./sdk.contractroles.md)<!-- -->&lt;TokenERC721, typeof [NFTCollection.contractRoles](./sdk.nftcollection.contractroles.md)<!-- -->\[number\]&gt; | <i>(Optional)</i> |

2 changes: 1 addition & 1 deletion docs/sdk.erc721withquantitysignaturemintable.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export declare class Erc721WithQuantitySignatureMintable implements DetectableFe

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(contractWrapper, storage, roles)](./sdk.erc721withquantitysignaturemintable._constructor_.md) | | Constructs a new instance of the <code>Erc721WithQuantitySignatureMintable</code> class |
| [(constructor)(contractWrapper, storage)](./sdk.erc721withquantitysignaturemintable._constructor_.md) | | Constructs a new instance of the <code>Erc721WithQuantitySignatureMintable</code> class |

## Properties

Expand Down
2 changes: 1 addition & 1 deletion etc/sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,7 @@ export class Erc721Supply implements DetectableFeature {
// @public
export class Erc721WithQuantitySignatureMintable implements DetectableFeature {
// Warning: (ae-forgotten-export) The symbol "SignatureMintERC721" needs to be exported by the entry point index.d.ts
constructor(contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>, storage: IStorage, roles?: ContractRoles<TokenERC721, typeof NFTCollection.contractRoles[number]>);
constructor(contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>, storage: IStorage);
// (undocumented)
featureName: "ERC721SignatureMint";
generate(mintRequest: PayloadToSign721withQuantity): Promise<SignedPayload721WithQuantitySignature>;
Expand Down
1 change: 0 additions & 1 deletion src/contracts/nft-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export class NFTCollection extends Erc721<TokenERC721> {
this.signature = new Erc721WithQuantitySignatureMintable(
this.contractWrapper,
this.storage,
this.roles,
);
this.events = new ContractEvents(this.contractWrapper);
this.platformFees = new ContractPlatformFee(this.contractWrapper);
Expand Down
27 changes: 8 additions & 19 deletions src/core/classes/erc-721-with-quantity-signature-mintable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {
TokenERC721,
} from "contracts";
import { IStorage } from "../interfaces";
import { ContractRoles } from "./contract-roles";
import { NFTCollection } from "../../contracts";
import { BigNumber, ethers } from "ethers";
import { uploadOrExtractURIs } from "../../common/nft";
import { TokensMintedWithSignatureEvent } from "contracts/SignatureDrop";
Expand All @@ -37,22 +35,13 @@ export class Erc721WithQuantitySignatureMintable implements DetectableFeature {
private contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>;

private storage: IStorage;
private roles?: ContractRoles<
TokenERC721,
typeof NFTCollection.contractRoles[number]
>;

constructor(
contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>,
storage: IStorage,
roles?: ContractRoles<
TokenERC721,
typeof NFTCollection.contractRoles[number]
>,
) {
this.contractWrapper = contractWrapper;
this.storage = storage;
this.roles = roles;
}

/**
Expand Down Expand Up @@ -263,10 +252,6 @@ export class Erc721WithQuantitySignatureMintable implements DetectableFeature {
): Promise<SignedPayload721WithQuantitySignature[]> {
const isLegacyNFTContract = await this.isLegacyNFTContract();

await this.roles?.verify(
["minter"],
await this.contractWrapper.getSignerAddress(),
);
const parsedRequests = payloadsToSign.map((m) =>
Signature721WithQuantityInput.parse(m),
);
Expand Down Expand Up @@ -380,10 +365,14 @@ export class Erc721WithQuantitySignatureMintable implements DetectableFeature {

private async isLegacyNFTContract() {
if (hasFunction<TokenERC721>("contractType", this.contractWrapper)) {
const contractType = ethers.utils.toUtf8String(
await this.contractWrapper.readContract.contractType(),
);
return contractType.includes("TokenERC721");
try {
const contractType = ethers.utils.toUtf8String(
await this.contractWrapper.readContract.contractType(),
);
return contractType.includes("TokenERC721");
} catch (e) {
return false;
}
} else {
return false;
}
Expand Down