@manifoldxyz/marketplace-sdk 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1039,6 +1039,13 @@ class MarketplaceListing {
1039
1039
  }
1040
1040
  else {
1041
1041
  // Handling referenced tokenURI
1042
+ // For ERC1155 we must find+replace the {id} with the actual tokenId
1043
+ if (tokenSpec == 'erc1155') {
1044
+ tokenURI = tokenURI.replace("{id}", (0, bytes_1.hexZeroPad)(
1045
+ //@ts-ignore
1046
+ (0, bytes_1.hexValue)(bignumber_1.BigNumber.from(this.listing.tokenId)), 32)
1047
+ .substring(2));
1048
+ }
1042
1049
  tokenURI = this._cleanURI(tokenURI);
1043
1050
  tokenData = yield this._fetchMetadata(this.listing.tokenAddress, tokenId, tokenURI);
1044
1051
  }
@@ -1136,10 +1143,10 @@ class MarketplaceListing {
1136
1143
  * Helper to process token data for consumption
1137
1144
  */
1138
1145
  _processTokenData(data) {
1139
- if (data.image) {
1146
+ if (data === null || data === void 0 ? void 0 : data.image) {
1140
1147
  data.image = this._cleanURI(data.image);
1141
1148
  }
1142
- if (data.animation_url) {
1149
+ if (data === null || data === void 0 ? void 0 : data.animation_url) {
1143
1150
  data.animation_url = this._cleanURI(data.animation_url);
1144
1151
  }
1145
1152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifoldxyz/marketplace-sdk",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "typings": "dist/index.d.ts",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
@@ -1003,6 +1003,18 @@ class MarketplaceListing {
1003
1003
  }
1004
1004
  } else {
1005
1005
  // Handling referenced tokenURI
1006
+ // For ERC1155 we must find+replace the {id} with the actual tokenId
1007
+ if (tokenSpec == 'erc1155') {
1008
+ tokenURI = tokenURI.replace(
1009
+ "{id}",
1010
+ hexZeroPad(
1011
+ //@ts-ignore
1012
+ hexValue(BigNumber.from(this.listing!.tokenId)),
1013
+ 32
1014
+ )
1015
+ .substring(2)
1016
+ );
1017
+ }
1006
1018
  tokenURI = this._cleanURI(tokenURI)
1007
1019
  tokenData = await this._fetchMetadata(this.listing!.tokenAddress, tokenId, tokenURI)
1008
1020
  }
@@ -1094,10 +1106,10 @@ class MarketplaceListing {
1094
1106
  * Helper to process token data for consumption
1095
1107
  */
1096
1108
  private _processTokenData(data: any) {
1097
- if (data.image) {
1109
+ if (data?.image) {
1098
1110
  data.image = this._cleanURI(data.image)
1099
1111
  }
1100
- if (data.animation_url) {
1112
+ if (data?.animation_url) {
1101
1113
  data.animation_url = this._cleanURI(data.animation_url)
1102
1114
  }
1103
1115
  }