diff --git a/src/tokens/erc1155.ts b/src/tokens/erc1155.ts index ae8656a..2cc362e 100644 --- a/src/tokens/erc1155.ts +++ b/src/tokens/erc1155.ts @@ -14,6 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { BadRequestException } from '@nestjs/common'; import { MethodSignature, TokenOperation, @@ -261,6 +262,7 @@ export const DynamicMethods: Record = { // In the case of a non-fungible token: // - We parse the value as a whole integer count of NFTs to mint // - We require the number to be small enough to express as a JS number (we're packing into an array) + verifyNoIndex(dto); const to: string[] = []; const amount = parseInt(dto.amount); for (let i = 0; i < amount; i++) { @@ -280,6 +282,7 @@ export const DynamicMethods: Record = { // In the case of a non-fungible token: // - We parse the value as a whole integer count of NFTs to mint // - We require the number to be small enough to express as a JS number (we're packing into an array) + verifyNoIndex(dto); const to: string[] = []; const amount = parseInt(dto.amount); for (let i = 0; i < amount; i++) { @@ -315,3 +318,9 @@ export const DynamicMethods: Record = { }, ], }; + +function verifyNoIndex(dto: TokenMint) { + if (dto.tokenIndex !== undefined) { + throw new BadRequestException('Setting token index is not supported by this contract'); + } +} diff --git a/src/tokens/tokens.interfaces.ts b/src/tokens/tokens.interfaces.ts index 9701e4b..298a6bc 100644 --- a/src/tokens/tokens.interfaces.ts +++ b/src/tokens/tokens.interfaces.ts @@ -293,7 +293,7 @@ export class TokenTransfer { interface?: TokenInterface; } -export class TokenMint extends OmitType(TokenTransfer, ['tokenIndex', 'from']) { +export class TokenMint extends OmitType(TokenTransfer, ['from']) { @ApiProperty() @IsOptional() uri?: string;