diff --git a/Dockerfile b/Dockerfile index 1ce94ab..b12cd3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ ADD . /SBOM RUN apk add --no-cache curl RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.48.3 RUN trivy fs --format spdx-json --output /sbom.spdx.json /SBOM -RUN trivy sbom /sbom.spdx.json --severity UNKNOWN,HIGH,CRITICAL --exit-code 1 +RUN trivy sbom /sbom.spdx.json --severity UNKNOWN,HIGH,CRITICAL --db-repository public.ecr.aws/aquasecurity/trivy-db --exit-code 1 FROM $BASE_IMAGE RUN apk add curl=8.9.1-r1 diff --git a/src/tokens/erc1155.ts b/src/tokens/erc1155.ts index ed401ae..af713fc 100644 --- a/src/tokens/erc1155.ts +++ b/src/tokens/erc1155.ts @@ -284,6 +284,43 @@ export const DynamicMethods: Record = { return undefined; }, }, + { + // Option with token index and single receiver + name: 'mintNonFungibleWithURI', + inputs: [{ type: 'uint256' }, { type: 'uint256' }, { type: 'address' }, { type: 'bytes' }, { type: 'string' }], + map: (poolLocator: PoolLocator, dto: TokenMint) => { + if (!poolLocator.isFungible) { + const amount = BigInt(dto.amount); + if (amount !== BigInt(1)) { + throw new BadRequestException('Amount for nonfungible tokens must be 1'); + } + return [ + computeTokenId(poolLocator), + dto.tokenIndex, + dto.to, + encodeHex(dto.data ?? ''), + dto.uri ?? '', + ]; + } + return undefined; + }, + }, + { + // Option with token index and single receiver + name: 'mintNonFungible', + inputs: [{ type: 'uint256' }, { type: 'uint256' }, { type: 'address' }, { type: 'bytes' }], + map: (poolLocator: PoolLocator, dto: TokenMint) => { + if (!poolLocator.isFungible) { + // In the case of a non-fungible token, we parse the value as a whole integer count of NFTs to mint + const amount = parseInt(dto.amount); + if (amount !== 1) { + throw new BadRequestException('Amount for nonfungible tokens must be 1'); + } + return [computeTokenId(poolLocator), dto.tokenIndex, dto.to, encodeHex(dto.data ?? '')]; + } + return undefined; + }, + }, { // Source: OpenZeppelin extension name: 'mint',