@tiplink/api
Advanced tools
Comparing version 0.1.7-beta2 to 0.1.7-beta3
@@ -160,8 +160,8 @@ import { PublicKey } from "@solana/web3.js"; | ||
imageUrl: string; | ||
externalUrl: string; | ||
externalUrl?: string; | ||
mintName: string; | ||
symbol: string; | ||
mintDescription: string; | ||
mintDescription?: string; | ||
mintLimit: number; | ||
attributes: Record<string, string>[]; | ||
attributes?: Record<string, string>[]; | ||
creatorPublicKey: PublicKey; | ||
@@ -172,3 +172,3 @@ collectionId: string; | ||
collectionUri: string; | ||
sellerFeeBasisPoints: number; | ||
royalties: number; | ||
primaryUrlSlug: string; | ||
@@ -184,16 +184,15 @@ rotatingUrlSlug: string; | ||
campaignName: string; | ||
campaignDescription: string; | ||
campaignDescription?: string; | ||
mintName: string; | ||
mintDescription: string; | ||
mintImageUrl: string; | ||
mintDescription?: string; | ||
symbol: string; | ||
sellerFeeBasisPoints: number; | ||
externalUrl: string; | ||
existingCollectionId: string; | ||
mintLimit: number; | ||
mintImageUrl: string; | ||
externalUrl?: string; | ||
existingCollectionId?: string; | ||
creatorPublicKey: PublicKey; | ||
royalties: number; | ||
royaltiesDestination: PublicKey; | ||
attributes: Record<string, string>; | ||
feeTransactionHash: string; | ||
royalties?: number; | ||
royaltiesDestination?: PublicKey; | ||
attributes?: Record<string, string>; | ||
feeTransactionHash?: string; | ||
} | ||
@@ -227,3 +226,3 @@ interface FeeResponse { | ||
collectionUri: string; | ||
sellerFeeBasisPoints: number; | ||
royalties: number; | ||
primaryUrlSlug: string; | ||
@@ -230,0 +229,0 @@ rotatingUrlSlug: string; |
@@ -403,3 +403,3 @@ "use strict"; | ||
description: params.mintDescription, | ||
attributes: this.transformAttributes(params.attributes), | ||
attributes: this.transformAttributes(params.attributes || {}), | ||
externalUrl: params.externalUrl, | ||
@@ -433,6 +433,6 @@ image: params.mintImageUrl, | ||
} | ||
else if (params.royalties > 50 || params.royalties < 0) { | ||
else if (typeof (params.royalties) !== 'undefined' && (params.royalties > 50 || params.royalties < 0)) { | ||
throw Error("Royalties must be between 0 and 50%"); | ||
} | ||
else if (params.externalUrl !== "" && !this.isValidUrl(params.externalUrl)) { | ||
else if (typeof (params.externalUrl) !== 'undefined' && params.externalUrl !== "" && !this.isValidUrl(params.externalUrl)) { | ||
throw Error("Invalid external url"); | ||
@@ -464,5 +464,2 @@ } | ||
} | ||
if (params.sellerFeeBasisPoints) { | ||
formData.append(`mint[${index}][sellerFeeBasisPoints]`, JSON.stringify(Number(params.sellerFeeBasisPoints) * 100)); | ||
} | ||
if (params.externalUrl) { | ||
@@ -480,2 +477,5 @@ formData.append(`mint[${index}][externalUrl]`, params.externalUrl); | ||
} | ||
if (params.royalties) { | ||
formData.append(`mint[${index}][sellerFeeBasisPoints]`, JSON.stringify(Number(params.royalties) * 100)); | ||
} | ||
if (params.royaltiesDestination) { | ||
@@ -502,2 +502,5 @@ formData.append(`mint[${index}][royaltiesDestination]`, params.royaltiesDestination.toBase58() || ''); | ||
} | ||
if (!params.feeTransactionHash) { | ||
throw Error("feeTransactionHash is required"); | ||
} | ||
const stageResponse = (yield this.client.fetch("/api/dynamic_mint/stage_mint_campaign", null, formData, "POST"))[0]; | ||
@@ -526,3 +529,3 @@ const feeTransactionHash = params.feeTransactionHash; | ||
externalUrl: createResponse["external_url"], | ||
sellerFeeBasisPoints: createResponse["seller_fee_basis_points"], | ||
royalties: createResponse["seller_fee_basis_points"], | ||
primaryUrlSlug: createResponse["primary_url_slug"], | ||
@@ -536,3 +539,3 @@ rotatingUrlSlug: createResponse["rotating_url_slug"], | ||
}; | ||
if (createResponse.hasOwn("royalties_destination") && typeof createResponse["royalties_destination"] === 'string') { | ||
if (Object.prototype.hasOwnProperty.call(createResponse, "royalties_destination") && typeof createResponse["royalties_destination"] === 'string') { | ||
mintParams["royaltiesDestination"] = new web3_js_1.PublicKey(createResponse["royalties_destination"]); | ||
@@ -551,10 +554,10 @@ } | ||
this.mintName = params.mintName; | ||
this.mintDescription = params.mintDescription; | ||
this.mintDescription = params.mintDescription || ""; | ||
this.campaignName = params.campaignName; | ||
this.imageUrl = params.imageUrl; | ||
this.externalUrl = params.externalUrl; | ||
this.externalUrl = params.externalUrl || ""; | ||
this.symbol = params.symbol; | ||
this.mintDescription = params.mintDescription; | ||
this.mintDescription = params.mintDescription || ""; | ||
this.mintLimit = params.mintLimit; | ||
this.attributes = params.attributes; | ||
this.attributes = params.attributes || []; | ||
this.creatorPublicKey = params.creatorPublicKey; | ||
@@ -565,3 +568,2 @@ this.collectionId = params.collectionId; | ||
this.collectionUri = params.collectionUri; | ||
this.sellerFeeBasisPoints = params.sellerFeeBasisPoints; | ||
this.primaryUrlSlug = params.primaryUrlSlug; | ||
@@ -574,2 +576,3 @@ this.rotatingUrlSlug = params.rotatingUrlSlug; | ||
this.royaltiesDestination = params.royaltiesDestination; | ||
this.royalties = params.royalties; | ||
} | ||
@@ -576,0 +579,0 @@ // TODO how should we handle rotating urls |
{ | ||
"name": "@tiplink/api", | ||
"version": "0.1.7-beta2", | ||
"version": "0.1.7-beta3", | ||
"description": "Api for creating and sending TipLinks", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92610
2173