From 0a95786e156c66fb08d96e9c63fbef1ae7a93b92 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:07:52 +0000 Subject: [PATCH] SDK regeneration --- .mock/definition/__package__.yml | 1207 +++++- .mock/definition/actions.yml | 76 + .mock/definition/api.yml | 14 +- .mock/definition/checkout.yml | 222 +- .mock/definition/headless.yml | 186 + .mock/definition/nfTs.yml | 726 ++++ .mock/definition/nftCollections.yml | 679 +++ .mock/definition/nftTemplates.yml | 326 ++ .mock/definition/quotePrice.yml | 59 + .mock/definition/registration.yml | 169 + .mock/definition/sign.yml | 51 + .mock/definition/verifiableCredentials.yml | 648 +++ .mock/definition/wallet.yml | 148 + .mock/fern.config.json | 2 +- README.md | 24 +- package.json | 4 +- reference.md | 3753 ++++++++++++++++- src/Client.ts | 337 ++ src/api/client/index.ts | 1 + src/api/client/requests/GetUsageRequest.ts | 24 + src/api/client/requests/NftRequest.ts | 26 + src/api/client/requests/index.ts | 2 + src/api/errors/BadRequestError.ts | 3 +- src/api/errors/ConflictError.ts | 16 + src/api/errors/FailedDependencyError.ts | 17 + src/api/errors/ForbiddenError.ts | 3 +- src/api/errors/NotFoundError.ts | 3 +- src/api/errors/NotImplementedError.ts | 17 + src/api/errors/ServiceUnavailableError.ts | 3 +- src/api/errors/UnauthorizedError.ts | 16 + src/api/errors/index.ts | 6 +- src/api/index.ts | 3 +- src/api/resources/actions/client/Client.ts | 123 + src/api/resources/actions/client/index.ts | 1 + src/api/resources/actions/index.ts | 2 + .../actions/types/GetActionStatusResponse.ts | 14 + .../types/GetActionStatusResponseData.ts | 11 + .../GetActionStatusResponseDataCollection.ts | 8 + .../GetActionStatusResponseDataRecipient.ts | 7 + .../types/GetActionStatusResponseDataToken.ts | 7 + src/api/resources/actions/types/index.ts | 5 + src/api/resources/checkout/client/Client.ts | 320 +- .../client/requests/CheckoutMintRequest.ts | 31 + .../checkout/client/requests/index.ts | 3 +- src/api/resources/checkout/index.ts | 1 + .../types/CheckoutMintRequestCollection.ts | 12 + .../types/CheckoutMintRequestMintConfig.ts | 7 + .../types/CheckoutMintRequestRedirect.ts | 8 + src/api/resources/checkout/types/index.ts | 3 + src/api/resources/headless/client/Client.ts | 304 ++ src/api/resources/headless/client/index.ts | 1 + .../client/requests/CreateOrderRequest.ts} | 2 +- .../client/requests/OrderDto.ts | 0 .../headless/client/requests/index.ts | 2 + src/api/resources/headless/index.ts | 1 + src/api/resources/index.ts | 29 + src/api/resources/nfTs/client/Client.ts | 1027 +++++ src/api/resources/nfTs/client/index.ts | 1 + .../client/requests/BatchMintNftRequest.ts | 16 + .../requests/EditNftByLocatorRequest.ts | 21 + .../nfTs/client/requests/EditNftRequest.ts | 20 + .../requests/MintNftIdempotentRequest.ts | 23 + .../nfTs/client/requests/MintSftRequest.ts | 24 + .../client/requests/MintStatusListRequest.ts | 21 + .../resources/nfTs/client/requests/index.ts | 6 + src/api/resources/nfTs/index.ts | 2 + .../nfTs/types/BatchMintNftRequestNftsItem.ts | 13 + src/api/resources/nfTs/types/Metadata.ts | 9 + .../nfTs/types/MintNftIdempotentResponse.ts | 11 + .../resources/nfTs/types/MintNftRequest.ts | 7 + .../nfTs/types/MintNftRequestTemplateId.ts | 7 + .../resources/nfTs/types/MintNftResponse.ts | 7 + .../resources/nfTs/types/MintSftResponse.ts | 14 + .../nfTs/types/MintSftResponseData.ts | 12 + .../types/MintSftResponseDataCollection.ts | 8 + .../types/MintSftResponseDataRecipient.ts | 8 + .../nfTs/types/MintSftResponseDataToken.ts | 7 + src/api/resources/nfTs/types/index.ts | 11 + .../resources/nftCollections/client/Client.ts | 1151 +++++ .../resources/nftCollections/client/index.ts | 1 + .../requests/EditRoyaltyInformationRequest.ts | 14 + .../client/requests/SetBaseUriRequest.ts | 12 + .../requests/SetTransferabilityRequest.ts | 14 + .../requests/UpdateCollectionRequest.ts | 15 + .../nftCollections/client/requests/index.ts | 4 + src/api/resources/nftCollections/index.ts | 2 + ...RoyaltyInformationRequestRecipientsItem.ts | 13 + .../types/GetBaseUriResponse.ts | 7 + .../types/GetRoyaltyInformationResponse.ts | 9 + ...oyaltyInformationResponseRecipientsItem.ts | 10 + .../types/GetTransferabilityResponse.ts | 7 + .../types/ListCollectionsResponse.ts | 9 + .../resources/nftCollections/types/index.ts | 6 + .../resources/nftTemplates/client/Client.ts | 616 +++ .../resources/nftTemplates/client/index.ts | 1 + .../client/requests/GetAllTemplatesRequest.ts | 21 + .../nftTemplates/client/requests/index.ts | 1 + src/api/resources/nftTemplates/index.ts | 2 + .../nftTemplates/types/EditTemplateRequest.ts | 7 + src/api/resources/nftTemplates/types/index.ts | 1 + src/api/resources/quotePrice/client/Client.ts | 128 + src/api/resources/quotePrice/client/index.ts | 1 + .../client/requests/QuoteRequest.ts | 25 + .../quotePrice/client/requests/index.ts | 1 + src/api/resources/quotePrice/index.ts | 2 + .../types/QuoteRequestQuoteCurrency.ts | 18 + src/api/resources/quotePrice/types/index.ts | 1 + .../resources/registration/client/Client.ts | 205 + .../resources/registration/client/index.ts | 1 + .../requests/RegisterNftCollectionRequest.ts | 37 + .../requests/UpdateNftCollectionRequest.ts | 20 + .../registration/client/requests/index.ts | 2 + src/api/resources/registration/index.ts | 2 + src/api/resources/registration/types/Evm.ts | 12 + .../types/RegisterNftCollectionRequestArgs.ts | 7 + ...rNftCollectionRequestArgsCandyMachineId.ts | 8 + .../RegisterNftCollectionRequestCategory.ts | 25 + .../RegisterNftCollectionRequestChain.ts | 15 + ...egisterNftCollectionRequestContractType.ts | 15 + .../RegisterNftCollectionRequestMetadata.ts | 15 + ...isterNftCollectionRequestMetadataSocial.ts | 10 + .../RegisterNftCollectionRequestOwnership.ts | 13 + .../RegisterNftCollectionRequestScopesItem.ts | 10 + .../UpdateNftCollectionRequestMetadata.ts | 11 + ...pdateNftCollectionRequestMetadataSocial.ts | 10 + src/api/resources/registration/types/index.ts | 12 + src/api/resources/sign/client/Client.ts | 135 + src/api/resources/sign/client/index.ts | 1 + .../client/requests/SignMessageRequest.ts | 14 + .../resources/sign/client/requests/index.ts | 1 + src/api/resources/sign/index.ts | 2 + .../sign/types/SignMessageResponse.ts | 8 + src/api/resources/sign/types/index.ts | 1 + .../verifiableCredentials/client/Client.ts | 883 ++++ .../verifiableCredentials/client/index.ts | 1 + .../requests/CreateTypeIdempotentRequest.ts | 25 + .../client/requests/CreateTypeRequest.ts | 25 + .../client/requests/IssueVcRequest.ts | 25 + .../requests/VcCreateTemplateRequest.ts | 23 + .../requests/VerifyCredentialRequest.ts | 37 + .../client/requests/index.ts | 5 + .../resources/verifiableCredentials/index.ts | 2 + ...otentRequestCredentialSubjectSchemaItem.ts | 10 + ...peIdempotentRequestNestedTypeSchemaItem.ts | 8 + .../types/CreateTypeIdempotentResponse.ts | 8 + ...eTypeRequestCredentialSubjectSchemaItem.ts | 10 + .../CreateTypeRequestNestedTypeSchemaItem.ts | 8 + .../types/CreateTypeResponse.ts | 8 + .../types/GetTypeResponse.ts | 10 + ...TypeResponseCredentialSubjectSchemaItem.ts | 8 + .../types/IssueVcRequestCredential.ts | 10 + .../types/IssueVcRequestMetadata.ts | 22 + .../IssueVcRequestMetadataAttributesItem.ts | 14 + ...equestMetadataAttributesItemDisplayType.ts | 14 + .../types/IssueVcResponse.ts | 12 + .../types/IssueVcResponseOnChain.ts | 9 + .../VcCreateTemplateRequestCredentials.ts | 21 + ...mplateRequestCredentialsDelegatedIssuer.ts | 15 + .../types/VcCreateTemplateRequestMetadata.ts | 10 + .../types/VerifyCredentialResponse.ts | 8 + .../verifiableCredentials/types/index.ts | 18 + src/api/resources/wallet/client/Client.ts | 301 ++ src/api/resources/wallet/client/index.ts | 1 + .../requests/FetchContentFromWalletRequest.ts | 21 + .../client/requests/FetchWalletRequest.ts | 18 + .../resources/wallet/client/requests/index.ts | 2 + src/api/resources/wallet/index.ts | 2 + .../wallet/types/CreateWalletRequest.ts | 7 + .../wallet/types/CreateWalletResponse.ts | 10 + src/api/resources/wallet/types/Email.ts | 11 + .../types/FetchContentFromWalletResponse.ts | 7 + src/api/resources/wallet/types/UserId.ts | 11 + src/api/resources/wallet/types/index.ts | 5 + src/api/types/AllChains.ts | 47 + src/api/types/BadRequestErrorBody.ts | 12 + src/api/types/BatchError.ts | 12 + src/api/types/BatchMintResponse.ts | 9 + src/api/types/BurnNftResponse.ts | 25 + src/api/types/BurnNftResponseData.ts | 18 + .../types/BurnNftResponseDataCollection.ts | 10 + src/api/types/BurnNftResponseDataToken.ts | 10 + src/api/types/Cardano.ts | 10 + src/api/types/Checkout.ts | 23 + src/api/types/CheckoutMintSuccess.ts | 8 + src/api/types/Collection.ts | 15 + src/api/types/Compressed.ts | 8 + src/api/types/CreateCollectionBody.ts | 17 + src/api/types/CreateCollectionBodyChain.ts | 49 + .../types/CreateCollectionBodyFungibility.ts | 13 + src/api/types/CreateCollectionBodyMetadata.ts | 14 + src/api/types/CreateCollectionResponse.ts | 13 + .../types/CreateCollectionResponseMetadata.ts | 10 + .../types/CreateCollectionResponseOnChain.ts | 8 + src/api/types/CreateTemplateBody.ts | 15 + src/api/types/CreateTemplateBodyMetadata.ts | 13 + src/api/types/CreateTemplateBodyOnChain.ts | 11 + src/api/types/CreateTemplateBodySupply.ts | 11 + src/api/types/EditNftResponse.ts | 20 + src/api/types/EditNftResponseData.ts | 18 + .../types/EditNftResponseDataCollection.ts | 8 + src/api/types/EditNftResponseDataToken.ts | 11 + .../types/EditNftResponseDataTokenOwner.ts | 7 + ...otFoundResponse.ts => Error400Response.ts} | 2 +- ...RequestResponse.ts => Error403Response.ts} | 2 +- ...horizedResponse.ts => Error404Response.ts} | 2 +- ...ilabileResponse.ts => Error503Response.ts} | 2 +- src/api/types/ErrorMsg.ts | 8 + src/api/types/Error_.ts | 7 + src/api/types/EvmChains.ts | 38 + src/api/types/EvmTransfer.ts | 19 + src/api/types/ExternalCollection.ts | 7 + src/api/types/FourHundredNineResponse.ts | 8 + .../types/FourHundredTwentyFourResponse.ts | 8 + src/api/types/GetCollectionResponse.ts | 14 + .../types/GetCollectionResponseMetadata.ts | 10 + src/api/types/GetCollectionResponseOnChain.ts | 9 + .../types/GetCollectionResponsePayments.ts | 8 + .../MintApiFeatureCollectionNotDeployed.ts | 8 + src/api/types/MintConfig.ts | 12 + src/api/types/MintResponseEvm200.ts | 11 + src/api/types/MintResponseEvm200OnChain.ts | 9 + src/api/types/MintResponseEvm200Subsequent.ts | 10 + src/api/types/MintResponseSolana200.ts | 11 + src/api/types/MintResponseSolana200OnChain.ts | 8 + .../types/MintResponseSolana200Subsequent.ts | 10 + src/api/types/MintStatus.ts | 16 + src/api/types/MintStatusSolana200.ts | 10 + src/api/types/MintStatusStatus.ts | 14 + src/api/types/MintingMetadata.ts | 10 + src/api/types/Nft.ts | 18 + src/api/types/NftAttributesItem.ts | 10 + src/api/types/NftAttributesItemValue.ts | 5 + src/api/types/NftCollection.ts | 8 + src/api/types/NftMetadata.ts | 22 + src/api/types/NftMetadataAttributesItem.ts | 14 + .../NftMetadataAttributesItemDisplayType.ts | 14 + src/api/types/NftMetadataOptions.ts | 18 + src/api/types/NftMetadataOptionsName.ts | 13 + src/api/types/NftMetadataSolana.ts | 16 + .../types/NftMetadataSolanaAttributesItem.ts | 14 + ...MetadataSolanaAttributesItemDisplayType.ts | 14 + src/api/types/NftObjectEvm.ts | 11 + src/api/types/NftObjectEvmMetadata.ts | 9 + src/api/types/NftObjectEvmOnChain.ts | 12 + src/api/types/NftObjectSolana.ts | 11 + src/api/types/NftObjectSolanaMetadata.ts | 15 + .../NftObjectSolanaMetadataAttributesItem.ts | 8 + .../NftObjectSolanaMetadataProperties.ts | 11 + ...ectSolanaMetadataPropertiesCreatorsItem.ts | 9 + ...ObjectSolanaMetadataPropertiesFilesItem.ts | 8 + src/api/types/NftObjectSolanaOnChain.ts | 11 + src/api/types/NftProperties.ts | 11 + src/api/types/NftPropertiesCreatorsItem.ts | 8 + src/api/types/NftPropertiesFilesItem.ts | 8 + src/api/types/NftSolana.ts | 10 + src/api/types/NftcarItem.ts | 15 + src/api/types/NftcarItemMetadata.ts | 13 + .../types/NftcarItemMetadataAttributesItem.ts | 8 + src/api/types/Nftevm.ts | 10 + src/api/types/NftevmItem.ts | 19 + src/api/types/NftevmItemMetadata.ts | 16 + .../types/NftevmItemMetadataAttributesItem.ts | 9 + src/api/types/NftsolItem.ts | 15 + src/api/types/NftsolItemMetadata.ts | 13 + .../types/NftsolItemMetadataAttributesItem.ts | 10 + .../NftsolItemMetadataAttributesItemValue.ts | 5 + src/api/types/NotFoundErrorBody.ts | 8 + src/api/types/NotImplementedErrorBody.ts | 8 + src/api/types/OldCollection.ts | 7 + src/api/types/OutdatedContract.ts | 7 + src/api/types/PaymentsObject.ts | 15 + src/api/types/QuoteResponse.ts | 8 + src/api/types/Recipient.ts | 21 +- src/api/types/RecipientEmail.ts | 10 - src/api/types/RecipientWallet.ts | 10 - src/api/types/Redirect.ts | 13 + src/api/types/ReuploadLinkedFiles.ts | 8 + src/api/types/SftCollection.ts | 7 + src/api/types/Solana.ts | 13 + src/api/types/SolanaNotSupported.ts | 7 + src/api/types/Supply.ts | 10 + src/api/types/SupplySupply.ts | 11 + src/api/types/TemplateResponse.ts | 12 + src/api/types/TemplateResponseMetadata.ts | 9 + src/api/types/TemplateResponseOnChain.ts | 7 + src/api/types/TemplateResponseSupply.ts | 8 + src/api/types/TransferPendingVerification.ts | 8 + src/api/types/UpdateCollectionResponse.ts | 14 + src/api/types/UpdateCollectionResponseData.ts | 11 + .../UpdateCollectionResponseDataCollection.ts | 8 + src/api/types/UsageResponse.ts | 9 + src/api/types/UsageResponseData.ts | 12 + src/api/types/UsageResponseDataUsage.ts | 13 + src/api/types/ValidationError.ts | 12 + src/api/types/VerificationRequestSent.ts | 10 + src/api/types/Wallet.ts | 10 + src/api/types/WalletsRequest.ts | 7 + src/api/types/WalletsTransfer.ts | 15 + src/api/types/index.ts | 128 +- src/core/fetcher/Fetcher.ts | 3 +- .../Node18UniversalStreamWrapper.ts | 226 + .../stream-wrappers/NodePre18StreamWrapper.ts | 87 + .../stream-wrappers/UndiciStreamWrapper.ts | 213 + .../stream-wrappers/chooseStreamWrapper.ts | 32 + src/environments.ts | 5 +- src/serialization/client/index.ts | 1 + .../client/requests/NftRequest.ts | 27 + src/serialization/client/requests/index.ts | 1 + src/serialization/index.ts | 3 +- src/serialization/resources/actions/index.ts | 1 + .../actions/types/GetActionStatusResponse.ts | 31 + .../types/GetActionStatusResponseData.ts | 27 + .../GetActionStatusResponseDataCollection.ts | 22 + .../GetActionStatusResponseDataRecipient.ts | 20 + .../types/GetActionStatusResponseDataToken.ts | 20 + .../resources/actions/types/index.ts | 5 + .../client/requests/CheckoutMintRequest.ts | 41 + .../checkout/client/requests/index.ts | 3 +- src/serialization/resources/checkout/index.ts | 1 + .../types/CheckoutMintRequestCollection.ts | 24 + .../types/CheckoutMintRequestMintConfig.ts | 20 + .../types/CheckoutMintRequestRedirect.ts | 22 + .../resources/checkout/types/index.ts | 3 + .../resources/headless/client/index.ts | 1 + .../client/requests/CreateOrderRequest.ts} | 8 +- .../client/requests/OrderDto.ts | 0 .../headless/client/requests/index.ts | 2 + src/serialization/resources/headless/index.ts | 1 + src/serialization/resources/index.ts | 26 + .../resources/nfTs/client/index.ts | 2 + .../resources/nfTs/client/mintStatusList.ts | 17 + .../client/requests/BatchMintNftRequest.ts | 21 + .../requests/EditNftByLocatorRequest.ts | 24 + .../nfTs/client/requests/EditNftRequest.ts | 22 + .../requests/MintNftIdempotentRequest.ts | 30 + .../nfTs/client/requests/MintSftRequest.ts | 25 + .../resources/nfTs/client/requests/index.ts | 5 + src/serialization/resources/nfTs/index.ts | 2 + .../nfTs/types/BatchMintNftRequestNftsItem.ts | 29 + .../resources/nfTs/types/Metadata.ts | 19 + .../nfTs/types/MintNftIdempotentResponse.ts | 29 + .../resources/nfTs/types/MintNftRequest.ts | 16 + .../nfTs/types/MintNftRequestTemplateId.ts | 20 + .../resources/nfTs/types/MintNftResponse.ts | 16 + .../resources/nfTs/types/MintSftResponse.ts | 31 + .../nfTs/types/MintSftResponseData.ts | 29 + .../types/MintSftResponseDataCollection.ts | 22 + .../types/MintSftResponseDataRecipient.ts | 22 + .../nfTs/types/MintSftResponseDataToken.ts | 20 + .../resources/nfTs/types/index.ts | 11 + .../resources/nftCollections/client/index.ts | 1 + .../requests/EditRoyaltyInformationRequest.ts | 21 + .../client/requests/SetBaseUriRequest.ts | 20 + .../requests/SetTransferabilityRequest.ts | 20 + .../requests/UpdateCollectionRequest.ts | 23 + .../nftCollections/client/requests/index.ts | 4 + .../resources/nftCollections/index.ts | 2 + ...RoyaltyInformationRequestRecipientsItem.ts | 22 + .../types/GetBaseUriResponse.ts | 20 + .../types/GetRoyaltyInformationResponse.ts | 21 + ...oyaltyInformationResponseRecipientsItem.ts | 22 + .../types/GetTransferabilityResponse.ts | 20 + .../types/ListCollectionsResponse.ts | 21 + .../resources/nftCollections/types/index.ts | 6 + .../nftTemplates/client/getAllTemplates.ts | 17 + .../resources/nftTemplates/client/index.ts | 1 + .../resources/nftTemplates/index.ts | 2 + .../nftTemplates/types/EditTemplateRequest.ts | 18 + .../resources/nftTemplates/types/index.ts | 1 + .../resources/quotePrice/index.ts | 1 + .../types/QuoteRequestQuoteCurrency.ts | 16 + .../resources/quotePrice/types/index.ts | 1 + .../resources/registration/client/index.ts | 1 + .../requests/RegisterNftCollectionRequest.ts | 39 + .../requests/UpdateNftCollectionRequest.ts | 23 + .../registration/client/requests/index.ts | 2 + .../resources/registration/index.ts | 2 + .../resources/registration/types/Evm.ts | 25 + .../types/RegisterNftCollectionRequestArgs.ts | 18 + ...rNftCollectionRequestArgsCandyMachineId.ts | 20 + .../RegisterNftCollectionRequestCategory.ts | 16 + .../RegisterNftCollectionRequestChain.ts | 16 + ...egisterNftCollectionRequestContractType.ts | 16 + .../RegisterNftCollectionRequestMetadata.ts | 27 + ...isterNftCollectionRequestMetadataSocial.ts | 22 + .../RegisterNftCollectionRequestOwnership.ts | 16 + .../RegisterNftCollectionRequestScopesItem.ts | 16 + .../UpdateNftCollectionRequestMetadata.ts | 25 + ...pdateNftCollectionRequestMetadataSocial.ts | 22 + .../resources/registration/types/index.ts | 12 + .../resources/sign/client/index.ts | 1 + .../client/requests/SignMessageRequest.ts | 20 + .../resources/sign/client/requests/index.ts | 1 + src/serialization/resources/sign/index.ts | 2 + .../sign/types/SignMessageResponse.ts | 20 + .../resources/sign/types/index.ts | 1 + .../verifiableCredentials/client/getVc.ts | 15 + .../verifiableCredentials/client/getVcById.ts | 15 + .../client/getVcByLocator.ts | 15 + .../verifiableCredentials/client/index.ts | 5 + .../requests/CreateTypeIdempotentRequest.ts | 24 + .../client/requests/CreateTypeRequest.ts | 24 + .../client/requests/IssueVcRequest.ts | 24 + .../requests/VcCreateTemplateRequest.ts | 24 + .../requests/VerifyCredentialRequest.ts | 20 + .../client/requests/index.ts | 5 + .../client/vcCreateTemplate.ts | 15 + .../resources/verifiableCredentials/index.ts | 2 + ...otentRequestCredentialSubjectSchemaItem.ts | 22 + ...peIdempotentRequestNestedTypeSchemaItem.ts | 22 + .../types/CreateTypeIdempotentResponse.ts | 20 + ...eTypeRequestCredentialSubjectSchemaItem.ts | 22 + .../CreateTypeRequestNestedTypeSchemaItem.ts | 22 + .../types/CreateTypeResponse.ts | 20 + .../types/GetTypeResponse.ts | 23 + ...TypeResponseCredentialSubjectSchemaItem.ts | 22 + .../types/IssueVcRequestCredential.ts | 22 + .../types/IssueVcRequestMetadata.ts | 29 + .../IssueVcRequestMetadataAttributesItem.ts | 28 + ...equestMetadataAttributesItemDisplayType.ts | 16 + .../types/IssueVcResponse.ts | 25 + .../types/IssueVcResponseOnChain.ts | 24 + .../VcCreateTemplateRequestCredentials.ts | 29 + ...mplateRequestCredentialsDelegatedIssuer.ts | 24 + .../types/VcCreateTemplateRequestMetadata.ts | 22 + .../types/VerifyCredentialResponse.ts | 22 + .../verifiableCredentials/types/index.ts | 18 + .../resources/wallet/client/fetchWallet.ts | 15 + .../resources/wallet/client/index.ts | 1 + src/serialization/resources/wallet/index.ts | 2 + .../wallet/types/CreateWalletRequest.ts | 18 + .../wallet/types/CreateWalletResponse.ts | 22 + .../resources/wallet/types/Email.ts | 22 + .../types/FetchContentFromWalletResponse.ts | 20 + .../resources/wallet/types/UserId.ts | 21 + .../resources/wallet/types/index.ts | 5 + src/serialization/types/AllChains.ts | 51 + .../types/BadRequestErrorBody.ts | 32 + src/serialization/types/BatchError.ts | 23 + src/serialization/types/BatchMintResponse.ts | 21 + src/serialization/types/BurnNftResponse.ts | 33 + .../types/BurnNftResponseData.ts | 28 + .../types/BurnNftResponseDataCollection.ts | 22 + .../types/BurnNftResponseDataToken.ts | 22 + src/serialization/types/Cardano.ts | 15 + src/serialization/types/Checkout.ts | 39 + .../types/CheckoutMintSuccess.ts | 20 + src/serialization/types/Collection.ts | 22 + src/serialization/types/Compressed.ts | 14 + .../types/CreateCollectionBody.ts | 35 + .../types/CreateCollectionBodyChain.ts | 55 + .../types/CreateCollectionBodyFungibility.ts | 16 + .../types/CreateCollectionBodyMetadata.ts | 26 + .../types/CreateCollectionResponse.ts | 30 + .../types/CreateCollectionResponseMetadata.ts | 26 + .../types/CreateCollectionResponseOnChain.ts | 22 + src/serialization/types/CreateTemplateBody.ts | 30 + .../types/CreateTemplateBodyMetadata.ts | 24 + .../types/CreateTemplateBodyOnChain.ts | 20 + .../types/CreateTemplateBodySupply.ts | 20 + src/serialization/types/EditNftResponse.ts | 33 + .../types/EditNftResponseData.ts | 30 + .../types/EditNftResponseDataCollection.ts | 22 + .../types/EditNftResponseDataToken.ts | 25 + .../types/EditNftResponseDataTokenOwner.ts | 20 + ...otFoundResponse.ts => Error400Response.ts} | 8 +- ...RequestResponse.ts => Error403Response.ts} | 8 +- ...horizedResponse.ts => Error404Response.ts} | 8 +- ...ilabileResponse.ts => Error503Response.ts} | 8 +- src/serialization/types/ErrorMsg.ts | 20 + .../types/{RecipientEmail.ts => Error_.ts} | 8 +- src/serialization/types/EvmChains.ts | 45 + src/serialization/types/EvmTransfer.ts | 29 + src/serialization/types/ExternalCollection.ts | 20 + .../types/FourHundredNineResponse.ts | 22 + .../types/FourHundredTwentyFourResponse.ts | 22 + .../types/GetCollectionResponse.ts | 33 + .../types/GetCollectionResponseMetadata.ts | 26 + .../types/GetCollectionResponseOnChain.ts | 24 + .../types/GetCollectionResponsePayments.ts | 22 + .../MintApiFeatureCollectionNotDeployed.ts | 22 + src/serialization/types/MintConfig.ts | 23 + src/serialization/types/MintResponseEvm200.ts | 25 + .../types/MintResponseEvm200OnChain.ts | 24 + .../types/MintResponseEvm200Subsequent.ts | 23 + .../types/MintResponseSolana200.ts | 25 + .../types/MintResponseSolana200OnChain.ts | 22 + .../types/MintResponseSolana200Subsequent.ts | 23 + src/serialization/types/MintStatus.ts | 25 + .../types/MintStatusSolana200.ts | 23 + src/serialization/types/MintStatusStatus.ts | 14 + src/serialization/types/MintingMetadata.ts | 24 + src/serialization/types/Nft.ts | 39 + src/serialization/types/NftAttributesItem.ts | 23 + .../types/NftAttributesItemValue.ts | 21 + src/serialization/types/NftCollection.ts | 20 + src/serialization/types/NftMetadata.ts | 27 + .../types/NftMetadataAttributesItem.ts | 25 + .../NftMetadataAttributesItemDisplayType.ts | 16 + src/serialization/types/NftMetadataOptions.ts | 24 + .../types/NftMetadataOptionsName.ts | 22 + src/serialization/types/NftMetadataSolana.ts | 27 + .../types/NftMetadataSolanaAttributesItem.ts | 25 + ...MetadataSolanaAttributesItemDisplayType.ts | 16 + src/serialization/types/NftObjectEvm.ts | 24 + .../types/NftObjectEvmMetadata.ts | 24 + .../types/NftObjectEvmOnChain.ts | 30 + src/serialization/types/NftObjectSolana.ts | 26 + .../types/NftObjectSolanaMetadata.ts | 37 + .../NftObjectSolanaMetadataAttributesItem.ts | 22 + .../NftObjectSolanaMetadataProperties.ts | 26 + ...ectSolanaMetadataPropertiesCreatorsItem.ts | 24 + ...ObjectSolanaMetadataPropertiesFilesItem.ts | 22 + .../types/NftObjectSolanaOnChain.ts | 28 + src/serialization/types/NftProperties.ts | 24 + .../types/NftPropertiesCreatorsItem.ts | 22 + .../types/NftPropertiesFilesItem.ts | 22 + src/serialization/types/NftSolana.ts | 15 + src/serialization/types/NftcarItem.ts | 25 + src/serialization/types/NftcarItemMetadata.ts | 29 + .../types/NftcarItemMetadataAttributesItem.ts | 22 + src/serialization/types/Nftevm.ts | 15 + src/serialization/types/NftevmItem.ts | 29 + src/serialization/types/NftevmItemMetadata.ts | 31 + .../types/NftevmItemMetadataAttributesItem.ts | 24 + src/serialization/types/NftsolItem.ts | 25 + src/serialization/types/NftsolItemMetadata.ts | 27 + .../types/NftsolItemMetadataAttributesItem.ts | 23 + .../NftsolItemMetadataAttributesItemValue.ts | 21 + src/serialization/types/NotFoundErrorBody.ts | 22 + .../types/NotImplementedErrorBody.ts | 22 + src/serialization/types/OldCollection.ts | 18 + src/serialization/types/OutdatedContract.ts | 20 + src/serialization/types/PaymentsObject.ts | 22 + src/serialization/types/QuoteResponse.ts | 20 + src/serialization/types/Recipient.ts | 6 +- src/serialization/types/RecipientWallet.ts | 20 - src/serialization/types/Redirect.ts | 20 + .../types/ReuploadLinkedFiles.ts | 16 + src/serialization/types/SftCollection.ts | 18 + src/serialization/types/Solana.ts | 24 + src/serialization/types/SolanaNotSupported.ts | 20 + src/serialization/types/Supply.ts | 19 + src/serialization/types/SupplySupply.ts | 18 + src/serialization/types/TemplateResponse.ts | 29 + .../types/TemplateResponseMetadata.ts | 24 + .../types/TemplateResponseOnChain.ts | 20 + .../types/TemplateResponseSupply.ts | 22 + .../types/TransferPendingVerification.ts | 20 + .../types/UpdateCollectionResponse.ts | 31 + .../types/UpdateCollectionResponseData.ts | 25 + .../UpdateCollectionResponseDataCollection.ts | 22 + src/serialization/types/UsageResponse.ts | 19 + src/serialization/types/UsageResponseData.ts | 23 + .../types/UsageResponseDataUsage.ts | 22 + src/serialization/types/ValidationError.ts | 24 + .../types/VerificationRequestSent.ts | 22 + src/serialization/types/Wallet.ts | 20 + src/serialization/types/WalletsRequest.ts | 16 + src/serialization/types/WalletsTransfer.ts | 28 + src/serialization/types/index.ts | 128 +- tests/unit/fetcher/Fetcher.test.ts | 47 + tests/unit/fetcher/createRequestUrl.test.ts | 51 + tests/unit/fetcher/getFetchFn.test.ts | 22 + tests/unit/fetcher/getRequestBody.test.ts | 81 + tests/unit/fetcher/getResponseBody.test.ts | 57 + tests/unit/fetcher/makeRequest.test.ts | 58 + tests/unit/fetcher/requestWithRetries.test.ts | 85 + tests/unit/fetcher/signals.test.ts | 69 + .../Node18UniversalStreamWrapper.test.ts | 157 + .../NodePre18StreamWrapper.test.ts | 114 + .../UndiciStreamWrapper.test.ts | 134 + .../chooseStreamWrapper.test.ts | 43 + tests/unit/zurg/date/date.test.ts | 31 + tests/unit/zurg/enum/enum.test.ts | 30 + tests/unit/zurg/lazy/lazy.test.ts | 57 + tests/unit/zurg/lazy/lazyObject.test.ts | 18 + tests/unit/zurg/lazy/recursive/a.ts | 7 + tests/unit/zurg/lazy/recursive/b.ts | 8 + tests/unit/zurg/list/list.test.ts | 41 + .../unit/zurg/literals/stringLiteral.test.ts | 21 + .../object-like/withParsedProperties.test.ts | 57 + tests/unit/zurg/object/extend.test.ts | 89 + tests/unit/zurg/object/object.test.ts | 255 ++ .../objectWithoutOptionalProperties.test.ts | 21 + tests/unit/zurg/primitives/any.test.ts | 6 + tests/unit/zurg/primitives/boolean.test.ts | 14 + tests/unit/zurg/primitives/number.test.ts | 14 + tests/unit/zurg/primitives/string.test.ts | 14 + tests/unit/zurg/primitives/unknown.test.ts | 6 + tests/unit/zurg/record/record.test.ts | 34 + .../zurg/schema-utils/getSchemaUtils.test.ts | 83 + tests/unit/zurg/schema.test.ts | 78 + tests/unit/zurg/set/set.test.ts | 48 + tests/unit/zurg/skipValidation.test.ts | 45 + .../undiscriminatedUnion.test.ts | 44 + tests/unit/zurg/union/union.test.ts | 113 + tests/unit/zurg/utils/itSchema.ts | 78 + tests/unit/zurg/utils/itValidate.ts | 56 + yarn.lock | 139 +- 600 files changed, 24197 insertions(+), 738 deletions(-) create mode 100644 .mock/definition/actions.yml create mode 100644 .mock/definition/headless.yml create mode 100644 .mock/definition/nfTs.yml create mode 100644 .mock/definition/nftCollections.yml create mode 100644 .mock/definition/nftTemplates.yml create mode 100644 .mock/definition/quotePrice.yml create mode 100644 .mock/definition/registration.yml create mode 100644 .mock/definition/sign.yml create mode 100644 .mock/definition/verifiableCredentials.yml create mode 100644 .mock/definition/wallet.yml create mode 100644 src/api/client/index.ts create mode 100644 src/api/client/requests/GetUsageRequest.ts create mode 100644 src/api/client/requests/NftRequest.ts create mode 100644 src/api/client/requests/index.ts create mode 100644 src/api/errors/ConflictError.ts create mode 100644 src/api/errors/FailedDependencyError.ts create mode 100644 src/api/errors/NotImplementedError.ts create mode 100644 src/api/errors/UnauthorizedError.ts create mode 100644 src/api/resources/actions/client/Client.ts create mode 100644 src/api/resources/actions/client/index.ts create mode 100644 src/api/resources/actions/index.ts create mode 100644 src/api/resources/actions/types/GetActionStatusResponse.ts create mode 100644 src/api/resources/actions/types/GetActionStatusResponseData.ts create mode 100644 src/api/resources/actions/types/GetActionStatusResponseDataCollection.ts create mode 100644 src/api/resources/actions/types/GetActionStatusResponseDataRecipient.ts create mode 100644 src/api/resources/actions/types/GetActionStatusResponseDataToken.ts create mode 100644 src/api/resources/actions/types/index.ts create mode 100644 src/api/resources/checkout/client/requests/CheckoutMintRequest.ts create mode 100644 src/api/resources/checkout/types/CheckoutMintRequestCollection.ts create mode 100644 src/api/resources/checkout/types/CheckoutMintRequestMintConfig.ts create mode 100644 src/api/resources/checkout/types/CheckoutMintRequestRedirect.ts create mode 100644 src/api/resources/checkout/types/index.ts create mode 100644 src/api/resources/headless/client/Client.ts create mode 100644 src/api/resources/headless/client/index.ts rename src/api/resources/{checkout/client/requests/CheckoutCreateOrderRequest.ts => headless/client/requests/CreateOrderRequest.ts} (92%) rename src/api/resources/{checkout => headless}/client/requests/OrderDto.ts (100%) create mode 100644 src/api/resources/headless/client/requests/index.ts create mode 100644 src/api/resources/headless/index.ts create mode 100644 src/api/resources/nfTs/client/Client.ts create mode 100644 src/api/resources/nfTs/client/index.ts create mode 100644 src/api/resources/nfTs/client/requests/BatchMintNftRequest.ts create mode 100644 src/api/resources/nfTs/client/requests/EditNftByLocatorRequest.ts create mode 100644 src/api/resources/nfTs/client/requests/EditNftRequest.ts create mode 100644 src/api/resources/nfTs/client/requests/MintNftIdempotentRequest.ts create mode 100644 src/api/resources/nfTs/client/requests/MintSftRequest.ts create mode 100644 src/api/resources/nfTs/client/requests/MintStatusListRequest.ts create mode 100644 src/api/resources/nfTs/client/requests/index.ts create mode 100644 src/api/resources/nfTs/index.ts create mode 100644 src/api/resources/nfTs/types/BatchMintNftRequestNftsItem.ts create mode 100644 src/api/resources/nfTs/types/Metadata.ts create mode 100644 src/api/resources/nfTs/types/MintNftIdempotentResponse.ts create mode 100644 src/api/resources/nfTs/types/MintNftRequest.ts create mode 100644 src/api/resources/nfTs/types/MintNftRequestTemplateId.ts create mode 100644 src/api/resources/nfTs/types/MintNftResponse.ts create mode 100644 src/api/resources/nfTs/types/MintSftResponse.ts create mode 100644 src/api/resources/nfTs/types/MintSftResponseData.ts create mode 100644 src/api/resources/nfTs/types/MintSftResponseDataCollection.ts create mode 100644 src/api/resources/nfTs/types/MintSftResponseDataRecipient.ts create mode 100644 src/api/resources/nfTs/types/MintSftResponseDataToken.ts create mode 100644 src/api/resources/nfTs/types/index.ts create mode 100644 src/api/resources/nftCollections/client/Client.ts create mode 100644 src/api/resources/nftCollections/client/index.ts create mode 100644 src/api/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts create mode 100644 src/api/resources/nftCollections/client/requests/SetBaseUriRequest.ts create mode 100644 src/api/resources/nftCollections/client/requests/SetTransferabilityRequest.ts create mode 100644 src/api/resources/nftCollections/client/requests/UpdateCollectionRequest.ts create mode 100644 src/api/resources/nftCollections/client/requests/index.ts create mode 100644 src/api/resources/nftCollections/index.ts create mode 100644 src/api/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts create mode 100644 src/api/resources/nftCollections/types/GetBaseUriResponse.ts create mode 100644 src/api/resources/nftCollections/types/GetRoyaltyInformationResponse.ts create mode 100644 src/api/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts create mode 100644 src/api/resources/nftCollections/types/GetTransferabilityResponse.ts create mode 100644 src/api/resources/nftCollections/types/ListCollectionsResponse.ts create mode 100644 src/api/resources/nftCollections/types/index.ts create mode 100644 src/api/resources/nftTemplates/client/Client.ts create mode 100644 src/api/resources/nftTemplates/client/index.ts create mode 100644 src/api/resources/nftTemplates/client/requests/GetAllTemplatesRequest.ts create mode 100644 src/api/resources/nftTemplates/client/requests/index.ts create mode 100644 src/api/resources/nftTemplates/index.ts create mode 100644 src/api/resources/nftTemplates/types/EditTemplateRequest.ts create mode 100644 src/api/resources/nftTemplates/types/index.ts create mode 100644 src/api/resources/quotePrice/client/Client.ts create mode 100644 src/api/resources/quotePrice/client/index.ts create mode 100644 src/api/resources/quotePrice/client/requests/QuoteRequest.ts create mode 100644 src/api/resources/quotePrice/client/requests/index.ts create mode 100644 src/api/resources/quotePrice/index.ts create mode 100644 src/api/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts create mode 100644 src/api/resources/quotePrice/types/index.ts create mode 100644 src/api/resources/registration/client/Client.ts create mode 100644 src/api/resources/registration/client/index.ts create mode 100644 src/api/resources/registration/client/requests/RegisterNftCollectionRequest.ts create mode 100644 src/api/resources/registration/client/requests/UpdateNftCollectionRequest.ts create mode 100644 src/api/resources/registration/client/requests/index.ts create mode 100644 src/api/resources/registration/index.ts create mode 100644 src/api/resources/registration/types/Evm.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestArgs.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestCategory.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestChain.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestContractType.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestMetadata.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestOwnership.ts create mode 100644 src/api/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts create mode 100644 src/api/resources/registration/types/UpdateNftCollectionRequestMetadata.ts create mode 100644 src/api/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts create mode 100644 src/api/resources/registration/types/index.ts create mode 100644 src/api/resources/sign/client/Client.ts create mode 100644 src/api/resources/sign/client/index.ts create mode 100644 src/api/resources/sign/client/requests/SignMessageRequest.ts create mode 100644 src/api/resources/sign/client/requests/index.ts create mode 100644 src/api/resources/sign/index.ts create mode 100644 src/api/resources/sign/types/SignMessageResponse.ts create mode 100644 src/api/resources/sign/types/index.ts create mode 100644 src/api/resources/verifiableCredentials/client/Client.ts create mode 100644 src/api/resources/verifiableCredentials/client/index.ts create mode 100644 src/api/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts create mode 100644 src/api/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts create mode 100644 src/api/resources/verifiableCredentials/client/requests/IssueVcRequest.ts create mode 100644 src/api/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts create mode 100644 src/api/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts create mode 100644 src/api/resources/verifiableCredentials/client/requests/index.ts create mode 100644 src/api/resources/verifiableCredentials/index.ts create mode 100644 src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts create mode 100644 src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts create mode 100644 src/api/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts create mode 100644 src/api/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts create mode 100644 src/api/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts create mode 100644 src/api/resources/verifiableCredentials/types/CreateTypeResponse.ts create mode 100644 src/api/resources/verifiableCredentials/types/GetTypeResponse.ts create mode 100644 src/api/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts create mode 100644 src/api/resources/verifiableCredentials/types/IssueVcRequestCredential.ts create mode 100644 src/api/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts create mode 100644 src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts create mode 100644 src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts create mode 100644 src/api/resources/verifiableCredentials/types/IssueVcResponse.ts create mode 100644 src/api/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts create mode 100644 src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts create mode 100644 src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts create mode 100644 src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts create mode 100644 src/api/resources/verifiableCredentials/types/VerifyCredentialResponse.ts create mode 100644 src/api/resources/verifiableCredentials/types/index.ts create mode 100644 src/api/resources/wallet/client/Client.ts create mode 100644 src/api/resources/wallet/client/index.ts create mode 100644 src/api/resources/wallet/client/requests/FetchContentFromWalletRequest.ts create mode 100644 src/api/resources/wallet/client/requests/FetchWalletRequest.ts create mode 100644 src/api/resources/wallet/client/requests/index.ts create mode 100644 src/api/resources/wallet/index.ts create mode 100644 src/api/resources/wallet/types/CreateWalletRequest.ts create mode 100644 src/api/resources/wallet/types/CreateWalletResponse.ts create mode 100644 src/api/resources/wallet/types/Email.ts create mode 100644 src/api/resources/wallet/types/FetchContentFromWalletResponse.ts create mode 100644 src/api/resources/wallet/types/UserId.ts create mode 100644 src/api/resources/wallet/types/index.ts create mode 100644 src/api/types/AllChains.ts create mode 100644 src/api/types/BadRequestErrorBody.ts create mode 100644 src/api/types/BatchError.ts create mode 100644 src/api/types/BatchMintResponse.ts create mode 100644 src/api/types/BurnNftResponse.ts create mode 100644 src/api/types/BurnNftResponseData.ts create mode 100644 src/api/types/BurnNftResponseDataCollection.ts create mode 100644 src/api/types/BurnNftResponseDataToken.ts create mode 100644 src/api/types/Cardano.ts create mode 100644 src/api/types/Checkout.ts create mode 100644 src/api/types/CheckoutMintSuccess.ts create mode 100644 src/api/types/Collection.ts create mode 100644 src/api/types/Compressed.ts create mode 100644 src/api/types/CreateCollectionBody.ts create mode 100644 src/api/types/CreateCollectionBodyChain.ts create mode 100644 src/api/types/CreateCollectionBodyFungibility.ts create mode 100644 src/api/types/CreateCollectionBodyMetadata.ts create mode 100644 src/api/types/CreateCollectionResponse.ts create mode 100644 src/api/types/CreateCollectionResponseMetadata.ts create mode 100644 src/api/types/CreateCollectionResponseOnChain.ts create mode 100644 src/api/types/CreateTemplateBody.ts create mode 100644 src/api/types/CreateTemplateBodyMetadata.ts create mode 100644 src/api/types/CreateTemplateBodyOnChain.ts create mode 100644 src/api/types/CreateTemplateBodySupply.ts create mode 100644 src/api/types/EditNftResponse.ts create mode 100644 src/api/types/EditNftResponseData.ts create mode 100644 src/api/types/EditNftResponseDataCollection.ts create mode 100644 src/api/types/EditNftResponseDataToken.ts create mode 100644 src/api/types/EditNftResponseDataTokenOwner.ts rename src/api/types/{NotFoundResponse.ts => Error400Response.ts} (76%) rename src/api/types/{BadRequestResponse.ts => Error403Response.ts} (75%) rename src/api/types/{UnauthorizedResponse.ts => Error404Response.ts} (74%) rename src/api/types/{ServiceUnavailabileResponse.ts => Error503Response.ts} (71%) create mode 100644 src/api/types/ErrorMsg.ts create mode 100644 src/api/types/Error_.ts create mode 100644 src/api/types/EvmChains.ts create mode 100644 src/api/types/EvmTransfer.ts create mode 100644 src/api/types/ExternalCollection.ts create mode 100644 src/api/types/FourHundredNineResponse.ts create mode 100644 src/api/types/FourHundredTwentyFourResponse.ts create mode 100644 src/api/types/GetCollectionResponse.ts create mode 100644 src/api/types/GetCollectionResponseMetadata.ts create mode 100644 src/api/types/GetCollectionResponseOnChain.ts create mode 100644 src/api/types/GetCollectionResponsePayments.ts create mode 100644 src/api/types/MintApiFeatureCollectionNotDeployed.ts create mode 100644 src/api/types/MintConfig.ts create mode 100644 src/api/types/MintResponseEvm200.ts create mode 100644 src/api/types/MintResponseEvm200OnChain.ts create mode 100644 src/api/types/MintResponseEvm200Subsequent.ts create mode 100644 src/api/types/MintResponseSolana200.ts create mode 100644 src/api/types/MintResponseSolana200OnChain.ts create mode 100644 src/api/types/MintResponseSolana200Subsequent.ts create mode 100644 src/api/types/MintStatus.ts create mode 100644 src/api/types/MintStatusSolana200.ts create mode 100644 src/api/types/MintStatusStatus.ts create mode 100644 src/api/types/MintingMetadata.ts create mode 100644 src/api/types/Nft.ts create mode 100644 src/api/types/NftAttributesItem.ts create mode 100644 src/api/types/NftAttributesItemValue.ts create mode 100644 src/api/types/NftCollection.ts create mode 100644 src/api/types/NftMetadata.ts create mode 100644 src/api/types/NftMetadataAttributesItem.ts create mode 100644 src/api/types/NftMetadataAttributesItemDisplayType.ts create mode 100644 src/api/types/NftMetadataOptions.ts create mode 100644 src/api/types/NftMetadataOptionsName.ts create mode 100644 src/api/types/NftMetadataSolana.ts create mode 100644 src/api/types/NftMetadataSolanaAttributesItem.ts create mode 100644 src/api/types/NftMetadataSolanaAttributesItemDisplayType.ts create mode 100644 src/api/types/NftObjectEvm.ts create mode 100644 src/api/types/NftObjectEvmMetadata.ts create mode 100644 src/api/types/NftObjectEvmOnChain.ts create mode 100644 src/api/types/NftObjectSolana.ts create mode 100644 src/api/types/NftObjectSolanaMetadata.ts create mode 100644 src/api/types/NftObjectSolanaMetadataAttributesItem.ts create mode 100644 src/api/types/NftObjectSolanaMetadataProperties.ts create mode 100644 src/api/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts create mode 100644 src/api/types/NftObjectSolanaMetadataPropertiesFilesItem.ts create mode 100644 src/api/types/NftObjectSolanaOnChain.ts create mode 100644 src/api/types/NftProperties.ts create mode 100644 src/api/types/NftPropertiesCreatorsItem.ts create mode 100644 src/api/types/NftPropertiesFilesItem.ts create mode 100644 src/api/types/NftSolana.ts create mode 100644 src/api/types/NftcarItem.ts create mode 100644 src/api/types/NftcarItemMetadata.ts create mode 100644 src/api/types/NftcarItemMetadataAttributesItem.ts create mode 100644 src/api/types/Nftevm.ts create mode 100644 src/api/types/NftevmItem.ts create mode 100644 src/api/types/NftevmItemMetadata.ts create mode 100644 src/api/types/NftevmItemMetadataAttributesItem.ts create mode 100644 src/api/types/NftsolItem.ts create mode 100644 src/api/types/NftsolItemMetadata.ts create mode 100644 src/api/types/NftsolItemMetadataAttributesItem.ts create mode 100644 src/api/types/NftsolItemMetadataAttributesItemValue.ts create mode 100644 src/api/types/NotFoundErrorBody.ts create mode 100644 src/api/types/NotImplementedErrorBody.ts create mode 100644 src/api/types/OldCollection.ts create mode 100644 src/api/types/OutdatedContract.ts create mode 100644 src/api/types/PaymentsObject.ts create mode 100644 src/api/types/QuoteResponse.ts delete mode 100644 src/api/types/RecipientEmail.ts delete mode 100644 src/api/types/RecipientWallet.ts create mode 100644 src/api/types/Redirect.ts create mode 100644 src/api/types/ReuploadLinkedFiles.ts create mode 100644 src/api/types/SftCollection.ts create mode 100644 src/api/types/Solana.ts create mode 100644 src/api/types/SolanaNotSupported.ts create mode 100644 src/api/types/Supply.ts create mode 100644 src/api/types/SupplySupply.ts create mode 100644 src/api/types/TemplateResponse.ts create mode 100644 src/api/types/TemplateResponseMetadata.ts create mode 100644 src/api/types/TemplateResponseOnChain.ts create mode 100644 src/api/types/TemplateResponseSupply.ts create mode 100644 src/api/types/TransferPendingVerification.ts create mode 100644 src/api/types/UpdateCollectionResponse.ts create mode 100644 src/api/types/UpdateCollectionResponseData.ts create mode 100644 src/api/types/UpdateCollectionResponseDataCollection.ts create mode 100644 src/api/types/UsageResponse.ts create mode 100644 src/api/types/UsageResponseData.ts create mode 100644 src/api/types/UsageResponseDataUsage.ts create mode 100644 src/api/types/ValidationError.ts create mode 100644 src/api/types/VerificationRequestSent.ts create mode 100644 src/api/types/Wallet.ts create mode 100644 src/api/types/WalletsRequest.ts create mode 100644 src/api/types/WalletsTransfer.ts create mode 100644 src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts create mode 100644 src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts create mode 100644 src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts create mode 100644 src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts create mode 100644 src/serialization/client/index.ts create mode 100644 src/serialization/client/requests/NftRequest.ts create mode 100644 src/serialization/client/requests/index.ts create mode 100644 src/serialization/resources/actions/index.ts create mode 100644 src/serialization/resources/actions/types/GetActionStatusResponse.ts create mode 100644 src/serialization/resources/actions/types/GetActionStatusResponseData.ts create mode 100644 src/serialization/resources/actions/types/GetActionStatusResponseDataCollection.ts create mode 100644 src/serialization/resources/actions/types/GetActionStatusResponseDataRecipient.ts create mode 100644 src/serialization/resources/actions/types/GetActionStatusResponseDataToken.ts create mode 100644 src/serialization/resources/actions/types/index.ts create mode 100644 src/serialization/resources/checkout/client/requests/CheckoutMintRequest.ts create mode 100644 src/serialization/resources/checkout/types/CheckoutMintRequestCollection.ts create mode 100644 src/serialization/resources/checkout/types/CheckoutMintRequestMintConfig.ts create mode 100644 src/serialization/resources/checkout/types/CheckoutMintRequestRedirect.ts create mode 100644 src/serialization/resources/checkout/types/index.ts create mode 100644 src/serialization/resources/headless/client/index.ts rename src/serialization/resources/{checkout/client/requests/CheckoutCreateOrderRequest.ts => headless/client/requests/CreateOrderRequest.ts} (78%) rename src/serialization/resources/{checkout => headless}/client/requests/OrderDto.ts (100%) create mode 100644 src/serialization/resources/headless/client/requests/index.ts create mode 100644 src/serialization/resources/headless/index.ts create mode 100644 src/serialization/resources/nfTs/client/index.ts create mode 100644 src/serialization/resources/nfTs/client/mintStatusList.ts create mode 100644 src/serialization/resources/nfTs/client/requests/BatchMintNftRequest.ts create mode 100644 src/serialization/resources/nfTs/client/requests/EditNftByLocatorRequest.ts create mode 100644 src/serialization/resources/nfTs/client/requests/EditNftRequest.ts create mode 100644 src/serialization/resources/nfTs/client/requests/MintNftIdempotentRequest.ts create mode 100644 src/serialization/resources/nfTs/client/requests/MintSftRequest.ts create mode 100644 src/serialization/resources/nfTs/client/requests/index.ts create mode 100644 src/serialization/resources/nfTs/index.ts create mode 100644 src/serialization/resources/nfTs/types/BatchMintNftRequestNftsItem.ts create mode 100644 src/serialization/resources/nfTs/types/Metadata.ts create mode 100644 src/serialization/resources/nfTs/types/MintNftIdempotentResponse.ts create mode 100644 src/serialization/resources/nfTs/types/MintNftRequest.ts create mode 100644 src/serialization/resources/nfTs/types/MintNftRequestTemplateId.ts create mode 100644 src/serialization/resources/nfTs/types/MintNftResponse.ts create mode 100644 src/serialization/resources/nfTs/types/MintSftResponse.ts create mode 100644 src/serialization/resources/nfTs/types/MintSftResponseData.ts create mode 100644 src/serialization/resources/nfTs/types/MintSftResponseDataCollection.ts create mode 100644 src/serialization/resources/nfTs/types/MintSftResponseDataRecipient.ts create mode 100644 src/serialization/resources/nfTs/types/MintSftResponseDataToken.ts create mode 100644 src/serialization/resources/nfTs/types/index.ts create mode 100644 src/serialization/resources/nftCollections/client/index.ts create mode 100644 src/serialization/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts create mode 100644 src/serialization/resources/nftCollections/client/requests/SetBaseUriRequest.ts create mode 100644 src/serialization/resources/nftCollections/client/requests/SetTransferabilityRequest.ts create mode 100644 src/serialization/resources/nftCollections/client/requests/UpdateCollectionRequest.ts create mode 100644 src/serialization/resources/nftCollections/client/requests/index.ts create mode 100644 src/serialization/resources/nftCollections/index.ts create mode 100644 src/serialization/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts create mode 100644 src/serialization/resources/nftCollections/types/GetBaseUriResponse.ts create mode 100644 src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponse.ts create mode 100644 src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts create mode 100644 src/serialization/resources/nftCollections/types/GetTransferabilityResponse.ts create mode 100644 src/serialization/resources/nftCollections/types/ListCollectionsResponse.ts create mode 100644 src/serialization/resources/nftCollections/types/index.ts create mode 100644 src/serialization/resources/nftTemplates/client/getAllTemplates.ts create mode 100644 src/serialization/resources/nftTemplates/client/index.ts create mode 100644 src/serialization/resources/nftTemplates/index.ts create mode 100644 src/serialization/resources/nftTemplates/types/EditTemplateRequest.ts create mode 100644 src/serialization/resources/nftTemplates/types/index.ts create mode 100644 src/serialization/resources/quotePrice/index.ts create mode 100644 src/serialization/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts create mode 100644 src/serialization/resources/quotePrice/types/index.ts create mode 100644 src/serialization/resources/registration/client/index.ts create mode 100644 src/serialization/resources/registration/client/requests/RegisterNftCollectionRequest.ts create mode 100644 src/serialization/resources/registration/client/requests/UpdateNftCollectionRequest.ts create mode 100644 src/serialization/resources/registration/client/requests/index.ts create mode 100644 src/serialization/resources/registration/index.ts create mode 100644 src/serialization/resources/registration/types/Evm.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestArgs.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestCategory.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestChain.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestContractType.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadata.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestOwnership.ts create mode 100644 src/serialization/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts create mode 100644 src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadata.ts create mode 100644 src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts create mode 100644 src/serialization/resources/registration/types/index.ts create mode 100644 src/serialization/resources/sign/client/index.ts create mode 100644 src/serialization/resources/sign/client/requests/SignMessageRequest.ts create mode 100644 src/serialization/resources/sign/client/requests/index.ts create mode 100644 src/serialization/resources/sign/index.ts create mode 100644 src/serialization/resources/sign/types/SignMessageResponse.ts create mode 100644 src/serialization/resources/sign/types/index.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/getVc.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/getVcById.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/getVcByLocator.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/index.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/requests/IssueVcRequest.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/requests/index.ts create mode 100644 src/serialization/resources/verifiableCredentials/client/vcCreateTemplate.ts create mode 100644 src/serialization/resources/verifiableCredentials/index.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/CreateTypeResponse.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/GetTypeResponse.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/IssueVcRequestCredential.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/IssueVcResponse.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/VerifyCredentialResponse.ts create mode 100644 src/serialization/resources/verifiableCredentials/types/index.ts create mode 100644 src/serialization/resources/wallet/client/fetchWallet.ts create mode 100644 src/serialization/resources/wallet/client/index.ts create mode 100644 src/serialization/resources/wallet/index.ts create mode 100644 src/serialization/resources/wallet/types/CreateWalletRequest.ts create mode 100644 src/serialization/resources/wallet/types/CreateWalletResponse.ts create mode 100644 src/serialization/resources/wallet/types/Email.ts create mode 100644 src/serialization/resources/wallet/types/FetchContentFromWalletResponse.ts create mode 100644 src/serialization/resources/wallet/types/UserId.ts create mode 100644 src/serialization/resources/wallet/types/index.ts create mode 100644 src/serialization/types/AllChains.ts create mode 100644 src/serialization/types/BadRequestErrorBody.ts create mode 100644 src/serialization/types/BatchError.ts create mode 100644 src/serialization/types/BatchMintResponse.ts create mode 100644 src/serialization/types/BurnNftResponse.ts create mode 100644 src/serialization/types/BurnNftResponseData.ts create mode 100644 src/serialization/types/BurnNftResponseDataCollection.ts create mode 100644 src/serialization/types/BurnNftResponseDataToken.ts create mode 100644 src/serialization/types/Cardano.ts create mode 100644 src/serialization/types/Checkout.ts create mode 100644 src/serialization/types/CheckoutMintSuccess.ts create mode 100644 src/serialization/types/Collection.ts create mode 100644 src/serialization/types/Compressed.ts create mode 100644 src/serialization/types/CreateCollectionBody.ts create mode 100644 src/serialization/types/CreateCollectionBodyChain.ts create mode 100644 src/serialization/types/CreateCollectionBodyFungibility.ts create mode 100644 src/serialization/types/CreateCollectionBodyMetadata.ts create mode 100644 src/serialization/types/CreateCollectionResponse.ts create mode 100644 src/serialization/types/CreateCollectionResponseMetadata.ts create mode 100644 src/serialization/types/CreateCollectionResponseOnChain.ts create mode 100644 src/serialization/types/CreateTemplateBody.ts create mode 100644 src/serialization/types/CreateTemplateBodyMetadata.ts create mode 100644 src/serialization/types/CreateTemplateBodyOnChain.ts create mode 100644 src/serialization/types/CreateTemplateBodySupply.ts create mode 100644 src/serialization/types/EditNftResponse.ts create mode 100644 src/serialization/types/EditNftResponseData.ts create mode 100644 src/serialization/types/EditNftResponseDataCollection.ts create mode 100644 src/serialization/types/EditNftResponseDataToken.ts create mode 100644 src/serialization/types/EditNftResponseDataTokenOwner.ts rename src/serialization/types/{NotFoundResponse.ts => Error400Response.ts} (70%) rename src/serialization/types/{BadRequestResponse.ts => Error403Response.ts} (70%) rename src/serialization/types/{UnauthorizedResponse.ts => Error404Response.ts} (69%) rename src/serialization/types/{ServiceUnavailabileResponse.ts => Error503Response.ts} (66%) create mode 100644 src/serialization/types/ErrorMsg.ts rename src/serialization/types/{RecipientEmail.ts => Error_.ts} (53%) create mode 100644 src/serialization/types/EvmChains.ts create mode 100644 src/serialization/types/EvmTransfer.ts create mode 100644 src/serialization/types/ExternalCollection.ts create mode 100644 src/serialization/types/FourHundredNineResponse.ts create mode 100644 src/serialization/types/FourHundredTwentyFourResponse.ts create mode 100644 src/serialization/types/GetCollectionResponse.ts create mode 100644 src/serialization/types/GetCollectionResponseMetadata.ts create mode 100644 src/serialization/types/GetCollectionResponseOnChain.ts create mode 100644 src/serialization/types/GetCollectionResponsePayments.ts create mode 100644 src/serialization/types/MintApiFeatureCollectionNotDeployed.ts create mode 100644 src/serialization/types/MintConfig.ts create mode 100644 src/serialization/types/MintResponseEvm200.ts create mode 100644 src/serialization/types/MintResponseEvm200OnChain.ts create mode 100644 src/serialization/types/MintResponseEvm200Subsequent.ts create mode 100644 src/serialization/types/MintResponseSolana200.ts create mode 100644 src/serialization/types/MintResponseSolana200OnChain.ts create mode 100644 src/serialization/types/MintResponseSolana200Subsequent.ts create mode 100644 src/serialization/types/MintStatus.ts create mode 100644 src/serialization/types/MintStatusSolana200.ts create mode 100644 src/serialization/types/MintStatusStatus.ts create mode 100644 src/serialization/types/MintingMetadata.ts create mode 100644 src/serialization/types/Nft.ts create mode 100644 src/serialization/types/NftAttributesItem.ts create mode 100644 src/serialization/types/NftAttributesItemValue.ts create mode 100644 src/serialization/types/NftCollection.ts create mode 100644 src/serialization/types/NftMetadata.ts create mode 100644 src/serialization/types/NftMetadataAttributesItem.ts create mode 100644 src/serialization/types/NftMetadataAttributesItemDisplayType.ts create mode 100644 src/serialization/types/NftMetadataOptions.ts create mode 100644 src/serialization/types/NftMetadataOptionsName.ts create mode 100644 src/serialization/types/NftMetadataSolana.ts create mode 100644 src/serialization/types/NftMetadataSolanaAttributesItem.ts create mode 100644 src/serialization/types/NftMetadataSolanaAttributesItemDisplayType.ts create mode 100644 src/serialization/types/NftObjectEvm.ts create mode 100644 src/serialization/types/NftObjectEvmMetadata.ts create mode 100644 src/serialization/types/NftObjectEvmOnChain.ts create mode 100644 src/serialization/types/NftObjectSolana.ts create mode 100644 src/serialization/types/NftObjectSolanaMetadata.ts create mode 100644 src/serialization/types/NftObjectSolanaMetadataAttributesItem.ts create mode 100644 src/serialization/types/NftObjectSolanaMetadataProperties.ts create mode 100644 src/serialization/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts create mode 100644 src/serialization/types/NftObjectSolanaMetadataPropertiesFilesItem.ts create mode 100644 src/serialization/types/NftObjectSolanaOnChain.ts create mode 100644 src/serialization/types/NftProperties.ts create mode 100644 src/serialization/types/NftPropertiesCreatorsItem.ts create mode 100644 src/serialization/types/NftPropertiesFilesItem.ts create mode 100644 src/serialization/types/NftSolana.ts create mode 100644 src/serialization/types/NftcarItem.ts create mode 100644 src/serialization/types/NftcarItemMetadata.ts create mode 100644 src/serialization/types/NftcarItemMetadataAttributesItem.ts create mode 100644 src/serialization/types/Nftevm.ts create mode 100644 src/serialization/types/NftevmItem.ts create mode 100644 src/serialization/types/NftevmItemMetadata.ts create mode 100644 src/serialization/types/NftevmItemMetadataAttributesItem.ts create mode 100644 src/serialization/types/NftsolItem.ts create mode 100644 src/serialization/types/NftsolItemMetadata.ts create mode 100644 src/serialization/types/NftsolItemMetadataAttributesItem.ts create mode 100644 src/serialization/types/NftsolItemMetadataAttributesItemValue.ts create mode 100644 src/serialization/types/NotFoundErrorBody.ts create mode 100644 src/serialization/types/NotImplementedErrorBody.ts create mode 100644 src/serialization/types/OldCollection.ts create mode 100644 src/serialization/types/OutdatedContract.ts create mode 100644 src/serialization/types/PaymentsObject.ts create mode 100644 src/serialization/types/QuoteResponse.ts delete mode 100644 src/serialization/types/RecipientWallet.ts create mode 100644 src/serialization/types/Redirect.ts create mode 100644 src/serialization/types/ReuploadLinkedFiles.ts create mode 100644 src/serialization/types/SftCollection.ts create mode 100644 src/serialization/types/Solana.ts create mode 100644 src/serialization/types/SolanaNotSupported.ts create mode 100644 src/serialization/types/Supply.ts create mode 100644 src/serialization/types/SupplySupply.ts create mode 100644 src/serialization/types/TemplateResponse.ts create mode 100644 src/serialization/types/TemplateResponseMetadata.ts create mode 100644 src/serialization/types/TemplateResponseOnChain.ts create mode 100644 src/serialization/types/TemplateResponseSupply.ts create mode 100644 src/serialization/types/TransferPendingVerification.ts create mode 100644 src/serialization/types/UpdateCollectionResponse.ts create mode 100644 src/serialization/types/UpdateCollectionResponseData.ts create mode 100644 src/serialization/types/UpdateCollectionResponseDataCollection.ts create mode 100644 src/serialization/types/UsageResponse.ts create mode 100644 src/serialization/types/UsageResponseData.ts create mode 100644 src/serialization/types/UsageResponseDataUsage.ts create mode 100644 src/serialization/types/ValidationError.ts create mode 100644 src/serialization/types/VerificationRequestSent.ts create mode 100644 src/serialization/types/Wallet.ts create mode 100644 src/serialization/types/WalletsRequest.ts create mode 100644 src/serialization/types/WalletsTransfer.ts create mode 100644 tests/unit/fetcher/Fetcher.test.ts create mode 100644 tests/unit/fetcher/createRequestUrl.test.ts create mode 100644 tests/unit/fetcher/getFetchFn.test.ts create mode 100644 tests/unit/fetcher/getRequestBody.test.ts create mode 100644 tests/unit/fetcher/getResponseBody.test.ts create mode 100644 tests/unit/fetcher/makeRequest.test.ts create mode 100644 tests/unit/fetcher/requestWithRetries.test.ts create mode 100644 tests/unit/fetcher/signals.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts create mode 100644 tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts create mode 100644 tests/unit/zurg/date/date.test.ts create mode 100644 tests/unit/zurg/enum/enum.test.ts create mode 100644 tests/unit/zurg/lazy/lazy.test.ts create mode 100644 tests/unit/zurg/lazy/lazyObject.test.ts create mode 100644 tests/unit/zurg/lazy/recursive/a.ts create mode 100644 tests/unit/zurg/lazy/recursive/b.ts create mode 100644 tests/unit/zurg/list/list.test.ts create mode 100644 tests/unit/zurg/literals/stringLiteral.test.ts create mode 100644 tests/unit/zurg/object-like/withParsedProperties.test.ts create mode 100644 tests/unit/zurg/object/extend.test.ts create mode 100644 tests/unit/zurg/object/object.test.ts create mode 100644 tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts create mode 100644 tests/unit/zurg/primitives/any.test.ts create mode 100644 tests/unit/zurg/primitives/boolean.test.ts create mode 100644 tests/unit/zurg/primitives/number.test.ts create mode 100644 tests/unit/zurg/primitives/string.test.ts create mode 100644 tests/unit/zurg/primitives/unknown.test.ts create mode 100644 tests/unit/zurg/record/record.test.ts create mode 100644 tests/unit/zurg/schema-utils/getSchemaUtils.test.ts create mode 100644 tests/unit/zurg/schema.test.ts create mode 100644 tests/unit/zurg/set/set.test.ts create mode 100644 tests/unit/zurg/skipValidation.test.ts create mode 100644 tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts create mode 100644 tests/unit/zurg/union/union.test.ts create mode 100644 tests/unit/zurg/utils/itSchema.ts create mode 100644 tests/unit/zurg/utils/itValidate.ts diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index d8a9a2d..631ac0d 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -1,59 +1,275 @@ errors: BadRequestError: status-code: 400 - type: BadRequestResponse - docs: >- - Invalid arguments, please make sure you're following the api - specification. + type: unknown ForbiddenError: status-code: 403 - type: UnauthorizedResponse - docs: Forbidden error, please ensure the credentials are correct. - NotFoundError: - status-code: 404 - type: NotFoundResponse - docs: Not found error. + type: unknown ServiceUnavailableError: status-code: 503 - type: ServiceUnavailabileResponse - docs: >- - Please try again in a few minutes. If the issue still persists, contact - Crossmint support. + type: unknown + NotFoundError: + status-code: 404 + type: unknown + NotImplementedError: + status-code: 501 + type: NotImplementedErrorBody + docs: Not Implemented + ConflictError: + status-code: 409 + type: unknown + FailedDependencyError: + status-code: 424 + type: four_hundred_twenty_four_Response + docs: Failed Dependency + UnauthorizedError: + status-code: 401 + type: unknown + docs: | + Unauthorized. This may mean either: + • The API key may not exist, or does not have the proper scopes to perform this action (`nfts.checkout`), or + • The `clientId` for the collection is not registered under the same project as the API key. +service: + auth: false + base-path: '' + endpoints: + get-usage: + path: /v1-alpha1/projects/{projectId}/usage + method: GET + auth: true + docs: | + Get usage data for a project. + + **API scope required** `projects:usage.read` + path-parameters: + projectId: + type: string + docs: You can find your project ID in the Crossmint console. + display-name: Get Usage + request: + name: GetUsageRequest + query-parameters: + dimension: + type: literal<"monthly_active_wallets"> + docs: >- + The `dimension` you want to query, for example + `monthly_active_wallets`. + startDate: + type: string + docs: >- + The `startDate` you want to query in YYYY-MM format, for example + `2023-11` for November 2023. + endDate: + type: optional + docs: >- + The `endDate` you want to query in YYYY-MM format, for example + `2023-12` for December 2023. + response: + docs: Success. + type: UsageResponse + errors: + - BadRequestError + - ForbiddenError + - ServiceUnavailableError + examples: + - path-parameters: + projectId: 94d09d19-25b4-45f7-8103-b48b7a2ae3cc + query-parameters: + dimension: monthly_active_wallets + startDate: startDate + response: + body: + data: + dimension: dimension + usage: + month: month + activeWallets: 1 + wallets: + path: /v1-alpha1/wallets/transfer + method: POST + auth: true + docs: > + Transfer NFTs from one wallet to another wallet. Intended for wallets + created using `email` option. + + + **API scope required**: `wallets:nfts.transfer` + display-name: Transfer NFT (email) + request: + body: WalletsRequest + response: + docs: >- + Verification request sent to user. Status updates for this export are + returned through the transfers webhook. + type: VerificationRequestSent + errors: + - BadRequestError + - UnauthorizedError + - NotFoundError + examples: + - request: {} + response: + body: + message: Verification request sent to user + actionId: actionId + NFT: + path: /v1-alpha1/transfer + method: POST + auth: true + docs: > + Transfer NFTs from one wallet to another wallet. Intended for wallets + created with `userId` option. + + + **API scope required**: `wallets:nfts.transfer` + display-name: Transfer NFT (userId) + request: + name: NftRequest + body: + properties: + chain: optional + tokenId: + type: optional + docs: >- + The numeric token ID of the NFT to be transferred, only used for + EVM tokens + fromAddress: + type: optional + docs: The wallet address for the current owner + toAddress: + type: optional + docs: The wallet address to send the NFT to + tokenMintAddress: + type: optional + docs: | + **Solana**: mintHash + + **EVM**: token contract address + errors: + - BadRequestError + - UnauthorizedError + examples: + - request: {} types: - RecipientEmail: - docs: >- - Recipient of the items being purchased. Crossmint will create a custodial - wallet address for the user on the fly, that they can later log in to. If - no recipient is passed, an order will be created with the status - 'requires-recipient', until you pass one. + BadRequestErrorBody: + discriminated: false + union: + - OutdatedContract + - OldCollection + - SolanaNotSupported + - ExternalCollection + - SFTCollection + NotFoundErrorBody: properties: - email: - type: string - validation: - format: email - RecipientWallet: - docs: >- - Recipient of the items being purchased. If specifying a recipient by - wallet address, ensure the address is valid for the chain your - **collection** is on, which may differ from the chain the payment is - performed on. + error: optional + message: optional + NotImplementedErrorBody: properties: - walletAddress: string - Recipient: + error: optional + message: optional + OutdatedContract: + properties: + message: optional + OldCollection: + properties: + message: optional + SolanaNotSupported: + properties: + message: optional + ExternalCollection: + properties: + message: optional + SFTCollection: + properties: + message: optional + EvmTransfer: + properties: + chain: optional + from: + type: optional + docs: The wallet address for the current owner + to: + type: optional + docs: The wallet address the token should be transferred to + contractAddress: + type: optional + docs: The contract address of the token to transfer + tokenId: + type: optional + docs: The numeric tokenId of the token to be transferred + quantity: + type: optional + docs: Required for ERC-1155 only, not relevant for ERC-721 tokens + Solana: + properties: + chain: optional> + from: + type: optional + docs: The wallet address for the current owner + to: + type: optional + docs: The wallet address the token should be transferred to + tokenMintAddress: + type: optional + docs: The mintHash of the token to transfer + WalletsRequest: discriminated: false union: - - type: RecipientEmail - docs: >- - Recipient of the items being purchased. Crossmint will create a - custodial wallet address for the user on the fly, that they can later - log in to. If no recipient is passed, an order will be created with - the status 'requires-recipient', until you pass one. - - type: RecipientWallet - docs: >- - Recipient of the items being purchased. If specifying a recipient by - wallet address, ensure the address is valid for the chain your - **collection** is on, which may differ from the chain the payment is - performed on. + - EvmTransfer + - Solana + UsageResponseDataUsage: + docs: The usage data for the specified dimension. + properties: + month: + type: optional + docs: YYYY-MM format indicating the month + activeWallets: + type: optional + docs: The number of active wallets for the given month + UsageResponseData: + properties: + dimension: + type: optional + docs: The type of usage data returned. + usage: + type: optional + docs: The usage data for the specified dimension. + UsageResponse: + properties: + data: optional + Error: + properties: + error: optional + ValidationError: + properties: + index: + type: optional + docs: The index of the NFT that caused the validation error. + id: + type: optional + docs: The idempotent identifier for the NFT, if available. + message: + type: optional + docs: The validation error message. + BatchError: + properties: + error: optional + message: optional + validationErrors: + type: optional> + docs: A list of specific validation errors. + Recipient: + type: string + docs: | + Allowed formats: + + `:
` or + + `email::` or + + `userId::` + + [see here for more info](/minting/advanced/specify-recipient) Locale: enum: - value: en-US @@ -91,6 +307,7 @@ types: Locale for the checkout, in IETF BCP 47. It impacts the email receipt language. Ensure your UI is set to the same language as specified here. Throws an error if passed an invalid language. + default: en-US EvmPaymentMethods: enum: - value: arbitrum-sepolia @@ -159,6 +376,7 @@ types: - krw - inr - vnd + default: usd FiatPayment: properties: receiptEmail: @@ -167,7 +385,9 @@ types: validation: format: email method: literal<"stripe-payment-element"> - currency: optional + currency: + type: optional + default: usd Payment: discriminated: false union: @@ -300,19 +520,19 @@ types: lineItems: optional> quote: optional payment: optional - BadRequestResponse: + Error400Response: properties: error: optional message: optional - UnauthorizedResponse: + Error403Response: properties: error: optional message: optional - NotFoundResponse: + Error404Response: properties: error: optional message: optional - ServiceUnavailabileResponse: + Error503Response: properties: error: optional message: optional @@ -320,3 +540,892 @@ types: properties: error: optional message: optional + ReuploadLinkedFiles: + type: boolean + docs: >- + Any URLs in the metadata object will be resolved and reuploaded to IPFS + [Default: true] + Compressed: + type: boolean + docs: | + **Solana only** Use NFT compression for cheaper mint costs [Default: true] + PaymentsObject: + docs: >- + Enable payments for this collection by setting `price`, `recipientAddress` + and `currency` + properties: + price: + type: optional + docs: The price of the token in native currency for the selected chain + recipientAddress: + type: optional + docs: The wallet address to receive payouts + currency: + type: optional + docs: >- + The currency for the price of the NFT. Defaults to the native currency + of the chain + NftMetadataOptionsName: + docs: Enter a URL to a JSON file containing the metadata contents + properties: + uri: + type: string + docs: Enter a URL to a JSON file containing the metadata contents + name: + type: string + docs: 'The name of your NFT (Max length: 32)' + validation: + maxLength: 32 + NftMetadataOptions: + discriminated: false + docs: >- + Optional if [baseURI](/api-reference/minting/collection/set-base-uri) is + set. + union: + - NftMetadata + - type: string + docs: Enter a URL to a JSON file containing the metadata contents + - NftMetadataSolana + - type: NftMetadataOptionsName + docs: Enter a URL to a JSON file containing the metadata contents + NftMetadataAttributesItemDisplayType: + enum: + - boost_number + - boost_percentage + - number + docs: Display name of your attribute + NftMetadataAttributesItem: + properties: + display_type: + type: optional + docs: Display name of your attribute + trait_type: + type: string + docs: The name of the trait + value: + type: string + docs: The value of the trait + NftMetadata: + properties: + name: + type: string + docs: 'The name of your NFT (Max length: 32)' + validation: + maxLength: 32 + image: + type: string + docs: Direct link to your NFT image + description: + type: string + docs: 'A brief description of the NFT (Max length: 64)' + validation: + maxLength: 64 + animation_url: + type: optional + docs: | + **EVM only** + + [See more info here](/minting/advanced/nft-metadata) + attributes: + type: optional> + docs: Add attributes to your NFT + NftMetadataSolanaAttributesItemDisplayType: + enum: + - boost_number + - boost_percentage + - number + docs: Display name of your attribute + NftMetadataSolanaAttributesItem: + properties: + display_type: + type: optional + docs: Display name of your attribute + trait_type: + type: string + docs: The name of the trait + value: + type: string + docs: The value of the trait + NftMetadataSolana: + properties: + name: + type: string + docs: 'The name of your NFT (Max length: 32)' + validation: + maxLength: 32 + image: + type: string + docs: Direct link to your NFT image + description: + type: string + docs: 'A brief description of the NFT (Max length: 64)' + validation: + maxLength: 64 + attributes: + type: optional> + docs: Add attributes to your NFT + CreateCollectionBodyChain: + enum: + - aptos + - arbitrum + - value: arbitrum-sepolia + name: ArbitrumSepolia + - value: astar-zkevm + name: AstarZkevm + - base + - value: base-sepolia + name: BaseSepolia + - bsc + - ethereum + - value: ethereum-sepolia + name: EthereumSepolia + - optimism + - value: optimism-sepolia + name: OptimismSepolia + - polygon + - value: polygon-amoy + name: PolygonAmoy + - value: skale-nebula + name: SkaleNebula + - value: skale-nebula-testnet + name: SkaleNebulaTestnet + - solana + - zkyoto + - zora + - value: zora-sepolia + name: ZoraSepolia + docs: Blockchain you would like to use for this collection + CreateCollectionBodyMetadata: + properties: + name: + type: string + docs: 'Collection name (Max length: 32)' + validation: + maxLength: 32 + imageUrl: + type: optional + docs: URL pointing to an image that represents the collection + description: + type: string + docs: A description of the NFT collection + validation: + maxLength: 64 + symbol: + type: optional + docs: '**EVM only** NFT collection symbol' + CreateCollectionBodyFungibility: + enum: + - value: non-fungible + name: NonFungible + - value: semi-fungible + name: SemiFungible + docs: >- + Whether or not this collection is fungible. Only EVM collections may be + set as semi-fungible + default: non-fungible + CreateCollectionBody: + properties: + chain: + type: CreateCollectionBodyChain + docs: Blockchain you would like to use for this collection + metadata: CreateCollectionBodyMetadata + fungibility: + type: optional + docs: >- + Whether or not this collection is fungible. Only EVM collections may + be set as semi-fungible + default: non-fungible + supplyLimit: + type: optional + docs: The maximum number of tokens that can be minted for this collection + payments: optional + reuploadLinkedFiles: optional + CreateTemplateBodyMetadata: + docs: See https://docs.crossmint.com/docs/metadata for more info + properties: + name: + type: optional + docs: Template name + default: My template + image: + type: optional + default: https://www.crossmint.com/assets/crossmint/logo.png + description: + type: optional + default: A new collection with its own dedicated smart contract + validation: + maxLength: 64 + CreateTemplateBodyOnChain: + docs: On-chain details + properties: + tokenId: + type: optional + docs: >- + The token ID. Only relevant for SFT (ERC-1155) collections. Leave + empty for NFT/ERC-721 collections. + CreateTemplateBodySupply: + docs: Supply details + properties: + limit: + type: optional + docs: Supply limit, Set to 1 for ERC721. + CreateTemplateBody: + properties: + metadata: + type: optional + docs: See https://docs.crossmint.com/docs/metadata for more info + onChain: + type: optional + docs: On-chain details + supply: + type: optional + docs: Supply details + reuploadLinkedFiles: optional + SupplySupply: + docs: Supply details + properties: + limit: + type: optional + docs: Supply limit. Set to 1 for ERC721. + Supply: + properties: + supply: + type: optional + docs: Supply details + MintingMetadata: + properties: + name: + type: optional + docs: Template name + default: My template + imageUrl: + type: optional + default: https://www.crossmint.com/assets/crossmint/logo.png + description: + type: optional + default: A new collection with its own dedicated smart contract + validation: + maxLength: 64 + EditNftResponseDataCollection: + properties: + id: optional + contractAddress: optional + EditNftResponseDataTokenOwner: + properties: + walletAddress: optional + EditNftResponseDataToken: + properties: + id: optional + owner: optional + tokenId: optional + EditNftResponseData: + properties: + txId: + type: optional + docs: | + The onchain transaction ID related to the request. + + This is only present when `status` is `succeeded` + chain: optional + collection: optional + token: optional + changes: optional> + EditNftResponse: + properties: + actionId: optional + action: optional + status: optional + data: optional + startedAt: optional + completedAt: + type: optional + docs: | + The time this operation completed in UTC. + + This is only present when `status` is `succeeded` + resource: optional + MintResponseSolana200OnChain: + properties: + status: optional + chain: optional + MintResponseSolana200: + properties: + id: optional + onChain: optional + actionId: optional + MintResponseEvm200OnChain: + properties: + status: optional + chain: optional + contractAddress: optional + MintResponseEvm200: + properties: + id: optional + onChain: optional + actionId: optional + MintResponseSolana200Subsequent: + properties: + actionId: + type: optional + docs: actionId for the request + extends: + - NftObjectSolana + MintStatusSolana200: + properties: + action: + type: optional + docs: URL to API endpoint for requesting status + extends: + - NftObjectSolana + NftObjectSolanaMetadataPropertiesFilesItem: + properties: + uri: optional + type: optional + NftObjectSolanaMetadataPropertiesCreatorsItem: + properties: + address: optional + verified: optional + share: optional + NftObjectSolanaMetadataProperties: + properties: + files: optional> + category: optional + creators: optional> + NftObjectSolanaMetadataAttributesItem: + properties: + trait_type: optional + value: optional + NftObjectSolanaMetadata: + properties: + name: optional + symbol: optional + seller_fee_basis_points: optional + properties: optional + description: optional + image: optional + attributes: optional> + NftObjectSolanaOnChain: + properties: + status: optional + mintHash: optional + txId: optional + owner: optional + chain: optional + NftObjectSolana: + properties: + id: optional + metadata: optional + onChain: optional + MintResponseEvm200Subsequent: + properties: + actionId: + type: optional + docs: actionId for the request + extends: + - NftObjectEvm + NftObjectEvmMetadata: + properties: + name: optional + image: optional + description: optional + NftObjectEvmOnChain: + properties: + status: optional + tokenId: optional + owner: optional + txId: optional + contractAddress: optional + chain: optional + NftObjectEvm: + properties: + id: optional + metadata: optional + onChain: optional + CreateCollectionResponseMetadata: + properties: + name: optional + description: optional + imageUrl: optional + symbol: optional + CreateCollectionResponseOnChain: + properties: + chain: optional + type: optional + CreateCollectionResponse: + properties: + id: optional + metadata: optional + fungibility: optional + onChain: optional + actionId: optional + GetCollectionResponseMetadata: + properties: + name: optional + description: optional + imageUrl: optional + symbol: optional + GetCollectionResponseOnChain: + properties: + chain: optional + type: optional + contractAddress: optional + GetCollectionResponsePayments: + properties: + price: optional + recipientAddress: optional + GetCollectionResponse: + properties: + id: optional + metadata: optional + fungibility: optional + onChain: optional + supplyLimit: optional + payments: optional + UpdateCollectionResponseDataCollection: + properties: + id: optional + contractAddress: optional + UpdateCollectionResponseData: + properties: + chain: optional + collection: optional + changes: optional> + UpdateCollectionResponse: + properties: + actionId: optional + action: optional + status: optional + data: optional + startedAt: optional + resource: optional + BurnNftResponseDataCollection: + properties: + id: + type: optional + docs: >- + The Crossmint identifier for the collection. Either a UUID or custom + string depending on how you create the collection. + contractAddress: + type: optional + docs: The on-chain contract address for the given collection. + BurnNftResponseDataToken: + properties: + id: + type: optional + docs: The Crossmint identifier for the NFT. This will be a UUID. + tokenId: + type: optional + docs: The numeric tokenId of the NFT in the contract. + BurnNftResponseData: + properties: + chain: + type: optional + docs: >- + Refer to the [supported chains](/introduction/supported-chains) page + for more info + txId: + type: optional + docs: | + The onchain transaction ID related to the request. + + This is only present when `status` is `succeeded` + collection: optional + token: optional + BurnNftResponse: + properties: + actionId: + type: optional + docs: > + Can be used to check the status via the [action status + API](/api-reference/common/get-action-status) + action: + type: optional + docs: The action performed, in this case `nfts.delete` + status: + type: optional + docs: Current status of the async operation. One of `pending` or `succeeded` + data: optional + startedAt: + type: optional + docs: The time this operation was initiated in UTC. + completedAt: + type: optional + docs: | + The time this operation completed in UTC. + + This is only present when `status` is `succeeded` + resource: + type: optional + docs: >- + The URL path to obtain current status with [action status + api](/api-reference/common/get-action-status) + TemplateResponseMetadata: + properties: + name: optional + image: optional + description: optional + TemplateResponseOnChain: + properties: + tokenId: optional + TemplateResponseSupply: + properties: + limit: optional + minted: optional + TemplateResponse: + properties: + templateId: + type: optional + validation: + format: uuid + metadata: optional + onChain: optional + supply: optional + BatchMintResponse: + properties: + results: list + four_hundred_nine_Response: + properties: + error: optional + message: optional + four_hundred_twenty_four_Response: + properties: + error: optional + message: optional + MintApiFeatureCollectionNotDeployed: + properties: + error: optional + message: optional + QuoteResponse: + properties: + currency: optional + price: optional + Checkout: + properties: + clientId: + type: string + docs: >- + Your Crossmint developer collection ID, found in the developer + console: https://www.crossmint.com/console/collections + collection: optional + redirect: optional + mintConfig: optional + emailTo: + type: optional + docs: The email address for mint confirmation + mintTo: + type: optional + docs: A wallet address to mint the NFT to + paymentMethod: + type: optional + docs: The payment method, either `"fiat"` or `"ETH"` + default: fiat + whPassThroughArgs: + type: optional> + docs: Any arguments to included in the webhook status updates + listingId: + type: optional + docs: The listing ID in a marketplace. Most contracts will not use this + Collection: + docs: Information about your collection, to be displayed on the checkout page. + properties: + title: + type: optional + docs: The title of your collection + description: + type: optional + docs: A description for your collection + photo: + type: optional + docs: Full URL to an image for your collection. + MintConfig: + docs: Arguments sent to your smart contract + properties: + totalPrice: optional + ...: + type: optional> + docs: >- + Any custom arguments to your minting function should be configured + here. + MintStatusStatus: + enum: + - minting + - success + - error + docs: The latest status of the mint + MintStatus: + properties: + status: + type: optional + docs: The latest status of the mint + mintAddress: + type: optional + docs: The address of the mint + walletAddress: + type: optional + docs: The wallet address the NFT is minted to + passThroughArgs: + type: optional + docs: >- + The arguments you sent via the `whPassThroughArgs` from + `/checkout/mint` + NftCollection: + properties: + name: optional + family: optional + NftAttributesItemValue: + discriminated: false + union: + - string + - double + - map + - list + NftAttributesItem: + properties: + traitType: optional + value: optional + NftPropertiesCreatorsItem: + properties: + address: optional + share: optional + NftPropertiesFilesItem: + properties: + uri: optional + type: optional + NftProperties: + properties: + category: optional + creators: optional> + files: optional> + Nft: + properties: + name: optional + symbol: optional + description: optional + image: + type: optional + docs: A url that represents the image for the NFT + collection: optional + attributes: optional> + properties: optional + mintHash: optional + seller_fee_basis_points: optional + Redirect: + docs: >- + The URLs to redirect the user to upon comletion or cancellation of the + checkout page. + properties: + continue: + type: optional + docs: >- + The URL to redirect the customer to when the customer's payment + information is accepted. + cancel: + type: optional + docs: The URL to redirect the customer cancels the payment. + WalletsTransfer: + properties: + chain: string + tokenId: + type: optional + docs: The NFT token ID + fromAddress: + type: string + docs: The wallet address for the current owner + toAddress: + type: string + docs: The wallet address to send the NFT to + tokenMintAddress: + type: string + docs: The NFT token mint address + Wallet: + properties: + chain: + type: optional + docs: The blockchain the wallet is on + publicKey: + type: optional + docs: The public address of the wallet + CheckoutMintSuccess: + properties: + checkoutURL: + type: optional + docs: >- + A URL to send the user to in order to capture payment and start the + minting process + TransferPendingVerification: + properties: + personaUrl: + type: optional + docs: >- + A URL to send the user to in order to perform a persona verification. + If the user has failed the OTP challenge 3 times, this will be the + only option. + ErrorMsg: + properties: + error: optional + message: optional + AllChains: + enum: + - arbitrum + - arbitrumnova + - value: arbitrum-sepolia + name: ArbitrumSepolia + - base + - value: base-sepolia + name: BaseSepolia + - bsc + - ethereum + - value: ethereum-sepolia + name: EthereumSepolia + - optimism + - value: optimism-sepolia + name: OptimismSepolia + - polygon + - value: polygon-amoy + name: PolygonAmoy + - value: skale-nebula + name: SkaleNebula + - value: skale-nebula-testnet + name: SkaleNebulaTestnet + - solana + - zkyoto + - zora + - value: zora-sepolia + name: ZoraSepolia + docs: Specify the name of the blockchain + default: ethereum + EvmChains: + enum: + - arbitrum + - arbitrumnova + - value: arbitrum-sepolia + name: ArbitrumSepolia + - base + - value: base-sepolia + name: BaseSepolia + - bsc + - ethereum + - value: ethereum-sepolia + name: EthereumSepolia + - optimism + - value: optimism-sepolia + name: OptimismSepolia + - polygon + - value: polygon-amoy + name: PolygonAmoy + - zkyoto + - zora + - value: zora-sepolia + name: ZoraSepolia + default: ethereum + NftevmItemMetadataAttributesItem: + properties: + trait_type: optional + value: optional + display_type: optional + NftevmItemMetadata: + properties: + attributes: optional> + collection: optional> + description: optional + image: + type: optional + docs: URL that represents the image for the NFT + animation_url: + type: optional + docs: Optional URL representing a video or other multimedia file + name: optional + NftevmItem: + properties: + chain: + type: optional + docs: The blockchain used in the request. + contractAddress: + type: optional + docs: The token contract address + tokenId: + type: optional + docs: The numeric tokenId for the specified NFT + metadata: optional + locator: + type: optional + docs: The address of the NFT on the blockchain + tokenStandard: + type: optional + docs: The type of contract this token is from (ERC-721 or ERC-1155) + NFTEVM: + docs: EVM + type: list + NftsolItemMetadataAttributesItemValue: + discriminated: false + union: + - string + - double + - boolean + - map + NftsolItemMetadataAttributesItem: + properties: + value: optional + trait_type: optional + NftsolItemMetadata: + properties: + name: optional + description: optional + image: + type: optional + docs: A URL that represents the image for the NFT + attributes: optional> + NftsolItem: + properties: + chain: + type: optional + docs: The blockchain used in the request, `solana` in this case. + mintHash: + type: optional + docs: The unique identifier of this NFT on Solana + metadata: optional + locator: + type: optional + docs: The address of the NFT on the blockchain + NFTSolana: + docs: Solana + type: list + NftcarItemMetadataAttributesItem: + properties: + trait_type: optional + value: optional + NftcarItemMetadata: + properties: + assetId: optional + name: optional + description: optional + image: + type: optional + validation: + format: uri + attributes: optional> + NftcarItem: + properties: + chain: + type: optional + docs: The blockchain used in the request, `cardano` in this case. + assetId: + type: optional + docs: The unique identifier of this NFT on Cardano + metadata: optional + locator: + type: optional + docs: The address of the NFT on the blockchain + Cardano: + docs: cardano + type: list + VerificationRequestSent: + properties: + message: + type: optional + docs: A message indicating the result. + actionId: + type: optional + docs: >- + An ID that can be used to poll the [actions + API](/api-reference/common/get-action-status). diff --git a/.mock/definition/actions.yml b/.mock/definition/actions.yml new file mode 100644 index 0000000..8d53895 --- /dev/null +++ b/.mock/definition/actions.yml @@ -0,0 +1,76 @@ +types: + GetActionStatusResponseDataCollection: + properties: + id: optional + contractAddress: optional + GetActionStatusResponseDataRecipient: + properties: + walletAddress: optional + GetActionStatusResponseDataToken: + properties: + id: optional + GetActionStatusResponseData: + properties: + collection: optional + recipient: optional + token: optional + GetActionStatusResponse: + properties: + actionId: + type: optional + validation: + format: uuid + action: optional + status: optional + data: optional + startedAt: optional + resource: + type: optional + validation: + format: uri +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + get-action-status: + path: /2022-06-09/actions/{actionId} + method: GET + auth: true + docs: > + Use this API to poll for the status of asynchonous actions such as NFT + mints, transfers, etc. + + + **API scope required**: `nfts.create` + path-parameters: + actionId: + type: string + docs: The actionId. + display-name: Get Action Status + response: + docs: Success + type: GetActionStatusResponse + errors: + - root.ForbiddenError + - root.NotFoundError + examples: + - path-parameters: + actionId: actionId + response: + body: + actionId: 66881a4d-eff9-467a-b19d-a2ff76eef5c2 + action: nfts.create + status: pending + data: + collection: + id: someCollection + contractAddress: '0x0B7c736cD6D517b6AFfB3F6151eC662B0000018B' + recipient: + walletAddress: '0x6Def4FF2Efe3731EB2Ca09c625d21bfd6da00000' + token: + id: 66881a4d-eff9-467a-b19d-a2ff76eef5c2 + startedAt: '2023-10-02T22:10:41Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/actions/66881a4d-eff9-467a-b19d-a2ff76eef5c2 diff --git a/.mock/definition/api.yml b/.mock/definition/api.yml index a092262..501ef1e 100644 --- a/.mock/definition/api.yml +++ b/.mock/definition/api.yml @@ -1,14 +1,20 @@ name: api error-discrimination: strategy: status-code -display-name: Headless Checkout -default-environment: Staging +display-name: Admin API environments: - Staging: https://staging.crossmint.com/api - Production: https://www.crossmint.com/api + Default: https://staging.crossmint.com/api +default-environment: Default auth-schemes: apiKey: header: X-API-KEY name: apiKey type: string auth: apiKey +headers: + Authorization: + type: string + name: authorization + X-CLIENT-ID: + type: string + name: clientId diff --git a/.mock/definition/checkout.yml b/.mock/definition/checkout.yml index 18cd29c..be98aa5 100644 --- a/.mock/definition/checkout.yml +++ b/.mock/definition/checkout.yml @@ -1,186 +1,74 @@ +types: + CheckoutMintRequestCollection: + properties: + title: + type: string + docs: Collection title + description: + type: string + docs: Collection description + photo: + type: string + docs: Photo url + CheckoutMintRequestRedirect: + properties: + continue: optional + cancel: optional + CheckoutMintRequestMintConfig: + properties: + totalPrice: optional imports: root: __package__.yml service: auth: false base-path: '' endpoints: - create-order: - path: /2022-06-09/orders + mint: + path: /v1-alpha1/checkout/mint method: POST auth: true - docs: Creates a new order that can be used to complete a headless checkout. - display-name: Create Order - request: - name: CheckoutCreateOrderRequest - body: - properties: - recipient: optional - locale: optional - payment: root.Payment - lineItems: root.LineItems - response: - docs: Order successfully created. - type: root.CreateOrderResponse - errors: - - root.BadRequestError - - root.ForbiddenError - - root.NotFoundError - - root.ServiceUnavailableError - examples: - - request: - payment: - method: arbitrum-sepolia - currency: eth - lineItems: - collectionLocator: crossmint: - response: - body: - clientSecret: _removed_ - order: - orderId: b2959ca5-65e4-466a-bd26-1bd05cb4f837 - phase: payment - locale: en-US - lineItems: - - chain: polygon-amoy - quantity: 1 - quote: - status: valid - quotedAt: '2024-06-07T16:55:44.653Z' - expiresAt: '2024-06-07T17:55:44.653Z' - totalPrice: - amount: '0.0001375741' - currency: eth - payment: - status: awaiting-payment - method: base-sepolia - currency: eth - preparation: - chain: base-sepolia - payerAddress: 0x1234abcd... - serializedTransaction: 0x02f90..... - get-order: - path: /2022-06-09/orders/{orderId} - method: GET - auth: true - docs: Get specific order by ID - path-parameters: - orderId: - type: string - docs: | - This is the identifier for the order with UUID format. - - **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` - display-name: Get Order - response: - docs: Order successfully created. - type: root.OrderObject - errors: - - root.BadRequestError - - root.ForbiddenError - - root.NotFoundError - - root.ServiceUnavailableError - examples: - - path-parameters: - orderId: orderId - response: - body: - orderId: b2959ca5-65e4-466a-bd26-1bd05cb4f837 - phase: payment - locale: en-US - lineItems: - - chain: polygon-amoy - quantity: 1 - callData: - quantity: 1 - ADDITIONAL_PROPERTIES: Your other mint function arguments - metadata: - name: Headless Checkout Demo - description: NFT Description - imageUrl: https://cdn.io/image.png - quote: - status: valid - delivery: - status: awaiting-payment - quote: - status: valid - quotedAt: '2024-06-07T16:55:44.653Z' - expiresAt: '2024-06-07T17:55:44.653Z' - totalPrice: - amount: '0.0001375741' - currency: eth - payment: - status: awaiting-payment - method: base-sepolia - currency: eth - preparation: - chain: base-sepolia - payerAddress: 0x1234abcd... - serializedTransaction: 0x02f90..... - edit-order: - path: /2022-06-09/orders/{orderId} - method: PATCH - auth: true docs: >- - Edit an existing order. You can update the recipient, the payment - method, and/or the locale. - path-parameters: - orderId: - type: string - docs: | - This is the identifier for the order with UUID format. + **API scope required**: `nfts.checkout` Begin the checkout process for a + mint - **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` - display-name: Edit Order + **This API is subject to change as it is currently in its alpha form.** + display-name: Generate Checkout Link request: - name: OrderDto + name: CheckoutMintRequest body: properties: - recipient: optional - locale: optional - payment: optional + clientId: + type: string + docs: The clientId of a previously created collection + userId: + type: string + docs: The userId of a previously created wallet + emailTo: + type: optional + docs: Target email + mintTo: + type: optional + docs: Crypto address to mint the NFT to + paymentMethod: + type: optional + docs: Payment method + listingId: optional + collection: optional + redirect: optional + mintConfig: optional + whPassThroughArgs: + type: optional + docs: Any arguments to included in the webhook status updates response: - docs: Order successfully created. - type: root.OrderObject + docs: Checkout url generated + type: root.CheckoutMintSuccess errors: - root.BadRequestError - - root.ForbiddenError - - root.NotFoundError - - root.ServiceUnavailableError + - root.UnauthorizedError examples: - - path-parameters: - orderId: orderId - request: {} + - request: + clientId: clientId + userId: userId response: body: - orderId: b2959ca5-65e4-466a-bd26-1bd05cb4f837 - phase: payment - locale: en-US - lineItems: - - chain: polygon-amoy - quantity: 1 - callData: - quantity: 1 - ADDITIONAL_PROPERTIES: Your other mint function arguments - metadata: - name: Headless Checkout Demo - description: NFT Description - imageUrl: https://cdn.io/image.png - quote: - status: valid - delivery: - status: awaiting-payment - quote: - status: valid - quotedAt: '2024-06-07T16:55:44.653Z' - expiresAt: '2024-06-07T17:55:44.653Z' - totalPrice: - amount: '0.0001375741' - currency: eth - payment: - status: awaiting-payment - method: base-sepolia - currency: eth - preparation: - chain: base-sepolia - payerAddress: 0x1234abcd... - serializedTransaction: 0x02f90..... + checkoutURL: checkoutURL diff --git a/.mock/definition/headless.yml b/.mock/definition/headless.yml new file mode 100644 index 0000000..e2d8da7 --- /dev/null +++ b/.mock/definition/headless.yml @@ -0,0 +1,186 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + create-order: + path: /2022-06-09/orders + method: POST + auth: true + docs: Creates a new order that can be used to complete a headless checkout. + display-name: Create Order + request: + name: CreateOrderRequest + body: + properties: + recipient: optional + locale: optional + payment: root.Payment + lineItems: root.LineItems + response: + docs: Order successfully created. + type: root.CreateOrderResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - request: + payment: + method: arbitrum-sepolia + currency: eth + lineItems: + collectionLocator: crossmint: + response: + body: + clientSecret: _removed_ + order: + orderId: b2959ca5-65e4-466a-bd26-1bd05cb4f837 + phase: payment + locale: en-US + lineItems: + - chain: polygon-amoy + quantity: 1 + quote: + status: valid + quotedAt: '2024-06-07T16:55:44.653Z' + expiresAt: '2024-06-07T17:55:44.653Z' + totalPrice: + amount: '0.0001375741' + currency: eth + payment: + status: awaiting-payment + method: base-sepolia + currency: eth + preparation: + chain: base-sepolia + payerAddress: 0x1234abcd... + serializedTransaction: 0x02f90..... + get-order: + path: /2022-06-09/orders/{orderId} + method: GET + auth: true + docs: Get specific order by ID + path-parameters: + orderId: + type: string + docs: | + This is the identifier for the order with UUID format. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + display-name: Get Order + response: + docs: Order successfully created. + type: root.OrderObject + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + orderId: orderId + response: + body: + orderId: b2959ca5-65e4-466a-bd26-1bd05cb4f837 + phase: payment + locale: en-US + lineItems: + - chain: polygon-amoy + quantity: 1 + callData: + quantity: 1 + ADDITIONAL_PROPERTIES: Your other mint function arguments + metadata: + name: Headless Checkout Demo + description: NFT Description + imageUrl: https://cdn.io/image.png + quote: + status: valid + delivery: + status: awaiting-payment + quote: + status: valid + quotedAt: '2024-06-07T16:55:44.653Z' + expiresAt: '2024-06-07T17:55:44.653Z' + totalPrice: + amount: '0.0001375741' + currency: eth + payment: + status: awaiting-payment + method: base-sepolia + currency: eth + preparation: + chain: base-sepolia + payerAddress: 0x1234abcd... + serializedTransaction: 0x02f90..... + edit-order: + path: /2022-06-09/orders/{orderId} + method: PATCH + auth: true + docs: >- + Edit an existing order. You can update the recipient, the payment + method, and/or the locale. + path-parameters: + orderId: + type: string + docs: | + This is the identifier for the order with UUID format. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + display-name: Edit Order + request: + name: OrderDto + body: + properties: + recipient: optional + locale: optional + payment: optional + response: + docs: Order successfully created. + type: root.OrderObject + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + orderId: orderId + request: {} + response: + body: + orderId: b2959ca5-65e4-466a-bd26-1bd05cb4f837 + phase: payment + locale: en-US + lineItems: + - chain: polygon-amoy + quantity: 1 + callData: + quantity: 1 + ADDITIONAL_PROPERTIES: Your other mint function arguments + metadata: + name: Headless Checkout Demo + description: NFT Description + imageUrl: https://cdn.io/image.png + quote: + status: valid + delivery: + status: awaiting-payment + quote: + status: valid + quotedAt: '2024-06-07T16:55:44.653Z' + expiresAt: '2024-06-07T17:55:44.653Z' + totalPrice: + amount: '0.0001375741' + currency: eth + payment: + status: awaiting-payment + method: base-sepolia + currency: eth + preparation: + chain: base-sepolia + payerAddress: 0x1234abcd... + serializedTransaction: 0x02f90..... diff --git a/.mock/definition/nfTs.yml b/.mock/definition/nfTs.yml new file mode 100644 index 0000000..a984ef2 --- /dev/null +++ b/.mock/definition/nfTs.yml @@ -0,0 +1,726 @@ +imports: + root: __package__.yml +types: + BatchMintNftRequestNftsItem: + properties: + recipient: optional + metadata: optional + compressed: optional + id: + type: optional + docs: '**Optional** The idempotent identifier for the NFT' + Metadata: + properties: + metadata: root.NftMetadataOptions + MintNftRequestTemplateId: + properties: + templateId: string + MintNftRequest: + discriminated: false + union: + - Metadata + - MintNftRequestTemplateId + MintNftResponse: + discriminated: false + union: + - root.MintResponseSolana200 + - root.MintResponseEvm200 + MintSftResponseDataCollection: + properties: + id: optional + contractAddress: optional + MintSftResponseDataRecipient: + properties: + walletAddress: optional + email: optional + MintSftResponseDataToken: + properties: + id: optional + MintSftResponseData: + properties: + chain: optional + collection: optional + recipient: optional + token: optional + MintSftResponse: + properties: + actionId: optional + action: optional + status: optional + data: optional + startedAt: optional + resource: optional + MintNftIdempotentResponse: + discriminated: false + union: + - root.MintResponseSolana200 + - root.MintResponseSolana200Subsequent + - root.MintResponseEvm200 + - root.MintResponseEvm200Subsequent +service: + auth: false + base-path: '' + endpoints: + batch-mint-nft: + path: /2022-06-09/collections/{collectionId}/nfts/ + method: POST + auth: true + docs: > + Mint multiple NFTs with a single call and deliver them to a web3 wallet + or an email address + + + **API scope required** `nfts.create` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Batch Mint NFTs + request: + name: BatchMintNftRequest + body: + properties: + nfts: + docs: Array of objects describing the NFTs to mint to recipients. + type: list + response: + docs: Success. + type: root.BatchMintResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: + nfts: + - {} + response: + body: + results: + - id: id + actionId: actionId + mint-status-list: + path: /2022-06-09/collections/{collectionId}/nfts + method: GET + auth: true + docs: | + Get a list of all the NFTs in a given collection. + + **API scope required**: `nfts.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Get All NFTs + request: + name: MintStatusListRequest + query-parameters: + page: + type: double + docs: The page number you want to query, starting at 1 + perPage: + type: optional + docs: How many items you want to be returned in the page. + response: + docs: >- + Success. Returns an array of objects describing the NFTs minted from + this collection. + type: list + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + query-parameters: + page: 1.1 + perPage: 20 + response: + body: + - id: id + metadata: + name: name + image: image + description: description + onChain: + status: status + tokenId: tokenId + owner: owner + txId: txId + contractAddress: contractAddress + chain: chain + mint-nft: + path: /2022-06-09/collections/{collectionId}/nfts + method: POST + auth: true + docs: | + Mint your NFTs and deliver them to a web3 wallet or an email address + + **API scope required**: `nfts.create` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Mint NFT + request: + body: MintNftRequest + response: + docs: Success. + type: MintNftResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: + metadata: + name: Crossmint Example NFT + image: https://www.crossmint.com/assets/crossmint/logo.png + description: My NFT created via the mint API! + response: + body: + id: id + onChain: + status: status + chain: chain + actionId: actionId + mint-sft: + path: /2022-06-09/collections/{collectionId}/sfts + method: POST + auth: true + docs: | + Mint your SFTs and deliver them to a web3 wallet or an email address + + **API scope required**: `nfts.create` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Mint SFT + request: + name: MintSftRequest + headers: + x-idempotency-key: + type: optional + name: idempotencyKey + docs: Unique identifier to prevent duplicate requests + body: + properties: + templateId: + type: string + docs: Identifier of the template + recipient: root.Recipient + amount: + type: optional + docs: (Optional) Amount to mint + response: + docs: Success + type: MintSftResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: + templateId: silver-pass + recipient: email:testy@crossmint.io:polygon + response: + body: + actionId: a91c15e3-60f2-4a45-bf1a-cee508981667 + action: nfts.create + status: pending + data: + chain: polygon + collection: + id: 84e3d617-9c1b-4e7a-9686-522a9ea7c520 + contractAddress: contractAddress + recipient: + walletAddress: walletAddress + email: testy@crossmint.io + token: + id: a91c15e3-60f2-4a45-bf1a-cee508981667 + startedAt: '2024-01-02T22:05:01.000Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/actions/a91c15e3-60f2-4a45-bf1a-cee508981667 + mint-status: + path: /2022-06-09/collections/{collectionId}/nfts/{id} + method: GET + auth: true + docs: | + Get the status and associated information for a mint operation. + + **API scope required**: `nfts.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + id: + type: string + docs: Unique ID of the minted NFT returned in the mint response + display-name: Mint Status + response: + docs: Success. + type: root.MintStatusSolana200 + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + id: id + response: + body: + id: id + metadata: + name: name + symbol: symbol + seller_fee_basis_points: 0 + properties: + files: + - {} + category: category + creators: + - {} + description: description + image: image + attributes: + - {} + onChain: + status: success + mintHash: mintHash + txId: txId + owner: owner + chain: solana + action: https://staging.crossmint.com/api/2022-06-09/actions/ + mint-nft-idempotent: + path: /2022-06-09/collections/{collectionId}/nfts/{id} + method: PUT + auth: true + docs: | + This pathway allows you to mint NFTs and guarantee idempotency + to ensure you never double mint for the same NFT. + + **API scope required**: `nfts.create` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + id: + type: string + docs: Custom ID of the NFT, which is used as an idempotency key + display-name: Mint NFT with ID + request: + name: MintNftIdempotentRequest + body: + properties: + recipient: root.Recipient + metadata: root.NftMetadataOptions + reuploadLinkedFiles: optional + compressed: optional + response: + docs: The request has been accepted. + type: MintNftIdempotentResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + id: my-idempotency-key + request: + recipient: email:testy@crossmint.io:polygon + metadata: + name: Crossmint Example NFT + image: https://www.crossmint.com/assets/crossmint/logo.png + description: My NFT created via the mint API! + response: + body: + id: id + onChain: + status: status + chain: chain + actionId: actionId + burn-nft: + path: /2022-06-09/collections/{collectionId}/nfts/{id} + method: DELETE + auth: true + docs: | + Burn a minted NFT. + + **API scope required**: `nfts.delete` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + id: + type: string + docs: Unique ID of the minted NFT returned in the mint response + display-name: Burn NFT + response: + docs: Success. + type: root.BurnNftResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + id: id + response: + body: + actionId: 201520fc-e0eb-4698-a2f3-c6b50cc7c894 + action: nfts.delete + status: pending OR succeeded + data: + chain: polygon + txId: >- + succeeded status ONLY - + 0x69cf6d971e6745f25f683db9c87663839be02bdaa4a70f0724f490d7335b0081 + collection: + id: default-polygon + contractAddress: '0x67a602CBb306b3DBaaC7ECf55b72EED0E04Dc785' + token: + id: 799a6f68-e2ea-4126-8577-4298dfcf900c + tokenId: '7' + startedAt: '2024-01-10T23:01:45Z' + completedAt: '2024-01-15T09:30:00Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts/201520fc-e0eb-4698-a2f3-c6b50cc7c894 + edit-nft: + path: /2022-06-09/collections/{collectionId}/nfts/{id} + method: PATCH + auth: true + docs: > + Edit a minted NFT's metadata on IPFS. + + + If you are using a custom baseURI, invoking this will overwrite the + specific tokenURI for the edited token. + + + **API scope required**: `nfts.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + id: + type: string + docs: Unique ID of the minted NFT returned in the mint response + display-name: Edit NFT + request: + name: EditNftRequest + body: + properties: + metadata: root.NftMetadataOptions + reuploadLinkedFiles: optional + response: + docs: The NFT metadata update action has been successfully been created. + type: root.EditNftResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + id: id + request: + metadata: + name: Crossmint Example NFT + image: https://www.crossmint.com/assets/crossmint/logo.png + description: My NFT created via the mint API! + response: + body: + actionId: d5e24c69-530d-4efd-9201-e6f9d6f647e2 + action: nfts.update + status: pending OR succeeded + data: + txId: >- + succeeded status ONLY - + 0x69cf6d971e6745f25f683db9c87663839be02bdaa4a70f0724f490d7335b0081 + chain: polygon + collection: + id: c242dcdb-57a7-4944-af9f-2c1472fa70fb + contractAddress: '0xc0DeE392CBe1af5f8211A17EAffAA5c358C0fE6d' + token: + id: 27db27cf-1596-4ab0-9826-a6740ffce61a + owner: + walletAddress: '0x0794f3aa4521d19273D775a08289110523D34DD4' + tokenId: '1' + changes: + - metadata + startedAt: '2024-03-08T00:10:59Z' + completedAt: '2024-01-15T09:30:00Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/collections/c242dcdb-57a7-4944-af9f-2c1472fa70fb/nfts/d5e24c69-530d-4efd-9201-e6f9d6f647e2 + burn-nft-by-locator: + path: /v1-alpha1/nfts/{locator} + method: DELETE + auth: true + docs: | + Burn a minted NFT using a Crossmint NFT locator. + + **API scope required**: `nfts.delete` + path-parameters: + locator: + type: string + docs: >- + The locator of the NFT, which includes the blockchain, contract + address, and token ID. + display-name: Burn NFT by Locator + response: + docs: Success + type: root.BurnNftResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.NotImplementedError + - root.ServiceUnavailableError + examples: + - path-parameters: + locator: polygon:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045:52 + response: + body: + actionId: 201520fc-e0eb-4698-a2f3-c6b50cc7c894 + action: nfts.delete + status: pending OR succeeded + data: + chain: polygon + txId: >- + succeeded status ONLY - + 0x69cf6d971e6745f25f683db9c87663839be02bdaa4a70f0724f490d7335b0081 + collection: + id: default-polygon + contractAddress: '0x67a602CBb306b3DBaaC7ECf55b72EED0E04Dc785' + token: + id: 799a6f68-e2ea-4126-8577-4298dfcf900c + tokenId: '7' + startedAt: '2024-01-10T23:01:45Z' + completedAt: '2024-01-15T09:30:00Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts/201520fc-e0eb-4698-a2f3-c6b50cc7c894 + edit-nft-by-locator: + path: /v1-alpha1/nfts/{locator} + method: PATCH + auth: true + docs: | + Edit a minted NFT's metadata using a Crossmint NFT locator. + + **API scope required**: `nfts.update` + path-parameters: + locator: + type: string + docs: >- + The locator of the NFT, which includes the blockchain, contract + address, and token ID. + display-name: Edit NFT by Locator + request: + name: EditNftByLocatorRequest + body: + properties: + metadata: root.NftMetadata + reuploadLinkedFiles: root.ReuploadLinkedFiles + response: + docs: Success + type: root.EditNftResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.NotImplementedError + - root.ServiceUnavailableError + examples: + - path-parameters: + locator: polygon:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045:52 + request: + metadata: + name: Crossmint Example NFT + image: https://www.crossmint.com/assets/crossmint/logo.png + description: My NFT created via the mint API! + reuploadLinkedFiles: true + response: + body: + actionId: d5e24c69-530d-4efd-9201-e6f9d6f647e2 + action: nfts.update + status: pending OR succeeded + data: + txId: >- + succeeded status ONLY - + 0x69cf6d971e6745f25f683db9c87663839be02bdaa4a70f0724f490d7335b0081 + chain: polygon + collection: + id: c242dcdb-57a7-4944-af9f-2c1472fa70fb + contractAddress: '0xc0DeE392CBe1af5f8211A17EAffAA5c358C0fE6d' + token: + id: 27db27cf-1596-4ab0-9826-a6740ffce61a + owner: + walletAddress: '0x0794f3aa4521d19273D775a08289110523D34DD4' + tokenId: '1' + changes: + - metadata + startedAt: '2024-03-08T00:10:59Z' + completedAt: '2024-01-15T09:30:00Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/collections/c242dcdb-57a7-4944-af9f-2c1472fa70fb/nfts/d5e24c69-530d-4efd-9201-e6f9d6f647e2 diff --git a/.mock/definition/nftCollections.yml b/.mock/definition/nftCollections.yml new file mode 100644 index 0000000..875914f --- /dev/null +++ b/.mock/definition/nftCollections.yml @@ -0,0 +1,679 @@ +imports: + root: __package__.yml +types: + ListCollectionsResponse: + properties: + results: optional> + GetRoyaltyInformationResponseRecipientsItem: + properties: + address: + type: optional + docs: Recipient address. e.g., 0x71C... + basisPoints: + type: optional + docs: > + A basis point is a standard measure for percentages in finance. One + basis point equals 1/100th of 1%, or 0.01%. + GetRoyaltyInformationResponse: + properties: + recipients: optional> + EditRoyaltyInformationRequestRecipientsItem: + properties: + address: + type: optional + docs: | + Address where the payments will be received. + Note: ENS addresses are not supported. + basisPoints: + type: optional + docs: > + Percentage of the sale price that will go to the recipient address. A + basis point is a standard measure for percentages in finance. One + basis point equals 1/100th of 1%, or 0.01%. + GetBaseUriResponse: + properties: + uri: optional + GetTransferabilityResponse: + properties: + value: optional +service: + auth: false + base-path: '' + endpoints: + list-collections: + path: /2022-06-09/collections/ + method: GET + auth: true + docs: | + List all collections created under the current Crossmint project + + **API scope required**: `collections.read` + display-name: Get All Collections + response: + docs: Success. + type: ListCollectionsResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - response: + body: + results: + - id: bb691876-edb3-404c-af3e-c019b8e2ed2c + metadata: + name: Test Collection + description: Test + imageUrl: ipfs://QmVocoiYXZLAtheEHV3VF8w4pa68bkPutT8cQZdMrrpzxh + symbol: XMINT + fungibility: non-fungible + onChain: + chain: polygon + type: erc-721 + contractAddress: '0x9564bD85f3D5677D86244dDb06F06bbD22D9d0DB' + supplyLimit: 95 + payments: + price: '0.001' + recipientAddress: '0x6C3b3225759Cbda68F96378A9F0277B4374f9F06' + create-collection: + path: /2022-06-09/collections/ + method: POST + auth: true + docs: | + Create a collection that you can mint NFTs/SFTs from + + **API scope required**: `collections.create` + display-name: Create Collection + request: + body: root.CreateCollectionBody + response: + docs: Success. + type: root.CreateCollectionResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - request: + chain: aptos + metadata: + name: Sample NFT Collection + description: This is a sample NFT collection + response: + body: + id: 5263650e-6d43-4ed3-9e31-0cf593d076a4 + metadata: + name: Test Collection + description: Test + imageUrl: https://cdn.io/metadata.json + symbol: XMINT + fungibility: semi-fungible + onChain: + chain: polygon + type: erc-1155 + actionId: 5263650e-6d43-4ed3-9e31-0cf593d076a4 + collection-info: + path: /2022-06-09/collections/{collectionId} + method: GET + auth: true + docs: | + Get information about a specific collection. + + **API scope required**: `collections.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Get Collection Info + response: + docs: Success. + type: root.GetCollectionResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + response: + body: + id: bb691876-edb3-404c-af3e-c019b8e2ed2c + metadata: + name: Test Collection + description: Test + imageUrl: ipfs://QmVocoiYXZLAtheEHV3VF8w4pa68bkPutT8cQZdMrrpzxh + symbol: XMINT + fungibility: non-fungible + onChain: + chain: polygon + type: erc-721 + contractAddress: '0x9564bD85f3D5677D86244dDb06F06bbD22D9d0DB' + supplyLimit: 95 + payments: + price: '0.001' + recipientAddress: '0x6C3b3225759Cbda68F96378A9F0277B4374f9F06' + create-collection-custom: + path: /2022-06-09/collections/{collectionId} + method: PUT + auth: true + docs: > + Create a collection that you can mint NFTs/SFTs from. This API is + idempotent, + + if you call it multiple times with the same ID, only one will be + created. + + + **API scope required**: `collections.create` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Create Collection with ID + request: + body: root.CreateCollectionBody + response: + docs: Success. + type: root.CreateCollectionResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: + chain: aptos + metadata: + name: Sample NFT Collection + description: This is a sample NFT collection + response: + body: + id: 5263650e-6d43-4ed3-9e31-0cf593d076a4 + metadata: + name: Test Collection + description: Test + imageUrl: https://cdn.io/metadata.json + symbol: XMINT + fungibility: semi-fungible + onChain: + chain: polygon + type: erc-1155 + actionId: 5263650e-6d43-4ed3-9e31-0cf593d076a4 + update-collection: + path: /2022-06-09/collections/{collectionId} + method: PATCH + auth: true + docs: | + Update the sales details of a collection + + **API scope required**: `collections.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Update Collection Info + request: + name: UpdateCollectionRequest + body: + properties: + supplyLimit: + type: optional + docs: >- + The maximum number of NFTs that can be minted for this + collection + payments: optional + response: + docs: A JSON object containing transactionId and status + type: root.UpdateCollectionResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: {} + response: + body: + actionId: e9abb61c-9371-447e-af1a-86fb5c073754 + action: collections.update + status: pending + data: + chain: arbitrum + collection: + id: 42c43e55-f92d-4b25-bc99-d8309b6e1f38 + contractAddress: '0x45ba91BCa91fA0D384022d3C279866811795FcF7' + changes: + - changes + startedAt: '2023-12-30T00:06:56Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/collections/ + get-royalty-information: + path: /v1-alpha1/minting/collections/{collectionId}/royalties + method: GET + auth: true + docs: > + Fetch the royalty configuration for a collection, from its current state + + in the blockchain. + + + This API is only supported on EVM chains. + + + If you call GET too soon after PUT/DELETE, + + you may not yet see your latest changes, as they can take a few seconds + to + + record on the blockchain. + + + **API scope required**: `collections.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Get Royalties Config + response: + docs: Success. + type: GetRoyaltyInformationResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + response: + body: + recipients: + - address: 0x71C... + basisPoints: 100 + edit-royalty-information: + path: /v1-alpha1/minting/collections/{collectionId}/royalties + method: PUT + auth: true + docs: > + Configure royalties for all NFTs in a collection. + + + This API is only supported for EVM chains and implements the EIP-2981 + standard. + + + **API scope required**: `collections.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Set Royalties + request: + name: EditRoyaltyInformationRequest + body: + properties: + recipients: + type: optional> + docs: >- + List of royalty recipients. Note: EVM collections only support a + single recipient. Use a contract splitter as recipient in order + to send payments to multiple addresses. + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: {} + disable-royalty-information: + path: /v1-alpha1/minting/collections/{collectionId}/royalties + method: DELETE + auth: true + docs: > + Remove all royalties from a given collection. No new NFT sales will + yield royalties to the creator. + + + This API is only supported on EVM Chains. + + + **API scope required**: `collections.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Remove Royalties + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + get-base-uri: + path: /v1-alpha1/minting/collections/{collectionId}/base-uri + method: GET + auth: true + docs: | + Get the Base URI of a collection as it appears on-chain. + + **API scope required**: `collections.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Get Base URI + response: + docs: Base URI of a collection as it appears on-chain + type: GetBaseUriResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + response: + body: + uri: uri + set-base-uri: + path: /v1-alpha1/minting/collections/{collectionId}/base-uri + method: PUT + auth: true + docs: > + Update the Base URI of a collection. Setting the baseURI enables + + excluding the metadata param when minting. Tokens minted without the + metadata + + param will have a tokenURI of: + + + `{BASE_URI}/{TOKEN_ID}` + + + This API is currently only supported on EVM Chains. + + + **API scope required**: `collections.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Set Base URI + request: + name: SetBaseUriRequest + body: + properties: + uri: + type: optional + docs: The new Base URI + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: {} + get-transferability: + path: /v1-alpha1/minting/collections/{collectionId}/transferable + method: GET + auth: true + docs: | + Get the transferable status of a collection. + + This API is only supported on EVM chains. + + You must contact sales to gain access to this API. + + **API scope required**: `collections.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Get Transferability + response: + docs: Success + type: GetTransferabilityResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + response: + body: + value: true + set-transferability: + path: /v1-alpha1/minting/collections/{collectionId}/transferable + method: PUT + auth: true + docs: | + Update the transferable status of a collection. + + This API is only supported on EVM chains. + You must contact sales to gain access to this API. + + **API scope required**: `collections.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Set Transferability + request: + name: SetTransferabilityRequest + body: + properties: + value: + type: boolean + docs: >- + Toggles the transferability of NFTs within the collection. Set + to `false` to disable transfers. + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ConflictError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + request: + value: true diff --git a/.mock/definition/nftTemplates.yml b/.mock/definition/nftTemplates.yml new file mode 100644 index 0000000..161fe07 --- /dev/null +++ b/.mock/definition/nftTemplates.yml @@ -0,0 +1,326 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + get-all-templates: + path: /2022-06-09/collections/{collectionId}/templates + method: GET + auth: true + docs: | + Get all of the templates for a collection + + **API scope required**: `nfts.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + display-name: Get All Templates + request: + name: GetAllTemplatesRequest + query-parameters: + page: + type: double + docs: The page number you want to query, starting at 1 + perPage: + type: optional + docs: How many items you want to be returned in the page. + response: + docs: success + type: list + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + query-parameters: + page: 1.1 + perPage: 20 + response: + body: + - templateId: 20ed0963-0185-49af-b4a0-2de3169bb367 + metadata: + name: My Token + image: https://cdn.io/image.png + description: Sample Token Template + onChain: + tokenId: 1 + supply: + limit: 1 + minted: 0 + create-template: + path: /2022-06-09/collections/{collectionId}/templates + method: POST + auth: true + docs: | + Create a token template, that NFTs or SFTs may be minted from + + **API scope required**: `nfts.create` + path-parameters: + collectionId: + type: string + docs: The ID of the named collection, used to create new tokens + display-name: Create Template + request: + body: root.CreateTemplateBody + response: + docs: Success + type: root.TemplateResponse + errors: + - root.BadRequestError + - root.NotFoundError + - root.ConflictError + - root.FailedDependencyError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: idempotent-collection-name + request: {} + response: + body: + templateId: 20ed0963-0185-49af-b4a0-2de3169bb367 + metadata: + name: My Token + image: https://cdn.io/image.png + description: Sample Token Template + onChain: + tokenId: 1 + supply: + limit: 1 + minted: 0 + get-template: + path: /2022-06-09/collections/{collectionId}/templates/{templateId} + method: GET + auth: true + docs: | + Fetch the contents of a token template. + + **API scope required**: `nfts.read` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + templateId: + type: string + docs: The template ID + display-name: Get Template + response: + docs: Success + type: root.TemplateResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + templateId: templateId + response: + body: + templateId: 20ed0963-0185-49af-b4a0-2de3169bb367 + metadata: + name: My Token + image: https://cdn.io/image.png + description: Sample Token Template + onChain: + tokenId: 1 + supply: + limit: 1 + minted: 0 + create-template-idempotent: + path: /2022-06-09/collections/{collectionId}/templates/{templateId} + method: PUT + auth: true + docs: | + Create a token template with preconfigured metadata + + **API scope required**: `nfts.create` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + templateId: + type: string + docs: The template ID + display-name: Create Template with ID + request: + body: root.CreateTemplateBody + response: + docs: Success + type: root.TemplateResponse + errors: + - root.BadRequestError + - root.NotFoundError + - root.ConflictError + - root.FailedDependencyError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + templateId: templateId + request: {} + response: + body: + templateId: 20ed0963-0185-49af-b4a0-2de3169bb367 + metadata: + name: My Token + image: https://cdn.io/image.png + description: Sample Token Template + onChain: + tokenId: 1 + supply: + limit: 1 + minted: 0 + delete-template: + path: /2022-06-09/collections/{collectionId}/templates/{templateId} + method: DELETE + auth: true + docs: | + Delete a Token template. + + **API scope required**: `nfts.delete` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + templateId: + type: string + docs: The template ID + display-name: Delete Template + errors: + - root.BadRequestError + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + templateId: templateId + edit-template: + path: /2022-06-09/collections/{collectionId}/templates/{templateId} + method: PATCH + auth: true + docs: | + Edit a Token template. + + **API scope required**: `nfts.update` + path-parameters: + collectionId: + type: string + docs: > + This is the identifier for the collection related to the request. + Every project has default collections: `default-solana` and + `default-polygon`. + + + The + [create-collection](/api-reference/minting/collection/create-collection) + API will result in collections with UUID formatted `collectionId`. + + **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + + + The + [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) + API allows you to specify an arbitrary identifier during the + intitial request. + + **Example:** `your-custom-identifer` + templateId: + type: string + docs: The template ID + display-name: Edit Template + request: + body: EditTemplateRequest + errors: + - root.BadRequestError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + collectionId: default-solana + templateId: templateId + request: {} +types: + EditTemplateRequest: + discriminated: false + union: + - root.MintingMetadata + - root.Supply diff --git a/.mock/definition/quotePrice.yml b/.mock/definition/quotePrice.yml new file mode 100644 index 0000000..16a2202 --- /dev/null +++ b/.mock/definition/quotePrice.yml @@ -0,0 +1,59 @@ +types: + QuoteRequestQuoteCurrency: + enum: + - usd + - eur + - gbp + - aud + - sgd + - hkd + - krw + - inr + - vnd + - jpy + default: usd +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + quote: + path: /v1-alpha1/quote + method: GET + auth: true + docs: > + Get the price of a transaction hosted through Crossmint, inclusive of + all fees. + + + **This API is subject to change as it is currently in its alpha form.** + display-name: Quote Transaction with Fees + request: + name: QuoteRequest + query-parameters: + nativePrice: + type: string + docs: > + Price in specified chain currency to quote. + + The chain is derived from the chain your collection is on. + + If your chain is on the Solana network, the parameter would be the + SOL amount, not Lamports. + quoteCurrency: + type: QuoteRequestQuoteCurrency + docs: Price in specified currency to quote + response: + docs: Success. + type: root.QuoteResponse + errors: + - root.BadRequestError + examples: + - query-parameters: + nativePrice: nativePrice + quoteCurrency: usd + response: + body: + currency: usd + price: 1.23 diff --git a/.mock/definition/registration.yml b/.mock/definition/registration.yml new file mode 100644 index 0000000..bae5b7b --- /dev/null +++ b/.mock/definition/registration.yml @@ -0,0 +1,169 @@ +types: + RegisterNftCollectionRequestChain: + enum: + - solana + - ethereum + - polygon + - bsc + docs: Crypto chain your NFT is on + default: solana + RegisterNftCollectionRequestContractType: + enum: + - value: candy-machine + name: CandyMachine + - value: erc-721 + name: Erc721 + - value: erc-1155 + name: Erc1155 + - value: thirdweb-drop + name: ThirdwebDrop + docs: The type of your contract. + default: erc-721 + RegisterNftCollectionRequestArgsCandyMachineId: + properties: + candyMachineId: + type: string + docs: Candy machine ID + EVM: + properties: + contractAddress: string + abi: string + mintFunctionName: string + toParamName: + type: string + docs: The name of the `to` parameter in the mint function + quantityParamName: optional + RegisterNftCollectionRequestArgs: + discriminated: false + union: + - RegisterNftCollectionRequestArgsCandyMachineId + - EVM + RegisterNftCollectionRequestMetadataSocial: + properties: + twitter: + type: optional + docs: A link to your twitter page + discord: + type: optional + docs: An invite link to your discord server + RegisterNftCollectionRequestMetadata: + properties: + title: + type: string + docs: Collection title + description: + type: string + docs: Description of your collection + imageUrl: + type: string + docs: Image url + social: optional + RegisterNftCollectionRequestOwnership: + enum: + - external + - self + docs: Ownership of the collection + RegisterNftCollectionRequestCategory: + enum: + - loyalty + - art + - music + - gaming + - ticketing + - charity + - other + docs: Verification category + RegisterNftCollectionRequestScopesItem: + enum: + - value: payments:credit-card + name: PaymentsCreditCard + - value: payments:cross-chain + name: PaymentsCrossChain + UpdateNftCollectionRequestMetadataSocial: + properties: + twitter: + type: optional + docs: A link to your twitter page + discord: + type: optional + docs: An invite link to your discord server + UpdateNftCollectionRequestMetadata: + properties: + title: string + imageUrl: string + social: optional +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + register-nft-collection: + path: /v1-alpha1/collections + method: POST + auth: true + docs: | + Register your NFT collection with Crossmint + + **This API is subject to change as it is currently in its alpha form.** + display-name: Register NFT Collection + request: + name: RegisterNftCollectionRequest + body: + properties: + chain: + type: RegisterNftCollectionRequestChain + docs: Crypto chain your NFT is on + default: solana + contractType: + type: RegisterNftCollectionRequestContractType + docs: The type of your contract. + default: erc-721 + args: RegisterNftCollectionRequestArgs + metadata: RegisterNftCollectionRequestMetadata + ownership: + type: RegisterNftCollectionRequestOwnership + docs: Ownership of the collection + category: + type: RegisterNftCollectionRequestCategory + docs: Verification category + scopes: list + errors: + - root.BadRequestError + examples: + - request: + chain: solana + contractType: candy-machine + args: + candyMachineId: candyMachineId + metadata: + title: title + description: description + imageUrl: imageUrl + ownership: external + category: loyalty + scopes: + - payments:credit-card + update-nft-collection: + path: /v1-alpha1/collections + method: PUT + auth: true + docs: | + Update your collection information registered on Crossmint + + **This API is subject to change as it is currently in its alpha form.** + display-name: Update Your Collection + request: + name: UpdateNftCollectionRequest + body: + properties: + clientId: string + metadata: UpdateNftCollectionRequestMetadata + errors: + - root.BadRequestError + examples: + - request: + clientId: clientId + metadata: + title: title + imageUrl: imageUrl diff --git a/.mock/definition/sign.yml b/.mock/definition/sign.yml new file mode 100644 index 0000000..67c1737 --- /dev/null +++ b/.mock/definition/sign.yml @@ -0,0 +1,51 @@ +imports: + root: __package__.yml +types: + SignMessageResponse: + properties: + signedMessage: + type: optional + docs: This is the result of `ethers.Signer.signMessage` +service: + auth: false + base-path: '' + endpoints: + message: + path: /v1-alpha1/wallets/{chain}:{address}/signMessage + method: POST + auth: true + docs: | + Sign a message using a custodial wallet's key + + **API scope required**: `wallets:messages.sign` + path-parameters: + chain: + type: root.EvmChains + docs: The blockchain network you are using. + address: + type: string + docs: The wallet address you want to sign the message with + display-name: Sign Message + request: + name: SignMessageRequest + body: + properties: + message: + type: string + docs: The message to be signed + response: + docs: Message has been successfully signed + type: SignMessageResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + - root.NotFoundError + examples: + - path-parameters: + chain: arbitrum + address: address + request: + message: message + response: + body: + signedMessage: 0x00000000... diff --git a/.mock/definition/verifiableCredentials.yml b/.mock/definition/verifiableCredentials.yml new file mode 100644 index 0000000..4f75cdc --- /dev/null +++ b/.mock/definition/verifiableCredentials.yml @@ -0,0 +1,648 @@ +types: + VerifyCredentialResponse: + properties: + isValid: optional + error: optional + VcCreateTemplateRequestMetadata: + properties: + name: + type: string + docs: 'The name of your collection (Max length: 32)' + validation: + maxLength: 32 + description: + type: string + docs: 'A brief description of credential (Max length: 64)' + validation: + maxLength: 64 + VcCreateTemplateRequestCredentialsDelegatedIssuer: + docs: Issuer information, fill only if using delegatedStorage + properties: + did: + type: optional + docs: The issuer's did + endpoint: + type: optional + docs: The issuer's endpoint to sign credentials + token: + type: optional + docs: Token used for auth on the issuer endpoint + VcCreateTemplateRequestCredentials: + docs: Credentials parameters + properties: + type: + type: string + docs: >- + The type of credentials inside the collection (blank or 'default' in + case no custom type is used) + storage: + type: optional + docs: Where to store the credential + default: crossmint | decentralized-ipfs | delegated + delegatedStorageEndpoint: + type: optional + docs: >- + Only if storage is 'delegated', the endpoint to retrieve the + credential from + encryption: + type: optional + docs: Whether to encrypt the credential using the recipient's wallet + default: none | decentralized-lit + delegatedIssuer: + type: optional + docs: Issuer information, fill only if using delegatedStorage + IssueVcRequestMetadataAttributesItemDisplayType: + enum: + - boost_number + - boost_percentage + - number + docs: Display name of your attribute + IssueVcRequestMetadataAttributesItem: + properties: + display_type: + type: optional + docs: Display name of your attribute + trait_type: + type: string + docs: The name of the trait + value: + type: string + docs: The value of the trait + IssueVcRequestMetadata: + properties: + name: + type: string + docs: 'The name of your NFT (Max length: 32)' + validation: + maxLength: 32 + image: + type: string + docs: Direct link to your NFT image + description: + type: string + docs: 'A brief description of the NFT (Max length: 64)' + validation: + maxLength: 64 + animation_url: + type: optional + docs: | + **EVM only** + + [See more info here](/minting/advanced/nft-metadata) + attributes: + type: optional> + docs: Add attributes to your NFT + IssueVcRequestCredential: + properties: + subject: + docs: >- + The credential claims object, matching the schema defined on the + collection types. + type: map + expiresAt: + type: optional + docs: optional expiration date in ISO 8601 + default: '2023-08-31T16:34:33.854Z' + IssueVcResponseOnChain: + properties: + status: optional + chain: optional + contractAddress: optional + IssueVcResponse: + properties: + credentialId: + type: optional + docs: The credential id + id: optional + onChain: optional + CreateTypeRequestCredentialSubjectSchemaItem: + properties: + name: + type: string + docs: The name of credential subject property + default: user_email + type: + type: string + docs: The type of credential subject property + default: basetype or nestedTypeSchema + CreateTypeRequestNestedTypeSchemaItem: + properties: + name: + type: string + default: age + type: + type: string + default: uint16 + CreateTypeResponse: + properties: + id: + type: optional + docs: The type name + GetTypeResponseCredentialSubjectSchemaItem: + properties: + name: optional + type: optional + GetTypeResponse: + properties: + name: optional + credentialSubjectSchema: optional> + CreateTypeIdempotentRequestCredentialSubjectSchemaItem: + properties: + name: + type: string + docs: The name of credential subject property + default: user_email + type: + type: string + docs: The type of credential subject property + default: basetype or nestedTypeSchema + CreateTypeIdempotentRequestNestedTypeSchemaItem: + properties: + name: + type: string + default: age + type: + type: string + default: uint16 + CreateTypeIdempotentResponse: + properties: + id: + type: optional + docs: The type name +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + verify-credential: + path: /unstable/credentials/verify + method: POST + auth: true + docs: | + Verify that a credential is valid. + + **API scope required** `credentials.read` + display-name: Verify Credential + request: + name: VerifyCredentialRequest + body: + properties: + credential: + docs: The JSON representing a credential. + type: map + response: + docs: Success. + type: VerifyCredentialResponse + errors: + - root.BadRequestError + examples: + - name: valid + request: + credential: + key: value + response: + body: + isValid: true + error: null / "error message" + - name: invalid revoked + request: + credential: + key: value + response: + body: + isValid: false + error: Credential Revoked + - name: invalid expired + request: + credential: + key: value + response: + body: + isValid: false + error: Credential expired at + - name: invalid proof + request: + credential: + key: value + response: + body: + isValid: false + error: Invalid proof + vc-create-template: + path: /unstable/credentials/templates/ + method: POST + auth: true + docs: > + Create a template (similar to an nft collection) for issuing verifiable + credentials. + + + **API scope required** `credentials:template.create` + display-name: Create VC template + request: + name: VcCreateTemplateRequest + body: + properties: + metadata: VcCreateTemplateRequestMetadata + chain: + type: literal<"polygon"> + docs: The chain to mint the nft on + credentials: + type: VcCreateTemplateRequestCredentials + docs: Credentials parameters + response: + docs: >- + Success. Refer to the standard create collection response for more + details. + type: string + errors: + - root.BadRequestError + examples: + - request: + metadata: + name: Verifiable Credential + description: The owner of this credential is authorized. + chain: polygon + credentials: + type: degreeForMastersStudent + response: + body: >- + Success. Refer to the standard nft create collection response for + more details. + get-vc: + path: /unstable/collections/{collectionId}/nfts/{id}/credentials + method: GET + auth: true + docs: > + Get a verifiable credential by the ID associated with the minted NFT. + + + This ID will have the format: ``. For example: + `d7eb777b-e9b4-4f34-ab5f-ce199111166a` + + + **API scope required** `credentials.read`. This endpoint will not work + with a client side API key. + path-parameters: + collectionId: + type: string + docs: Collection id (template id) + id: + type: string + docs: > + UUID of the NFT returned in the NFT creation response. Format is: + `` + display-name: Get VC by NFT ID + response: + docs: Success. + type: map + errors: + - root.BadRequestError + - root.NotFoundError + examples: + - path-parameters: + collectionId: collectionId + id: id + response: + body: + value: + id: + credentialSubject: + id: 0xSUBJECT_ADDRESS + ...additional fields: ... + nft: + tokenId: + chain: polygon + contractAddress: + expirationDate: '2234-12-12' + '@context': + - https://www.w3.org/2018/credentials/v1 + - >- + https://github.com/haardikk21/ethereum-eip712-signature-2021-spec/blob/main/index.html + issuer: + id: did:0xISSUER_ADDRESS + type: + - VerifiableCredential + - 64f0c05641a512c86786fd3b + issuanceDate: '2023-08-31T16:34:33.854Z' + proof: + proofValue: ProofValue + ...additional required fields: ... + get-vc-by-id: + path: /unstable/credentials/{id} + method: GET + auth: true + docs: > + Get a verifiable credential by the ID associated with it. + + + This ID will have the format: `urn:uuid:`. For example: + `urn:uuid:64f9877d-a19a-4205-8d61-f8c2abed5766` + + + **API scope required** `credentials.read`. This enpoint will work also + with a client side API key. + path-parameters: + id: + type: string + docs: > + Unique ID of the credential as returned in the NFT creation + response. Format is: `urn:uuid:` + display-name: Get VC by Credential ID + response: + docs: Success. + type: map + errors: + - root.BadRequestError + - root.NotFoundError + examples: + - path-parameters: + id: id + response: + body: + value: + id: + credentialSubject: + id: 0xSUBJECT_ADDRESS + ...additional fields: ... + nft: + tokenId: + chain: polygon + contractAddress: + expirationDate: '2234-12-12' + '@context': + - https://www.w3.org/2018/credentials/v1 + - >- + https://github.com/haardikk21/ethereum-eip712-signature-2021-spec/blob/main/index.html + issuer: + id: did:0xISSUER_ADDRESS + type: + - VerifiableCredential + - 64f0c05641a512c86786fd3b + issuanceDate: '2023-08-31T16:34:33.854Z' + proof: + proofValue: ProofValue + ...additional required fields: ... + revoke-credential: + path: /unstable/credentials/{id} + method: DELETE + auth: true + docs: > + Revoke a verifiable credential by the credential ID. + + This involves burning the associated nft. + + + This ID will have the format: `urn:uuid:`. For example: + `urn:uuid:64f9877d-a19a-4205-8d61-f8c2abed5766` + + + **API scope required** `credentials.create`. + path-parameters: + id: + type: string + docs: > + Unique ID of the credential as returned in the NFT creation + response. Format is: `urn:uuid:` + display-name: Revoke credential by id + response: + docs: Success + type: root.BurnNftResponse + errors: + - root.ForbiddenError + - root.NotFoundError + - root.ServiceUnavailableError + examples: + - path-parameters: + id: id + response: + body: + actionId: 201520fc-e0eb-4698-a2f3-c6b50cc7c894 + action: nfts.delete + status: pending OR succeeded + data: + chain: polygon + txId: >- + succeeded status ONLY - + 0x69cf6d971e6745f25f683db9c87663839be02bdaa4a70f0724f490d7335b0081 + collection: + id: default-polygon + contractAddress: '0x67a602CBb306b3DBaaC7ECf55b72EED0E04Dc785' + token: + id: 799a6f68-e2ea-4126-8577-4298dfcf900c + tokenId: '7' + startedAt: '2024-01-10T23:01:45Z' + completedAt: '2024-01-15T09:30:00Z' + resource: >- + https://staging.crossmint.com/api/2022-06-09/collections/default-polygon/nfts/201520fc-e0eb-4698-a2f3-c6b50cc7c894 + get-vc-by-locator: + path: /unstable/nfts/{nftLocator}/credentials + method: GET + auth: true + docs: > + Get a verifiable credential by the NFT locator. + + + This locator will have the format: + `::`. + + For example: `polygon:0x1234abcde...:1` + + + **API scope required** `credentials.read`. This enpoint will work also + with a client side API key. + path-parameters: + nftLocator: + type: string + docs: >- + NFT on chain locator, in the format of + `::` + display-name: Get VC by NFT Locator + response: + docs: Success. + type: map + errors: + - root.BadRequestError + - root.NotFoundError + examples: + - path-parameters: + nftLocator: nftLocator + response: + body: + value: + id: + credentialSubject: + id: 0xSUBJECT_ADDRESS + ...additional fields: ... + nft: + tokenId: + chain: polygon + contractAddress: + expirationDate: '2234-12-12' + '@context': + - https://www.w3.org/2018/credentials/v1 + - >- + https://github.com/haardikk21/ethereum-eip712-signature-2021-spec/blob/main/index.html + issuer: + id: did:0xISSUER_ADDRESS + type: + - VerifiableCredential + - 64f0c05641a512c86786fd3b + issuanceDate: '2023-08-31T16:34:33.854Z' + proof: + proofValue: ProofValue + ...additional required fields: ... + issue-vc: + path: /unstable/credentials/templates/{templateId}/vcs + method: POST + auth: true + docs: > + Issue a verifiable credential. Deliver to a web3 wallet or email + address. + + + **API scope required** `credentials.create` + path-parameters: + templateId: + type: string + docs: Template id of a credential enabled collection + display-name: Issue VC + request: + name: IssueVcRequest + body: + properties: + recipient: + type: string + docs: >- + Recipient address in the format of `:
` or + `email::`. + metadata: optional + credential: IssueVcRequestCredential + response: + docs: Success. + type: IssueVcResponse + errors: + - root.BadRequestError + - root.ForbiddenError + - root.ServiceUnavailableError + examples: + - name: Pending + path-parameters: + templateId: default + request: + recipient: polygon:0x1234abcde... or email::polygon + credential: + subject: + subjectName: foo + subjectAge: 20 + claim: bar + response: + body: + credentialId: urn:uuid:40ada19e-3b4a-4de0-8d61-e0e7aedbfa0 + id: 1938b38c-3037-45dc-8033-333b7ebaee7 + onChain: + status: status + chain: chain + contractAddress: contractAddress + create-type: + path: /unstable/credentials/types + method: POST + auth: true + docs: > + Create a type with a random UUID. This is how you define a custom + schema. + + + **API scope required** `credentials.create` + display-name: Create VC Type + request: + name: CreateTypeRequest + body: + properties: + credentialSubjectSchema: list + nestedTypeSchema: optional> + response: + docs: Success. + type: CreateTypeResponse + errors: + - root.BadRequestError + examples: + - request: + credentialSubjectSchema: + - name: username + type: string + - name: courses_completed + type: uint64 + - name: courses + type: Course[] + response: + body: + id: 64f0c05641a512c86786fd3b + get-type: + path: /unstable/credentials/types/{typeName} + method: GET + auth: true + docs: | + Get the schema of a given type by name + + **API scope required** `credentials.read` + path-parameters: + typeName: + type: string + docs: The name of the type + display-name: Get a Type + response: + docs: Success. + type: GetTypeResponse + errors: + - root.BadRequestError + examples: + - path-parameters: + typeName: typeName + response: + body: + name: 64f0c05641a512c86786fd3b + credentialSubjectSchema: + - name: age + type: uint8 + - name: name + type: string + create-type-idempotent: + path: /unstable/credentials/types/{typeName} + method: PUT + auth: true + docs: | + Create a type with a given name. This is how you define a custom schema. + + **API scope required** `credentials.create` + path-parameters: + typeName: + type: string + docs: The name of the type + display-name: Create VC Type with name + request: + name: CreateTypeIdempotentRequest + body: + properties: + credentialSubjectSchema: list + nestedTypeSchema: optional> + response: + docs: Success. + type: CreateTypeIdempotentResponse + errors: + - root.BadRequestError + examples: + - path-parameters: + typeName: typeName + request: + credentialSubjectSchema: + - name: username + type: string + - name: courses_completed + type: uint64 + - name: courses + type: Course[] + response: + body: + id: 64f0c05641a512c86786fd3b diff --git a/.mock/definition/wallet.yml b/.mock/definition/wallet.yml new file mode 100644 index 0000000..4fbbc3f --- /dev/null +++ b/.mock/definition/wallet.yml @@ -0,0 +1,148 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + fetch-wallet: + path: /v1-alpha1/wallets + method: GET + auth: true + docs: | + Fetch the addresses of a user's Crossmint custodial wallets + + **API scope required**: `wallets.read` + display-name: Get Wallets for User + request: + name: FetchWalletRequest + query-parameters: + userId: + type: optional + docs: >- + Unique identifier for your user. Any arbitrary string can be + passed here. + email: + type: optional + docs: The email used when creating the wallet + response: + docs: Success + type: list + errors: + - root.BadRequestError + - root.UnauthorizedError + examples: + - response: + body: + - chain: ethereum + publicKey: '0xB364346FDb52e42CcC186b3BA3730cb4A87bF5B0' + - chain: polygon + publicKey: '0x30E3E8feEc68d5Cb5424113E9d161611c7fc7290' + - chain: solana + publicKey: A9vzqFSxKVasf55GdZCAFKhKW9zckzx6ekhhsQTretTa + create-wallet: + path: /v1-alpha1/wallets + method: POST + auth: true + docs: | + Create a new Crossmint custodial wallet for a user + + **API scope required**: `wallets.create` + display-name: Create Wallet + request: + body: CreateWalletRequest + response: + docs: Wallet already exists + type: CreateWalletResponse + errors: + - root.BadRequestError + - root.UnauthorizedError + examples: + - request: + email: email + chain: arbitrum + response: + body: + chain: ethereum + publicKey: '0xB364346FDb52e42CcC186b3BA3730cb4A87bF5B0' + fetch-content-from-wallet: + path: /2022-06-09/wallets/{identifier}/nfts + method: GET + auth: true + docs: | + Fetch the NFTs in a provided wallet + + **API scope required**: `wallets:nfts.read` + path-parameters: + identifier: + type: string + docs: >- + The wallet identifier in the format of `:
`, + `email::` or `userId::`. + display-name: Get NFTs from Wallet + request: + name: FetchContentFromWalletRequest + query-parameters: + page: + type: string + docs: Page index + perPage: + type: string + docs: Number of items to display per page + response: + docs: Success + type: FetchContentFromWalletResponse + errors: + - root.BadRequestError + examples: + - path-parameters: + identifier: identifier + query-parameters: + page: page + perPage: perPage + response: + body: + - chain: chain + contractAddress: contractAddress + tokenId: tokenId + metadata: + attributes: + - {} + collection: + key: value + description: description + image: image + animation_url: animation_url + name: name + locator: locator + tokenStandard: tokenStandard +types: + email: + properties: + email: + type: string + docs: Provide an email for this wallet to be associated to + chain: root.AllChains + userId: + properties: + userId: + type: string + docs: Provide an arbitrary ID for this wallet to be associated to + chain: root.AllChains + CreateWalletRequest: + discriminated: false + union: + - email + - userId + CreateWalletResponse: + properties: + chain: + type: optional + docs: The blockchain the wallet is on + publicKey: + type: optional + docs: The address of the created wallet + FetchContentFromWalletResponse: + discriminated: false + union: + - root.NFTEVM + - root.NFTSolana diff --git a/.mock/fern.config.json b/.mock/fern.config.json index 4471af3..55f8356 100644 --- a/.mock/fern.config.json +++ b/.mock/fern.config.json @@ -1,4 +1,4 @@ { "organization" : "crossmint", - "version" : "0.33.5" + "version" : "0.36.0" } \ No newline at end of file diff --git a/README.md b/README.md index 7a511a9..cd3032a 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,12 @@ Instantiate and use the client with the following: ```typescript import { CrossmintClient, Crossmint } from "crossmint"; -const client = new CrossmintClient({ apiKey: "YOUR_API_KEY" }); -await client.checkout.createOrder({ - payment: { - method: Crossmint.EvmPaymentMethods.ArbitrumSepolia, - currency: Crossmint.EvmPaymentCurrency.Eth, - }, - lineItems: { - collectionLocator: "crossmint:", - }, +const client = new CrossmintClient({ + apiKey: "YOUR_API_KEY", + authorization: "YOUR_AUTHORIZATION", + clientId: "YOUR_CLIENT_ID", }); +await client.wallets({}); ``` ## Request And Response Types @@ -38,7 +34,7 @@ following namespace: ```typescript import { Crossmint } from "crossmint"; -const request: Crossmint.CheckoutCreateOrderRequest = { +const request: Crossmint.CreateOrderRequest = { ... }; ``` @@ -52,7 +48,7 @@ will be thrown. import { CrossmintError } from "crossmint"; try { - await client.checkout.createOrder(...); + await client.wallets(...); } catch (err) { if (err instanceof CrossmintError) { console.log(err.statusCode); @@ -79,7 +75,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret Use the `maxRetries` request option to configure this behavior. ```typescript -const response = await client.checkout.createOrder(..., { +const response = await client.wallets(..., { maxRetries: 0 // override maxRetries at the request level }); ``` @@ -89,7 +85,7 @@ const response = await client.checkout.createOrder(..., { The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior. ```typescript -const response = await client.checkout.createOrder(..., { +const response = await client.wallets(..., { timeoutInSeconds: 30 // override timeout to 30s }); ``` @@ -100,7 +96,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa ```typescript const controller = new AbortController(); -const response = await client.checkout.createOrder(..., { +const response = await client.wallets(..., { abortSignal: controller.signal }); controller.abort(); // aborts the request diff --git a/package.json b/package.json index 3b4f9f1..e15d99f 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "crossmint", - "version": "0.1.8", + "version": "0.0.9", "private": false, - "repository": "https://github.com/fern-demo/crossmint-typescript-sdk", + "repository": "https://github.com/Paella-Labs/typescript-sdk", "main": "./index.js", "types": "./index.d.ts", "scripts": { diff --git a/reference.md b/reference.md index 6c8d62b..9df058f 100644 --- a/reference.md +++ b/reference.md @@ -1,8 +1,75 @@ # Reference -## Checkout +
client.nft({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Transfer NFTs from one wallet to another wallet. Intended for wallets created with `userId` option. + +**API scope required**: `wallets:nfts.transfer` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nft(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.NftRequest` + +
+
+ +
+
+ +**requestOptions:** `CrossmintClient.RequestOptions` + +
+
+
+
+ +
+
+
+ +## -
client.checkout.createOrder({ ...params }) -> Crossmint.CreateOrderResponse +## Headless + +
client.headless.createOrder({ ...params }) -> Crossmint.CreateOrderResponse
@@ -30,7 +97,7 @@ Creates a new order that can be used to complete a headless checkout.
```typescript -await client.checkout.createOrder({ +await client.headless.createOrder({ payment: { method: Crossmint.EvmPaymentMethods.ArbitrumSepolia, currency: Crossmint.EvmPaymentCurrency.Eth, @@ -54,7 +121,7 @@ await client.checkout.createOrder({
-**request:** `Crossmint.CheckoutCreateOrderRequest` +**request:** `Crossmint.CreateOrderRequest`
@@ -62,7 +129,7 @@ await client.checkout.createOrder({
-**requestOptions:** `Checkout.RequestOptions` +**requestOptions:** `Headless.RequestOptions`
@@ -73,7 +140,7 @@ await client.checkout.createOrder({
-
client.checkout.getOrder(orderId) -> Crossmint.OrderObject +
client.headless.getOrder(orderId) -> Crossmint.OrderObject
@@ -101,7 +168,7 @@ Get specific order by ID
```typescript -await client.checkout.getOrder("orderId"); +await client.headless.getOrder("orderId"); ```
@@ -129,7 +196,7 @@ This is the identifier for the order with UUID format.
-**requestOptions:** `Checkout.RequestOptions` +**requestOptions:** `Headless.RequestOptions`
@@ -140,7 +207,7 @@ This is the identifier for the order with UUID format.
-
client.checkout.editOrder(orderId, { ...params }) -> Crossmint.OrderObject +
client.headless.editOrder(orderId, { ...params }) -> Crossmint.OrderObject
@@ -168,7 +235,7 @@ Edit an existing order. You can update the recipient, the payment method, and/or
```typescript -await client.checkout.editOrder("orderId"); +await client.headless.editOrder("orderId"); ```
@@ -204,7 +271,3671 @@ This is the identifier for the order with UUID format.
-**requestOptions:** `Checkout.RequestOptions` +**requestOptions:** `Headless.RequestOptions` + +
+
+ +
+ + + +
+ +## NfTs + +
client.nfTs.batchMintNft(collectionId, { ...params }) -> Crossmint.BatchMintResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mint multiple NFTs with a single call and deliver them to a web3 wallet or an email address + +**API scope required** `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.batchMintNft("default-solana", { + nfts: [{}], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.BatchMintNftRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.mintStatusList(collectionId, { ...params }) -> Crossmint.NftObjectEvm[] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of all the NFTs in a given collection. + +**API scope required**: `nfts.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.mintStatusList("default-solana", { + page: 1.1, + perPage: 20, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.MintStatusListRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.mintNft(collectionId, { ...params }) -> Crossmint.MintNftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mint your NFTs and deliver them to a web3 wallet or an email address + +**API scope required**: `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.mintNft("default-solana", { + metadata: { + name: "Crossmint Example NFT", + image: "https://www.crossmint.com/assets/crossmint/logo.png", + description: "My NFT created via the mint API!", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.MintNftRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.mintSft(collectionId, { ...params }) -> Crossmint.MintSftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mint your SFTs and deliver them to a web3 wallet or an email address + +**API scope required**: `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.mintSft("default-solana", { + templateId: "silver-pass", + recipient: "email:testy@crossmint.io:polygon", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.MintSftRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.mintStatus(collectionId, id) -> Crossmint.MintStatusSolana200 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the status and associated information for a mint operation. + +**API scope required**: `nfts.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.mintStatus("default-solana", "id"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**id:** `string` — Unique ID of the minted NFT returned in the mint response + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.mintNftIdempotent(collectionId, id, { ...params }) -> Crossmint.MintNftIdempotentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This pathway allows you to mint NFTs and guarantee idempotency +to ensure you never double mint for the same NFT. + +**API scope required**: `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.mintNftIdempotent("default-solana", "my-idempotency-key", { + recipient: "email:testy@crossmint.io:polygon", + metadata: { + name: "Crossmint Example NFT", + image: "https://www.crossmint.com/assets/crossmint/logo.png", + description: "My NFT created via the mint API!", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**id:** `string` — Custom ID of the NFT, which is used as an idempotency key + +
+
+ +
+
+ +**request:** `Crossmint.MintNftIdempotentRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.burnNft(collectionId, id) -> Crossmint.BurnNftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Burn a minted NFT. + +**API scope required**: `nfts.delete` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.burnNft("default-solana", "id"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**id:** `string` — Unique ID of the minted NFT returned in the mint response + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.editNft(collectionId, id, { ...params }) -> Crossmint.EditNftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit a minted NFT's metadata on IPFS. + +If you are using a custom baseURI, invoking this will overwrite the specific tokenURI for the edited token. + +**API scope required**: `nfts.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.editNft("default-solana", "id", { + metadata: { + name: "Crossmint Example NFT", + image: "https://www.crossmint.com/assets/crossmint/logo.png", + description: "My NFT created via the mint API!", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**id:** `string` — Unique ID of the minted NFT returned in the mint response + +
+
+ +
+
+ +**request:** `Crossmint.EditNftRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.burnNftByLocator(locator) -> Crossmint.BurnNftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Burn a minted NFT using a Crossmint NFT locator. + +**API scope required**: `nfts.delete` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.burnNftByLocator("polygon:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045:52"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**locator:** `string` — The locator of the NFT, which includes the blockchain, contract address, and token ID. + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nfTs.editNftByLocator(locator, { ...params }) -> Crossmint.EditNftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit a minted NFT's metadata using a Crossmint NFT locator. + +**API scope required**: `nfts.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nfTs.editNftByLocator("polygon:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045:52", { + metadata: { + name: "Crossmint Example NFT", + image: "https://www.crossmint.com/assets/crossmint/logo.png", + description: "My NFT created via the mint API!", + }, + reuploadLinkedFiles: true, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**locator:** `string` — The locator of the NFT, which includes the blockchain, contract address, and token ID. + +
+
+ +
+
+ +**request:** `Crossmint.EditNftByLocatorRequest` + +
+
+ +
+
+ +**requestOptions:** `NfTs.RequestOptions` + +
+
+
+
+ +
+
+
+ +## NftCollections + +
client.nftCollections.listCollections() -> Crossmint.ListCollectionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all collections created under the current Crossmint project + +**API scope required**: `collections.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.listCollections(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.createCollection({ ...params }) -> Crossmint.CreateCollectionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a collection that you can mint NFTs/SFTs from + +**API scope required**: `collections.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.createCollection({ + chain: Crossmint.CreateCollectionBodyChain.Aptos, + metadata: { + name: "Sample NFT Collection", + description: "This is a sample NFT collection", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.CreateCollectionBody` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.collectionInfo(collectionId) -> Crossmint.GetCollectionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get information about a specific collection. + +**API scope required**: `collections.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.collectionInfo("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.createCollectionCustom(collectionId, { ...params }) -> Crossmint.CreateCollectionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a collection that you can mint NFTs/SFTs from. This API is idempotent, +if you call it multiple times with the same ID, only one will be created. + +**API scope required**: `collections.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.createCollectionCustom("default-solana", { + chain: Crossmint.CreateCollectionBodyChain.Aptos, + metadata: { + name: "Sample NFT Collection", + description: "This is a sample NFT collection", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.CreateCollectionBody` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.updateCollection(collectionId, { ...params }) -> Crossmint.UpdateCollectionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the sales details of a collection + +**API scope required**: `collections.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.updateCollection("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.UpdateCollectionRequest` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.getRoyaltyInformation(collectionId) -> Crossmint.GetRoyaltyInformationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch the royalty configuration for a collection, from its current state +in the blockchain. + +This API is only supported on EVM chains. + +If you call GET too soon after PUT/DELETE, +you may not yet see your latest changes, as they can take a few seconds to +record on the blockchain. + +**API scope required**: `collections.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.getRoyaltyInformation("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.editRoyaltyInformation(collectionId, { ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Configure royalties for all NFTs in a collection. + +This API is only supported for EVM chains and implements the EIP-2981 standard. + +**API scope required**: `collections.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.editRoyaltyInformation("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.EditRoyaltyInformationRequest` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.disableRoyaltyInformation(collectionId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove all royalties from a given collection. No new NFT sales will yield royalties to the creator. + +This API is only supported on EVM Chains. + +**API scope required**: `collections.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.disableRoyaltyInformation("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.getBaseUri(collectionId) -> Crossmint.GetBaseUriResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the Base URI of a collection as it appears on-chain. + +**API scope required**: `collections.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.getBaseUri("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.setBaseUri(collectionId, { ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the Base URI of a collection. Setting the baseURI enables +excluding the metadata param when minting. Tokens minted without the metadata +param will have a tokenURI of: + +`{BASE_URI}/{TOKEN_ID}` + +This API is currently only supported on EVM Chains. + +**API scope required**: `collections.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.setBaseUri("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.SetBaseUriRequest` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.getTransferability(collectionId) -> Crossmint.GetTransferabilityResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the transferable status of a collection. + +This API is only supported on EVM chains. + +You must contact sales to gain access to this API. + +**API scope required**: `collections.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.getTransferability("default-solana"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftCollections.setTransferability(collectionId, { ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the transferable status of a collection. + +This API is only supported on EVM chains. +You must contact sales to gain access to this API. + +**API scope required**: `collections.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftCollections.setTransferability("default-solana", { + value: true, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.SetTransferabilityRequest` + +
+
+ +
+
+ +**requestOptions:** `NftCollections.RequestOptions` + +
+
+
+
+ +
+
+
+ +## NftTemplates + +
client.nftTemplates.getAllTemplates(collectionId, { ...params }) -> Crossmint.TemplateResponse[] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all of the templates for a collection + +**API scope required**: `nfts.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftTemplates.getAllTemplates("default-solana", { + page: 1.1, + perPage: 20, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**request:** `Crossmint.GetAllTemplatesRequest` + +
+
+ +
+
+ +**requestOptions:** `NftTemplates.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftTemplates.createTemplate(collectionId, { ...params }) -> Crossmint.TemplateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a token template, that NFTs or SFTs may be minted from + +**API scope required**: `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftTemplates.createTemplate("idempotent-collection-name", {}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — The ID of the named collection, used to create new tokens + +
+
+ +
+
+ +**request:** `Crossmint.CreateTemplateBody` + +
+
+ +
+
+ +**requestOptions:** `NftTemplates.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftTemplates.getTemplate(collectionId, templateId) -> Crossmint.TemplateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch the contents of a token template. + +**API scope required**: `nfts.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftTemplates.getTemplate("default-solana", "templateId"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**templateId:** `string` — The template ID + +
+
+ +
+
+ +**requestOptions:** `NftTemplates.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftTemplates.createTemplateIdempotent(collectionId, templateId, { ...params }) -> Crossmint.TemplateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a token template with preconfigured metadata + +**API scope required**: `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftTemplates.createTemplateIdempotent("default-solana", "templateId", {}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**templateId:** `string` — The template ID + +
+
+ +
+
+ +**request:** `Crossmint.CreateTemplateBody` + +
+
+ +
+
+ +**requestOptions:** `NftTemplates.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftTemplates.deleteTemplate(collectionId, templateId) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a Token template. + +**API scope required**: `nfts.delete` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftTemplates.deleteTemplate("default-solana", "templateId"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**templateId:** `string` — The template ID + +
+
+ +
+
+ +**requestOptions:** `NftTemplates.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.nftTemplates.editTemplate(collectionId, templateId, { ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit a Token template. + +**API scope required**: `nfts.update` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.nftTemplates.editTemplate("default-solana", "templateId", {}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` + +This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + +The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. +**Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + +The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. +**Example:** `your-custom-identifer` + +
+
+ +
+
+ +**templateId:** `string` — The template ID + +
+
+ +
+
+ +**request:** `Crossmint.EditTemplateRequest` + +
+
+ +
+
+ +**requestOptions:** `NftTemplates.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Actions + +
client.actions.getActionStatus(actionId) -> Crossmint.GetActionStatusResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Use this API to poll for the status of asynchonous actions such as NFT mints, transfers, etc. + +**API scope required**: `nfts.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.actions.getActionStatus("actionId"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**actionId:** `string` — The actionId. + +
+
+ +
+
+ +**requestOptions:** `Actions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Registration + +
client.registration.registerNftCollection({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Register your NFT collection with Crossmint + +**This API is subject to change as it is currently in its alpha form.** + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.registration.registerNftCollection({ + chain: Crossmint.RegisterNftCollectionRequestChain.Solana, + contractType: Crossmint.RegisterNftCollectionRequestContractType.CandyMachine, + args: { + candyMachineId: "candyMachineId", + }, + metadata: { + title: "title", + description: "description", + imageUrl: "imageUrl", + }, + ownership: Crossmint.RegisterNftCollectionRequestOwnership.External, + category: Crossmint.RegisterNftCollectionRequestCategory.Loyalty, + scopes: [Crossmint.RegisterNftCollectionRequestScopesItem.PaymentsCreditCard], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.RegisterNftCollectionRequest` + +
+
+ +
+
+ +**requestOptions:** `Registration.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.registration.updateNftCollection({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update your collection information registered on Crossmint + +**This API is subject to change as it is currently in its alpha form.** + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.registration.updateNftCollection({ + clientId: "clientId", + metadata: { + title: "title", + imageUrl: "imageUrl", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.UpdateNftCollectionRequest` + +
+
+ +
+
+ +**requestOptions:** `Registration.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Checkout + +
client.checkout.mint({ ...params }) -> Crossmint.CheckoutMintSuccess +
+
+ +#### 📝 Description + +
+
+ +
+
+ +**API scope required**: `nfts.checkout` Begin the checkout process for a mint +**This API is subject to change as it is currently in its alpha form.** + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.mint({ + clientId: "clientId", + userId: "userId", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.CheckoutMintRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkout.RequestOptions` + +
+
+
+
+ +
+
+
+ +## QuotePrice + +
client.quotePrice.quote({ ...params }) -> Crossmint.QuoteResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the price of a transaction hosted through Crossmint, inclusive of all fees. + +**This API is subject to change as it is currently in its alpha form.** + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.quotePrice.quote({ + nativePrice: "nativePrice", + quoteCurrency: Crossmint.QuoteRequestQuoteCurrency.Usd, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.QuoteRequest` + +
+
+ +
+
+ +**requestOptions:** `QuotePrice.RequestOptions` + +
+
+
+
+ +
+
+
+ +## VerifiableCredentials + +
client.verifiableCredentials.verifyCredential({ ...params }) -> Crossmint.VerifyCredentialResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Verify that a credential is valid. + +**API scope required** `credentials.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.verifyCredential({ + credential: { + key: "value", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.VerifyCredentialRequest` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.vcCreateTemplate({ ...params }) -> string +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a template (similar to an nft collection) for issuing verifiable credentials. + +**API scope required** `credentials:template.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.vcCreateTemplate({ + metadata: { + name: "Verifiable Credential", + description: "The owner of this credential is authorized.", + }, + credentials: { + type: "degreeForMastersStudent", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.VcCreateTemplateRequest` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.getVc(collectionId, id) -> Record +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a verifiable credential by the ID associated with the minted NFT. + +This ID will have the format: ``. For example: `d7eb777b-e9b4-4f34-ab5f-ce199111166a` + +**API scope required** `credentials.read`. This endpoint will not work with a client side API key. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.getVc("collectionId", "id"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collectionId:** `string` — Collection id (template id) + +
+
+ +
+
+ +**id:** `string` — UUID of the NFT returned in the NFT creation response. Format is: `` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.getVcById(id) -> Record +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a verifiable credential by the ID associated with it. + +This ID will have the format: `urn:uuid:`. For example: `urn:uuid:64f9877d-a19a-4205-8d61-f8c2abed5766` + +**API scope required** `credentials.read`. This enpoint will work also with a client side API key. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.getVcById("id"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique ID of the credential as returned in the NFT creation response. Format is: `urn:uuid:` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.revokeCredential(id) -> Crossmint.BurnNftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Revoke a verifiable credential by the credential ID. +This involves burning the associated nft. + +This ID will have the format: `urn:uuid:`. For example: `urn:uuid:64f9877d-a19a-4205-8d61-f8c2abed5766` + +**API scope required** `credentials.create`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.revokeCredential("id"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique ID of the credential as returned in the NFT creation response. Format is: `urn:uuid:` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.getVcByLocator(nftLocator) -> Record +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a verifiable credential by the NFT locator. + +This locator will have the format: `::`. +For example: `polygon:0x1234abcde...:1` + +**API scope required** `credentials.read`. This enpoint will work also with a client side API key. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.getVcByLocator("nftLocator"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**nftLocator:** `string` — NFT on chain locator, in the format of `::` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.issueVc(templateId, { ...params }) -> Crossmint.IssueVcResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Issue a verifiable credential. Deliver to a web3 wallet or email address. + +**API scope required** `credentials.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.issueVc("default", { + recipient: "polygon:0x1234abcde... or email::polygon", + credential: { + subject: { + subjectName: "foo", + subjectAge: 20, + claim: "bar", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**templateId:** `string` — Template id of a credential enabled collection + +
+
+ +
+
+ +**request:** `Crossmint.IssueVcRequest` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.createType({ ...params }) -> Crossmint.CreateTypeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a type with a random UUID. This is how you define a custom schema. + +**API scope required** `credentials.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.createType({ + credentialSubjectSchema: [ + { + name: "username", + type: "string", + }, + { + name: "courses_completed", + type: "uint64", + }, + { + name: "courses", + type: "Course[]", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.CreateTypeRequest` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.getType(typeName) -> Crossmint.GetTypeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the schema of a given type by name + +**API scope required** `credentials.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.getType("typeName"); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**typeName:** `string` — The name of the type + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.verifiableCredentials.createTypeIdempotent(typeName, { ...params }) -> Crossmint.CreateTypeIdempotentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a type with a given name. This is how you define a custom schema. + +**API scope required** `credentials.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.verifiableCredentials.createTypeIdempotent("typeName", { + credentialSubjectSchema: [ + { + name: "username", + type: "string", + }, + { + name: "courses_completed", + type: "uint64", + }, + { + name: "courses", + type: "Course[]", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**typeName:** `string` — The name of the type + +
+
+ +
+
+ +**request:** `Crossmint.CreateTypeIdempotentRequest` + +
+
+ +
+
+ +**requestOptions:** `VerifiableCredentials.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Wallet + +
client.wallet.fetchWallet({ ...params }) -> Crossmint.Wallet[] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch the addresses of a user's Crossmint custodial wallets + +**API scope required**: `wallets.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.wallet.fetchWallet(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.FetchWalletRequest` + +
+
+ +
+
+ +**requestOptions:** `Wallet.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.wallet.createWallet({ ...params }) -> Crossmint.CreateWalletResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new Crossmint custodial wallet for a user + +**API scope required**: `wallets.create` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.wallet.createWallet({ + email: "email", + chain: Crossmint.AllChains.Arbitrum, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Crossmint.CreateWalletRequest` + +
+
+ +
+
+ +**requestOptions:** `Wallet.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.wallet.fetchContentFromWallet(identifier, { ...params }) -> Crossmint.FetchContentFromWalletResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch the NFTs in a provided wallet + +**API scope required**: `wallets:nfts.read` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.wallet.fetchContentFromWallet("identifier", { + page: "page", + perPage: "perPage", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**identifier:** `string` — The wallet identifier in the format of `:
`, `email::` or `userId::`. + +
+
+ +
+
+ +**request:** `Crossmint.FetchContentFromWalletRequest` + +
+
+ +
+
+ +**requestOptions:** `Wallet.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Sign + +
client.sign.message(chain, address, { ...params }) -> Crossmint.SignMessageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sign a message using a custodial wallet's key + +**API scope required**: `wallets:messages.sign` + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sign.message(Crossmint.EvmChains.Arbitrum, "address", { + message: "message", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**chain:** `Crossmint.EvmChains` — The blockchain network you are using. + +
+
+ +
+
+ +**address:** `string` — The wallet address you want to sign the message with + +
+
+ +
+
+ +**request:** `Crossmint.SignMessageRequest` + +
+
+ +
+
+ +**requestOptions:** `Sign.RequestOptions`
diff --git a/src/Client.ts b/src/Client.ts index b39645f..04160e1 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -4,12 +4,30 @@ import * as environments from "./environments"; import * as core from "./core"; +import * as Crossmint from "./api/index"; +import urlJoin from "url-join"; +import * as serializers from "./serialization/index"; +import * as errors from "./errors/index"; +import { Headless } from "./api/resources/headless/client/Client"; +import { NfTs } from "./api/resources/nfTs/client/Client"; +import { NftCollections } from "./api/resources/nftCollections/client/Client"; +import { NftTemplates } from "./api/resources/nftTemplates/client/Client"; +import { Actions } from "./api/resources/actions/client/Client"; +import { Registration } from "./api/resources/registration/client/Client"; import { Checkout } from "./api/resources/checkout/client/Client"; +import { QuotePrice } from "./api/resources/quotePrice/client/Client"; +import { VerifiableCredentials } from "./api/resources/verifiableCredentials/client/Client"; +import { Wallet } from "./api/resources/wallet/client/Client"; +import { Sign } from "./api/resources/sign/client/Client"; export declare namespace CrossmintClient { interface Options { environment?: core.Supplier; apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; fetcher?: core.FetchFunction; } @@ -20,15 +38,334 @@ export declare namespace CrossmintClient { maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; } } export class CrossmintClient { constructor(protected readonly _options: CrossmintClient.Options) {} + /** + * Get usage data for a project. + * + * **API scope required** `projects:usage.read` + * + * @param {string} projectId - You can find your project ID in the Crossmint console. + * @param {Crossmint.GetUsageRequest} request + * @param {CrossmintClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.getUsage("94d09d19-25b4-45f7-8103-b48b7a2ae3cc", { + * startDate: "startDate" + * }) + */ + public async getUsage( + projectId: string, + request: Crossmint.GetUsageRequest, + requestOptions?: CrossmintClient.RequestOptions + ): Promise { + const { dimension, startDate, endDate } = request; + const _queryParams: Record = {}; + _queryParams["dimension"] = dimension; + _queryParams["startDate"] = startDate; + if (endDate != null) { + _queryParams["endDate"] = endDate; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/projects/${encodeURIComponent(projectId)}/usage` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UsageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Transfer NFTs from one wallet to another wallet. Intended for wallets created using `email` option. + * + * **API scope required**: `wallets:nfts.transfer` + * + * @param {Crossmint.WalletsRequest} request + * @param {CrossmintClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.UnauthorizedError} + * @throws {@link Crossmint.NotFoundError} + * + * @example + * await client.wallets({}) + */ + public async wallets( + request: Crossmint.WalletsRequest, + requestOptions?: CrossmintClient.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/wallets/transfer" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.WalletsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.VerificationRequestSent.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 401: + throw new Crossmint.UnauthorizedError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Transfer NFTs from one wallet to another wallet. Intended for wallets created with `userId` option. + * + * **API scope required**: `wallets:nfts.transfer` + * + * @param {Crossmint.NftRequest} request + * @param {CrossmintClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.UnauthorizedError} + * + * @example + * await client.nft() + */ + public async nft( + request: Crossmint.NftRequest = {}, + requestOptions?: CrossmintClient.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/transfer" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.NftRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 401: + throw new Crossmint.UnauthorizedError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected _headless: Headless | undefined; + + public get headless(): Headless { + return (this._headless ??= new Headless(this._options)); + } + + protected _nfTs: NfTs | undefined; + + public get nfTs(): NfTs { + return (this._nfTs ??= new NfTs(this._options)); + } + + protected _nftCollections: NftCollections | undefined; + + public get nftCollections(): NftCollections { + return (this._nftCollections ??= new NftCollections(this._options)); + } + + protected _nftTemplates: NftTemplates | undefined; + + public get nftTemplates(): NftTemplates { + return (this._nftTemplates ??= new NftTemplates(this._options)); + } + + protected _actions: Actions | undefined; + + public get actions(): Actions { + return (this._actions ??= new Actions(this._options)); + } + + protected _registration: Registration | undefined; + + public get registration(): Registration { + return (this._registration ??= new Registration(this._options)); + } + protected _checkout: Checkout | undefined; public get checkout(): Checkout { return (this._checkout ??= new Checkout(this._options)); } + + protected _quotePrice: QuotePrice | undefined; + + public get quotePrice(): QuotePrice { + return (this._quotePrice ??= new QuotePrice(this._options)); + } + + protected _verifiableCredentials: VerifiableCredentials | undefined; + + public get verifiableCredentials(): VerifiableCredentials { + return (this._verifiableCredentials ??= new VerifiableCredentials(this._options)); + } + + protected _wallet: Wallet | undefined; + + public get wallet(): Wallet { + return (this._wallet ??= new Wallet(this._options)); + } + + protected _sign: Sign | undefined; + + public get sign(): Sign { + return (this._sign ??= new Sign(this._options)); + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } } diff --git a/src/api/client/index.ts b/src/api/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/client/requests/GetUsageRequest.ts b/src/api/client/requests/GetUsageRequest.ts new file mode 100644 index 0000000..7522722 --- /dev/null +++ b/src/api/client/requests/GetUsageRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * startDate: "startDate" + * } + */ +export interface GetUsageRequest { + /** + * The `dimension` you want to query, for example `monthly_active_wallets`. + */ + dimension: "monthly_active_wallets"; + /** + * The `startDate` you want to query in YYYY-MM format, for example `2023-11` for November 2023. + */ + startDate: string; + /** + * The `endDate` you want to query in YYYY-MM format, for example `2023-12` for December 2023. + */ + endDate?: string; +} diff --git a/src/api/client/requests/NftRequest.ts b/src/api/client/requests/NftRequest.ts new file mode 100644 index 0000000..219a87a --- /dev/null +++ b/src/api/client/requests/NftRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../index"; + +/** + * @example + * {} + */ +export interface NftRequest { + chain?: Crossmint.AllChains; + /** The numeric token ID of the NFT to be transferred, only used for EVM tokens */ + tokenId?: string; + /** The wallet address for the current owner */ + fromAddress?: string; + /** The wallet address to send the NFT to */ + toAddress?: string; + /** + * **Solana**: mintHash + * + * **EVM**: token contract address + * + */ + tokenMintAddress?: string; +} diff --git a/src/api/client/requests/index.ts b/src/api/client/requests/index.ts new file mode 100644 index 0000000..ff417bd --- /dev/null +++ b/src/api/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type GetUsageRequest } from "./GetUsageRequest"; +export { type NftRequest } from "./NftRequest"; diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 0695521..fb022ae 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -3,10 +3,9 @@ */ import * as errors from "../../errors/index"; -import * as Crossmint from "../index"; export class BadRequestError extends errors.CrossmintError { - constructor(body: Crossmint.BadRequestResponse) { + constructor(body?: unknown) { super({ message: "BadRequestError", statusCode: 400, diff --git a/src/api/errors/ConflictError.ts b/src/api/errors/ConflictError.ts new file mode 100644 index 0000000..88a3005 --- /dev/null +++ b/src/api/errors/ConflictError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors/index"; + +export class ConflictError extends errors.CrossmintError { + constructor(body?: unknown) { + super({ + message: "ConflictError", + statusCode: 409, + body: body, + }); + Object.setPrototypeOf(this, ConflictError.prototype); + } +} diff --git a/src/api/errors/FailedDependencyError.ts b/src/api/errors/FailedDependencyError.ts new file mode 100644 index 0000000..3219a53 --- /dev/null +++ b/src/api/errors/FailedDependencyError.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors/index"; +import * as Crossmint from "../index"; + +export class FailedDependencyError extends errors.CrossmintError { + constructor(body: Crossmint.FourHundredTwentyFourResponse) { + super({ + message: "FailedDependencyError", + statusCode: 424, + body: body, + }); + Object.setPrototypeOf(this, FailedDependencyError.prototype); + } +} diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts index 21819ae..eb30754 100644 --- a/src/api/errors/ForbiddenError.ts +++ b/src/api/errors/ForbiddenError.ts @@ -3,10 +3,9 @@ */ import * as errors from "../../errors/index"; -import * as Crossmint from "../index"; export class ForbiddenError extends errors.CrossmintError { - constructor(body: Crossmint.UnauthorizedResponse) { + constructor(body?: unknown) { super({ message: "ForbiddenError", statusCode: 403, diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts index 7b7849a..3b5a8ee 100644 --- a/src/api/errors/NotFoundError.ts +++ b/src/api/errors/NotFoundError.ts @@ -3,10 +3,9 @@ */ import * as errors from "../../errors/index"; -import * as Crossmint from "../index"; export class NotFoundError extends errors.CrossmintError { - constructor(body: Crossmint.NotFoundResponse) { + constructor(body?: unknown) { super({ message: "NotFoundError", statusCode: 404, diff --git a/src/api/errors/NotImplementedError.ts b/src/api/errors/NotImplementedError.ts new file mode 100644 index 0000000..73eb13f --- /dev/null +++ b/src/api/errors/NotImplementedError.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors/index"; +import * as Crossmint from "../index"; + +export class NotImplementedError extends errors.CrossmintError { + constructor(body: Crossmint.NotImplementedErrorBody) { + super({ + message: "NotImplementedError", + statusCode: 501, + body: body, + }); + Object.setPrototypeOf(this, NotImplementedError.prototype); + } +} diff --git a/src/api/errors/ServiceUnavailableError.ts b/src/api/errors/ServiceUnavailableError.ts index 3d054b4..835bf70 100644 --- a/src/api/errors/ServiceUnavailableError.ts +++ b/src/api/errors/ServiceUnavailableError.ts @@ -3,10 +3,9 @@ */ import * as errors from "../../errors/index"; -import * as Crossmint from "../index"; export class ServiceUnavailableError extends errors.CrossmintError { - constructor(body: Crossmint.ServiceUnavailabileResponse) { + constructor(body?: unknown) { super({ message: "ServiceUnavailableError", statusCode: 503, diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts new file mode 100644 index 0000000..4266612 --- /dev/null +++ b/src/api/errors/UnauthorizedError.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors/index"; + +export class UnauthorizedError extends errors.CrossmintError { + constructor(body?: unknown) { + super({ + message: "UnauthorizedError", + statusCode: 401, + body: body, + }); + Object.setPrototypeOf(this, UnauthorizedError.prototype); + } +} diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts index 3f58829..85106fe 100644 --- a/src/api/errors/index.ts +++ b/src/api/errors/index.ts @@ -1,4 +1,8 @@ export * from "./BadRequestError"; export * from "./ForbiddenError"; -export * from "./NotFoundError"; export * from "./ServiceUnavailableError"; +export * from "./NotFoundError"; +export * from "./NotImplementedError"; +export * from "./ConflictError"; +export * from "./FailedDependencyError"; +export * from "./UnauthorizedError"; diff --git a/src/api/index.ts b/src/api/index.ts index 1cb55b6..d5c609c 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,3 +1,4 @@ +export * from "./resources"; export * from "./types"; export * from "./errors"; -export * from "./resources"; +export * from "./client"; diff --git a/src/api/resources/actions/client/Client.ts b/src/api/resources/actions/client/Client.ts new file mode 100644 index 0000000..0978e04 --- /dev/null +++ b/src/api/resources/actions/client/Client.ts @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Actions { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class Actions { + constructor(protected readonly _options: Actions.Options) {} + + /** + * Use this API to poll for the status of asynchonous actions such as NFT mints, transfers, etc. + * + * **API scope required**: `nfts.create` + * + * @param {string} actionId - The actionId. + * @param {Actions.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * + * @example + * await client.actions.getActionStatus("actionId") + */ + public async getActionStatus( + actionId: string, + requestOptions?: Actions.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/actions/${encodeURIComponent(actionId)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetActionStatusResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/actions/client/index.ts b/src/api/resources/actions/client/index.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/api/resources/actions/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/actions/index.ts b/src/api/resources/actions/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/actions/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/actions/types/GetActionStatusResponse.ts b/src/api/resources/actions/types/GetActionStatusResponse.ts new file mode 100644 index 0000000..eb2e72b --- /dev/null +++ b/src/api/resources/actions/types/GetActionStatusResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface GetActionStatusResponse { + actionId?: string; + action?: string; + status?: string; + data?: Crossmint.GetActionStatusResponseData; + startedAt?: Date; + resource?: string; +} diff --git a/src/api/resources/actions/types/GetActionStatusResponseData.ts b/src/api/resources/actions/types/GetActionStatusResponseData.ts new file mode 100644 index 0000000..37f0483 --- /dev/null +++ b/src/api/resources/actions/types/GetActionStatusResponseData.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface GetActionStatusResponseData { + collection?: Crossmint.GetActionStatusResponseDataCollection; + recipient?: Crossmint.GetActionStatusResponseDataRecipient; + token?: Crossmint.GetActionStatusResponseDataToken; +} diff --git a/src/api/resources/actions/types/GetActionStatusResponseDataCollection.ts b/src/api/resources/actions/types/GetActionStatusResponseDataCollection.ts new file mode 100644 index 0000000..0a3e44f --- /dev/null +++ b/src/api/resources/actions/types/GetActionStatusResponseDataCollection.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetActionStatusResponseDataCollection { + id?: string; + contractAddress?: string; +} diff --git a/src/api/resources/actions/types/GetActionStatusResponseDataRecipient.ts b/src/api/resources/actions/types/GetActionStatusResponseDataRecipient.ts new file mode 100644 index 0000000..cb24d05 --- /dev/null +++ b/src/api/resources/actions/types/GetActionStatusResponseDataRecipient.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetActionStatusResponseDataRecipient { + walletAddress?: string; +} diff --git a/src/api/resources/actions/types/GetActionStatusResponseDataToken.ts b/src/api/resources/actions/types/GetActionStatusResponseDataToken.ts new file mode 100644 index 0000000..4aaaff9 --- /dev/null +++ b/src/api/resources/actions/types/GetActionStatusResponseDataToken.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetActionStatusResponseDataToken { + id?: string; +} diff --git a/src/api/resources/actions/types/index.ts b/src/api/resources/actions/types/index.ts new file mode 100644 index 0000000..4ebf5bc --- /dev/null +++ b/src/api/resources/actions/types/index.ts @@ -0,0 +1,5 @@ +export * from "./GetActionStatusResponseDataCollection"; +export * from "./GetActionStatusResponseDataRecipient"; +export * from "./GetActionStatusResponseDataToken"; +export * from "./GetActionStatusResponseData"; +export * from "./GetActionStatusResponse"; diff --git a/src/api/resources/checkout/client/Client.ts b/src/api/resources/checkout/client/Client.ts index 4547931..84e4ead 100644 --- a/src/api/resources/checkout/client/Client.ts +++ b/src/api/resources/checkout/client/Client.ts @@ -13,6 +13,10 @@ export declare namespace Checkout { interface Options { environment?: core.Supplier; apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; fetcher?: core.FetchFunction; } @@ -23,6 +27,10 @@ export declare namespace Checkout { maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; } } @@ -30,54 +38,49 @@ export class Checkout { constructor(protected readonly _options: Checkout.Options) {} /** - * Creates a new order that can be used to complete a headless checkout. + * **API scope required**: `nfts.checkout` Begin the checkout process for a mint + * **This API is subject to change as it is currently in its alpha form.** * - * @param {Crossmint.CheckoutCreateOrderRequest} request + * @param {Crossmint.CheckoutMintRequest} request * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Crossmint.BadRequestError} - * @throws {@link Crossmint.ForbiddenError} - * @throws {@link Crossmint.NotFoundError} - * @throws {@link Crossmint.ServiceUnavailableError} + * @throws {@link Crossmint.UnauthorizedError} * * @example - * await client.checkout.createOrder({ - * payment: { - * method: Crossmint.EvmPaymentMethods.ArbitrumSepolia, - * currency: Crossmint.EvmPaymentCurrency.Eth - * }, - * lineItems: { - * collectionLocator: "crossmint:" - * } + * await client.checkout.mint({ + * clientId: "clientId", + * userId: "userId" * }) */ - public async createOrder( - request: Crossmint.CheckoutCreateOrderRequest, + public async mint( + request: Crossmint.CheckoutMintRequest, requestOptions?: Checkout.RequestOptions - ): Promise { + ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Staging, - "2022-06-09/orders" + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/checkout/mint" ), method: "POST", headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "crossmint", - "X-Fern-SDK-Version": "0.1.8", + "X-Fern-SDK-Version": "0.0.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await this._getCustomAuthorizationHeaders()), }, contentType: "application/json", requestType: "json", - body: serializers.CheckoutCreateOrderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + body: serializers.CheckoutMintRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return serializers.CreateOrderResponse.parseOrThrow(_response.body, { + return serializers.CheckoutMintSuccess.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -89,275 +92,9 @@ export class Checkout { if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: - throw new Crossmint.BadRequestError( - serializers.BadRequestResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 403: - throw new Crossmint.ForbiddenError( - serializers.UnauthorizedResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 404: - throw new Crossmint.NotFoundError( - serializers.NotFoundResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 503: - throw new Crossmint.ServiceUnavailableError( - serializers.ServiceUnavailabileResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - default: - throw new errors.CrossmintError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.CrossmintError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - }); - case "timeout": - throw new errors.CrossmintTimeoutError(); - case "unknown": - throw new errors.CrossmintError({ - message: _response.error.errorMessage, - }); - } - } - - /** - * Get specific order by ID - * - * @param {string} orderId - This is the identifier for the order with UUID format. - * - * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` - * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. - * - * @throws {@link Crossmint.BadRequestError} - * @throws {@link Crossmint.ForbiddenError} - * @throws {@link Crossmint.NotFoundError} - * @throws {@link Crossmint.ServiceUnavailableError} - * - * @example - * await client.checkout.getOrder("orderId") - */ - public async getOrder(orderId: string, requestOptions?: Checkout.RequestOptions): Promise { - const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Staging, - `2022-06-09/orders/${encodeURIComponent(orderId)}` - ), - method: "GET", - headers: { - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "crossmint", - "X-Fern-SDK-Version": "0.1.8", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await this._getCustomAuthorizationHeaders()), - }, - contentType: "application/json", - requestType: "json", - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return serializers.OrderObject.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 400: - throw new Crossmint.BadRequestError( - serializers.BadRequestResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 403: - throw new Crossmint.ForbiddenError( - serializers.UnauthorizedResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 404: - throw new Crossmint.NotFoundError( - serializers.NotFoundResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 503: - throw new Crossmint.ServiceUnavailableError( - serializers.ServiceUnavailabileResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - default: - throw new errors.CrossmintError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - }); - } - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.CrossmintError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - }); - case "timeout": - throw new errors.CrossmintTimeoutError(); - case "unknown": - throw new errors.CrossmintError({ - message: _response.error.errorMessage, - }); - } - } - - /** - * Edit an existing order. You can update the recipient, the payment method, and/or the locale. - * - * @param {string} orderId - This is the identifier for the order with UUID format. - * - * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` - * @param {Crossmint.OrderDto} request - * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. - * - * @throws {@link Crossmint.BadRequestError} - * @throws {@link Crossmint.ForbiddenError} - * @throws {@link Crossmint.NotFoundError} - * @throws {@link Crossmint.ServiceUnavailableError} - * - * @example - * await client.checkout.editOrder("orderId") - */ - public async editOrder( - orderId: string, - request: Crossmint.OrderDto = {}, - requestOptions?: Checkout.RequestOptions - ): Promise { - const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Staging, - `2022-06-09/orders/${encodeURIComponent(orderId)}` - ), - method: "PATCH", - headers: { - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "crossmint", - "X-Fern-SDK-Version": "0.1.8", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await this._getCustomAuthorizationHeaders()), - }, - contentType: "application/json", - requestType: "json", - body: serializers.OrderDto.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return serializers.OrderObject.parseOrThrow(_response.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }); - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 400: - throw new Crossmint.BadRequestError( - serializers.BadRequestResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 403: - throw new Crossmint.ForbiddenError( - serializers.UnauthorizedResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 404: - throw new Crossmint.NotFoundError( - serializers.NotFoundResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); - case 503: - throw new Crossmint.ServiceUnavailableError( - serializers.ServiceUnavailabileResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }) - ); + throw new Crossmint.BadRequestError(_response.error.body); + case 401: + throw new Crossmint.UnauthorizedError(_response.error.body); default: throw new errors.CrossmintError({ statusCode: _response.error.statusCode, @@ -382,7 +119,8 @@ export class Checkout { } protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { "X-API-KEY": apiKeyValue }; + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; } } diff --git a/src/api/resources/checkout/client/requests/CheckoutMintRequest.ts b/src/api/resources/checkout/client/requests/CheckoutMintRequest.ts new file mode 100644 index 0000000..081f37a --- /dev/null +++ b/src/api/resources/checkout/client/requests/CheckoutMintRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * clientId: "clientId", + * userId: "userId" + * } + */ +export interface CheckoutMintRequest { + /** The clientId of a previously created collection */ + clientId: string; + /** The userId of a previously created wallet */ + userId: string; + /** Target email */ + emailTo?: string; + /** Crypto address to mint the NFT to */ + mintTo?: string; + /** Payment method */ + paymentMethod?: string; + listingId?: string; + collection?: Crossmint.CheckoutMintRequestCollection; + redirect?: Crossmint.CheckoutMintRequestRedirect; + mintConfig?: Crossmint.CheckoutMintRequestMintConfig; + /** Any arguments to included in the webhook status updates */ + whPassThroughArgs?: string; +} diff --git a/src/api/resources/checkout/client/requests/index.ts b/src/api/resources/checkout/client/requests/index.ts index 75c4af4..25cb8a4 100644 --- a/src/api/resources/checkout/client/requests/index.ts +++ b/src/api/resources/checkout/client/requests/index.ts @@ -1,2 +1 @@ -export { type CheckoutCreateOrderRequest } from "./CheckoutCreateOrderRequest"; -export { type OrderDto } from "./OrderDto"; +export { type CheckoutMintRequest } from "./CheckoutMintRequest"; diff --git a/src/api/resources/checkout/index.ts b/src/api/resources/checkout/index.ts index 5ec7692..c9240f8 100644 --- a/src/api/resources/checkout/index.ts +++ b/src/api/resources/checkout/index.ts @@ -1 +1,2 @@ +export * from "./types"; export * from "./client"; diff --git a/src/api/resources/checkout/types/CheckoutMintRequestCollection.ts b/src/api/resources/checkout/types/CheckoutMintRequestCollection.ts new file mode 100644 index 0000000..0565da1 --- /dev/null +++ b/src/api/resources/checkout/types/CheckoutMintRequestCollection.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CheckoutMintRequestCollection { + /** Collection title */ + title: string; + /** Collection description */ + description: string; + /** Photo url */ + photo: string; +} diff --git a/src/api/resources/checkout/types/CheckoutMintRequestMintConfig.ts b/src/api/resources/checkout/types/CheckoutMintRequestMintConfig.ts new file mode 100644 index 0000000..128c276 --- /dev/null +++ b/src/api/resources/checkout/types/CheckoutMintRequestMintConfig.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CheckoutMintRequestMintConfig { + totalPrice?: string; +} diff --git a/src/api/resources/checkout/types/CheckoutMintRequestRedirect.ts b/src/api/resources/checkout/types/CheckoutMintRequestRedirect.ts new file mode 100644 index 0000000..f68b570 --- /dev/null +++ b/src/api/resources/checkout/types/CheckoutMintRequestRedirect.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CheckoutMintRequestRedirect { + continue?: string; + cancel?: string; +} diff --git a/src/api/resources/checkout/types/index.ts b/src/api/resources/checkout/types/index.ts new file mode 100644 index 0000000..1038318 --- /dev/null +++ b/src/api/resources/checkout/types/index.ts @@ -0,0 +1,3 @@ +export * from "./CheckoutMintRequestCollection"; +export * from "./CheckoutMintRequestRedirect"; +export * from "./CheckoutMintRequestMintConfig"; diff --git a/src/api/resources/headless/client/Client.ts b/src/api/resources/headless/client/Client.ts new file mode 100644 index 0000000..b0fa748 --- /dev/null +++ b/src/api/resources/headless/client/Client.ts @@ -0,0 +1,304 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Headless { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class Headless { + constructor(protected readonly _options: Headless.Options) {} + + /** + * Creates a new order that can be used to complete a headless checkout. + * + * @param {Crossmint.CreateOrderRequest} request + * @param {Headless.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.headless.createOrder({ + * payment: { + * method: Crossmint.EvmPaymentMethods.ArbitrumSepolia, + * currency: Crossmint.EvmPaymentCurrency.Eth + * }, + * lineItems: { + * collectionLocator: "crossmint:" + * } + * }) + */ + public async createOrder( + request: Crossmint.CreateOrderRequest, + requestOptions?: Headless.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "2022-06-09/orders" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateOrderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get specific order by ID + * + * @param {string} orderId - This is the identifier for the order with UUID format. + * + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * @param {Headless.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.headless.getOrder("orderId") + */ + public async getOrder(orderId: string, requestOptions?: Headless.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/orders/${encodeURIComponent(orderId)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.OrderObject.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Edit an existing order. You can update the recipient, the payment method, and/or the locale. + * + * @param {string} orderId - This is the identifier for the order with UUID format. + * + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * @param {Crossmint.OrderDto} request + * @param {Headless.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.headless.editOrder("orderId") + */ + public async editOrder( + orderId: string, + request: Crossmint.OrderDto = {}, + requestOptions?: Headless.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/orders/${encodeURIComponent(orderId)}` + ), + method: "PATCH", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.OrderDto.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.OrderObject.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/headless/client/index.ts b/src/api/resources/headless/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/headless/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/checkout/client/requests/CheckoutCreateOrderRequest.ts b/src/api/resources/headless/client/requests/CreateOrderRequest.ts similarity index 92% rename from src/api/resources/checkout/client/requests/CheckoutCreateOrderRequest.ts rename to src/api/resources/headless/client/requests/CreateOrderRequest.ts index 256c2d3..1c78e76 100644 --- a/src/api/resources/checkout/client/requests/CheckoutCreateOrderRequest.ts +++ b/src/api/resources/headless/client/requests/CreateOrderRequest.ts @@ -16,7 +16,7 @@ import * as Crossmint from "../../../../index"; * } * } */ -export interface CheckoutCreateOrderRequest { +export interface CreateOrderRequest { recipient?: Crossmint.Recipient; locale?: Crossmint.Locale; payment: Crossmint.Payment; diff --git a/src/api/resources/checkout/client/requests/OrderDto.ts b/src/api/resources/headless/client/requests/OrderDto.ts similarity index 100% rename from src/api/resources/checkout/client/requests/OrderDto.ts rename to src/api/resources/headless/client/requests/OrderDto.ts diff --git a/src/api/resources/headless/client/requests/index.ts b/src/api/resources/headless/client/requests/index.ts new file mode 100644 index 0000000..0dbebaf --- /dev/null +++ b/src/api/resources/headless/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type CreateOrderRequest } from "./CreateOrderRequest"; +export { type OrderDto } from "./OrderDto"; diff --git a/src/api/resources/headless/index.ts b/src/api/resources/headless/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/headless/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 0bcc23f..c386d63 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,2 +1,31 @@ +export * as nfTs from "./nfTs"; +export * from "./nfTs/types"; +export * as nftCollections from "./nftCollections"; +export * from "./nftCollections/types"; +export * as nftTemplates from "./nftTemplates"; +export * from "./nftTemplates/types"; +export * as actions from "./actions"; +export * from "./actions/types"; +export * as registration from "./registration"; +export * from "./registration/types"; export * as checkout from "./checkout"; +export * from "./checkout/types"; +export * as quotePrice from "./quotePrice"; +export * from "./quotePrice/types"; +export * as verifiableCredentials from "./verifiableCredentials"; +export * from "./verifiableCredentials/types"; +export * as wallet from "./wallet"; +export * from "./wallet/types"; +export * as sign from "./sign"; +export * from "./sign/types"; +export * as headless from "./headless"; +export * from "./headless/client/requests"; +export * from "./nfTs/client/requests"; +export * from "./nftCollections/client/requests"; +export * from "./nftTemplates/client/requests"; +export * from "./registration/client/requests"; export * from "./checkout/client/requests"; +export * from "./quotePrice/client/requests"; +export * from "./verifiableCredentials/client/requests"; +export * from "./wallet/client/requests"; +export * from "./sign/client/requests"; diff --git a/src/api/resources/nfTs/client/Client.ts b/src/api/resources/nfTs/client/Client.ts new file mode 100644 index 0000000..b3fca30 --- /dev/null +++ b/src/api/resources/nfTs/client/Client.ts @@ -0,0 +1,1027 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace NfTs { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class NfTs { + constructor(protected readonly _options: NfTs.Options) {} + + /** + * Mint multiple NFTs with a single call and deliver them to a web3 wallet or an email address + * + * **API scope required** `nfts.create` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.BatchMintNftRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.batchMintNft("default-solana", { + * nfts: [{}] + * }) + */ + public async batchMintNft( + collectionId: string, + request: Crossmint.BatchMintNftRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts/` + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchMintNftRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchMintResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of all the NFTs in a given collection. + * + * **API scope required**: `nfts.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.MintStatusListRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.mintStatusList("default-solana", { + * page: 1.1, + * perPage: 20 + * }) + */ + public async mintStatusList( + collectionId: string, + request: Crossmint.MintStatusListRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const { page, perPage } = request; + const _queryParams: Record = {}; + _queryParams["page"] = page.toString(); + if (perPage != null) { + _queryParams["perPage"] = perPage.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.nfTs.mintStatusList.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Mint your NFTs and deliver them to a web3 wallet or an email address + * + * **API scope required**: `nfts.create` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.MintNftRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.mintNft("default-solana", { + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * } + * }) + */ + public async mintNft( + collectionId: string, + request: Crossmint.MintNftRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts` + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.MintNftRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.MintNftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Mint your SFTs and deliver them to a web3 wallet or an email address + * + * **API scope required**: `nfts.create` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.MintSftRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.mintSft("default-solana", { + * templateId: "silver-pass", + * recipient: "email:testy@crossmint.io:polygon" + * }) + */ + public async mintSft( + collectionId: string, + request: Crossmint.MintSftRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const { idempotencyKey, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/sfts` + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + "x-idempotency-key": idempotencyKey != null ? idempotencyKey : undefined, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.MintSftRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.MintSftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get the status and associated information for a mint operation. + * + * **API scope required**: `nfts.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} id - Unique ID of the minted NFT returned in the mint response + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.mintStatus("default-solana", "id") + */ + public async mintStatus( + collectionId: string, + id: string, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.MintStatusSolana200.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * This pathway allows you to mint NFTs and guarantee idempotency + * to ensure you never double mint for the same NFT. + * + * **API scope required**: `nfts.create` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} id - Custom ID of the NFT, which is used as an idempotency key + * @param {Crossmint.MintNftIdempotentRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.mintNftIdempotent("default-solana", "my-idempotency-key", { + * recipient: "email:testy@crossmint.io:polygon", + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * } + * }) + */ + public async mintNftIdempotent( + collectionId: string, + id: string, + request: Crossmint.MintNftIdempotentRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts/${encodeURIComponent(id)}` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.MintNftIdempotentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.MintNftIdempotentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Burn a minted NFT. + * + * **API scope required**: `nfts.delete` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} id - Unique ID of the minted NFT returned in the mint response + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.burnNft("default-solana", "id") + */ + public async burnNft( + collectionId: string, + id: string, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BurnNftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Edit a minted NFT's metadata on IPFS. + * + * If you are using a custom baseURI, invoking this will overwrite the specific tokenURI for the edited token. + * + * **API scope required**: `nfts.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} id - Unique ID of the minted NFT returned in the mint response + * @param {Crossmint.EditNftRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.editNft("default-solana", "id", { + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * } + * }) + */ + public async editNft( + collectionId: string, + id: string, + request: Crossmint.EditNftRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/nfts/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.EditNftRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.EditNftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Burn a minted NFT using a Crossmint NFT locator. + * + * **API scope required**: `nfts.delete` + * + * @param {string} locator - The locator of the NFT, which includes the blockchain, contract address, and token ID. + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.NotImplementedError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.burnNftByLocator("polygon:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045:52") + */ + public async burnNftByLocator( + locator: string, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/nfts/${encodeURIComponent(locator)}` + ), + method: "DELETE", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BurnNftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 501: + throw new Crossmint.NotImplementedError( + serializers.NotImplementedErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Edit a minted NFT's metadata using a Crossmint NFT locator. + * + * **API scope required**: `nfts.update` + * + * @param {string} locator - The locator of the NFT, which includes the blockchain, contract address, and token ID. + * @param {Crossmint.EditNftByLocatorRequest} request + * @param {NfTs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.NotImplementedError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nfTs.editNftByLocator("polygon:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045:52", { + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * }, + * reuploadLinkedFiles: true + * }) + */ + public async editNftByLocator( + locator: string, + request: Crossmint.EditNftByLocatorRequest, + requestOptions?: NfTs.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/nfts/${encodeURIComponent(locator)}` + ), + method: "PATCH", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.EditNftByLocatorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.EditNftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 501: + throw new Crossmint.NotImplementedError( + serializers.NotImplementedErrorBody.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/nfTs/client/index.ts b/src/api/resources/nfTs/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/nfTs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/nfTs/client/requests/BatchMintNftRequest.ts b/src/api/resources/nfTs/client/requests/BatchMintNftRequest.ts new file mode 100644 index 0000000..7feb72b --- /dev/null +++ b/src/api/resources/nfTs/client/requests/BatchMintNftRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * nfts: [{}] + * } + */ +export interface BatchMintNftRequest { + /** Array of objects describing the NFTs to mint to recipients. */ + nfts: Crossmint.BatchMintNftRequestNftsItem[]; +} diff --git a/src/api/resources/nfTs/client/requests/EditNftByLocatorRequest.ts b/src/api/resources/nfTs/client/requests/EditNftByLocatorRequest.ts new file mode 100644 index 0000000..b7d8489 --- /dev/null +++ b/src/api/resources/nfTs/client/requests/EditNftByLocatorRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * }, + * reuploadLinkedFiles: true + * } + */ +export interface EditNftByLocatorRequest { + metadata: Crossmint.NftMetadata; + reuploadLinkedFiles: Crossmint.ReuploadLinkedFiles; +} diff --git a/src/api/resources/nfTs/client/requests/EditNftRequest.ts b/src/api/resources/nfTs/client/requests/EditNftRequest.ts new file mode 100644 index 0000000..d26e19a --- /dev/null +++ b/src/api/resources/nfTs/client/requests/EditNftRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * } + * } + */ +export interface EditNftRequest { + metadata: Crossmint.NftMetadataOptions; + reuploadLinkedFiles?: Crossmint.ReuploadLinkedFiles; +} diff --git a/src/api/resources/nfTs/client/requests/MintNftIdempotentRequest.ts b/src/api/resources/nfTs/client/requests/MintNftIdempotentRequest.ts new file mode 100644 index 0000000..e7ed521 --- /dev/null +++ b/src/api/resources/nfTs/client/requests/MintNftIdempotentRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * recipient: "email:testy@crossmint.io:polygon", + * metadata: { + * name: "Crossmint Example NFT", + * image: "https://www.crossmint.com/assets/crossmint/logo.png", + * description: "My NFT created via the mint API!" + * } + * } + */ +export interface MintNftIdempotentRequest { + recipient: Crossmint.Recipient; + metadata: Crossmint.NftMetadataOptions; + reuploadLinkedFiles?: Crossmint.ReuploadLinkedFiles; + compressed?: Crossmint.Compressed; +} diff --git a/src/api/resources/nfTs/client/requests/MintSftRequest.ts b/src/api/resources/nfTs/client/requests/MintSftRequest.ts new file mode 100644 index 0000000..4f0b4a9 --- /dev/null +++ b/src/api/resources/nfTs/client/requests/MintSftRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * templateId: "silver-pass", + * recipient: "email:testy@crossmint.io:polygon" + * } + */ +export interface MintSftRequest { + /** + * Unique identifier to prevent duplicate requests + */ + idempotencyKey?: string; + /** Identifier of the template */ + templateId: string; + recipient: Crossmint.Recipient; + /** (Optional) Amount to mint */ + amount?: number; +} diff --git a/src/api/resources/nfTs/client/requests/MintStatusListRequest.ts b/src/api/resources/nfTs/client/requests/MintStatusListRequest.ts new file mode 100644 index 0000000..aacec1c --- /dev/null +++ b/src/api/resources/nfTs/client/requests/MintStatusListRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * page: 1.1, + * perPage: 20 + * } + */ +export interface MintStatusListRequest { + /** + * The page number you want to query, starting at 1 + */ + page: number; + /** + * How many items you want to be returned in the page. + */ + perPage?: number; +} diff --git a/src/api/resources/nfTs/client/requests/index.ts b/src/api/resources/nfTs/client/requests/index.ts new file mode 100644 index 0000000..f76f5f0 --- /dev/null +++ b/src/api/resources/nfTs/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type BatchMintNftRequest } from "./BatchMintNftRequest"; +export { type MintStatusListRequest } from "./MintStatusListRequest"; +export { type MintSftRequest } from "./MintSftRequest"; +export { type MintNftIdempotentRequest } from "./MintNftIdempotentRequest"; +export { type EditNftRequest } from "./EditNftRequest"; +export { type EditNftByLocatorRequest } from "./EditNftByLocatorRequest"; diff --git a/src/api/resources/nfTs/index.ts b/src/api/resources/nfTs/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/nfTs/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/nfTs/types/BatchMintNftRequestNftsItem.ts b/src/api/resources/nfTs/types/BatchMintNftRequestNftsItem.ts new file mode 100644 index 0000000..3af33f8 --- /dev/null +++ b/src/api/resources/nfTs/types/BatchMintNftRequestNftsItem.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface BatchMintNftRequestNftsItem { + recipient?: Crossmint.Recipient; + metadata?: Crossmint.NftMetadataOptions; + compressed?: Crossmint.Compressed; + /** **Optional** The idempotent identifier for the NFT */ + id?: string; +} diff --git a/src/api/resources/nfTs/types/Metadata.ts b/src/api/resources/nfTs/types/Metadata.ts new file mode 100644 index 0000000..56d89cc --- /dev/null +++ b/src/api/resources/nfTs/types/Metadata.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface Metadata { + metadata: Crossmint.NftMetadataOptions; +} diff --git a/src/api/resources/nfTs/types/MintNftIdempotentResponse.ts b/src/api/resources/nfTs/types/MintNftIdempotentResponse.ts new file mode 100644 index 0000000..dfdda69 --- /dev/null +++ b/src/api/resources/nfTs/types/MintNftIdempotentResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type MintNftIdempotentResponse = + | Crossmint.MintResponseSolana200 + | Crossmint.MintResponseSolana200Subsequent + | Crossmint.MintResponseEvm200 + | Crossmint.MintResponseEvm200Subsequent; diff --git a/src/api/resources/nfTs/types/MintNftRequest.ts b/src/api/resources/nfTs/types/MintNftRequest.ts new file mode 100644 index 0000000..d0f0569 --- /dev/null +++ b/src/api/resources/nfTs/types/MintNftRequest.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type MintNftRequest = Crossmint.Metadata | Crossmint.MintNftRequestTemplateId; diff --git a/src/api/resources/nfTs/types/MintNftRequestTemplateId.ts b/src/api/resources/nfTs/types/MintNftRequestTemplateId.ts new file mode 100644 index 0000000..acc5438 --- /dev/null +++ b/src/api/resources/nfTs/types/MintNftRequestTemplateId.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintNftRequestTemplateId { + templateId: string; +} diff --git a/src/api/resources/nfTs/types/MintNftResponse.ts b/src/api/resources/nfTs/types/MintNftResponse.ts new file mode 100644 index 0000000..910d4d1 --- /dev/null +++ b/src/api/resources/nfTs/types/MintNftResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type MintNftResponse = Crossmint.MintResponseSolana200 | Crossmint.MintResponseEvm200; diff --git a/src/api/resources/nfTs/types/MintSftResponse.ts b/src/api/resources/nfTs/types/MintSftResponse.ts new file mode 100644 index 0000000..7a6754c --- /dev/null +++ b/src/api/resources/nfTs/types/MintSftResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface MintSftResponse { + actionId?: string; + action?: string; + status?: string; + data?: Crossmint.MintSftResponseData; + startedAt?: string; + resource?: string; +} diff --git a/src/api/resources/nfTs/types/MintSftResponseData.ts b/src/api/resources/nfTs/types/MintSftResponseData.ts new file mode 100644 index 0000000..31eb698 --- /dev/null +++ b/src/api/resources/nfTs/types/MintSftResponseData.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface MintSftResponseData { + chain?: string; + collection?: Crossmint.MintSftResponseDataCollection; + recipient?: Crossmint.MintSftResponseDataRecipient; + token?: Crossmint.MintSftResponseDataToken; +} diff --git a/src/api/resources/nfTs/types/MintSftResponseDataCollection.ts b/src/api/resources/nfTs/types/MintSftResponseDataCollection.ts new file mode 100644 index 0000000..4965f79 --- /dev/null +++ b/src/api/resources/nfTs/types/MintSftResponseDataCollection.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintSftResponseDataCollection { + id?: string; + contractAddress?: string; +} diff --git a/src/api/resources/nfTs/types/MintSftResponseDataRecipient.ts b/src/api/resources/nfTs/types/MintSftResponseDataRecipient.ts new file mode 100644 index 0000000..8b0ce3a --- /dev/null +++ b/src/api/resources/nfTs/types/MintSftResponseDataRecipient.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintSftResponseDataRecipient { + walletAddress?: string; + email?: string; +} diff --git a/src/api/resources/nfTs/types/MintSftResponseDataToken.ts b/src/api/resources/nfTs/types/MintSftResponseDataToken.ts new file mode 100644 index 0000000..698003b --- /dev/null +++ b/src/api/resources/nfTs/types/MintSftResponseDataToken.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintSftResponseDataToken { + id?: string; +} diff --git a/src/api/resources/nfTs/types/index.ts b/src/api/resources/nfTs/types/index.ts new file mode 100644 index 0000000..6765de4 --- /dev/null +++ b/src/api/resources/nfTs/types/index.ts @@ -0,0 +1,11 @@ +export * from "./BatchMintNftRequestNftsItem"; +export * from "./Metadata"; +export * from "./MintNftRequestTemplateId"; +export * from "./MintNftRequest"; +export * from "./MintNftResponse"; +export * from "./MintSftResponseDataCollection"; +export * from "./MintSftResponseDataRecipient"; +export * from "./MintSftResponseDataToken"; +export * from "./MintSftResponseData"; +export * from "./MintSftResponse"; +export * from "./MintNftIdempotentResponse"; diff --git a/src/api/resources/nftCollections/client/Client.ts b/src/api/resources/nftCollections/client/Client.ts new file mode 100644 index 0000000..f91fac2 --- /dev/null +++ b/src/api/resources/nftCollections/client/Client.ts @@ -0,0 +1,1151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace NftCollections { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class NftCollections { + constructor(protected readonly _options: NftCollections.Options) {} + + /** + * List all collections created under the current Crossmint project + * + * **API scope required**: `collections.read` + * + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.listCollections() + */ + public async listCollections( + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "2022-06-09/collections/" + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCollectionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a collection that you can mint NFTs/SFTs from + * + * **API scope required**: `collections.create` + * + * @param {Crossmint.CreateCollectionBody} request + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.createCollection({ + * chain: Crossmint.CreateCollectionBodyChain.Aptos, + * metadata: { + * name: "Sample NFT Collection", + * description: "This is a sample NFT collection" + * } + * }) + */ + public async createCollection( + request: Crossmint.CreateCollectionBody, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "2022-06-09/collections/" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateCollectionBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCollectionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get information about a specific collection. + * + * **API scope required**: `collections.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.collectionInfo("default-solana") + */ + public async collectionInfo( + collectionId: string, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCollectionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a collection that you can mint NFTs/SFTs from. This API is idempotent, + * if you call it multiple times with the same ID, only one will be created. + * + * **API scope required**: `collections.create` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.CreateCollectionBody} request + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.createCollectionCustom("default-solana", { + * chain: Crossmint.CreateCollectionBodyChain.Aptos, + * metadata: { + * name: "Sample NFT Collection", + * description: "This is a sample NFT collection" + * } + * }) + */ + public async createCollectionCustom( + collectionId: string, + request: Crossmint.CreateCollectionBody, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateCollectionBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCollectionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update the sales details of a collection + * + * **API scope required**: `collections.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.UpdateCollectionRequest} request + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.updateCollection("default-solana") + */ + public async updateCollection( + collectionId: string, + request: Crossmint.UpdateCollectionRequest = {}, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}` + ), + method: "PATCH", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateCollectionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Fetch the royalty configuration for a collection, from its current state + * in the blockchain. + * + * This API is only supported on EVM chains. + * + * If you call GET too soon after PUT/DELETE, + * you may not yet see your latest changes, as they can take a few seconds to + * record on the blockchain. + * + * **API scope required**: `collections.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.getRoyaltyInformation("default-solana") + */ + public async getRoyaltyInformation( + collectionId: string, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/royalties` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetRoyaltyInformationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Configure royalties for all NFTs in a collection. + * + * This API is only supported for EVM chains and implements the EIP-2981 standard. + * + * **API scope required**: `collections.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.EditRoyaltyInformationRequest} request + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ConflictError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.editRoyaltyInformation("default-solana") + */ + public async editRoyaltyInformation( + collectionId: string, + request: Crossmint.EditRoyaltyInformationRequest = {}, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/royalties` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.EditRoyaltyInformationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 409: + throw new Crossmint.ConflictError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Remove all royalties from a given collection. No new NFT sales will yield royalties to the creator. + * + * This API is only supported on EVM Chains. + * + * **API scope required**: `collections.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.disableRoyaltyInformation("default-solana") + */ + public async disableRoyaltyInformation( + collectionId: string, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/royalties` + ), + method: "DELETE", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get the Base URI of a collection as it appears on-chain. + * + * **API scope required**: `collections.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.getBaseUri("default-solana") + */ + public async getBaseUri( + collectionId: string, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/base-uri` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetBaseUriResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update the Base URI of a collection. Setting the baseURI enables + * excluding the metadata param when minting. Tokens minted without the metadata + * param will have a tokenURI of: + * + * `{BASE_URI}/{TOKEN_ID}` + * + * This API is currently only supported on EVM Chains. + * + * **API scope required**: `collections.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.SetBaseUriRequest} request + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ConflictError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.setBaseUri("default-solana") + */ + public async setBaseUri( + collectionId: string, + request: Crossmint.SetBaseUriRequest = {}, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/base-uri` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.SetBaseUriRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 409: + throw new Crossmint.ConflictError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get the transferable status of a collection. + * + * This API is only supported on EVM chains. + * + * You must contact sales to gain access to this API. + * + * **API scope required**: `collections.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.getTransferability("default-solana") + */ + public async getTransferability( + collectionId: string, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/transferable` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTransferabilityResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update the transferable status of a collection. + * + * This API is only supported on EVM chains. + * You must contact sales to gain access to this API. + * + * **API scope required**: `collections.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.SetTransferabilityRequest} request + * @param {NftCollections.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ConflictError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftCollections.setTransferability("default-solana", { + * value: true + * }) + */ + public async setTransferability( + collectionId: string, + request: Crossmint.SetTransferabilityRequest, + requestOptions?: NftCollections.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/minting/collections/${encodeURIComponent(collectionId)}/transferable` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.SetTransferabilityRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 409: + throw new Crossmint.ConflictError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/nftCollections/client/index.ts b/src/api/resources/nftCollections/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/nftCollections/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts b/src/api/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts new file mode 100644 index 0000000..983fd9a --- /dev/null +++ b/src/api/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * {} + */ +export interface EditRoyaltyInformationRequest { + /** List of royalty recipients. Note: EVM collections only support a single recipient. Use a contract splitter as recipient in order to send payments to multiple addresses. */ + recipients?: Crossmint.EditRoyaltyInformationRequestRecipientsItem[]; +} diff --git a/src/api/resources/nftCollections/client/requests/SetBaseUriRequest.ts b/src/api/resources/nftCollections/client/requests/SetBaseUriRequest.ts new file mode 100644 index 0000000..3f83a5b --- /dev/null +++ b/src/api/resources/nftCollections/client/requests/SetBaseUriRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface SetBaseUriRequest { + /** The new Base URI */ + uri?: string; +} diff --git a/src/api/resources/nftCollections/client/requests/SetTransferabilityRequest.ts b/src/api/resources/nftCollections/client/requests/SetTransferabilityRequest.ts new file mode 100644 index 0000000..64fc95b --- /dev/null +++ b/src/api/resources/nftCollections/client/requests/SetTransferabilityRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * value: true + * } + */ +export interface SetTransferabilityRequest { + /** Toggles the transferability of NFTs within the collection. Set to `false` to disable transfers. */ + value: boolean; +} diff --git a/src/api/resources/nftCollections/client/requests/UpdateCollectionRequest.ts b/src/api/resources/nftCollections/client/requests/UpdateCollectionRequest.ts new file mode 100644 index 0000000..e53cde7 --- /dev/null +++ b/src/api/resources/nftCollections/client/requests/UpdateCollectionRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * {} + */ +export interface UpdateCollectionRequest { + /** The maximum number of NFTs that can be minted for this collection */ + supplyLimit?: number; + payments?: Crossmint.PaymentsObject; +} diff --git a/src/api/resources/nftCollections/client/requests/index.ts b/src/api/resources/nftCollections/client/requests/index.ts new file mode 100644 index 0000000..6458464 --- /dev/null +++ b/src/api/resources/nftCollections/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type UpdateCollectionRequest } from "./UpdateCollectionRequest"; +export { type EditRoyaltyInformationRequest } from "./EditRoyaltyInformationRequest"; +export { type SetBaseUriRequest } from "./SetBaseUriRequest"; +export { type SetTransferabilityRequest } from "./SetTransferabilityRequest"; diff --git a/src/api/resources/nftCollections/index.ts b/src/api/resources/nftCollections/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/nftCollections/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts b/src/api/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts new file mode 100644 index 0000000..993d7e9 --- /dev/null +++ b/src/api/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EditRoyaltyInformationRequestRecipientsItem { + /** + * Address where the payments will be received. + * Note: ENS addresses are not supported. + */ + address?: string; + /** Percentage of the sale price that will go to the recipient address. A basis point is a standard measure for percentages in finance. One basis point equals 1/100th of 1%, or 0.01%. */ + basisPoints?: number; +} diff --git a/src/api/resources/nftCollections/types/GetBaseUriResponse.ts b/src/api/resources/nftCollections/types/GetBaseUriResponse.ts new file mode 100644 index 0000000..c445383 --- /dev/null +++ b/src/api/resources/nftCollections/types/GetBaseUriResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetBaseUriResponse { + uri?: string; +} diff --git a/src/api/resources/nftCollections/types/GetRoyaltyInformationResponse.ts b/src/api/resources/nftCollections/types/GetRoyaltyInformationResponse.ts new file mode 100644 index 0000000..12b34a3 --- /dev/null +++ b/src/api/resources/nftCollections/types/GetRoyaltyInformationResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface GetRoyaltyInformationResponse { + recipients?: Crossmint.GetRoyaltyInformationResponseRecipientsItem[]; +} diff --git a/src/api/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts b/src/api/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts new file mode 100644 index 0000000..b7a7d98 --- /dev/null +++ b/src/api/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetRoyaltyInformationResponseRecipientsItem { + /** Recipient address. e.g., 0x71C... */ + address?: string; + /** A basis point is a standard measure for percentages in finance. One basis point equals 1/100th of 1%, or 0.01%. */ + basisPoints?: number; +} diff --git a/src/api/resources/nftCollections/types/GetTransferabilityResponse.ts b/src/api/resources/nftCollections/types/GetTransferabilityResponse.ts new file mode 100644 index 0000000..0c617b9 --- /dev/null +++ b/src/api/resources/nftCollections/types/GetTransferabilityResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetTransferabilityResponse { + value?: boolean; +} diff --git a/src/api/resources/nftCollections/types/ListCollectionsResponse.ts b/src/api/resources/nftCollections/types/ListCollectionsResponse.ts new file mode 100644 index 0000000..f64722d --- /dev/null +++ b/src/api/resources/nftCollections/types/ListCollectionsResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface ListCollectionsResponse { + results?: Crossmint.GetCollectionResponse[]; +} diff --git a/src/api/resources/nftCollections/types/index.ts b/src/api/resources/nftCollections/types/index.ts new file mode 100644 index 0000000..9a8870b --- /dev/null +++ b/src/api/resources/nftCollections/types/index.ts @@ -0,0 +1,6 @@ +export * from "./ListCollectionsResponse"; +export * from "./GetRoyaltyInformationResponseRecipientsItem"; +export * from "./GetRoyaltyInformationResponse"; +export * from "./EditRoyaltyInformationRequestRecipientsItem"; +export * from "./GetBaseUriResponse"; +export * from "./GetTransferabilityResponse"; diff --git a/src/api/resources/nftTemplates/client/Client.ts b/src/api/resources/nftTemplates/client/Client.ts new file mode 100644 index 0000000..91d87f7 --- /dev/null +++ b/src/api/resources/nftTemplates/client/Client.ts @@ -0,0 +1,616 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace NftTemplates { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class NftTemplates { + constructor(protected readonly _options: NftTemplates.Options) {} + + /** + * Get all of the templates for a collection + * + * **API scope required**: `nfts.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {Crossmint.GetAllTemplatesRequest} request + * @param {NftTemplates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftTemplates.getAllTemplates("default-solana", { + * page: 1.1, + * perPage: 20 + * }) + */ + public async getAllTemplates( + collectionId: string, + request: Crossmint.GetAllTemplatesRequest, + requestOptions?: NftTemplates.RequestOptions + ): Promise { + const { page, perPage } = request; + const _queryParams: Record = {}; + _queryParams["page"] = page.toString(); + if (perPage != null) { + _queryParams["perPage"] = perPage.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/templates` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.nftTemplates.getAllTemplates.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a token template, that NFTs or SFTs may be minted from + * + * **API scope required**: `nfts.create` + * + * @param {string} collectionId - The ID of the named collection, used to create new tokens + * @param {Crossmint.CreateTemplateBody} request + * @param {NftTemplates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ConflictError} + * @throws {@link Crossmint.FailedDependencyError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftTemplates.createTemplate("idempotent-collection-name", {}) + */ + public async createTemplate( + collectionId: string, + request: Crossmint.CreateTemplateBody, + requestOptions?: NftTemplates.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/templates` + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateTemplateBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.TemplateResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 409: + throw new Crossmint.ConflictError(_response.error.body); + case 424: + throw new Crossmint.FailedDependencyError( + serializers.FourHundredTwentyFourResponse.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Fetch the contents of a token template. + * + * **API scope required**: `nfts.read` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} templateId - The template ID + * @param {NftTemplates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftTemplates.getTemplate("default-solana", "templateId") + */ + public async getTemplate( + collectionId: string, + templateId: string, + requestOptions?: NftTemplates.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/templates/${encodeURIComponent(templateId)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.TemplateResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a token template with preconfigured metadata + * + * **API scope required**: `nfts.create` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} templateId - The template ID + * @param {Crossmint.CreateTemplateBody} request + * @param {NftTemplates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ConflictError} + * @throws {@link Crossmint.FailedDependencyError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftTemplates.createTemplateIdempotent("default-solana", "templateId", {}) + */ + public async createTemplateIdempotent( + collectionId: string, + templateId: string, + request: Crossmint.CreateTemplateBody, + requestOptions?: NftTemplates.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/templates/${encodeURIComponent(templateId)}` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateTemplateBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.TemplateResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 409: + throw new Crossmint.ConflictError(_response.error.body); + case 424: + throw new Crossmint.FailedDependencyError( + serializers.FourHundredTwentyFourResponse.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete a Token template. + * + * **API scope required**: `nfts.delete` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} templateId - The template ID + * @param {NftTemplates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftTemplates.deleteTemplate("default-solana", "templateId") + */ + public async deleteTemplate( + collectionId: string, + templateId: string, + requestOptions?: NftTemplates.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/templates/${encodeURIComponent(templateId)}` + ), + method: "DELETE", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Edit a Token template. + * + * **API scope required**: `nfts.update` + * + * @param {string} collectionId - This is the identifier for the collection related to the request. Every project has default collections: `default-solana` and `default-polygon`. + * + * The [create-collection](/api-reference/minting/collection/create-collection) API will result in collections with UUID formatted `collectionId`. + * **Example:** `9c82ef99-617f-497d-9abb-fd355291681b` + * + * The [create-collection-idempotent](/api-reference/minting/collection/create-collection-idempotent) API allows you to specify an arbitrary identifier during the intitial request. + * **Example:** `your-custom-identifer` + * @param {string} templateId - The template ID + * @param {Crossmint.EditTemplateRequest} request + * @param {NftTemplates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.nftTemplates.editTemplate("default-solana", "templateId", {}) + */ + public async editTemplate( + collectionId: string, + templateId: string, + request: Crossmint.EditTemplateRequest, + requestOptions?: NftTemplates.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/collections/${encodeURIComponent(collectionId)}/templates/${encodeURIComponent(templateId)}` + ), + method: "PATCH", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.EditTemplateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/nftTemplates/client/index.ts b/src/api/resources/nftTemplates/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/nftTemplates/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/nftTemplates/client/requests/GetAllTemplatesRequest.ts b/src/api/resources/nftTemplates/client/requests/GetAllTemplatesRequest.ts new file mode 100644 index 0000000..3883269 --- /dev/null +++ b/src/api/resources/nftTemplates/client/requests/GetAllTemplatesRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * page: 1.1, + * perPage: 20 + * } + */ +export interface GetAllTemplatesRequest { + /** + * The page number you want to query, starting at 1 + */ + page: number; + /** + * How many items you want to be returned in the page. + */ + perPage?: number; +} diff --git a/src/api/resources/nftTemplates/client/requests/index.ts b/src/api/resources/nftTemplates/client/requests/index.ts new file mode 100644 index 0000000..20afb46 --- /dev/null +++ b/src/api/resources/nftTemplates/client/requests/index.ts @@ -0,0 +1 @@ +export { type GetAllTemplatesRequest } from "./GetAllTemplatesRequest"; diff --git a/src/api/resources/nftTemplates/index.ts b/src/api/resources/nftTemplates/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/nftTemplates/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/nftTemplates/types/EditTemplateRequest.ts b/src/api/resources/nftTemplates/types/EditTemplateRequest.ts new file mode 100644 index 0000000..24bf651 --- /dev/null +++ b/src/api/resources/nftTemplates/types/EditTemplateRequest.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type EditTemplateRequest = Crossmint.MintingMetadata | Crossmint.Supply; diff --git a/src/api/resources/nftTemplates/types/index.ts b/src/api/resources/nftTemplates/types/index.ts new file mode 100644 index 0000000..b2f8f64 --- /dev/null +++ b/src/api/resources/nftTemplates/types/index.ts @@ -0,0 +1 @@ +export * from "./EditTemplateRequest"; diff --git a/src/api/resources/quotePrice/client/Client.ts b/src/api/resources/quotePrice/client/Client.ts new file mode 100644 index 0000000..f5569d0 --- /dev/null +++ b/src/api/resources/quotePrice/client/Client.ts @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace QuotePrice { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class QuotePrice { + constructor(protected readonly _options: QuotePrice.Options) {} + + /** + * Get the price of a transaction hosted through Crossmint, inclusive of all fees. + * + * **This API is subject to change as it is currently in its alpha form.** + * + * @param {Crossmint.QuoteRequest} request + * @param {QuotePrice.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.quotePrice.quote({ + * nativePrice: "nativePrice", + * quoteCurrency: Crossmint.QuoteRequestQuoteCurrency.Usd + * }) + */ + public async quote( + request: Crossmint.QuoteRequest, + requestOptions?: QuotePrice.RequestOptions + ): Promise { + const { nativePrice, quoteCurrency } = request; + const _queryParams: Record = {}; + _queryParams["nativePrice"] = nativePrice; + _queryParams["quoteCurrency"] = quoteCurrency; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/quote" + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.QuoteResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/quotePrice/client/index.ts b/src/api/resources/quotePrice/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/quotePrice/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/quotePrice/client/requests/QuoteRequest.ts b/src/api/resources/quotePrice/client/requests/QuoteRequest.ts new file mode 100644 index 0000000..f12013d --- /dev/null +++ b/src/api/resources/quotePrice/client/requests/QuoteRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * nativePrice: "nativePrice", + * quoteCurrency: Crossmint.QuoteRequestQuoteCurrency.Usd + * } + */ +export interface QuoteRequest { + /** + * Price in specified chain currency to quote. + * The chain is derived from the chain your collection is on. + * If your chain is on the Solana network, the parameter would be the SOL amount, not Lamports. + */ + nativePrice: string; + /** + * Price in specified currency to quote + */ + quoteCurrency: Crossmint.QuoteRequestQuoteCurrency; +} diff --git a/src/api/resources/quotePrice/client/requests/index.ts b/src/api/resources/quotePrice/client/requests/index.ts new file mode 100644 index 0000000..0ae061f --- /dev/null +++ b/src/api/resources/quotePrice/client/requests/index.ts @@ -0,0 +1 @@ +export { type QuoteRequest } from "./QuoteRequest"; diff --git a/src/api/resources/quotePrice/index.ts b/src/api/resources/quotePrice/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/quotePrice/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts b/src/api/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts new file mode 100644 index 0000000..6ecd0ac --- /dev/null +++ b/src/api/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type QuoteRequestQuoteCurrency = "usd" | "eur" | "gbp" | "aud" | "sgd" | "hkd" | "krw" | "inr" | "vnd" | "jpy"; + +export const QuoteRequestQuoteCurrency = { + Usd: "usd", + Eur: "eur", + Gbp: "gbp", + Aud: "aud", + Sgd: "sgd", + Hkd: "hkd", + Krw: "krw", + Inr: "inr", + Vnd: "vnd", + Jpy: "jpy", +} as const; diff --git a/src/api/resources/quotePrice/types/index.ts b/src/api/resources/quotePrice/types/index.ts new file mode 100644 index 0000000..b5ecb0f --- /dev/null +++ b/src/api/resources/quotePrice/types/index.ts @@ -0,0 +1 @@ +export * from "./QuoteRequestQuoteCurrency"; diff --git a/src/api/resources/registration/client/Client.ts b/src/api/resources/registration/client/Client.ts new file mode 100644 index 0000000..df38289 --- /dev/null +++ b/src/api/resources/registration/client/Client.ts @@ -0,0 +1,205 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Registration { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class Registration { + constructor(protected readonly _options: Registration.Options) {} + + /** + * Register your NFT collection with Crossmint + * + * **This API is subject to change as it is currently in its alpha form.** + * + * @param {Crossmint.RegisterNftCollectionRequest} request + * @param {Registration.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.registration.registerNftCollection({ + * chain: Crossmint.RegisterNftCollectionRequestChain.Solana, + * contractType: Crossmint.RegisterNftCollectionRequestContractType.CandyMachine, + * args: { + * candyMachineId: "candyMachineId" + * }, + * metadata: { + * title: "title", + * description: "description", + * imageUrl: "imageUrl" + * }, + * ownership: Crossmint.RegisterNftCollectionRequestOwnership.External, + * category: Crossmint.RegisterNftCollectionRequestCategory.Loyalty, + * scopes: [Crossmint.RegisterNftCollectionRequestScopesItem.PaymentsCreditCard] + * }) + */ + public async registerNftCollection( + request: Crossmint.RegisterNftCollectionRequest, + requestOptions?: Registration.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/collections" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.RegisterNftCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update your collection information registered on Crossmint + * + * **This API is subject to change as it is currently in its alpha form.** + * + * @param {Crossmint.UpdateNftCollectionRequest} request + * @param {Registration.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.registration.updateNftCollection({ + * clientId: "clientId", + * metadata: { + * title: "title", + * imageUrl: "imageUrl" + * } + * }) + */ + public async updateNftCollection( + request: Crossmint.UpdateNftCollectionRequest, + requestOptions?: Registration.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/collections" + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateNftCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/registration/client/index.ts b/src/api/resources/registration/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/registration/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/registration/client/requests/RegisterNftCollectionRequest.ts b/src/api/resources/registration/client/requests/RegisterNftCollectionRequest.ts new file mode 100644 index 0000000..02d405c --- /dev/null +++ b/src/api/resources/registration/client/requests/RegisterNftCollectionRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * chain: Crossmint.RegisterNftCollectionRequestChain.Solana, + * contractType: Crossmint.RegisterNftCollectionRequestContractType.CandyMachine, + * args: { + * candyMachineId: "candyMachineId" + * }, + * metadata: { + * title: "title", + * description: "description", + * imageUrl: "imageUrl" + * }, + * ownership: Crossmint.RegisterNftCollectionRequestOwnership.External, + * category: Crossmint.RegisterNftCollectionRequestCategory.Loyalty, + * scopes: [Crossmint.RegisterNftCollectionRequestScopesItem.PaymentsCreditCard] + * } + */ +export interface RegisterNftCollectionRequest { + /** Crypto chain your NFT is on */ + chain: Crossmint.RegisterNftCollectionRequestChain; + /** The type of your contract. */ + contractType: Crossmint.RegisterNftCollectionRequestContractType; + args: Crossmint.RegisterNftCollectionRequestArgs; + metadata: Crossmint.RegisterNftCollectionRequestMetadata; + /** Ownership of the collection */ + ownership: Crossmint.RegisterNftCollectionRequestOwnership; + /** Verification category */ + category: Crossmint.RegisterNftCollectionRequestCategory; + scopes: Crossmint.RegisterNftCollectionRequestScopesItem[]; +} diff --git a/src/api/resources/registration/client/requests/UpdateNftCollectionRequest.ts b/src/api/resources/registration/client/requests/UpdateNftCollectionRequest.ts new file mode 100644 index 0000000..f1f029c --- /dev/null +++ b/src/api/resources/registration/client/requests/UpdateNftCollectionRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * clientId: "clientId", + * metadata: { + * title: "title", + * imageUrl: "imageUrl" + * } + * } + */ +export interface UpdateNftCollectionRequest { + clientId: string; + metadata: Crossmint.UpdateNftCollectionRequestMetadata; +} diff --git a/src/api/resources/registration/client/requests/index.ts b/src/api/resources/registration/client/requests/index.ts new file mode 100644 index 0000000..7078778 --- /dev/null +++ b/src/api/resources/registration/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type RegisterNftCollectionRequest } from "./RegisterNftCollectionRequest"; +export { type UpdateNftCollectionRequest } from "./UpdateNftCollectionRequest"; diff --git a/src/api/resources/registration/index.ts b/src/api/resources/registration/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/registration/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/registration/types/Evm.ts b/src/api/resources/registration/types/Evm.ts new file mode 100644 index 0000000..1a20477 --- /dev/null +++ b/src/api/resources/registration/types/Evm.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Evm { + contractAddress: string; + abi: string; + mintFunctionName: string; + /** The name of the `to` parameter in the mint function */ + toParamName: string; + quantityParamName?: string; +} diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestArgs.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestArgs.ts new file mode 100644 index 0000000..34a7243 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestArgs.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type RegisterNftCollectionRequestArgs = Crossmint.RegisterNftCollectionRequestArgsCandyMachineId | Crossmint.Evm; diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts new file mode 100644 index 0000000..d245e71 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface RegisterNftCollectionRequestArgsCandyMachineId { + /** Candy machine ID */ + candyMachineId: string; +} diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestCategory.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestCategory.ts new file mode 100644 index 0000000..e8675c9 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestCategory.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Verification category + */ +export type RegisterNftCollectionRequestCategory = + | "loyalty" + | "art" + | "music" + | "gaming" + | "ticketing" + | "charity" + | "other"; + +export const RegisterNftCollectionRequestCategory = { + Loyalty: "loyalty", + Art: "art", + Music: "music", + Gaming: "gaming", + Ticketing: "ticketing", + Charity: "charity", + Other: "other", +} as const; diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestChain.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestChain.ts new file mode 100644 index 0000000..61cbf6c --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestChain.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Crypto chain your NFT is on + */ +export type RegisterNftCollectionRequestChain = "solana" | "ethereum" | "polygon" | "bsc"; + +export const RegisterNftCollectionRequestChain = { + Solana: "solana", + Ethereum: "ethereum", + Polygon: "polygon", + Bsc: "bsc", +} as const; diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestContractType.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestContractType.ts new file mode 100644 index 0000000..6d79d74 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestContractType.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of your contract. + */ +export type RegisterNftCollectionRequestContractType = "candy-machine" | "erc-721" | "erc-1155" | "thirdweb-drop"; + +export const RegisterNftCollectionRequestContractType = { + CandyMachine: "candy-machine", + Erc721: "erc-721", + Erc1155: "erc-1155", + ThirdwebDrop: "thirdweb-drop", +} as const; diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestMetadata.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestMetadata.ts new file mode 100644 index 0000000..8101d41 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestMetadata.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface RegisterNftCollectionRequestMetadata { + /** Collection title */ + title: string; + /** Description of your collection */ + description: string; + /** Image url */ + imageUrl: string; + social?: Crossmint.RegisterNftCollectionRequestMetadataSocial; +} diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts new file mode 100644 index 0000000..200d7d4 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface RegisterNftCollectionRequestMetadataSocial { + /** A link to your twitter page */ + twitter?: string; + /** An invite link to your discord server */ + discord?: string; +} diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestOwnership.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestOwnership.ts new file mode 100644 index 0000000..eb63608 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestOwnership.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Ownership of the collection + */ +export type RegisterNftCollectionRequestOwnership = "external" | "self"; + +export const RegisterNftCollectionRequestOwnership = { + External: "external", + Self: "self", +} as const; diff --git a/src/api/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts b/src/api/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts new file mode 100644 index 0000000..176ee34 --- /dev/null +++ b/src/api/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type RegisterNftCollectionRequestScopesItem = "payments:credit-card" | "payments:cross-chain"; + +export const RegisterNftCollectionRequestScopesItem = { + PaymentsCreditCard: "payments:credit-card", + PaymentsCrossChain: "payments:cross-chain", +} as const; diff --git a/src/api/resources/registration/types/UpdateNftCollectionRequestMetadata.ts b/src/api/resources/registration/types/UpdateNftCollectionRequestMetadata.ts new file mode 100644 index 0000000..096228f --- /dev/null +++ b/src/api/resources/registration/types/UpdateNftCollectionRequestMetadata.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface UpdateNftCollectionRequestMetadata { + title: string; + imageUrl: string; + social?: Crossmint.UpdateNftCollectionRequestMetadataSocial; +} diff --git a/src/api/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts b/src/api/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts new file mode 100644 index 0000000..b8bfb34 --- /dev/null +++ b/src/api/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UpdateNftCollectionRequestMetadataSocial { + /** A link to your twitter page */ + twitter?: string; + /** An invite link to your discord server */ + discord?: string; +} diff --git a/src/api/resources/registration/types/index.ts b/src/api/resources/registration/types/index.ts new file mode 100644 index 0000000..64461dc --- /dev/null +++ b/src/api/resources/registration/types/index.ts @@ -0,0 +1,12 @@ +export * from "./RegisterNftCollectionRequestChain"; +export * from "./RegisterNftCollectionRequestContractType"; +export * from "./RegisterNftCollectionRequestArgsCandyMachineId"; +export * from "./Evm"; +export * from "./RegisterNftCollectionRequestArgs"; +export * from "./RegisterNftCollectionRequestMetadataSocial"; +export * from "./RegisterNftCollectionRequestMetadata"; +export * from "./RegisterNftCollectionRequestOwnership"; +export * from "./RegisterNftCollectionRequestCategory"; +export * from "./RegisterNftCollectionRequestScopesItem"; +export * from "./UpdateNftCollectionRequestMetadataSocial"; +export * from "./UpdateNftCollectionRequestMetadata"; diff --git a/src/api/resources/sign/client/Client.ts b/src/api/resources/sign/client/Client.ts new file mode 100644 index 0000000..1f14c3f --- /dev/null +++ b/src/api/resources/sign/client/Client.ts @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Sign { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class Sign { + constructor(protected readonly _options: Sign.Options) {} + + /** + * Sign a message using a custodial wallet's key + * + * **API scope required**: `wallets:messages.sign` + * + * @param {Crossmint.EvmChains} chain - The blockchain network you are using. + * @param {string} address - The wallet address you want to sign the message with + * @param {Crossmint.SignMessageRequest} request + * @param {Sign.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.UnauthorizedError} + * @throws {@link Crossmint.NotFoundError} + * + * @example + * await client.sign.message(Crossmint.EvmChains.Arbitrum, "address", { + * message: "message" + * }) + */ + public async message( + chain: Crossmint.EvmChains, + address: string, + request: Crossmint.SignMessageRequest, + requestOptions?: Sign.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `v1-alpha1/wallets/${encodeURIComponent(serializers.EvmChains.jsonOrThrow(chain))}:${encodeURIComponent( + address + )}/signMessage` + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.SignMessageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SignMessageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 401: + throw new Crossmint.UnauthorizedError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/sign/client/index.ts b/src/api/resources/sign/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/sign/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/sign/client/requests/SignMessageRequest.ts b/src/api/resources/sign/client/requests/SignMessageRequest.ts new file mode 100644 index 0000000..2fca480 --- /dev/null +++ b/src/api/resources/sign/client/requests/SignMessageRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * message: "message" + * } + */ +export interface SignMessageRequest { + /** The message to be signed */ + message: string; +} diff --git a/src/api/resources/sign/client/requests/index.ts b/src/api/resources/sign/client/requests/index.ts new file mode 100644 index 0000000..b19962e --- /dev/null +++ b/src/api/resources/sign/client/requests/index.ts @@ -0,0 +1 @@ +export { type SignMessageRequest } from "./SignMessageRequest"; diff --git a/src/api/resources/sign/index.ts b/src/api/resources/sign/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/sign/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/sign/types/SignMessageResponse.ts b/src/api/resources/sign/types/SignMessageResponse.ts new file mode 100644 index 0000000..4693406 --- /dev/null +++ b/src/api/resources/sign/types/SignMessageResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SignMessageResponse { + /** This is the result of `ethers.Signer.signMessage` */ + signedMessage?: string; +} diff --git a/src/api/resources/sign/types/index.ts b/src/api/resources/sign/types/index.ts new file mode 100644 index 0000000..602ef7e --- /dev/null +++ b/src/api/resources/sign/types/index.ts @@ -0,0 +1 @@ +export * from "./SignMessageResponse"; diff --git a/src/api/resources/verifiableCredentials/client/Client.ts b/src/api/resources/verifiableCredentials/client/Client.ts new file mode 100644 index 0000000..cea539d --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/Client.ts @@ -0,0 +1,883 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace VerifiableCredentials { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class VerifiableCredentials { + constructor(protected readonly _options: VerifiableCredentials.Options) {} + + /** + * Verify that a credential is valid. + * + * **API scope required** `credentials.read` + * + * @param {Crossmint.VerifyCredentialRequest} request + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.verifiableCredentials.verifyCredential({ + * credential: { + * "key": "value" + * } + * }) + */ + public async verifyCredential( + request: Crossmint.VerifyCredentialRequest, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "unstable/credentials/verify" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.VerifyCredentialRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.VerifyCredentialResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a template (similar to an nft collection) for issuing verifiable credentials. + * + * **API scope required** `credentials:template.create` + * + * @param {Crossmint.VcCreateTemplateRequest} request + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.verifiableCredentials.vcCreateTemplate({ + * metadata: { + * name: "Verifiable Credential", + * description: "The owner of this credential is authorized." + * }, + * credentials: { + * type: "degreeForMastersStudent" + * } + * }) + */ + public async vcCreateTemplate( + request: Crossmint.VcCreateTemplateRequest, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "unstable/credentials/templates/" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: { + ...serializers.VcCreateTemplateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + chain: "polygon", + }, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.verifiableCredentials.vcCreateTemplate.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a verifiable credential by the ID associated with the minted NFT. + * + * This ID will have the format: ``. For example: `d7eb777b-e9b4-4f34-ab5f-ce199111166a` + * + * **API scope required** `credentials.read`. This endpoint will not work with a client side API key. + * + * @param {string} collectionId - Collection id (template id) + * @param {string} id - UUID of the NFT returned in the NFT creation response. Format is: `` + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.NotFoundError} + * + * @example + * await client.verifiableCredentials.getVc("collectionId", "id") + */ + public async getVc( + collectionId: string, + id: string, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/collections/${encodeURIComponent(collectionId)}/nfts/${encodeURIComponent(id)}/credentials` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.verifiableCredentials.getVc.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a verifiable credential by the ID associated with it. + * + * This ID will have the format: `urn:uuid:`. For example: `urn:uuid:64f9877d-a19a-4205-8d61-f8c2abed5766` + * + * **API scope required** `credentials.read`. This enpoint will work also with a client side API key. + * + * @param {string} id - Unique ID of the credential as returned in the NFT creation response. Format is: `urn:uuid:` + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.NotFoundError} + * + * @example + * await client.verifiableCredentials.getVcById("id") + */ + public async getVcById( + id: string, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/credentials/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.verifiableCredentials.getVcById.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Revoke a verifiable credential by the credential ID. + * This involves burning the associated nft. + * + * This ID will have the format: `urn:uuid:`. For example: `urn:uuid:64f9877d-a19a-4205-8d61-f8c2abed5766` + * + * **API scope required** `credentials.create`. + * + * @param {string} id - Unique ID of the credential as returned in the NFT creation response. Format is: `urn:uuid:` + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.NotFoundError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.verifiableCredentials.revokeCredential("id") + */ + public async revokeCredential( + id: string, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/credentials/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BurnNftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a verifiable credential by the NFT locator. + * + * This locator will have the format: `::`. + * For example: `polygon:0x1234abcde...:1` + * + * **API scope required** `credentials.read`. This enpoint will work also with a client side API key. + * + * @param {string} nftLocator - NFT on chain locator, in the format of `::` + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.NotFoundError} + * + * @example + * await client.verifiableCredentials.getVcByLocator("nftLocator") + */ + public async getVcByLocator( + nftLocator: string, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/nfts/${encodeURIComponent(nftLocator)}/credentials` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.verifiableCredentials.getVcByLocator.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 404: + throw new Crossmint.NotFoundError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Issue a verifiable credential. Deliver to a web3 wallet or email address. + * + * **API scope required** `credentials.create` + * + * @param {string} templateId - Template id of a credential enabled collection + * @param {Crossmint.IssueVcRequest} request + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.ForbiddenError} + * @throws {@link Crossmint.ServiceUnavailableError} + * + * @example + * await client.verifiableCredentials.issueVc("default", { + * recipient: "polygon:0x1234abcde... or email::polygon", + * credential: { + * subject: { + * "subjectName": "foo", + * "subjectAge": 20, + * "claim": "bar" + * } + * } + * }) + */ + public async issueVc( + templateId: string, + request: Crossmint.IssueVcRequest, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/credentials/templates/${encodeURIComponent(templateId)}/vcs` + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.IssueVcRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.IssueVcResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 403: + throw new Crossmint.ForbiddenError(_response.error.body); + case 503: + throw new Crossmint.ServiceUnavailableError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a type with a random UUID. This is how you define a custom schema. + * + * **API scope required** `credentials.create` + * + * @param {Crossmint.CreateTypeRequest} request + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.verifiableCredentials.createType({ + * credentialSubjectSchema: [{ + * name: "username", + * type: "string" + * }, { + * name: "courses_completed", + * type: "uint64" + * }, { + * name: "courses", + * type: "Course[]" + * }] + * }) + */ + public async createType( + request: Crossmint.CreateTypeRequest, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "unstable/credentials/types" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateTypeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateTypeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get the schema of a given type by name + * + * **API scope required** `credentials.read` + * + * @param {string} typeName - The name of the type + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.verifiableCredentials.getType("typeName") + */ + public async getType( + typeName: string, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/credentials/types/${encodeURIComponent(typeName)}` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTypeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a type with a given name. This is how you define a custom schema. + * + * **API scope required** `credentials.create` + * + * @param {string} typeName - The name of the type + * @param {Crossmint.CreateTypeIdempotentRequest} request + * @param {VerifiableCredentials.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.verifiableCredentials.createTypeIdempotent("typeName", { + * credentialSubjectSchema: [{ + * name: "username", + * type: "string" + * }, { + * name: "courses_completed", + * type: "uint64" + * }, { + * name: "courses", + * type: "Course[]" + * }] + * }) + */ + public async createTypeIdempotent( + typeName: string, + request: Crossmint.CreateTypeIdempotentRequest, + requestOptions?: VerifiableCredentials.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `unstable/credentials/types/${encodeURIComponent(typeName)}` + ), + method: "PUT", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateTypeIdempotentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateTypeIdempotentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/verifiableCredentials/client/index.ts b/src/api/resources/verifiableCredentials/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts b/src/api/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts new file mode 100644 index 0000000..e49d5d1 --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * credentialSubjectSchema: [{ + * name: "username", + * type: "string" + * }, { + * name: "courses_completed", + * type: "uint64" + * }, { + * name: "courses", + * type: "Course[]" + * }] + * } + */ +export interface CreateTypeIdempotentRequest { + credentialSubjectSchema: Crossmint.CreateTypeIdempotentRequestCredentialSubjectSchemaItem[]; + nestedTypeSchema?: Crossmint.CreateTypeIdempotentRequestNestedTypeSchemaItem[]; +} diff --git a/src/api/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts b/src/api/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts new file mode 100644 index 0000000..9b1358a --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * credentialSubjectSchema: [{ + * name: "username", + * type: "string" + * }, { + * name: "courses_completed", + * type: "uint64" + * }, { + * name: "courses", + * type: "Course[]" + * }] + * } + */ +export interface CreateTypeRequest { + credentialSubjectSchema: Crossmint.CreateTypeRequestCredentialSubjectSchemaItem[]; + nestedTypeSchema?: Crossmint.CreateTypeRequestNestedTypeSchemaItem[]; +} diff --git a/src/api/resources/verifiableCredentials/client/requests/IssueVcRequest.ts b/src/api/resources/verifiableCredentials/client/requests/IssueVcRequest.ts new file mode 100644 index 0000000..f538530 --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/requests/IssueVcRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * recipient: "polygon:0x1234abcde... or email::polygon", + * credential: { + * subject: { + * "subjectName": "foo", + * "subjectAge": 20, + * "claim": "bar" + * } + * } + * } + */ +export interface IssueVcRequest { + /** Recipient address in the format of `:
` or `email::`. */ + recipient: string; + metadata?: Crossmint.IssueVcRequestMetadata; + credential: Crossmint.IssueVcRequestCredential; +} diff --git a/src/api/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts b/src/api/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts new file mode 100644 index 0000000..4d92ea2 --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../../index"; + +/** + * @example + * { + * metadata: { + * name: "Verifiable Credential", + * description: "The owner of this credential is authorized." + * }, + * credentials: { + * type: "degreeForMastersStudent" + * } + * } + */ +export interface VcCreateTemplateRequest { + metadata: Crossmint.VcCreateTemplateRequestMetadata; + /** Credentials parameters */ + credentials: Crossmint.VcCreateTemplateRequestCredentials; +} diff --git a/src/api/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts b/src/api/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts new file mode 100644 index 0000000..c8f7942 --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * credential: { + * "key": "value" + * } + * } + * + * @example + * { + * credential: { + * "key": "value" + * } + * } + * + * @example + * { + * credential: { + * "key": "value" + * } + * } + * + * @example + * { + * credential: { + * "key": "value" + * } + * } + */ +export interface VerifyCredentialRequest { + /** The JSON representing a credential. */ + credential: Record; +} diff --git a/src/api/resources/verifiableCredentials/client/requests/index.ts b/src/api/resources/verifiableCredentials/client/requests/index.ts new file mode 100644 index 0000000..215a3a5 --- /dev/null +++ b/src/api/resources/verifiableCredentials/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type VerifyCredentialRequest } from "./VerifyCredentialRequest"; +export { type VcCreateTemplateRequest } from "./VcCreateTemplateRequest"; +export { type IssueVcRequest } from "./IssueVcRequest"; +export { type CreateTypeRequest } from "./CreateTypeRequest"; +export { type CreateTypeIdempotentRequest } from "./CreateTypeIdempotentRequest"; diff --git a/src/api/resources/verifiableCredentials/index.ts b/src/api/resources/verifiableCredentials/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/verifiableCredentials/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts b/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts new file mode 100644 index 0000000..1a0790e --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateTypeIdempotentRequestCredentialSubjectSchemaItem { + /** The name of credential subject property */ + name: string; + /** The type of credential subject property */ + type: string; +} diff --git a/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts b/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts new file mode 100644 index 0000000..a12a0d5 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateTypeIdempotentRequestNestedTypeSchemaItem { + name: string; + type: string; +} diff --git a/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts b/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts new file mode 100644 index 0000000..2b61130 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateTypeIdempotentResponse { + /** The type name */ + id?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts b/src/api/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts new file mode 100644 index 0000000..8b0fb2c --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateTypeRequestCredentialSubjectSchemaItem { + /** The name of credential subject property */ + name: string; + /** The type of credential subject property */ + type: string; +} diff --git a/src/api/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts b/src/api/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts new file mode 100644 index 0000000..ec3d97a --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateTypeRequestNestedTypeSchemaItem { + name: string; + type: string; +} diff --git a/src/api/resources/verifiableCredentials/types/CreateTypeResponse.ts b/src/api/resources/verifiableCredentials/types/CreateTypeResponse.ts new file mode 100644 index 0000000..6ac3f25 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/CreateTypeResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateTypeResponse { + /** The type name */ + id?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/GetTypeResponse.ts b/src/api/resources/verifiableCredentials/types/GetTypeResponse.ts new file mode 100644 index 0000000..a7a456b --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/GetTypeResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface GetTypeResponse { + name?: string; + credentialSubjectSchema?: Crossmint.GetTypeResponseCredentialSubjectSchemaItem[]; +} diff --git a/src/api/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts b/src/api/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts new file mode 100644 index 0000000..ad7af3f --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetTypeResponseCredentialSubjectSchemaItem { + name?: string; + type?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/IssueVcRequestCredential.ts b/src/api/resources/verifiableCredentials/types/IssueVcRequestCredential.ts new file mode 100644 index 0000000..2c14267 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/IssueVcRequestCredential.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface IssueVcRequestCredential { + /** The credential claims object, matching the schema defined on the collection types. */ + subject: Record; + /** optional expiration date in ISO 8601 */ + expiresAt?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts b/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts new file mode 100644 index 0000000..e50147f --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface IssueVcRequestMetadata { + /** The name of your NFT (Max length: 32) */ + name: string; + /** Direct link to your NFT image */ + image: string; + /** A brief description of the NFT (Max length: 64) */ + description: string; + /** + * **EVM only** + * + * [See more info here](/minting/advanced/nft-metadata) + */ + animationUrl?: string; + /** Add attributes to your NFT */ + attributes?: Crossmint.IssueVcRequestMetadataAttributesItem[]; +} diff --git a/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts b/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts new file mode 100644 index 0000000..4d63de9 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface IssueVcRequestMetadataAttributesItem { + /** Display name of your attribute */ + displayType?: Crossmint.IssueVcRequestMetadataAttributesItemDisplayType; + /** The name of the trait */ + traitType: string; + /** The value of the trait */ + value: string; +} diff --git a/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts b/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts new file mode 100644 index 0000000..e437937 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Display name of your attribute + */ +export type IssueVcRequestMetadataAttributesItemDisplayType = "boost_number" | "boost_percentage" | "number"; + +export const IssueVcRequestMetadataAttributesItemDisplayType = { + BoostNumber: "boost_number", + BoostPercentage: "boost_percentage", + Number: "number", +} as const; diff --git a/src/api/resources/verifiableCredentials/types/IssueVcResponse.ts b/src/api/resources/verifiableCredentials/types/IssueVcResponse.ts new file mode 100644 index 0000000..5e5fec4 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/IssueVcResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface IssueVcResponse { + /** The credential id */ + credentialId?: string; + id?: string; + onChain?: Crossmint.IssueVcResponseOnChain; +} diff --git a/src/api/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts b/src/api/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts new file mode 100644 index 0000000..467d692 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface IssueVcResponseOnChain { + status?: string; + chain?: string; + contractAddress?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts b/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts new file mode 100644 index 0000000..5801d17 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +/** + * Credentials parameters + */ +export interface VcCreateTemplateRequestCredentials { + /** The type of credentials inside the collection (blank or 'default' in case no custom type is used) */ + type: string; + /** Where to store the credential */ + storage?: string; + /** Only if storage is 'delegated', the endpoint to retrieve the credential from */ + delegatedStorageEndpoint?: string; + /** Whether to encrypt the credential using the recipient's wallet */ + encryption?: string; + /** Issuer information, fill only if using delegatedStorage */ + delegatedIssuer?: Crossmint.VcCreateTemplateRequestCredentialsDelegatedIssuer; +} diff --git a/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts b/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts new file mode 100644 index 0000000..f781f56 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Issuer information, fill only if using delegatedStorage + */ +export interface VcCreateTemplateRequestCredentialsDelegatedIssuer { + /** The issuer's did */ + did?: string; + /** The issuer's endpoint to sign credentials */ + endpoint?: string; + /** Token used for auth on the issuer endpoint */ + token?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts b/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts new file mode 100644 index 0000000..fc613b1 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface VcCreateTemplateRequestMetadata { + /** The name of your collection (Max length: 32) */ + name: string; + /** A brief description of credential (Max length: 64) */ + description: string; +} diff --git a/src/api/resources/verifiableCredentials/types/VerifyCredentialResponse.ts b/src/api/resources/verifiableCredentials/types/VerifyCredentialResponse.ts new file mode 100644 index 0000000..e864115 --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/VerifyCredentialResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface VerifyCredentialResponse { + isValid?: boolean; + error?: string; +} diff --git a/src/api/resources/verifiableCredentials/types/index.ts b/src/api/resources/verifiableCredentials/types/index.ts new file mode 100644 index 0000000..ff303ad --- /dev/null +++ b/src/api/resources/verifiableCredentials/types/index.ts @@ -0,0 +1,18 @@ +export * from "./VerifyCredentialResponse"; +export * from "./VcCreateTemplateRequestMetadata"; +export * from "./VcCreateTemplateRequestCredentialsDelegatedIssuer"; +export * from "./VcCreateTemplateRequestCredentials"; +export * from "./IssueVcRequestMetadataAttributesItemDisplayType"; +export * from "./IssueVcRequestMetadataAttributesItem"; +export * from "./IssueVcRequestMetadata"; +export * from "./IssueVcRequestCredential"; +export * from "./IssueVcResponseOnChain"; +export * from "./IssueVcResponse"; +export * from "./CreateTypeRequestCredentialSubjectSchemaItem"; +export * from "./CreateTypeRequestNestedTypeSchemaItem"; +export * from "./CreateTypeResponse"; +export * from "./GetTypeResponseCredentialSubjectSchemaItem"; +export * from "./GetTypeResponse"; +export * from "./CreateTypeIdempotentRequestCredentialSubjectSchemaItem"; +export * from "./CreateTypeIdempotentRequestNestedTypeSchemaItem"; +export * from "./CreateTypeIdempotentResponse"; diff --git a/src/api/resources/wallet/client/Client.ts b/src/api/resources/wallet/client/Client.ts new file mode 100644 index 0000000..581c63c --- /dev/null +++ b/src/api/resources/wallet/client/Client.ts @@ -0,0 +1,301 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Crossmint from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Wallet { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + /** Override the Authorization header */ + authorization: core.Supplier; + /** Override the X-CLIENT-ID header */ + clientId: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Authorization header */ + authorization?: string; + /** Override the X-CLIENT-ID header */ + clientId?: string; + } +} + +export class Wallet { + constructor(protected readonly _options: Wallet.Options) {} + + /** + * Fetch the addresses of a user's Crossmint custodial wallets + * + * **API scope required**: `wallets.read` + * + * @param {Crossmint.FetchWalletRequest} request + * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.UnauthorizedError} + * + * @example + * await client.wallet.fetchWallet() + */ + public async fetchWallet( + request: Crossmint.FetchWalletRequest = {}, + requestOptions?: Wallet.RequestOptions + ): Promise { + const { userId, email } = request; + const _queryParams: Record = {}; + if (userId != null) { + _queryParams["userId"] = userId; + } + + if (email != null) { + _queryParams["email"] = email; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/wallets" + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.wallet.fetchWallet.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 401: + throw new Crossmint.UnauthorizedError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a new Crossmint custodial wallet for a user + * + * **API scope required**: `wallets.create` + * + * @param {Crossmint.CreateWalletRequest} request + * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * @throws {@link Crossmint.UnauthorizedError} + * + * @example + * await client.wallet.createWallet({ + * email: "email", + * chain: Crossmint.AllChains.Arbitrum + * }) + */ + public async createWallet( + request: Crossmint.CreateWalletRequest, + requestOptions?: Wallet.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + "v1-alpha1/wallets" + ), + method: "POST", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateWalletRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateWalletResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + case 401: + throw new Crossmint.UnauthorizedError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Fetch the NFTs in a provided wallet + * + * **API scope required**: `wallets:nfts.read` + * + * @param {string} identifier - The wallet identifier in the format of `:
`, `email::` or `userId::`. + * @param {Crossmint.FetchContentFromWalletRequest} request + * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Crossmint.BadRequestError} + * + * @example + * await client.wallet.fetchContentFromWallet("identifier", { + * page: "page", + * perPage: "perPage" + * }) + */ + public async fetchContentFromWallet( + identifier: string, + request: Crossmint.FetchContentFromWalletRequest, + requestOptions?: Wallet.RequestOptions + ): Promise { + const { page, perPage } = request; + const _queryParams: Record = {}; + _queryParams["page"] = page; + _queryParams["perPage"] = perPage; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CrossmintEnvironment.Default, + `2022-06-09/wallets/${encodeURIComponent(identifier)}/nfts` + ), + method: "GET", + headers: { + "X-CLIENT-ID": await core.Supplier.get(this._options.clientId), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "crossmint", + "X-Fern-SDK-Version": "0.0.9", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.FetchContentFromWalletResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Crossmint.BadRequestError(_response.error.body); + default: + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CrossmintError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CrossmintTimeoutError(); + case "unknown": + throw new errors.CrossmintError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const authorizationValue = await core.Supplier.get(this._options.authorization); + const apiKeyValue = await core.Supplier.get(this._options.apiKey); + return { Authorization: authorizationValue, "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/wallet/client/index.ts b/src/api/resources/wallet/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/wallet/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/wallet/client/requests/FetchContentFromWalletRequest.ts b/src/api/resources/wallet/client/requests/FetchContentFromWalletRequest.ts new file mode 100644 index 0000000..a529d65 --- /dev/null +++ b/src/api/resources/wallet/client/requests/FetchContentFromWalletRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * page: "page", + * perPage: "perPage" + * } + */ +export interface FetchContentFromWalletRequest { + /** + * Page index + */ + page: string; + /** + * Number of items to display per page + */ + perPage: string; +} diff --git a/src/api/resources/wallet/client/requests/FetchWalletRequest.ts b/src/api/resources/wallet/client/requests/FetchWalletRequest.ts new file mode 100644 index 0000000..f137ead --- /dev/null +++ b/src/api/resources/wallet/client/requests/FetchWalletRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface FetchWalletRequest { + /** + * Unique identifier for your user. Any arbitrary string can be passed here. + */ + userId?: string; + /** + * The email used when creating the wallet + */ + email?: string; +} diff --git a/src/api/resources/wallet/client/requests/index.ts b/src/api/resources/wallet/client/requests/index.ts new file mode 100644 index 0000000..78f0ab2 --- /dev/null +++ b/src/api/resources/wallet/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type FetchWalletRequest } from "./FetchWalletRequest"; +export { type FetchContentFromWalletRequest } from "./FetchContentFromWalletRequest"; diff --git a/src/api/resources/wallet/index.ts b/src/api/resources/wallet/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/wallet/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/wallet/types/CreateWalletRequest.ts b/src/api/resources/wallet/types/CreateWalletRequest.ts new file mode 100644 index 0000000..ec5cc85 --- /dev/null +++ b/src/api/resources/wallet/types/CreateWalletRequest.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type CreateWalletRequest = Crossmint.Email | Crossmint.UserId; diff --git a/src/api/resources/wallet/types/CreateWalletResponse.ts b/src/api/resources/wallet/types/CreateWalletResponse.ts new file mode 100644 index 0000000..aa2b37f --- /dev/null +++ b/src/api/resources/wallet/types/CreateWalletResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateWalletResponse { + /** The blockchain the wallet is on */ + chain?: string; + /** The address of the created wallet */ + publicKey?: string; +} diff --git a/src/api/resources/wallet/types/Email.ts b/src/api/resources/wallet/types/Email.ts new file mode 100644 index 0000000..64c13b6 --- /dev/null +++ b/src/api/resources/wallet/types/Email.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface Email { + /** Provide an email for this wallet to be associated to */ + email: string; + chain: Crossmint.AllChains; +} diff --git a/src/api/resources/wallet/types/FetchContentFromWalletResponse.ts b/src/api/resources/wallet/types/FetchContentFromWalletResponse.ts new file mode 100644 index 0000000..f39b758 --- /dev/null +++ b/src/api/resources/wallet/types/FetchContentFromWalletResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export type FetchContentFromWalletResponse = Crossmint.Nftevm | Crossmint.NftSolana; diff --git a/src/api/resources/wallet/types/UserId.ts b/src/api/resources/wallet/types/UserId.ts new file mode 100644 index 0000000..9cc9ae6 --- /dev/null +++ b/src/api/resources/wallet/types/UserId.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../../../index"; + +export interface UserId { + /** Provide an arbitrary ID for this wallet to be associated to */ + userId: string; + chain: Crossmint.AllChains; +} diff --git a/src/api/resources/wallet/types/index.ts b/src/api/resources/wallet/types/index.ts new file mode 100644 index 0000000..9e8bf51 --- /dev/null +++ b/src/api/resources/wallet/types/index.ts @@ -0,0 +1,5 @@ +export * from "./Email"; +export * from "./UserId"; +export * from "./CreateWalletRequest"; +export * from "./CreateWalletResponse"; +export * from "./FetchContentFromWalletResponse"; diff --git a/src/api/types/AllChains.ts b/src/api/types/AllChains.ts new file mode 100644 index 0000000..b620746 --- /dev/null +++ b/src/api/types/AllChains.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specify the name of the blockchain + */ +export type AllChains = + | "arbitrum" + | "arbitrumnova" + | "arbitrum-sepolia" + | "base" + | "base-sepolia" + | "bsc" + | "ethereum" + | "ethereum-sepolia" + | "optimism" + | "optimism-sepolia" + | "polygon" + | "polygon-amoy" + | "skale-nebula" + | "skale-nebula-testnet" + | "solana" + | "zkyoto" + | "zora" + | "zora-sepolia"; + +export const AllChains = { + Arbitrum: "arbitrum", + Arbitrumnova: "arbitrumnova", + ArbitrumSepolia: "arbitrum-sepolia", + Base: "base", + BaseSepolia: "base-sepolia", + Bsc: "bsc", + Ethereum: "ethereum", + EthereumSepolia: "ethereum-sepolia", + Optimism: "optimism", + OptimismSepolia: "optimism-sepolia", + Polygon: "polygon", + PolygonAmoy: "polygon-amoy", + SkaleNebula: "skale-nebula", + SkaleNebulaTestnet: "skale-nebula-testnet", + Solana: "solana", + Zkyoto: "zkyoto", + Zora: "zora", + ZoraSepolia: "zora-sepolia", +} as const; diff --git a/src/api/types/BadRequestErrorBody.ts b/src/api/types/BadRequestErrorBody.ts new file mode 100644 index 0000000..3b5dc18 --- /dev/null +++ b/src/api/types/BadRequestErrorBody.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export type BadRequestErrorBody = + | Crossmint.OutdatedContract + | Crossmint.OldCollection + | Crossmint.SolanaNotSupported + | Crossmint.ExternalCollection + | Crossmint.SftCollection; diff --git a/src/api/types/BatchError.ts b/src/api/types/BatchError.ts new file mode 100644 index 0000000..502deeb --- /dev/null +++ b/src/api/types/BatchError.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface BatchError { + error?: boolean; + message?: string; + /** A list of specific validation errors. */ + validationErrors?: Crossmint.ValidationError[]; +} diff --git a/src/api/types/BatchMintResponse.ts b/src/api/types/BatchMintResponse.ts new file mode 100644 index 0000000..364aa9b --- /dev/null +++ b/src/api/types/BatchMintResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface BatchMintResponse { + results: Crossmint.MintResponseEvm200[]; +} diff --git a/src/api/types/BurnNftResponse.ts b/src/api/types/BurnNftResponse.ts new file mode 100644 index 0000000..4807832 --- /dev/null +++ b/src/api/types/BurnNftResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface BurnNftResponse { + /** Can be used to check the status via the [action status API](/api-reference/common/get-action-status) */ + actionId?: string; + /** The action performed, in this case `nfts.delete` */ + action?: string; + /** Current status of the async operation. One of `pending` or `succeeded` */ + status?: string; + data?: Crossmint.BurnNftResponseData; + /** The time this operation was initiated in UTC. */ + startedAt?: Date; + /** + * The time this operation completed in UTC. + * + * This is only present when `status` is `succeeded` + */ + completedAt?: Date; + /** The URL path to obtain current status with [action status api](/api-reference/common/get-action-status) */ + resource?: string; +} diff --git a/src/api/types/BurnNftResponseData.ts b/src/api/types/BurnNftResponseData.ts new file mode 100644 index 0000000..31a2f93 --- /dev/null +++ b/src/api/types/BurnNftResponseData.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface BurnNftResponseData { + /** Refer to the [supported chains](/introduction/supported-chains) page for more info */ + chain?: string; + /** + * The onchain transaction ID related to the request. + * + * This is only present when `status` is `succeeded` + */ + txId?: string; + collection?: Crossmint.BurnNftResponseDataCollection; + token?: Crossmint.BurnNftResponseDataToken; +} diff --git a/src/api/types/BurnNftResponseDataCollection.ts b/src/api/types/BurnNftResponseDataCollection.ts new file mode 100644 index 0000000..f32d195 --- /dev/null +++ b/src/api/types/BurnNftResponseDataCollection.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface BurnNftResponseDataCollection { + /** The Crossmint identifier for the collection. Either a UUID or custom string depending on how you create the collection. */ + id?: string; + /** The on-chain contract address for the given collection. */ + contractAddress?: string; +} diff --git a/src/api/types/BurnNftResponseDataToken.ts b/src/api/types/BurnNftResponseDataToken.ts new file mode 100644 index 0000000..00ed7f1 --- /dev/null +++ b/src/api/types/BurnNftResponseDataToken.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface BurnNftResponseDataToken { + /** The Crossmint identifier for the NFT. This will be a UUID. */ + id?: string; + /** The numeric tokenId of the NFT in the contract. */ + tokenId?: string; +} diff --git a/src/api/types/Cardano.ts b/src/api/types/Cardano.ts new file mode 100644 index 0000000..9529ea1 --- /dev/null +++ b/src/api/types/Cardano.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +/** + * cardano + */ +export type Cardano = Crossmint.NftcarItem[]; diff --git a/src/api/types/Checkout.ts b/src/api/types/Checkout.ts new file mode 100644 index 0000000..1c9b7c1 --- /dev/null +++ b/src/api/types/Checkout.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface Checkout { + /** Your Crossmint developer collection ID, found in the developer console: https://www.crossmint.com/console/collections */ + clientId: string; + collection?: Crossmint.Collection; + redirect?: Crossmint.Redirect; + mintConfig?: Crossmint.MintConfig; + /** The email address for mint confirmation */ + emailTo?: string; + /** A wallet address to mint the NFT to */ + mintTo?: string; + /** The payment method, either `"fiat"` or `"ETH"` */ + paymentMethod?: string; + /** Any arguments to included in the webhook status updates */ + whPassThroughArgs?: Record; + /** The listing ID in a marketplace. Most contracts will not use this */ + listingId?: string; +} diff --git a/src/api/types/CheckoutMintSuccess.ts b/src/api/types/CheckoutMintSuccess.ts new file mode 100644 index 0000000..17de950 --- /dev/null +++ b/src/api/types/CheckoutMintSuccess.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CheckoutMintSuccess { + /** A URL to send the user to in order to capture payment and start the minting process */ + checkoutUrl?: string; +} diff --git a/src/api/types/Collection.ts b/src/api/types/Collection.ts new file mode 100644 index 0000000..ac64533 --- /dev/null +++ b/src/api/types/Collection.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Information about your collection, to be displayed on the checkout page. + */ +export interface Collection { + /** The title of your collection */ + title?: string; + /** A description for your collection */ + description?: string; + /** Full URL to an image for your collection. */ + photo?: string; +} diff --git a/src/api/types/Compressed.ts b/src/api/types/Compressed.ts new file mode 100644 index 0000000..39655d2 --- /dev/null +++ b/src/api/types/Compressed.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * **Solana only** Use NFT compression for cheaper mint costs [Default: true] + */ +export type Compressed = boolean; diff --git a/src/api/types/CreateCollectionBody.ts b/src/api/types/CreateCollectionBody.ts new file mode 100644 index 0000000..2e2414e --- /dev/null +++ b/src/api/types/CreateCollectionBody.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface CreateCollectionBody { + /** Blockchain you would like to use for this collection */ + chain: Crossmint.CreateCollectionBodyChain; + metadata: Crossmint.CreateCollectionBodyMetadata; + /** Whether or not this collection is fungible. Only EVM collections may be set as semi-fungible */ + fungibility?: Crossmint.CreateCollectionBodyFungibility; + /** The maximum number of tokens that can be minted for this collection */ + supplyLimit?: number; + payments?: Crossmint.PaymentsObject; + reuploadLinkedFiles?: Crossmint.ReuploadLinkedFiles; +} diff --git a/src/api/types/CreateCollectionBodyChain.ts b/src/api/types/CreateCollectionBodyChain.ts new file mode 100644 index 0000000..f423fdc --- /dev/null +++ b/src/api/types/CreateCollectionBodyChain.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Blockchain you would like to use for this collection + */ +export type CreateCollectionBodyChain = + | "aptos" + | "arbitrum" + | "arbitrum-sepolia" + | "astar-zkevm" + | "base" + | "base-sepolia" + | "bsc" + | "ethereum" + | "ethereum-sepolia" + | "optimism" + | "optimism-sepolia" + | "polygon" + | "polygon-amoy" + | "skale-nebula" + | "skale-nebula-testnet" + | "solana" + | "zkyoto" + | "zora" + | "zora-sepolia"; + +export const CreateCollectionBodyChain = { + Aptos: "aptos", + Arbitrum: "arbitrum", + ArbitrumSepolia: "arbitrum-sepolia", + AstarZkevm: "astar-zkevm", + Base: "base", + BaseSepolia: "base-sepolia", + Bsc: "bsc", + Ethereum: "ethereum", + EthereumSepolia: "ethereum-sepolia", + Optimism: "optimism", + OptimismSepolia: "optimism-sepolia", + Polygon: "polygon", + PolygonAmoy: "polygon-amoy", + SkaleNebula: "skale-nebula", + SkaleNebulaTestnet: "skale-nebula-testnet", + Solana: "solana", + Zkyoto: "zkyoto", + Zora: "zora", + ZoraSepolia: "zora-sepolia", +} as const; diff --git a/src/api/types/CreateCollectionBodyFungibility.ts b/src/api/types/CreateCollectionBodyFungibility.ts new file mode 100644 index 0000000..1fa3e5d --- /dev/null +++ b/src/api/types/CreateCollectionBodyFungibility.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Whether or not this collection is fungible. Only EVM collections may be set as semi-fungible + */ +export type CreateCollectionBodyFungibility = "non-fungible" | "semi-fungible"; + +export const CreateCollectionBodyFungibility = { + NonFungible: "non-fungible", + SemiFungible: "semi-fungible", +} as const; diff --git a/src/api/types/CreateCollectionBodyMetadata.ts b/src/api/types/CreateCollectionBodyMetadata.ts new file mode 100644 index 0000000..32678bc --- /dev/null +++ b/src/api/types/CreateCollectionBodyMetadata.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateCollectionBodyMetadata { + /** Collection name (Max length: 32) */ + name: string; + /** URL pointing to an image that represents the collection */ + imageUrl?: string; + /** A description of the NFT collection */ + description: string; + /** **EVM only** NFT collection symbol */ + symbol?: string; +} diff --git a/src/api/types/CreateCollectionResponse.ts b/src/api/types/CreateCollectionResponse.ts new file mode 100644 index 0000000..a316c35 --- /dev/null +++ b/src/api/types/CreateCollectionResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface CreateCollectionResponse { + id?: string; + metadata?: Crossmint.CreateCollectionResponseMetadata; + fungibility?: string; + onChain?: Crossmint.CreateCollectionResponseOnChain; + actionId?: string; +} diff --git a/src/api/types/CreateCollectionResponseMetadata.ts b/src/api/types/CreateCollectionResponseMetadata.ts new file mode 100644 index 0000000..149a708 --- /dev/null +++ b/src/api/types/CreateCollectionResponseMetadata.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateCollectionResponseMetadata { + name?: string; + description?: string; + imageUrl?: string; + symbol?: string; +} diff --git a/src/api/types/CreateCollectionResponseOnChain.ts b/src/api/types/CreateCollectionResponseOnChain.ts new file mode 100644 index 0000000..1cb2a3a --- /dev/null +++ b/src/api/types/CreateCollectionResponseOnChain.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateCollectionResponseOnChain { + chain?: string; + type?: string; +} diff --git a/src/api/types/CreateTemplateBody.ts b/src/api/types/CreateTemplateBody.ts new file mode 100644 index 0000000..b75da69 --- /dev/null +++ b/src/api/types/CreateTemplateBody.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface CreateTemplateBody { + /** See https://docs.crossmint.com/docs/metadata for more info */ + metadata?: Crossmint.CreateTemplateBodyMetadata; + /** On-chain details */ + onChain?: Crossmint.CreateTemplateBodyOnChain; + /** Supply details */ + supply?: Crossmint.CreateTemplateBodySupply; + reuploadLinkedFiles?: Crossmint.ReuploadLinkedFiles; +} diff --git a/src/api/types/CreateTemplateBodyMetadata.ts b/src/api/types/CreateTemplateBodyMetadata.ts new file mode 100644 index 0000000..93f8771 --- /dev/null +++ b/src/api/types/CreateTemplateBodyMetadata.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * See https://docs.crossmint.com/docs/metadata for more info + */ +export interface CreateTemplateBodyMetadata { + /** Template name */ + name?: string; + image?: string; + description?: string; +} diff --git a/src/api/types/CreateTemplateBodyOnChain.ts b/src/api/types/CreateTemplateBodyOnChain.ts new file mode 100644 index 0000000..ede8d94 --- /dev/null +++ b/src/api/types/CreateTemplateBodyOnChain.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * On-chain details + */ +export interface CreateTemplateBodyOnChain { + /** The token ID. Only relevant for SFT (ERC-1155) collections. Leave empty for NFT/ERC-721 collections. */ + tokenId?: string; +} diff --git a/src/api/types/CreateTemplateBodySupply.ts b/src/api/types/CreateTemplateBodySupply.ts new file mode 100644 index 0000000..79f27a1 --- /dev/null +++ b/src/api/types/CreateTemplateBodySupply.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supply details + */ +export interface CreateTemplateBodySupply { + /** Supply limit, Set to 1 for ERC721. */ + limit?: number; +} diff --git a/src/api/types/EditNftResponse.ts b/src/api/types/EditNftResponse.ts new file mode 100644 index 0000000..f52e07d --- /dev/null +++ b/src/api/types/EditNftResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface EditNftResponse { + actionId?: string; + action?: string; + status?: string; + data?: Crossmint.EditNftResponseData; + startedAt?: Date; + /** + * The time this operation completed in UTC. + * + * This is only present when `status` is `succeeded` + */ + completedAt?: Date; + resource?: string; +} diff --git a/src/api/types/EditNftResponseData.ts b/src/api/types/EditNftResponseData.ts new file mode 100644 index 0000000..cf557fb --- /dev/null +++ b/src/api/types/EditNftResponseData.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface EditNftResponseData { + /** + * The onchain transaction ID related to the request. + * + * This is only present when `status` is `succeeded` + */ + txId?: string; + chain?: string; + collection?: Crossmint.EditNftResponseDataCollection; + token?: Crossmint.EditNftResponseDataToken; + changes?: string[]; +} diff --git a/src/api/types/EditNftResponseDataCollection.ts b/src/api/types/EditNftResponseDataCollection.ts new file mode 100644 index 0000000..6d68ad9 --- /dev/null +++ b/src/api/types/EditNftResponseDataCollection.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EditNftResponseDataCollection { + id?: string; + contractAddress?: string; +} diff --git a/src/api/types/EditNftResponseDataToken.ts b/src/api/types/EditNftResponseDataToken.ts new file mode 100644 index 0000000..f7a5054 --- /dev/null +++ b/src/api/types/EditNftResponseDataToken.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface EditNftResponseDataToken { + id?: string; + owner?: Crossmint.EditNftResponseDataTokenOwner; + tokenId?: string; +} diff --git a/src/api/types/EditNftResponseDataTokenOwner.ts b/src/api/types/EditNftResponseDataTokenOwner.ts new file mode 100644 index 0000000..783fbdb --- /dev/null +++ b/src/api/types/EditNftResponseDataTokenOwner.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EditNftResponseDataTokenOwner { + walletAddress?: string; +} diff --git a/src/api/types/NotFoundResponse.ts b/src/api/types/Error400Response.ts similarity index 76% rename from src/api/types/NotFoundResponse.ts rename to src/api/types/Error400Response.ts index 14ad0e6..29b7590 100644 --- a/src/api/types/NotFoundResponse.ts +++ b/src/api/types/Error400Response.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface NotFoundResponse { +export interface Error400Response { error?: boolean; message?: string; } diff --git a/src/api/types/BadRequestResponse.ts b/src/api/types/Error403Response.ts similarity index 75% rename from src/api/types/BadRequestResponse.ts rename to src/api/types/Error403Response.ts index f22f8cd..24cca90 100644 --- a/src/api/types/BadRequestResponse.ts +++ b/src/api/types/Error403Response.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface BadRequestResponse { +export interface Error403Response { error?: boolean; message?: string; } diff --git a/src/api/types/UnauthorizedResponse.ts b/src/api/types/Error404Response.ts similarity index 74% rename from src/api/types/UnauthorizedResponse.ts rename to src/api/types/Error404Response.ts index a7d5705..27a6419 100644 --- a/src/api/types/UnauthorizedResponse.ts +++ b/src/api/types/Error404Response.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface UnauthorizedResponse { +export interface Error404Response { error?: boolean; message?: string; } diff --git a/src/api/types/ServiceUnavailabileResponse.ts b/src/api/types/Error503Response.ts similarity index 71% rename from src/api/types/ServiceUnavailabileResponse.ts rename to src/api/types/Error503Response.ts index 30aec3b..6bdbfc9 100644 --- a/src/api/types/ServiceUnavailabileResponse.ts +++ b/src/api/types/Error503Response.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface ServiceUnavailabileResponse { +export interface Error503Response { error?: boolean; message?: string; } diff --git a/src/api/types/ErrorMsg.ts b/src/api/types/ErrorMsg.ts new file mode 100644 index 0000000..03be70e --- /dev/null +++ b/src/api/types/ErrorMsg.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ErrorMsg { + error?: boolean; + message?: string; +} diff --git a/src/api/types/Error_.ts b/src/api/types/Error_.ts new file mode 100644 index 0000000..2d35c0e --- /dev/null +++ b/src/api/types/Error_.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Error_ { + error?: string; +} diff --git a/src/api/types/EvmChains.ts b/src/api/types/EvmChains.ts new file mode 100644 index 0000000..ac8b66c --- /dev/null +++ b/src/api/types/EvmChains.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type EvmChains = + | "arbitrum" + | "arbitrumnova" + | "arbitrum-sepolia" + | "base" + | "base-sepolia" + | "bsc" + | "ethereum" + | "ethereum-sepolia" + | "optimism" + | "optimism-sepolia" + | "polygon" + | "polygon-amoy" + | "zkyoto" + | "zora" + | "zora-sepolia"; + +export const EvmChains = { + Arbitrum: "arbitrum", + Arbitrumnova: "arbitrumnova", + ArbitrumSepolia: "arbitrum-sepolia", + Base: "base", + BaseSepolia: "base-sepolia", + Bsc: "bsc", + Ethereum: "ethereum", + EthereumSepolia: "ethereum-sepolia", + Optimism: "optimism", + OptimismSepolia: "optimism-sepolia", + Polygon: "polygon", + PolygonAmoy: "polygon-amoy", + Zkyoto: "zkyoto", + Zora: "zora", + ZoraSepolia: "zora-sepolia", +} as const; diff --git a/src/api/types/EvmTransfer.ts b/src/api/types/EvmTransfer.ts new file mode 100644 index 0000000..7433e48 --- /dev/null +++ b/src/api/types/EvmTransfer.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface EvmTransfer { + chain?: Crossmint.EvmChains; + /** The wallet address for the current owner */ + from?: string; + /** The wallet address the token should be transferred to */ + to?: string; + /** The contract address of the token to transfer */ + contractAddress?: string; + /** The numeric tokenId of the token to be transferred */ + tokenId?: string; + /** Required for ERC-1155 only, not relevant for ERC-721 tokens */ + quantity?: string; +} diff --git a/src/api/types/ExternalCollection.ts b/src/api/types/ExternalCollection.ts new file mode 100644 index 0000000..aa57f78 --- /dev/null +++ b/src/api/types/ExternalCollection.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ExternalCollection { + message?: string; +} diff --git a/src/api/types/FourHundredNineResponse.ts b/src/api/types/FourHundredNineResponse.ts new file mode 100644 index 0000000..88aebc6 --- /dev/null +++ b/src/api/types/FourHundredNineResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface FourHundredNineResponse { + error?: boolean; + message?: string; +} diff --git a/src/api/types/FourHundredTwentyFourResponse.ts b/src/api/types/FourHundredTwentyFourResponse.ts new file mode 100644 index 0000000..9dde808 --- /dev/null +++ b/src/api/types/FourHundredTwentyFourResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface FourHundredTwentyFourResponse { + error?: boolean; + message?: string; +} diff --git a/src/api/types/GetCollectionResponse.ts b/src/api/types/GetCollectionResponse.ts new file mode 100644 index 0000000..5dd3588 --- /dev/null +++ b/src/api/types/GetCollectionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface GetCollectionResponse { + id?: string; + metadata?: Crossmint.GetCollectionResponseMetadata; + fungibility?: string; + onChain?: Crossmint.GetCollectionResponseOnChain; + supplyLimit?: number; + payments?: Crossmint.GetCollectionResponsePayments; +} diff --git a/src/api/types/GetCollectionResponseMetadata.ts b/src/api/types/GetCollectionResponseMetadata.ts new file mode 100644 index 0000000..f22c3e6 --- /dev/null +++ b/src/api/types/GetCollectionResponseMetadata.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetCollectionResponseMetadata { + name?: string; + description?: string; + imageUrl?: string; + symbol?: string; +} diff --git a/src/api/types/GetCollectionResponseOnChain.ts b/src/api/types/GetCollectionResponseOnChain.ts new file mode 100644 index 0000000..89f6bde --- /dev/null +++ b/src/api/types/GetCollectionResponseOnChain.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetCollectionResponseOnChain { + chain?: string; + type?: string; + contractAddress?: string; +} diff --git a/src/api/types/GetCollectionResponsePayments.ts b/src/api/types/GetCollectionResponsePayments.ts new file mode 100644 index 0000000..b85e5fb --- /dev/null +++ b/src/api/types/GetCollectionResponsePayments.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetCollectionResponsePayments { + price?: string; + recipientAddress?: string; +} diff --git a/src/api/types/MintApiFeatureCollectionNotDeployed.ts b/src/api/types/MintApiFeatureCollectionNotDeployed.ts new file mode 100644 index 0000000..d25342f --- /dev/null +++ b/src/api/types/MintApiFeatureCollectionNotDeployed.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintApiFeatureCollectionNotDeployed { + error?: boolean; + message?: string; +} diff --git a/src/api/types/MintConfig.ts b/src/api/types/MintConfig.ts new file mode 100644 index 0000000..5c0b733 --- /dev/null +++ b/src/api/types/MintConfig.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Arguments sent to your smart contract + */ +export interface MintConfig { + totalPrice?: string; + /** Any custom arguments to your minting function should be configured here. */ + ""?: Record; +} diff --git a/src/api/types/MintResponseEvm200.ts b/src/api/types/MintResponseEvm200.ts new file mode 100644 index 0000000..119a70d --- /dev/null +++ b/src/api/types/MintResponseEvm200.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface MintResponseEvm200 { + id?: string; + onChain?: Crossmint.MintResponseEvm200OnChain; + actionId?: string; +} diff --git a/src/api/types/MintResponseEvm200OnChain.ts b/src/api/types/MintResponseEvm200OnChain.ts new file mode 100644 index 0000000..d29bd07 --- /dev/null +++ b/src/api/types/MintResponseEvm200OnChain.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintResponseEvm200OnChain { + status?: string; + chain?: string; + contractAddress?: string; +} diff --git a/src/api/types/MintResponseEvm200Subsequent.ts b/src/api/types/MintResponseEvm200Subsequent.ts new file mode 100644 index 0000000..606cb60 --- /dev/null +++ b/src/api/types/MintResponseEvm200Subsequent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface MintResponseEvm200Subsequent extends Crossmint.NftObjectEvm { + /** actionId for the request */ + actionId?: string; +} diff --git a/src/api/types/MintResponseSolana200.ts b/src/api/types/MintResponseSolana200.ts new file mode 100644 index 0000000..e0b6375 --- /dev/null +++ b/src/api/types/MintResponseSolana200.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface MintResponseSolana200 { + id?: string; + onChain?: Crossmint.MintResponseSolana200OnChain; + actionId?: string; +} diff --git a/src/api/types/MintResponseSolana200OnChain.ts b/src/api/types/MintResponseSolana200OnChain.ts new file mode 100644 index 0000000..a06ad82 --- /dev/null +++ b/src/api/types/MintResponseSolana200OnChain.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintResponseSolana200OnChain { + status?: string; + chain?: string; +} diff --git a/src/api/types/MintResponseSolana200Subsequent.ts b/src/api/types/MintResponseSolana200Subsequent.ts new file mode 100644 index 0000000..58dc286 --- /dev/null +++ b/src/api/types/MintResponseSolana200Subsequent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface MintResponseSolana200Subsequent extends Crossmint.NftObjectSolana { + /** actionId for the request */ + actionId?: string; +} diff --git a/src/api/types/MintStatus.ts b/src/api/types/MintStatus.ts new file mode 100644 index 0000000..448f4e0 --- /dev/null +++ b/src/api/types/MintStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface MintStatus { + /** The latest status of the mint */ + status?: Crossmint.MintStatusStatus; + /** The address of the mint */ + mintAddress?: string; + /** The wallet address the NFT is minted to */ + walletAddress?: string; + /** The arguments you sent via the `whPassThroughArgs` from `/checkout/mint` */ + passThroughArgs?: string; +} diff --git a/src/api/types/MintStatusSolana200.ts b/src/api/types/MintStatusSolana200.ts new file mode 100644 index 0000000..2e350d2 --- /dev/null +++ b/src/api/types/MintStatusSolana200.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface MintStatusSolana200 extends Crossmint.NftObjectSolana { + /** URL to API endpoint for requesting status */ + action?: string; +} diff --git a/src/api/types/MintStatusStatus.ts b/src/api/types/MintStatusStatus.ts new file mode 100644 index 0000000..f775e9e --- /dev/null +++ b/src/api/types/MintStatusStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The latest status of the mint + */ +export type MintStatusStatus = "minting" | "success" | "error"; + +export const MintStatusStatus = { + Minting: "minting", + Success: "success", + Error: "error", +} as const; diff --git a/src/api/types/MintingMetadata.ts b/src/api/types/MintingMetadata.ts new file mode 100644 index 0000000..fa05ac0 --- /dev/null +++ b/src/api/types/MintingMetadata.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MintingMetadata { + /** Template name */ + name?: string; + imageUrl?: string; + description?: string; +} diff --git a/src/api/types/Nft.ts b/src/api/types/Nft.ts new file mode 100644 index 0000000..0930137 --- /dev/null +++ b/src/api/types/Nft.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface Nft { + name?: string; + symbol?: string; + description?: string; + /** A url that represents the image for the NFT */ + image?: string; + collection?: Crossmint.NftCollection; + attributes?: Crossmint.NftAttributesItem[]; + properties?: Crossmint.NftProperties; + mintHash?: string; + sellerFeeBasisPoints?: number; +} diff --git a/src/api/types/NftAttributesItem.ts b/src/api/types/NftAttributesItem.ts new file mode 100644 index 0000000..0728254 --- /dev/null +++ b/src/api/types/NftAttributesItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftAttributesItem { + traitType?: string; + value?: Crossmint.NftAttributesItemValue; +} diff --git a/src/api/types/NftAttributesItemValue.ts b/src/api/types/NftAttributesItemValue.ts new file mode 100644 index 0000000..a6c2045 --- /dev/null +++ b/src/api/types/NftAttributesItemValue.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type NftAttributesItemValue = string | number | Record | unknown[]; diff --git a/src/api/types/NftCollection.ts b/src/api/types/NftCollection.ts new file mode 100644 index 0000000..70dd165 --- /dev/null +++ b/src/api/types/NftCollection.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftCollection { + name?: string; + family?: string; +} diff --git a/src/api/types/NftMetadata.ts b/src/api/types/NftMetadata.ts new file mode 100644 index 0000000..221d43e --- /dev/null +++ b/src/api/types/NftMetadata.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftMetadata { + /** The name of your NFT (Max length: 32) */ + name: string; + /** Direct link to your NFT image */ + image: string; + /** A brief description of the NFT (Max length: 64) */ + description: string; + /** + * **EVM only** + * + * [See more info here](/minting/advanced/nft-metadata) + */ + animationUrl?: string; + /** Add attributes to your NFT */ + attributes?: Crossmint.NftMetadataAttributesItem[]; +} diff --git a/src/api/types/NftMetadataAttributesItem.ts b/src/api/types/NftMetadataAttributesItem.ts new file mode 100644 index 0000000..25cd052 --- /dev/null +++ b/src/api/types/NftMetadataAttributesItem.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftMetadataAttributesItem { + /** Display name of your attribute */ + displayType?: Crossmint.NftMetadataAttributesItemDisplayType; + /** The name of the trait */ + traitType: string; + /** The value of the trait */ + value: string; +} diff --git a/src/api/types/NftMetadataAttributesItemDisplayType.ts b/src/api/types/NftMetadataAttributesItemDisplayType.ts new file mode 100644 index 0000000..b221163 --- /dev/null +++ b/src/api/types/NftMetadataAttributesItemDisplayType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Display name of your attribute + */ +export type NftMetadataAttributesItemDisplayType = "boost_number" | "boost_percentage" | "number"; + +export const NftMetadataAttributesItemDisplayType = { + BoostNumber: "boost_number", + BoostPercentage: "boost_percentage", + Number: "number", +} as const; diff --git a/src/api/types/NftMetadataOptions.ts b/src/api/types/NftMetadataOptions.ts new file mode 100644 index 0000000..71e4fad --- /dev/null +++ b/src/api/types/NftMetadataOptions.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +/** + * Optional if [baseURI](/api-reference/minting/collection/set-base-uri) is set. + */ +export type NftMetadataOptions = + | Crossmint.NftMetadata + /** + * Enter a URL to a JSON file containing the metadata contents */ + | string + | Crossmint.NftMetadataSolana + /** + * Enter a URL to a JSON file containing the metadata contents */ + | Crossmint.NftMetadataOptionsName; diff --git a/src/api/types/NftMetadataOptionsName.ts b/src/api/types/NftMetadataOptionsName.ts new file mode 100644 index 0000000..4b3afa2 --- /dev/null +++ b/src/api/types/NftMetadataOptionsName.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enter a URL to a JSON file containing the metadata contents + */ +export interface NftMetadataOptionsName { + /** Enter a URL to a JSON file containing the metadata contents */ + uri: string; + /** The name of your NFT (Max length: 32) */ + name: string; +} diff --git a/src/api/types/NftMetadataSolana.ts b/src/api/types/NftMetadataSolana.ts new file mode 100644 index 0000000..4a987c3 --- /dev/null +++ b/src/api/types/NftMetadataSolana.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftMetadataSolana { + /** The name of your NFT (Max length: 32) */ + name: string; + /** Direct link to your NFT image */ + image: string; + /** A brief description of the NFT (Max length: 64) */ + description: string; + /** Add attributes to your NFT */ + attributes?: Crossmint.NftMetadataSolanaAttributesItem[]; +} diff --git a/src/api/types/NftMetadataSolanaAttributesItem.ts b/src/api/types/NftMetadataSolanaAttributesItem.ts new file mode 100644 index 0000000..38f5646 --- /dev/null +++ b/src/api/types/NftMetadataSolanaAttributesItem.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftMetadataSolanaAttributesItem { + /** Display name of your attribute */ + displayType?: Crossmint.NftMetadataSolanaAttributesItemDisplayType; + /** The name of the trait */ + traitType: string; + /** The value of the trait */ + value: string; +} diff --git a/src/api/types/NftMetadataSolanaAttributesItemDisplayType.ts b/src/api/types/NftMetadataSolanaAttributesItemDisplayType.ts new file mode 100644 index 0000000..0c33975 --- /dev/null +++ b/src/api/types/NftMetadataSolanaAttributesItemDisplayType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Display name of your attribute + */ +export type NftMetadataSolanaAttributesItemDisplayType = "boost_number" | "boost_percentage" | "number"; + +export const NftMetadataSolanaAttributesItemDisplayType = { + BoostNumber: "boost_number", + BoostPercentage: "boost_percentage", + Number: "number", +} as const; diff --git a/src/api/types/NftObjectEvm.ts b/src/api/types/NftObjectEvm.ts new file mode 100644 index 0000000..bfef21b --- /dev/null +++ b/src/api/types/NftObjectEvm.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftObjectEvm { + id?: string; + metadata?: Crossmint.NftObjectEvmMetadata; + onChain?: Crossmint.NftObjectEvmOnChain; +} diff --git a/src/api/types/NftObjectEvmMetadata.ts b/src/api/types/NftObjectEvmMetadata.ts new file mode 100644 index 0000000..a92884d --- /dev/null +++ b/src/api/types/NftObjectEvmMetadata.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftObjectEvmMetadata { + name?: string; + image?: string; + description?: string; +} diff --git a/src/api/types/NftObjectEvmOnChain.ts b/src/api/types/NftObjectEvmOnChain.ts new file mode 100644 index 0000000..73e5c8d --- /dev/null +++ b/src/api/types/NftObjectEvmOnChain.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftObjectEvmOnChain { + status?: string; + tokenId?: string; + owner?: string; + txId?: string; + contractAddress?: string; + chain?: string; +} diff --git a/src/api/types/NftObjectSolana.ts b/src/api/types/NftObjectSolana.ts new file mode 100644 index 0000000..2f385ca --- /dev/null +++ b/src/api/types/NftObjectSolana.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftObjectSolana { + id?: string; + metadata?: Crossmint.NftObjectSolanaMetadata; + onChain?: Crossmint.NftObjectSolanaOnChain; +} diff --git a/src/api/types/NftObjectSolanaMetadata.ts b/src/api/types/NftObjectSolanaMetadata.ts new file mode 100644 index 0000000..6406016 --- /dev/null +++ b/src/api/types/NftObjectSolanaMetadata.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftObjectSolanaMetadata { + name?: string; + symbol?: string; + sellerFeeBasisPoints?: number; + properties?: Crossmint.NftObjectSolanaMetadataProperties; + description?: string; + image?: string; + attributes?: Crossmint.NftObjectSolanaMetadataAttributesItem[]; +} diff --git a/src/api/types/NftObjectSolanaMetadataAttributesItem.ts b/src/api/types/NftObjectSolanaMetadataAttributesItem.ts new file mode 100644 index 0000000..9806437 --- /dev/null +++ b/src/api/types/NftObjectSolanaMetadataAttributesItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftObjectSolanaMetadataAttributesItem { + traitType?: string; + value?: string; +} diff --git a/src/api/types/NftObjectSolanaMetadataProperties.ts b/src/api/types/NftObjectSolanaMetadataProperties.ts new file mode 100644 index 0000000..b51178d --- /dev/null +++ b/src/api/types/NftObjectSolanaMetadataProperties.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftObjectSolanaMetadataProperties { + files?: Crossmint.NftObjectSolanaMetadataPropertiesFilesItem[]; + category?: string; + creators?: Crossmint.NftObjectSolanaMetadataPropertiesCreatorsItem[]; +} diff --git a/src/api/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts b/src/api/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts new file mode 100644 index 0000000..053531f --- /dev/null +++ b/src/api/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftObjectSolanaMetadataPropertiesCreatorsItem { + address?: string; + verified?: boolean; + share?: number; +} diff --git a/src/api/types/NftObjectSolanaMetadataPropertiesFilesItem.ts b/src/api/types/NftObjectSolanaMetadataPropertiesFilesItem.ts new file mode 100644 index 0000000..c5c2dfc --- /dev/null +++ b/src/api/types/NftObjectSolanaMetadataPropertiesFilesItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftObjectSolanaMetadataPropertiesFilesItem { + uri?: string; + type?: string; +} diff --git a/src/api/types/NftObjectSolanaOnChain.ts b/src/api/types/NftObjectSolanaOnChain.ts new file mode 100644 index 0000000..5b17c20 --- /dev/null +++ b/src/api/types/NftObjectSolanaOnChain.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftObjectSolanaOnChain { + status?: string; + mintHash?: string; + txId?: string; + owner?: string; + chain?: string; +} diff --git a/src/api/types/NftProperties.ts b/src/api/types/NftProperties.ts new file mode 100644 index 0000000..8e687a5 --- /dev/null +++ b/src/api/types/NftProperties.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftProperties { + category?: string; + creators?: Crossmint.NftPropertiesCreatorsItem[]; + files?: Crossmint.NftPropertiesFilesItem[]; +} diff --git a/src/api/types/NftPropertiesCreatorsItem.ts b/src/api/types/NftPropertiesCreatorsItem.ts new file mode 100644 index 0000000..b884cc4 --- /dev/null +++ b/src/api/types/NftPropertiesCreatorsItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftPropertiesCreatorsItem { + address?: string; + share?: number; +} diff --git a/src/api/types/NftPropertiesFilesItem.ts b/src/api/types/NftPropertiesFilesItem.ts new file mode 100644 index 0000000..b498e38 --- /dev/null +++ b/src/api/types/NftPropertiesFilesItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftPropertiesFilesItem { + uri?: string; + type?: string; +} diff --git a/src/api/types/NftSolana.ts b/src/api/types/NftSolana.ts new file mode 100644 index 0000000..148211b --- /dev/null +++ b/src/api/types/NftSolana.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +/** + * Solana + */ +export type NftSolana = Crossmint.NftsolItem[]; diff --git a/src/api/types/NftcarItem.ts b/src/api/types/NftcarItem.ts new file mode 100644 index 0000000..e90af3d --- /dev/null +++ b/src/api/types/NftcarItem.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftcarItem { + /** The blockchain used in the request, `cardano` in this case. */ + chain?: string; + /** The unique identifier of this NFT on Cardano */ + assetId?: string; + metadata?: Crossmint.NftcarItemMetadata; + /** The address of the NFT on the blockchain */ + locator?: string; +} diff --git a/src/api/types/NftcarItemMetadata.ts b/src/api/types/NftcarItemMetadata.ts new file mode 100644 index 0000000..80baae8 --- /dev/null +++ b/src/api/types/NftcarItemMetadata.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftcarItemMetadata { + assetId?: string; + name?: string; + description?: string; + image?: string; + attributes?: Crossmint.NftcarItemMetadataAttributesItem[]; +} diff --git a/src/api/types/NftcarItemMetadataAttributesItem.ts b/src/api/types/NftcarItemMetadataAttributesItem.ts new file mode 100644 index 0000000..05de1b4 --- /dev/null +++ b/src/api/types/NftcarItemMetadataAttributesItem.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftcarItemMetadataAttributesItem { + traitType?: string; + value?: string; +} diff --git a/src/api/types/Nftevm.ts b/src/api/types/Nftevm.ts new file mode 100644 index 0000000..b6fc498 --- /dev/null +++ b/src/api/types/Nftevm.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +/** + * EVM + */ +export type Nftevm = Crossmint.NftevmItem[]; diff --git a/src/api/types/NftevmItem.ts b/src/api/types/NftevmItem.ts new file mode 100644 index 0000000..d195f78 --- /dev/null +++ b/src/api/types/NftevmItem.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftevmItem { + /** The blockchain used in the request. */ + chain?: string; + /** The token contract address */ + contractAddress?: string; + /** The numeric tokenId for the specified NFT */ + tokenId?: string; + metadata?: Crossmint.NftevmItemMetadata; + /** The address of the NFT on the blockchain */ + locator?: string; + /** The type of contract this token is from (ERC-721 or ERC-1155) */ + tokenStandard?: string; +} diff --git a/src/api/types/NftevmItemMetadata.ts b/src/api/types/NftevmItemMetadata.ts new file mode 100644 index 0000000..ae7c6c6 --- /dev/null +++ b/src/api/types/NftevmItemMetadata.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftevmItemMetadata { + attributes?: Crossmint.NftevmItemMetadataAttributesItem[]; + collection?: Record; + description?: string; + /** URL that represents the image for the NFT */ + image?: string; + /** Optional URL representing a video or other multimedia file */ + animationUrl?: string; + name?: string; +} diff --git a/src/api/types/NftevmItemMetadataAttributesItem.ts b/src/api/types/NftevmItemMetadataAttributesItem.ts new file mode 100644 index 0000000..8952967 --- /dev/null +++ b/src/api/types/NftevmItemMetadataAttributesItem.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NftevmItemMetadataAttributesItem { + traitType?: string; + value?: string; + displayType?: string; +} diff --git a/src/api/types/NftsolItem.ts b/src/api/types/NftsolItem.ts new file mode 100644 index 0000000..baff7e9 --- /dev/null +++ b/src/api/types/NftsolItem.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftsolItem { + /** The blockchain used in the request, `solana` in this case. */ + chain?: string; + /** The unique identifier of this NFT on Solana */ + mintHash?: string; + metadata?: Crossmint.NftsolItemMetadata; + /** The address of the NFT on the blockchain */ + locator?: string; +} diff --git a/src/api/types/NftsolItemMetadata.ts b/src/api/types/NftsolItemMetadata.ts new file mode 100644 index 0000000..c9142c8 --- /dev/null +++ b/src/api/types/NftsolItemMetadata.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftsolItemMetadata { + name?: string; + description?: string; + /** A URL that represents the image for the NFT */ + image?: string; + attributes?: Crossmint.NftsolItemMetadataAttributesItem[]; +} diff --git a/src/api/types/NftsolItemMetadataAttributesItem.ts b/src/api/types/NftsolItemMetadataAttributesItem.ts new file mode 100644 index 0000000..aae329e --- /dev/null +++ b/src/api/types/NftsolItemMetadataAttributesItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface NftsolItemMetadataAttributesItem { + value?: Crossmint.NftsolItemMetadataAttributesItemValue; + traitType?: string; +} diff --git a/src/api/types/NftsolItemMetadataAttributesItemValue.ts b/src/api/types/NftsolItemMetadataAttributesItemValue.ts new file mode 100644 index 0000000..178f0c2 --- /dev/null +++ b/src/api/types/NftsolItemMetadataAttributesItemValue.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type NftsolItemMetadataAttributesItemValue = string | number | boolean | Record; diff --git a/src/api/types/NotFoundErrorBody.ts b/src/api/types/NotFoundErrorBody.ts new file mode 100644 index 0000000..2a26fd9 --- /dev/null +++ b/src/api/types/NotFoundErrorBody.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NotFoundErrorBody { + error?: boolean; + message?: string; +} diff --git a/src/api/types/NotImplementedErrorBody.ts b/src/api/types/NotImplementedErrorBody.ts new file mode 100644 index 0000000..a276b6d --- /dev/null +++ b/src/api/types/NotImplementedErrorBody.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NotImplementedErrorBody { + error?: boolean; + message?: string; +} diff --git a/src/api/types/OldCollection.ts b/src/api/types/OldCollection.ts new file mode 100644 index 0000000..d058cf0 --- /dev/null +++ b/src/api/types/OldCollection.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OldCollection { + message?: string; +} diff --git a/src/api/types/OutdatedContract.ts b/src/api/types/OutdatedContract.ts new file mode 100644 index 0000000..2d3c16b --- /dev/null +++ b/src/api/types/OutdatedContract.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OutdatedContract { + message?: string; +} diff --git a/src/api/types/PaymentsObject.ts b/src/api/types/PaymentsObject.ts new file mode 100644 index 0000000..50a627a --- /dev/null +++ b/src/api/types/PaymentsObject.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enable payments for this collection by setting `price`, `recipientAddress` and `currency` + */ +export interface PaymentsObject { + /** The price of the token in native currency for the selected chain */ + price?: string; + /** The wallet address to receive payouts */ + recipientAddress?: string; + /** The currency for the price of the NFT. Defaults to the native currency of the chain */ + currency?: string; +} diff --git a/src/api/types/QuoteResponse.ts b/src/api/types/QuoteResponse.ts new file mode 100644 index 0000000..5421bc6 --- /dev/null +++ b/src/api/types/QuoteResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface QuoteResponse { + currency?: string; + price?: number; +} diff --git a/src/api/types/Recipient.ts b/src/api/types/Recipient.ts index 1e5d79e..255f776 100644 --- a/src/api/types/Recipient.ts +++ b/src/api/types/Recipient.ts @@ -2,12 +2,15 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Crossmint from "../index"; - -export type Recipient = - /** - * Recipient of the items being purchased. Crossmint will create a custodial wallet address for the user on the fly, that they can later log in to. If no recipient is passed, an order will be created with the status 'requires-recipient', until you pass one. */ - | Crossmint.RecipientEmail - /** - * Recipient of the items being purchased. If specifying a recipient by wallet address, ensure the address is valid for the chain your **collection** is on, which may differ from the chain the payment is performed on. */ - | Crossmint.RecipientWallet; +/** + * Allowed formats: + * + * `:
` or + * + * `email::` or + * + * `userId::` + * + * [see here for more info](/minting/advanced/specify-recipient) + */ +export type Recipient = string; diff --git a/src/api/types/RecipientEmail.ts b/src/api/types/RecipientEmail.ts deleted file mode 100644 index 72a7653..0000000 --- a/src/api/types/RecipientEmail.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Recipient of the items being purchased. Crossmint will create a custodial wallet address for the user on the fly, that they can later log in to. If no recipient is passed, an order will be created with the status 'requires-recipient', until you pass one. - */ -export interface RecipientEmail { - email: string; -} diff --git a/src/api/types/RecipientWallet.ts b/src/api/types/RecipientWallet.ts deleted file mode 100644 index a22c96e..0000000 --- a/src/api/types/RecipientWallet.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * Recipient of the items being purchased. If specifying a recipient by wallet address, ensure the address is valid for the chain your **collection** is on, which may differ from the chain the payment is performed on. - */ -export interface RecipientWallet { - walletAddress: string; -} diff --git a/src/api/types/Redirect.ts b/src/api/types/Redirect.ts new file mode 100644 index 0000000..bbdecfa --- /dev/null +++ b/src/api/types/Redirect.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The URLs to redirect the user to upon comletion or cancellation of the checkout page. + */ +export interface Redirect { + /** The URL to redirect the customer to when the customer's payment information is accepted. */ + continue?: string; + /** The URL to redirect the customer cancels the payment. */ + cancel?: string; +} diff --git a/src/api/types/ReuploadLinkedFiles.ts b/src/api/types/ReuploadLinkedFiles.ts new file mode 100644 index 0000000..ff5a201 --- /dev/null +++ b/src/api/types/ReuploadLinkedFiles.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Any URLs in the metadata object will be resolved and reuploaded to IPFS [Default: true] + */ +export type ReuploadLinkedFiles = boolean; diff --git a/src/api/types/SftCollection.ts b/src/api/types/SftCollection.ts new file mode 100644 index 0000000..baefd58 --- /dev/null +++ b/src/api/types/SftCollection.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SftCollection { + message?: string; +} diff --git a/src/api/types/Solana.ts b/src/api/types/Solana.ts new file mode 100644 index 0000000..1d48e69 --- /dev/null +++ b/src/api/types/Solana.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Solana { + chain?: "solana"; + /** The wallet address for the current owner */ + from?: string; + /** The wallet address the token should be transferred to */ + to?: string; + /** The mintHash of the token to transfer */ + tokenMintAddress?: string; +} diff --git a/src/api/types/SolanaNotSupported.ts b/src/api/types/SolanaNotSupported.ts new file mode 100644 index 0000000..3e7cce5 --- /dev/null +++ b/src/api/types/SolanaNotSupported.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SolanaNotSupported { + message?: string; +} diff --git a/src/api/types/Supply.ts b/src/api/types/Supply.ts new file mode 100644 index 0000000..b0724c6 --- /dev/null +++ b/src/api/types/Supply.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface Supply { + /** Supply details */ + supply?: Crossmint.SupplySupply; +} diff --git a/src/api/types/SupplySupply.ts b/src/api/types/SupplySupply.ts new file mode 100644 index 0000000..c3fba21 --- /dev/null +++ b/src/api/types/SupplySupply.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supply details + */ +export interface SupplySupply { + /** Supply limit. Set to 1 for ERC721. */ + limit?: number; +} diff --git a/src/api/types/TemplateResponse.ts b/src/api/types/TemplateResponse.ts new file mode 100644 index 0000000..3a3be03 --- /dev/null +++ b/src/api/types/TemplateResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface TemplateResponse { + templateId?: string; + metadata?: Crossmint.TemplateResponseMetadata; + onChain?: Crossmint.TemplateResponseOnChain; + supply?: Crossmint.TemplateResponseSupply; +} diff --git a/src/api/types/TemplateResponseMetadata.ts b/src/api/types/TemplateResponseMetadata.ts new file mode 100644 index 0000000..836b2f3 --- /dev/null +++ b/src/api/types/TemplateResponseMetadata.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TemplateResponseMetadata { + name?: string; + image?: string; + description?: string; +} diff --git a/src/api/types/TemplateResponseOnChain.ts b/src/api/types/TemplateResponseOnChain.ts new file mode 100644 index 0000000..43021bf --- /dev/null +++ b/src/api/types/TemplateResponseOnChain.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TemplateResponseOnChain { + tokenId?: number; +} diff --git a/src/api/types/TemplateResponseSupply.ts b/src/api/types/TemplateResponseSupply.ts new file mode 100644 index 0000000..a4e0dad --- /dev/null +++ b/src/api/types/TemplateResponseSupply.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TemplateResponseSupply { + limit?: number; + minted?: number; +} diff --git a/src/api/types/TransferPendingVerification.ts b/src/api/types/TransferPendingVerification.ts new file mode 100644 index 0000000..1f6418b --- /dev/null +++ b/src/api/types/TransferPendingVerification.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TransferPendingVerification { + /** A URL to send the user to in order to perform a persona verification. If the user has failed the OTP challenge 3 times, this will be the only option. */ + personaUrl?: string; +} diff --git a/src/api/types/UpdateCollectionResponse.ts b/src/api/types/UpdateCollectionResponse.ts new file mode 100644 index 0000000..582af4f --- /dev/null +++ b/src/api/types/UpdateCollectionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface UpdateCollectionResponse { + actionId?: string; + action?: string; + status?: string; + data?: Crossmint.UpdateCollectionResponseData; + startedAt?: Date; + resource?: string; +} diff --git a/src/api/types/UpdateCollectionResponseData.ts b/src/api/types/UpdateCollectionResponseData.ts new file mode 100644 index 0000000..3737cb6 --- /dev/null +++ b/src/api/types/UpdateCollectionResponseData.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface UpdateCollectionResponseData { + chain?: string; + collection?: Crossmint.UpdateCollectionResponseDataCollection; + changes?: string[]; +} diff --git a/src/api/types/UpdateCollectionResponseDataCollection.ts b/src/api/types/UpdateCollectionResponseDataCollection.ts new file mode 100644 index 0000000..ef1dba1 --- /dev/null +++ b/src/api/types/UpdateCollectionResponseDataCollection.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UpdateCollectionResponseDataCollection { + id?: string; + contractAddress?: string; +} diff --git a/src/api/types/UsageResponse.ts b/src/api/types/UsageResponse.ts new file mode 100644 index 0000000..cdddffa --- /dev/null +++ b/src/api/types/UsageResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface UsageResponse { + data?: Crossmint.UsageResponseData; +} diff --git a/src/api/types/UsageResponseData.ts b/src/api/types/UsageResponseData.ts new file mode 100644 index 0000000..5d0a238 --- /dev/null +++ b/src/api/types/UsageResponseData.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export interface UsageResponseData { + /** The type of usage data returned. */ + dimension?: string; + /** The usage data for the specified dimension. */ + usage?: Crossmint.UsageResponseDataUsage; +} diff --git a/src/api/types/UsageResponseDataUsage.ts b/src/api/types/UsageResponseDataUsage.ts new file mode 100644 index 0000000..dbbc43c --- /dev/null +++ b/src/api/types/UsageResponseDataUsage.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The usage data for the specified dimension. + */ +export interface UsageResponseDataUsage { + /** YYYY-MM format indicating the month */ + month?: string; + /** The number of active wallets for the given month */ + activeWallets?: number; +} diff --git a/src/api/types/ValidationError.ts b/src/api/types/ValidationError.ts new file mode 100644 index 0000000..a20ed3f --- /dev/null +++ b/src/api/types/ValidationError.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ValidationError { + /** The index of the NFT that caused the validation error. */ + index?: number; + /** The idempotent identifier for the NFT, if available. */ + id?: string; + /** The validation error message. */ + message?: string; +} diff --git a/src/api/types/VerificationRequestSent.ts b/src/api/types/VerificationRequestSent.ts new file mode 100644 index 0000000..1c81903 --- /dev/null +++ b/src/api/types/VerificationRequestSent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface VerificationRequestSent { + /** A message indicating the result. */ + message?: string; + /** An ID that can be used to poll the [actions API](/api-reference/common/get-action-status). */ + actionId?: string; +} diff --git a/src/api/types/Wallet.ts b/src/api/types/Wallet.ts new file mode 100644 index 0000000..9b5824e --- /dev/null +++ b/src/api/types/Wallet.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Wallet { + /** The blockchain the wallet is on */ + chain?: string; + /** The public address of the wallet */ + publicKey?: string; +} diff --git a/src/api/types/WalletsRequest.ts b/src/api/types/WalletsRequest.ts new file mode 100644 index 0000000..357c45f --- /dev/null +++ b/src/api/types/WalletsRequest.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Crossmint from "../index"; + +export type WalletsRequest = Crossmint.EvmTransfer | Crossmint.Solana; diff --git a/src/api/types/WalletsTransfer.ts b/src/api/types/WalletsTransfer.ts new file mode 100644 index 0000000..269f4b4 --- /dev/null +++ b/src/api/types/WalletsTransfer.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface WalletsTransfer { + chain: string; + /** The NFT token ID */ + tokenId?: string; + /** The wallet address for the current owner */ + fromAddress: string; + /** The wallet address to send the NFT to */ + toAddress: string; + /** The NFT token mint address */ + tokenMintAddress: string; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index b648801..9608d08 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,5 +1,20 @@ -export * from "./RecipientEmail"; -export * from "./RecipientWallet"; +export * from "./BadRequestErrorBody"; +export * from "./NotFoundErrorBody"; +export * from "./NotImplementedErrorBody"; +export * from "./OutdatedContract"; +export * from "./OldCollection"; +export * from "./SolanaNotSupported"; +export * from "./ExternalCollection"; +export * from "./SftCollection"; +export * from "./EvmTransfer"; +export * from "./Solana"; +export * from "./WalletsRequest"; +export * from "./UsageResponseDataUsage"; +export * from "./UsageResponseData"; +export * from "./UsageResponse"; +export * from "./Error_"; +export * from "./ValidationError"; +export * from "./BatchError"; export * from "./Recipient"; export * from "./Locale"; export * from "./EvmPaymentMethods"; @@ -30,8 +45,109 @@ export * from "./OrderObjectQuote"; export * from "./OrderObjectPaymentPreparation"; export * from "./OrderObjectPayment"; export * from "./OrderObject"; -export * from "./BadRequestResponse"; -export * from "./UnauthorizedResponse"; -export * from "./NotFoundResponse"; -export * from "./ServiceUnavailabileResponse"; +export * from "./Error400Response"; +export * from "./Error403Response"; +export * from "./Error404Response"; +export * from "./Error503Response"; export * from "./TimeoutResponse"; +export * from "./ReuploadLinkedFiles"; +export * from "./Compressed"; +export * from "./PaymentsObject"; +export * from "./NftMetadataOptionsName"; +export * from "./NftMetadataOptions"; +export * from "./NftMetadataAttributesItemDisplayType"; +export * from "./NftMetadataAttributesItem"; +export * from "./NftMetadata"; +export * from "./NftMetadataSolanaAttributesItemDisplayType"; +export * from "./NftMetadataSolanaAttributesItem"; +export * from "./NftMetadataSolana"; +export * from "./CreateCollectionBodyChain"; +export * from "./CreateCollectionBodyMetadata"; +export * from "./CreateCollectionBodyFungibility"; +export * from "./CreateCollectionBody"; +export * from "./CreateTemplateBodyMetadata"; +export * from "./CreateTemplateBodyOnChain"; +export * from "./CreateTemplateBodySupply"; +export * from "./CreateTemplateBody"; +export * from "./SupplySupply"; +export * from "./Supply"; +export * from "./MintingMetadata"; +export * from "./EditNftResponseDataCollection"; +export * from "./EditNftResponseDataTokenOwner"; +export * from "./EditNftResponseDataToken"; +export * from "./EditNftResponseData"; +export * from "./EditNftResponse"; +export * from "./MintResponseSolana200OnChain"; +export * from "./MintResponseSolana200"; +export * from "./MintResponseEvm200OnChain"; +export * from "./MintResponseEvm200"; +export * from "./MintResponseSolana200Subsequent"; +export * from "./MintStatusSolana200"; +export * from "./NftObjectSolanaMetadataPropertiesFilesItem"; +export * from "./NftObjectSolanaMetadataPropertiesCreatorsItem"; +export * from "./NftObjectSolanaMetadataProperties"; +export * from "./NftObjectSolanaMetadataAttributesItem"; +export * from "./NftObjectSolanaMetadata"; +export * from "./NftObjectSolanaOnChain"; +export * from "./NftObjectSolana"; +export * from "./MintResponseEvm200Subsequent"; +export * from "./NftObjectEvmMetadata"; +export * from "./NftObjectEvmOnChain"; +export * from "./NftObjectEvm"; +export * from "./CreateCollectionResponseMetadata"; +export * from "./CreateCollectionResponseOnChain"; +export * from "./CreateCollectionResponse"; +export * from "./GetCollectionResponseMetadata"; +export * from "./GetCollectionResponseOnChain"; +export * from "./GetCollectionResponsePayments"; +export * from "./GetCollectionResponse"; +export * from "./UpdateCollectionResponseDataCollection"; +export * from "./UpdateCollectionResponseData"; +export * from "./UpdateCollectionResponse"; +export * from "./BurnNftResponseDataCollection"; +export * from "./BurnNftResponseDataToken"; +export * from "./BurnNftResponseData"; +export * from "./BurnNftResponse"; +export * from "./TemplateResponseMetadata"; +export * from "./TemplateResponseOnChain"; +export * from "./TemplateResponseSupply"; +export * from "./TemplateResponse"; +export * from "./BatchMintResponse"; +export * from "./FourHundredNineResponse"; +export * from "./FourHundredTwentyFourResponse"; +export * from "./MintApiFeatureCollectionNotDeployed"; +export * from "./QuoteResponse"; +export * from "./Checkout"; +export * from "./Collection"; +export * from "./MintConfig"; +export * from "./MintStatusStatus"; +export * from "./MintStatus"; +export * from "./NftCollection"; +export * from "./NftAttributesItemValue"; +export * from "./NftAttributesItem"; +export * from "./NftPropertiesCreatorsItem"; +export * from "./NftPropertiesFilesItem"; +export * from "./NftProperties"; +export * from "./Nft"; +export * from "./Redirect"; +export * from "./WalletsTransfer"; +export * from "./Wallet"; +export * from "./CheckoutMintSuccess"; +export * from "./TransferPendingVerification"; +export * from "./ErrorMsg"; +export * from "./AllChains"; +export * from "./EvmChains"; +export * from "./NftevmItemMetadataAttributesItem"; +export * from "./NftevmItemMetadata"; +export * from "./NftevmItem"; +export * from "./Nftevm"; +export * from "./NftsolItemMetadataAttributesItemValue"; +export * from "./NftsolItemMetadataAttributesItem"; +export * from "./NftsolItemMetadata"; +export * from "./NftsolItem"; +export * from "./NftSolana"; +export * from "./NftcarItemMetadataAttributesItem"; +export * from "./NftcarItemMetadata"; +export * from "./NftcarItem"; +export * from "./Cardano"; +export * from "./VerificationRequestSent"; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 02af7dc..ef36c97 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -5,6 +5,7 @@ import { getRequestBody } from "./getRequestBody"; import { getResponseBody } from "./getResponseBody"; import { makeRequest } from "./makeRequest"; import { requestWithRetries } from "./requestWithRetries"; +import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -90,7 +91,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise= 200 && response.status < 400) { if (args.duplex && args.responseType === "streaming") { - responseBody = (await import("stream")).Readable.from(responseBody as any); + responseBody = chooseStreamWrapper(responseBody); } return { diff --git a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts new file mode 100644 index 0000000..e274a32 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts @@ -0,0 +1,226 @@ +// this should be transpiled away as a type +import type { Writable } from "stream"; +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +export class Node18UniversalStreamWrapper + implements StreamWrapper, Uint8Array> +{ + private readableStream: ReadableStream; + private reader: ReadableStreamDefaultReader; + private events: Record; + private paused: boolean; + private resumeCallback: ((value?: unknown) => void) | null; + private encoding: string | null; + + constructor(readableStream: ReadableStream) { + this.readableStream = readableStream; + this.reader = this.readableStream.getReader(); + this.events = { + data: [], + end: [], + error: [], + readable: [], + close: [], + pause: [], + resume: [], + }; + this.paused = false; + this.resumeCallback = null; + this.encoding = null; + } + + public on(event: string, callback: EventCallback): void { + this.events[event]?.push(callback); + } + + public off(event: string, callback: EventCallback): void { + this.events[event] = this.events[event]?.filter((cb) => cb !== callback); + } + + public pipe( + dest: Node18UniversalStreamWrapper | Writable | WritableStream + ): Node18UniversalStreamWrapper | Writable | WritableStream { + this.on("data", async (chunk) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._write(chunk); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } else { + dest.write(chunk); + } + }); + + this.on("end", async () => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._end(); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.close(); + } else { + dest.end(); + } + }); + + this.on("error", async (error) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._error(error); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.abort(error); + } else { + dest.destroy(error); + } + }); + + this._startReading(); + + return dest; + } + + public unpipe(dest: Node18UniversalStreamWrapper | Writable | WritableStream): void { + this.off("data", async (chunk) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._write(chunk); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } else { + dest.write(chunk); + } + }); + + this.off("end", async () => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._end(); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.close(); + } else { + dest.end(); + } + }); + + this.off("error", async (error) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._error(error); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.abort(error); + } else { + dest.destroy(error); + } + }); + } + + public destroy(error?: Error): void { + this.reader + .cancel(error) + .then(() => { + this._emit("close"); + }) + .catch((err) => { + this._emit("error", err); + }); + } + + public pause(): void { + this.paused = true; + this._emit("pause"); + } + + public resume(): void { + if (this.paused) { + this.paused = false; + this._emit("resume"); + if (this.resumeCallback) { + this.resumeCallback(); + this.resumeCallback = null; + } + } + } + + public get isPaused(): boolean { + return this.paused; + } + + public async read(): Promise { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + + if (done) { + return undefined; + } + return value; + } + + public setEncoding(encoding: string): void { + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: Uint8Array[] = []; + + while (true) { + const { done, value } = await this.reader.read(); + if (done) break; + if (value) chunks.push(value); + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(await new Blob(chunks).arrayBuffer()); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + private _write(chunk: Uint8Array): void { + this._emit("data", chunk); + } + + private _end(): void { + this._emit("end"); + } + + private _error(error: any): void { + this._emit("error", error); + } + + private _emit(event: string, data?: any): void { + if (this.events[event]) { + for (const callback of this.events[event] || []) { + callback(data); + } + } + } + + private async _startReading(): Promise { + try { + this._emit("readable"); + while (true) { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + this._emit("end"); + this._emit("close"); + break; + } + if (value) { + this._emit("data", value); + } + } + } catch (error) { + this._emit("error", error); + } + } +} diff --git a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts new file mode 100644 index 0000000..78aa4e4 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts @@ -0,0 +1,87 @@ +// this should be transpiled away as a type +import type { Readable, Writable } from "stream"; +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +export class NodePre18StreamWrapper implements StreamWrapper { + private readableStream: Readable; + private encoding: string | undefined; + + constructor(readableStream: Readable) { + this.readableStream = readableStream; + } + + public on(event: string, callback: EventCallback): void { + this.readableStream.on(event, callback); + } + + public off(event: string, callback: EventCallback): void { + this.readableStream.off(event, callback); + } + + public pipe(dest: Writable): Writable { + this.readableStream.pipe(dest); + return dest; + } + + public unpipe(dest?: Writable): void { + if (dest) { + this.readableStream.unpipe(dest); + } else { + this.readableStream.unpipe(); + } + } + + public destroy(error?: Error): void { + this.readableStream.destroy(error); + } + + public pause(): void { + this.readableStream.pause(); + } + + public resume(): void { + this.readableStream.resume(); + } + + public get isPaused(): boolean { + return this.readableStream.isPaused(); + } + + public async read(): Promise { + return new Promise((resolve, reject) => { + const chunk = this.readableStream.read(); + if (chunk) { + resolve(chunk); + } else { + this.readableStream.once("readable", () => { + const chunk = this.readableStream.read(); + resolve(chunk); + }); + this.readableStream.once("error", reject); + } + }); + } + + public setEncoding(encoding?: string): void { + this.readableStream.setEncoding(encoding as BufferEncoding); + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: Uint8Array[] = []; + const encoder = new TextEncoder(); + this.readableStream.setEncoding((this.encoding || "utf-8") as BufferEncoding); + + for await (const chunk of this.readableStream) { + chunks.push(encoder.encode(chunk)); + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(Buffer.concat(chunks)); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } +} diff --git a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts new file mode 100644 index 0000000..083edb4 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts @@ -0,0 +1,213 @@ +import { StreamWrapper } from "./chooseStreamWrapper"; + +type EventCallback = (data?: any) => void; + +export class UndiciStreamWrapper + implements StreamWrapper, Uint8Array> +{ + private readableStream: ReadableStream; + private reader: ReadableStreamDefaultReader; + private events: Record; + private paused: boolean; + private resumeCallback: ((value?: unknown) => void) | null; + private encoding: string | null; + + constructor(readableStream: ReadableStream) { + this.readableStream = readableStream; + this.reader = this.readableStream.getReader(); + this.events = { + data: [], + end: [], + error: [], + readable: [], + close: [], + pause: [], + resume: [], + }; + this.paused = false; + this.resumeCallback = null; + this.encoding = null; + } + + public on(event: string, callback: EventCallback): void { + this.events[event]?.push(callback); + } + + public off(event: string, callback: EventCallback): void { + this.events[event] = this.events[event]?.filter((cb) => cb !== callback); + } + + public pipe( + dest: UndiciStreamWrapper | WritableStream + ): UndiciStreamWrapper | WritableStream { + this.on("data", (chunk) => { + if (dest instanceof UndiciStreamWrapper) { + dest._write(chunk); + } else { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } + }); + + this.on("end", () => { + if (dest instanceof UndiciStreamWrapper) { + dest._end(); + } else { + const writer = dest.getWriter(); + writer.close(); + } + }); + + this.on("error", (error) => { + if (dest instanceof UndiciStreamWrapper) { + dest._error(error); + } else { + const writer = dest.getWriter(); + writer.abort(error); + } + }); + + this._startReading(); + + return dest; + } + + public unpipe(dest: UndiciStreamWrapper | WritableStream): void { + this.off("data", (chunk) => { + if (dest instanceof UndiciStreamWrapper) { + dest._write(chunk); + } else { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } + }); + + this.off("end", () => { + if (dest instanceof UndiciStreamWrapper) { + dest._end(); + } else { + const writer = dest.getWriter(); + writer.close(); + } + }); + + this.off("error", (error) => { + if (dest instanceof UndiciStreamWrapper) { + dest._error(error); + } else { + const writer = dest.getWriter(); + writer.abort(error); + } + }); + } + + public destroy(error?: Error): void { + this.reader + .cancel(error) + .then(() => { + this._emit("close"); + }) + .catch((err) => { + this._emit("error", err); + }); + } + + public pause(): void { + this.paused = true; + this._emit("pause"); + } + + public resume(): void { + if (this.paused) { + this.paused = false; + this._emit("resume"); + if (this.resumeCallback) { + this.resumeCallback(); + this.resumeCallback = null; + } + } + } + + public get isPaused(): boolean { + return this.paused; + } + + public async read(): Promise { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return undefined; + } + return value; + } + + public setEncoding(encoding: string): void { + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: Uint8Array[] = []; + + while (true) { + const { done, value } = await this.reader.read(); + if (done) break; + if (value) chunks.push(value); + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(await new Blob(chunks).arrayBuffer()); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + private _write(chunk: Uint8Array): void { + this._emit("data", chunk); + } + + private _end(): void { + this._emit("end"); + } + + private _error(error: any): void { + this._emit("error", error); + } + + private _emit(event: string, data?: any): void { + if (this.events[event]) { + for (const callback of this.events[event] || []) { + callback(data); + } + } + } + + private async _startReading(): Promise { + try { + this._emit("readable"); + while (true) { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + this._emit("end"); + this._emit("close"); + break; + } + if (value) { + this._emit("data", value); + } + } + } catch (error) { + this._emit("error", error); + } + } +} diff --git a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts new file mode 100644 index 0000000..5a8e3e1 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts @@ -0,0 +1,32 @@ +// this should be transpiled away during compilation +import type { Readable } from "stream"; +import { RUNTIME } from "../../runtime"; + +export type EventCallback = (data?: any) => void; + +export interface StreamWrapper { + setEncoding(encoding?: string): void; + on(event: string, callback: EventCallback): void; + off(event: string, callback: EventCallback): void; + pipe(dest: WritableStream): WritableStream; + unpipe(dest?: WritableStream): void; + destroy(error?: Error): void; + pause(): void; + resume(): void; + get isPaused(): boolean; + read(): Promise; + text(): Promise; + json(): Promise; +} + +export async function chooseStreamWrapper(responseBody: any): Promise>> { + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + return new (await import("./Node18UniversalStreamWrapper")).Node18UniversalStreamWrapper( + responseBody as ReadableStream + ); + } else if (RUNTIME.type !== "node" && typeof fetch == "function") { + return new (await import("./UndiciStreamWrapper")).UndiciStreamWrapper(responseBody as ReadableStream); + } else { + return new (await import("./NodePre18StreamWrapper")).NodePre18StreamWrapper(responseBody as Readable); + } +} diff --git a/src/environments.ts b/src/environments.ts index c89264f..985b1f7 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -3,8 +3,7 @@ */ export const CrossmintEnvironment = { - Staging: "https://staging.crossmint.com/api", - Production: "https://www.crossmint.com/api", + Default: "https://staging.crossmint.com/api", } as const; -export type CrossmintEnvironment = typeof CrossmintEnvironment.Staging | typeof CrossmintEnvironment.Production; +export type CrossmintEnvironment = typeof CrossmintEnvironment.Default; diff --git a/src/serialization/client/index.ts b/src/serialization/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/client/requests/NftRequest.ts b/src/serialization/client/requests/NftRequest.ts new file mode 100644 index 0000000..0e36059 --- /dev/null +++ b/src/serialization/client/requests/NftRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../index"; +import * as Crossmint from "../../../api/index"; +import * as core from "../../../core"; +import { AllChains } from "../../types/AllChains"; + +export const NftRequest: core.serialization.Schema = + core.serialization.object({ + chain: AllChains.optional(), + tokenId: core.serialization.string().optional(), + fromAddress: core.serialization.string().optional(), + toAddress: core.serialization.string().optional(), + tokenMintAddress: core.serialization.string().optional(), + }); + +export declare namespace NftRequest { + interface Raw { + chain?: AllChains.Raw | null; + tokenId?: string | null; + fromAddress?: string | null; + toAddress?: string | null; + tokenMintAddress?: string | null; + } +} diff --git a/src/serialization/client/requests/index.ts b/src/serialization/client/requests/index.ts new file mode 100644 index 0000000..e16a4f4 --- /dev/null +++ b/src/serialization/client/requests/index.ts @@ -0,0 +1 @@ +export { NftRequest } from "./NftRequest"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts index 3ce0a3e..d3c5080 100644 --- a/src/serialization/index.ts +++ b/src/serialization/index.ts @@ -1,2 +1,3 @@ -export * from "./types"; export * from "./resources"; +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/actions/index.ts b/src/serialization/resources/actions/index.ts new file mode 100644 index 0000000..eea524d --- /dev/null +++ b/src/serialization/resources/actions/index.ts @@ -0,0 +1 @@ +export * from "./types"; diff --git a/src/serialization/resources/actions/types/GetActionStatusResponse.ts b/src/serialization/resources/actions/types/GetActionStatusResponse.ts new file mode 100644 index 0000000..b070ad4 --- /dev/null +++ b/src/serialization/resources/actions/types/GetActionStatusResponse.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { GetActionStatusResponseData } from "./GetActionStatusResponseData"; + +export const GetActionStatusResponse: core.serialization.ObjectSchema< + serializers.GetActionStatusResponse.Raw, + Crossmint.GetActionStatusResponse +> = core.serialization.object({ + actionId: core.serialization.string().optional(), + action: core.serialization.string().optional(), + status: core.serialization.string().optional(), + data: GetActionStatusResponseData.optional(), + startedAt: core.serialization.date().optional(), + resource: core.serialization.string().optional(), +}); + +export declare namespace GetActionStatusResponse { + interface Raw { + actionId?: string | null; + action?: string | null; + status?: string | null; + data?: GetActionStatusResponseData.Raw | null; + startedAt?: string | null; + resource?: string | null; + } +} diff --git a/src/serialization/resources/actions/types/GetActionStatusResponseData.ts b/src/serialization/resources/actions/types/GetActionStatusResponseData.ts new file mode 100644 index 0000000..59afedd --- /dev/null +++ b/src/serialization/resources/actions/types/GetActionStatusResponseData.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { GetActionStatusResponseDataCollection } from "./GetActionStatusResponseDataCollection"; +import { GetActionStatusResponseDataRecipient } from "./GetActionStatusResponseDataRecipient"; +import { GetActionStatusResponseDataToken } from "./GetActionStatusResponseDataToken"; + +export const GetActionStatusResponseData: core.serialization.ObjectSchema< + serializers.GetActionStatusResponseData.Raw, + Crossmint.GetActionStatusResponseData +> = core.serialization.object({ + collection: GetActionStatusResponseDataCollection.optional(), + recipient: GetActionStatusResponseDataRecipient.optional(), + token: GetActionStatusResponseDataToken.optional(), +}); + +export declare namespace GetActionStatusResponseData { + interface Raw { + collection?: GetActionStatusResponseDataCollection.Raw | null; + recipient?: GetActionStatusResponseDataRecipient.Raw | null; + token?: GetActionStatusResponseDataToken.Raw | null; + } +} diff --git a/src/serialization/resources/actions/types/GetActionStatusResponseDataCollection.ts b/src/serialization/resources/actions/types/GetActionStatusResponseDataCollection.ts new file mode 100644 index 0000000..4cd0f98 --- /dev/null +++ b/src/serialization/resources/actions/types/GetActionStatusResponseDataCollection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetActionStatusResponseDataCollection: core.serialization.ObjectSchema< + serializers.GetActionStatusResponseDataCollection.Raw, + Crossmint.GetActionStatusResponseDataCollection +> = core.serialization.object({ + id: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace GetActionStatusResponseDataCollection { + interface Raw { + id?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/resources/actions/types/GetActionStatusResponseDataRecipient.ts b/src/serialization/resources/actions/types/GetActionStatusResponseDataRecipient.ts new file mode 100644 index 0000000..7e0fa7b --- /dev/null +++ b/src/serialization/resources/actions/types/GetActionStatusResponseDataRecipient.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetActionStatusResponseDataRecipient: core.serialization.ObjectSchema< + serializers.GetActionStatusResponseDataRecipient.Raw, + Crossmint.GetActionStatusResponseDataRecipient +> = core.serialization.object({ + walletAddress: core.serialization.string().optional(), +}); + +export declare namespace GetActionStatusResponseDataRecipient { + interface Raw { + walletAddress?: string | null; + } +} diff --git a/src/serialization/resources/actions/types/GetActionStatusResponseDataToken.ts b/src/serialization/resources/actions/types/GetActionStatusResponseDataToken.ts new file mode 100644 index 0000000..56c65a2 --- /dev/null +++ b/src/serialization/resources/actions/types/GetActionStatusResponseDataToken.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetActionStatusResponseDataToken: core.serialization.ObjectSchema< + serializers.GetActionStatusResponseDataToken.Raw, + Crossmint.GetActionStatusResponseDataToken +> = core.serialization.object({ + id: core.serialization.string().optional(), +}); + +export declare namespace GetActionStatusResponseDataToken { + interface Raw { + id?: string | null; + } +} diff --git a/src/serialization/resources/actions/types/index.ts b/src/serialization/resources/actions/types/index.ts new file mode 100644 index 0000000..4ebf5bc --- /dev/null +++ b/src/serialization/resources/actions/types/index.ts @@ -0,0 +1,5 @@ +export * from "./GetActionStatusResponseDataCollection"; +export * from "./GetActionStatusResponseDataRecipient"; +export * from "./GetActionStatusResponseDataToken"; +export * from "./GetActionStatusResponseData"; +export * from "./GetActionStatusResponse"; diff --git a/src/serialization/resources/checkout/client/requests/CheckoutMintRequest.ts b/src/serialization/resources/checkout/client/requests/CheckoutMintRequest.ts new file mode 100644 index 0000000..a9c6ad1 --- /dev/null +++ b/src/serialization/resources/checkout/client/requests/CheckoutMintRequest.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CheckoutMintRequestCollection } from "../../types/CheckoutMintRequestCollection"; +import { CheckoutMintRequestRedirect } from "../../types/CheckoutMintRequestRedirect"; +import { CheckoutMintRequestMintConfig } from "../../types/CheckoutMintRequestMintConfig"; + +export const CheckoutMintRequest: core.serialization.Schema< + serializers.CheckoutMintRequest.Raw, + Crossmint.CheckoutMintRequest +> = core.serialization.object({ + clientId: core.serialization.string(), + userId: core.serialization.string(), + emailTo: core.serialization.string().optional(), + mintTo: core.serialization.string().optional(), + paymentMethod: core.serialization.string().optional(), + listingId: core.serialization.string().optional(), + collection: CheckoutMintRequestCollection.optional(), + redirect: CheckoutMintRequestRedirect.optional(), + mintConfig: CheckoutMintRequestMintConfig.optional(), + whPassThroughArgs: core.serialization.string().optional(), +}); + +export declare namespace CheckoutMintRequest { + interface Raw { + clientId: string; + userId: string; + emailTo?: string | null; + mintTo?: string | null; + paymentMethod?: string | null; + listingId?: string | null; + collection?: CheckoutMintRequestCollection.Raw | null; + redirect?: CheckoutMintRequestRedirect.Raw | null; + mintConfig?: CheckoutMintRequestMintConfig.Raw | null; + whPassThroughArgs?: string | null; + } +} diff --git a/src/serialization/resources/checkout/client/requests/index.ts b/src/serialization/resources/checkout/client/requests/index.ts index 3c1abcb..2eb109c 100644 --- a/src/serialization/resources/checkout/client/requests/index.ts +++ b/src/serialization/resources/checkout/client/requests/index.ts @@ -1,2 +1 @@ -export { CheckoutCreateOrderRequest } from "./CheckoutCreateOrderRequest"; -export { OrderDto } from "./OrderDto"; +export { CheckoutMintRequest } from "./CheckoutMintRequest"; diff --git a/src/serialization/resources/checkout/index.ts b/src/serialization/resources/checkout/index.ts index 5ec7692..c9240f8 100644 --- a/src/serialization/resources/checkout/index.ts +++ b/src/serialization/resources/checkout/index.ts @@ -1 +1,2 @@ +export * from "./types"; export * from "./client"; diff --git a/src/serialization/resources/checkout/types/CheckoutMintRequestCollection.ts b/src/serialization/resources/checkout/types/CheckoutMintRequestCollection.ts new file mode 100644 index 0000000..8ac2e89 --- /dev/null +++ b/src/serialization/resources/checkout/types/CheckoutMintRequestCollection.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CheckoutMintRequestCollection: core.serialization.ObjectSchema< + serializers.CheckoutMintRequestCollection.Raw, + Crossmint.CheckoutMintRequestCollection +> = core.serialization.object({ + title: core.serialization.string(), + description: core.serialization.string(), + photo: core.serialization.string(), +}); + +export declare namespace CheckoutMintRequestCollection { + interface Raw { + title: string; + description: string; + photo: string; + } +} diff --git a/src/serialization/resources/checkout/types/CheckoutMintRequestMintConfig.ts b/src/serialization/resources/checkout/types/CheckoutMintRequestMintConfig.ts new file mode 100644 index 0000000..24c1992 --- /dev/null +++ b/src/serialization/resources/checkout/types/CheckoutMintRequestMintConfig.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CheckoutMintRequestMintConfig: core.serialization.ObjectSchema< + serializers.CheckoutMintRequestMintConfig.Raw, + Crossmint.CheckoutMintRequestMintConfig +> = core.serialization.object({ + totalPrice: core.serialization.string().optional(), +}); + +export declare namespace CheckoutMintRequestMintConfig { + interface Raw { + totalPrice?: string | null; + } +} diff --git a/src/serialization/resources/checkout/types/CheckoutMintRequestRedirect.ts b/src/serialization/resources/checkout/types/CheckoutMintRequestRedirect.ts new file mode 100644 index 0000000..a179792 --- /dev/null +++ b/src/serialization/resources/checkout/types/CheckoutMintRequestRedirect.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CheckoutMintRequestRedirect: core.serialization.ObjectSchema< + serializers.CheckoutMintRequestRedirect.Raw, + Crossmint.CheckoutMintRequestRedirect +> = core.serialization.object({ + continue: core.serialization.string().optional(), + cancel: core.serialization.string().optional(), +}); + +export declare namespace CheckoutMintRequestRedirect { + interface Raw { + continue?: string | null; + cancel?: string | null; + } +} diff --git a/src/serialization/resources/checkout/types/index.ts b/src/serialization/resources/checkout/types/index.ts new file mode 100644 index 0000000..1038318 --- /dev/null +++ b/src/serialization/resources/checkout/types/index.ts @@ -0,0 +1,3 @@ +export * from "./CheckoutMintRequestCollection"; +export * from "./CheckoutMintRequestRedirect"; +export * from "./CheckoutMintRequestMintConfig"; diff --git a/src/serialization/resources/headless/client/index.ts b/src/serialization/resources/headless/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/headless/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/checkout/client/requests/CheckoutCreateOrderRequest.ts b/src/serialization/resources/headless/client/requests/CreateOrderRequest.ts similarity index 78% rename from src/serialization/resources/checkout/client/requests/CheckoutCreateOrderRequest.ts rename to src/serialization/resources/headless/client/requests/CreateOrderRequest.ts index 8164475..d9fc962 100644 --- a/src/serialization/resources/checkout/client/requests/CheckoutCreateOrderRequest.ts +++ b/src/serialization/resources/headless/client/requests/CreateOrderRequest.ts @@ -10,9 +10,9 @@ import { Locale } from "../../../../types/Locale"; import { Payment } from "../../../../types/Payment"; import { LineItems } from "../../../../types/LineItems"; -export const CheckoutCreateOrderRequest: core.serialization.Schema< - serializers.CheckoutCreateOrderRequest.Raw, - Crossmint.CheckoutCreateOrderRequest +export const CreateOrderRequest: core.serialization.Schema< + serializers.CreateOrderRequest.Raw, + Crossmint.CreateOrderRequest > = core.serialization.object({ recipient: Recipient.optional(), locale: Locale.optional(), @@ -20,7 +20,7 @@ export const CheckoutCreateOrderRequest: core.serialization.Schema< lineItems: LineItems, }); -export declare namespace CheckoutCreateOrderRequest { +export declare namespace CreateOrderRequest { interface Raw { recipient?: Recipient.Raw | null; locale?: Locale.Raw | null; diff --git a/src/serialization/resources/checkout/client/requests/OrderDto.ts b/src/serialization/resources/headless/client/requests/OrderDto.ts similarity index 100% rename from src/serialization/resources/checkout/client/requests/OrderDto.ts rename to src/serialization/resources/headless/client/requests/OrderDto.ts diff --git a/src/serialization/resources/headless/client/requests/index.ts b/src/serialization/resources/headless/client/requests/index.ts new file mode 100644 index 0000000..584abc0 --- /dev/null +++ b/src/serialization/resources/headless/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateOrderRequest } from "./CreateOrderRequest"; +export { OrderDto } from "./OrderDto"; diff --git a/src/serialization/resources/headless/index.ts b/src/serialization/resources/headless/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/headless/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index 0bcc23f..1405512 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -1,2 +1,28 @@ +export * as nfTs from "./nfTs"; +export * from "./nfTs/types"; +export * as nftCollections from "./nftCollections"; +export * from "./nftCollections/types"; +export * as nftTemplates from "./nftTemplates"; +export * from "./nftTemplates/types"; +export * as actions from "./actions"; +export * from "./actions/types"; +export * as registration from "./registration"; +export * from "./registration/types"; export * as checkout from "./checkout"; +export * from "./checkout/types"; +export * as quotePrice from "./quotePrice"; +export * from "./quotePrice/types"; +export * as verifiableCredentials from "./verifiableCredentials"; +export * from "./verifiableCredentials/types"; +export * as wallet from "./wallet"; +export * from "./wallet/types"; +export * as sign from "./sign"; +export * from "./sign/types"; +export * as headless from "./headless"; +export * from "./headless/client/requests"; +export * from "./nfTs/client/requests"; +export * from "./nftCollections/client/requests"; +export * from "./registration/client/requests"; export * from "./checkout/client/requests"; +export * from "./verifiableCredentials/client/requests"; +export * from "./sign/client/requests"; diff --git a/src/serialization/resources/nfTs/client/index.ts b/src/serialization/resources/nfTs/client/index.ts new file mode 100644 index 0000000..6f20271 --- /dev/null +++ b/src/serialization/resources/nfTs/client/index.ts @@ -0,0 +1,2 @@ +export * as mintStatusList from "./mintStatusList"; +export * from "./requests"; diff --git a/src/serialization/resources/nfTs/client/mintStatusList.ts b/src/serialization/resources/nfTs/client/mintStatusList.ts new file mode 100644 index 0000000..ac11daa --- /dev/null +++ b/src/serialization/resources/nfTs/client/mintStatusList.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { NftObjectEvm } from "../../../types/NftObjectEvm"; + +export const Response: core.serialization.Schema< + serializers.nfTs.mintStatusList.Response.Raw, + Crossmint.NftObjectEvm[] +> = core.serialization.list(NftObjectEvm); + +export declare namespace Response { + type Raw = NftObjectEvm.Raw[]; +} diff --git a/src/serialization/resources/nfTs/client/requests/BatchMintNftRequest.ts b/src/serialization/resources/nfTs/client/requests/BatchMintNftRequest.ts new file mode 100644 index 0000000..abf90bc --- /dev/null +++ b/src/serialization/resources/nfTs/client/requests/BatchMintNftRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { BatchMintNftRequestNftsItem } from "../../types/BatchMintNftRequestNftsItem"; + +export const BatchMintNftRequest: core.serialization.Schema< + serializers.BatchMintNftRequest.Raw, + Crossmint.BatchMintNftRequest +> = core.serialization.object({ + nfts: core.serialization.list(BatchMintNftRequestNftsItem), +}); + +export declare namespace BatchMintNftRequest { + interface Raw { + nfts: BatchMintNftRequestNftsItem.Raw[]; + } +} diff --git a/src/serialization/resources/nfTs/client/requests/EditNftByLocatorRequest.ts b/src/serialization/resources/nfTs/client/requests/EditNftByLocatorRequest.ts new file mode 100644 index 0000000..342b5d0 --- /dev/null +++ b/src/serialization/resources/nfTs/client/requests/EditNftByLocatorRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { NftMetadata } from "../../../../types/NftMetadata"; +import { ReuploadLinkedFiles } from "../../../../types/ReuploadLinkedFiles"; + +export const EditNftByLocatorRequest: core.serialization.Schema< + serializers.EditNftByLocatorRequest.Raw, + Crossmint.EditNftByLocatorRequest +> = core.serialization.object({ + metadata: NftMetadata, + reuploadLinkedFiles: ReuploadLinkedFiles, +}); + +export declare namespace EditNftByLocatorRequest { + interface Raw { + metadata: NftMetadata.Raw; + reuploadLinkedFiles: ReuploadLinkedFiles.Raw; + } +} diff --git a/src/serialization/resources/nfTs/client/requests/EditNftRequest.ts b/src/serialization/resources/nfTs/client/requests/EditNftRequest.ts new file mode 100644 index 0000000..54b8962 --- /dev/null +++ b/src/serialization/resources/nfTs/client/requests/EditNftRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { NftMetadataOptions } from "../../../../types/NftMetadataOptions"; +import { ReuploadLinkedFiles } from "../../../../types/ReuploadLinkedFiles"; + +export const EditNftRequest: core.serialization.Schema = + core.serialization.object({ + metadata: NftMetadataOptions, + reuploadLinkedFiles: ReuploadLinkedFiles.optional(), + }); + +export declare namespace EditNftRequest { + interface Raw { + metadata: NftMetadataOptions.Raw; + reuploadLinkedFiles?: ReuploadLinkedFiles.Raw | null; + } +} diff --git a/src/serialization/resources/nfTs/client/requests/MintNftIdempotentRequest.ts b/src/serialization/resources/nfTs/client/requests/MintNftIdempotentRequest.ts new file mode 100644 index 0000000..0f6000e --- /dev/null +++ b/src/serialization/resources/nfTs/client/requests/MintNftIdempotentRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Recipient } from "../../../../types/Recipient"; +import { NftMetadataOptions } from "../../../../types/NftMetadataOptions"; +import { ReuploadLinkedFiles } from "../../../../types/ReuploadLinkedFiles"; +import { Compressed } from "../../../../types/Compressed"; + +export const MintNftIdempotentRequest: core.serialization.Schema< + serializers.MintNftIdempotentRequest.Raw, + Crossmint.MintNftIdempotentRequest +> = core.serialization.object({ + recipient: Recipient, + metadata: NftMetadataOptions, + reuploadLinkedFiles: ReuploadLinkedFiles.optional(), + compressed: Compressed.optional(), +}); + +export declare namespace MintNftIdempotentRequest { + interface Raw { + recipient: Recipient.Raw; + metadata: NftMetadataOptions.Raw; + reuploadLinkedFiles?: ReuploadLinkedFiles.Raw | null; + compressed?: Compressed.Raw | null; + } +} diff --git a/src/serialization/resources/nfTs/client/requests/MintSftRequest.ts b/src/serialization/resources/nfTs/client/requests/MintSftRequest.ts new file mode 100644 index 0000000..54a458f --- /dev/null +++ b/src/serialization/resources/nfTs/client/requests/MintSftRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Recipient } from "../../../../types/Recipient"; + +export const MintSftRequest: core.serialization.Schema< + serializers.MintSftRequest.Raw, + Omit +> = core.serialization.object({ + templateId: core.serialization.string(), + recipient: Recipient, + amount: core.serialization.number().optional(), +}); + +export declare namespace MintSftRequest { + interface Raw { + templateId: string; + recipient: Recipient.Raw; + amount?: number | null; + } +} diff --git a/src/serialization/resources/nfTs/client/requests/index.ts b/src/serialization/resources/nfTs/client/requests/index.ts new file mode 100644 index 0000000..80a2482 --- /dev/null +++ b/src/serialization/resources/nfTs/client/requests/index.ts @@ -0,0 +1,5 @@ +export { BatchMintNftRequest } from "./BatchMintNftRequest"; +export { MintSftRequest } from "./MintSftRequest"; +export { MintNftIdempotentRequest } from "./MintNftIdempotentRequest"; +export { EditNftRequest } from "./EditNftRequest"; +export { EditNftByLocatorRequest } from "./EditNftByLocatorRequest"; diff --git a/src/serialization/resources/nfTs/index.ts b/src/serialization/resources/nfTs/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/nfTs/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/nfTs/types/BatchMintNftRequestNftsItem.ts b/src/serialization/resources/nfTs/types/BatchMintNftRequestNftsItem.ts new file mode 100644 index 0000000..3bd3318 --- /dev/null +++ b/src/serialization/resources/nfTs/types/BatchMintNftRequestNftsItem.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { Recipient } from "../../../types/Recipient"; +import { NftMetadataOptions } from "../../../types/NftMetadataOptions"; +import { Compressed } from "../../../types/Compressed"; + +export const BatchMintNftRequestNftsItem: core.serialization.ObjectSchema< + serializers.BatchMintNftRequestNftsItem.Raw, + Crossmint.BatchMintNftRequestNftsItem +> = core.serialization.object({ + recipient: Recipient.optional(), + metadata: NftMetadataOptions.optional(), + compressed: Compressed.optional(), + id: core.serialization.string().optional(), +}); + +export declare namespace BatchMintNftRequestNftsItem { + interface Raw { + recipient?: Recipient.Raw | null; + metadata?: NftMetadataOptions.Raw | null; + compressed?: Compressed.Raw | null; + id?: string | null; + } +} diff --git a/src/serialization/resources/nfTs/types/Metadata.ts b/src/serialization/resources/nfTs/types/Metadata.ts new file mode 100644 index 0000000..432f538 --- /dev/null +++ b/src/serialization/resources/nfTs/types/Metadata.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { NftMetadataOptions } from "../../../types/NftMetadataOptions"; + +export const Metadata: core.serialization.ObjectSchema = + core.serialization.object({ + metadata: NftMetadataOptions, + }); + +export declare namespace Metadata { + interface Raw { + metadata: NftMetadataOptions.Raw; + } +} diff --git a/src/serialization/resources/nfTs/types/MintNftIdempotentResponse.ts b/src/serialization/resources/nfTs/types/MintNftIdempotentResponse.ts new file mode 100644 index 0000000..cedf2c3 --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintNftIdempotentResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { MintResponseSolana200 } from "../../../types/MintResponseSolana200"; +import { MintResponseSolana200Subsequent } from "../../../types/MintResponseSolana200Subsequent"; +import { MintResponseEvm200 } from "../../../types/MintResponseEvm200"; +import { MintResponseEvm200Subsequent } from "../../../types/MintResponseEvm200Subsequent"; + +export const MintNftIdempotentResponse: core.serialization.Schema< + serializers.MintNftIdempotentResponse.Raw, + Crossmint.MintNftIdempotentResponse +> = core.serialization.undiscriminatedUnion([ + MintResponseSolana200, + MintResponseSolana200Subsequent, + MintResponseEvm200, + MintResponseEvm200Subsequent, +]); + +export declare namespace MintNftIdempotentResponse { + type Raw = + | MintResponseSolana200.Raw + | MintResponseSolana200Subsequent.Raw + | MintResponseEvm200.Raw + | MintResponseEvm200Subsequent.Raw; +} diff --git a/src/serialization/resources/nfTs/types/MintNftRequest.ts b/src/serialization/resources/nfTs/types/MintNftRequest.ts new file mode 100644 index 0000000..3a496d9 --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintNftRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { Metadata } from "./Metadata"; +import { MintNftRequestTemplateId } from "./MintNftRequestTemplateId"; + +export const MintNftRequest: core.serialization.Schema = + core.serialization.undiscriminatedUnion([Metadata, MintNftRequestTemplateId]); + +export declare namespace MintNftRequest { + type Raw = Metadata.Raw | MintNftRequestTemplateId.Raw; +} diff --git a/src/serialization/resources/nfTs/types/MintNftRequestTemplateId.ts b/src/serialization/resources/nfTs/types/MintNftRequestTemplateId.ts new file mode 100644 index 0000000..fd2dd8b --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintNftRequestTemplateId.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const MintNftRequestTemplateId: core.serialization.ObjectSchema< + serializers.MintNftRequestTemplateId.Raw, + Crossmint.MintNftRequestTemplateId +> = core.serialization.object({ + templateId: core.serialization.string(), +}); + +export declare namespace MintNftRequestTemplateId { + interface Raw { + templateId: string; + } +} diff --git a/src/serialization/resources/nfTs/types/MintNftResponse.ts b/src/serialization/resources/nfTs/types/MintNftResponse.ts new file mode 100644 index 0000000..d0f55ac --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintNftResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { MintResponseSolana200 } from "../../../types/MintResponseSolana200"; +import { MintResponseEvm200 } from "../../../types/MintResponseEvm200"; + +export const MintNftResponse: core.serialization.Schema = + core.serialization.undiscriminatedUnion([MintResponseSolana200, MintResponseEvm200]); + +export declare namespace MintNftResponse { + type Raw = MintResponseSolana200.Raw | MintResponseEvm200.Raw; +} diff --git a/src/serialization/resources/nfTs/types/MintSftResponse.ts b/src/serialization/resources/nfTs/types/MintSftResponse.ts new file mode 100644 index 0000000..5437c44 --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintSftResponse.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { MintSftResponseData } from "./MintSftResponseData"; + +export const MintSftResponse: core.serialization.ObjectSchema< + serializers.MintSftResponse.Raw, + Crossmint.MintSftResponse +> = core.serialization.object({ + actionId: core.serialization.string().optional(), + action: core.serialization.string().optional(), + status: core.serialization.string().optional(), + data: MintSftResponseData.optional(), + startedAt: core.serialization.string().optional(), + resource: core.serialization.string().optional(), +}); + +export declare namespace MintSftResponse { + interface Raw { + actionId?: string | null; + action?: string | null; + status?: string | null; + data?: MintSftResponseData.Raw | null; + startedAt?: string | null; + resource?: string | null; + } +} diff --git a/src/serialization/resources/nfTs/types/MintSftResponseData.ts b/src/serialization/resources/nfTs/types/MintSftResponseData.ts new file mode 100644 index 0000000..3e3746a --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintSftResponseData.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { MintSftResponseDataCollection } from "./MintSftResponseDataCollection"; +import { MintSftResponseDataRecipient } from "./MintSftResponseDataRecipient"; +import { MintSftResponseDataToken } from "./MintSftResponseDataToken"; + +export const MintSftResponseData: core.serialization.ObjectSchema< + serializers.MintSftResponseData.Raw, + Crossmint.MintSftResponseData +> = core.serialization.object({ + chain: core.serialization.string().optional(), + collection: MintSftResponseDataCollection.optional(), + recipient: MintSftResponseDataRecipient.optional(), + token: MintSftResponseDataToken.optional(), +}); + +export declare namespace MintSftResponseData { + interface Raw { + chain?: string | null; + collection?: MintSftResponseDataCollection.Raw | null; + recipient?: MintSftResponseDataRecipient.Raw | null; + token?: MintSftResponseDataToken.Raw | null; + } +} diff --git a/src/serialization/resources/nfTs/types/MintSftResponseDataCollection.ts b/src/serialization/resources/nfTs/types/MintSftResponseDataCollection.ts new file mode 100644 index 0000000..2b7c3ee --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintSftResponseDataCollection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const MintSftResponseDataCollection: core.serialization.ObjectSchema< + serializers.MintSftResponseDataCollection.Raw, + Crossmint.MintSftResponseDataCollection +> = core.serialization.object({ + id: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace MintSftResponseDataCollection { + interface Raw { + id?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/resources/nfTs/types/MintSftResponseDataRecipient.ts b/src/serialization/resources/nfTs/types/MintSftResponseDataRecipient.ts new file mode 100644 index 0000000..a991289 --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintSftResponseDataRecipient.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const MintSftResponseDataRecipient: core.serialization.ObjectSchema< + serializers.MintSftResponseDataRecipient.Raw, + Crossmint.MintSftResponseDataRecipient +> = core.serialization.object({ + walletAddress: core.serialization.string().optional(), + email: core.serialization.string().optional(), +}); + +export declare namespace MintSftResponseDataRecipient { + interface Raw { + walletAddress?: string | null; + email?: string | null; + } +} diff --git a/src/serialization/resources/nfTs/types/MintSftResponseDataToken.ts b/src/serialization/resources/nfTs/types/MintSftResponseDataToken.ts new file mode 100644 index 0000000..40fe7c3 --- /dev/null +++ b/src/serialization/resources/nfTs/types/MintSftResponseDataToken.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const MintSftResponseDataToken: core.serialization.ObjectSchema< + serializers.MintSftResponseDataToken.Raw, + Crossmint.MintSftResponseDataToken +> = core.serialization.object({ + id: core.serialization.string().optional(), +}); + +export declare namespace MintSftResponseDataToken { + interface Raw { + id?: string | null; + } +} diff --git a/src/serialization/resources/nfTs/types/index.ts b/src/serialization/resources/nfTs/types/index.ts new file mode 100644 index 0000000..6765de4 --- /dev/null +++ b/src/serialization/resources/nfTs/types/index.ts @@ -0,0 +1,11 @@ +export * from "./BatchMintNftRequestNftsItem"; +export * from "./Metadata"; +export * from "./MintNftRequestTemplateId"; +export * from "./MintNftRequest"; +export * from "./MintNftResponse"; +export * from "./MintSftResponseDataCollection"; +export * from "./MintSftResponseDataRecipient"; +export * from "./MintSftResponseDataToken"; +export * from "./MintSftResponseData"; +export * from "./MintSftResponse"; +export * from "./MintNftIdempotentResponse"; diff --git a/src/serialization/resources/nftCollections/client/index.ts b/src/serialization/resources/nftCollections/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/nftCollections/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts b/src/serialization/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts new file mode 100644 index 0000000..f449ed0 --- /dev/null +++ b/src/serialization/resources/nftCollections/client/requests/EditRoyaltyInformationRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { EditRoyaltyInformationRequestRecipientsItem } from "../../types/EditRoyaltyInformationRequestRecipientsItem"; + +export const EditRoyaltyInformationRequest: core.serialization.Schema< + serializers.EditRoyaltyInformationRequest.Raw, + Crossmint.EditRoyaltyInformationRequest +> = core.serialization.object({ + recipients: core.serialization.list(EditRoyaltyInformationRequestRecipientsItem).optional(), +}); + +export declare namespace EditRoyaltyInformationRequest { + interface Raw { + recipients?: EditRoyaltyInformationRequestRecipientsItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/nftCollections/client/requests/SetBaseUriRequest.ts b/src/serialization/resources/nftCollections/client/requests/SetBaseUriRequest.ts new file mode 100644 index 0000000..b1ef768 --- /dev/null +++ b/src/serialization/resources/nftCollections/client/requests/SetBaseUriRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const SetBaseUriRequest: core.serialization.Schema< + serializers.SetBaseUriRequest.Raw, + Crossmint.SetBaseUriRequest +> = core.serialization.object({ + uri: core.serialization.string().optional(), +}); + +export declare namespace SetBaseUriRequest { + interface Raw { + uri?: string | null; + } +} diff --git a/src/serialization/resources/nftCollections/client/requests/SetTransferabilityRequest.ts b/src/serialization/resources/nftCollections/client/requests/SetTransferabilityRequest.ts new file mode 100644 index 0000000..e64d1d9 --- /dev/null +++ b/src/serialization/resources/nftCollections/client/requests/SetTransferabilityRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const SetTransferabilityRequest: core.serialization.Schema< + serializers.SetTransferabilityRequest.Raw, + Crossmint.SetTransferabilityRequest +> = core.serialization.object({ + value: core.serialization.boolean(), +}); + +export declare namespace SetTransferabilityRequest { + interface Raw { + value: boolean; + } +} diff --git a/src/serialization/resources/nftCollections/client/requests/UpdateCollectionRequest.ts b/src/serialization/resources/nftCollections/client/requests/UpdateCollectionRequest.ts new file mode 100644 index 0000000..dc4f423 --- /dev/null +++ b/src/serialization/resources/nftCollections/client/requests/UpdateCollectionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PaymentsObject } from "../../../../types/PaymentsObject"; + +export const UpdateCollectionRequest: core.serialization.Schema< + serializers.UpdateCollectionRequest.Raw, + Crossmint.UpdateCollectionRequest +> = core.serialization.object({ + supplyLimit: core.serialization.number().optional(), + payments: PaymentsObject.optional(), +}); + +export declare namespace UpdateCollectionRequest { + interface Raw { + supplyLimit?: number | null; + payments?: PaymentsObject.Raw | null; + } +} diff --git a/src/serialization/resources/nftCollections/client/requests/index.ts b/src/serialization/resources/nftCollections/client/requests/index.ts new file mode 100644 index 0000000..f4abc1d --- /dev/null +++ b/src/serialization/resources/nftCollections/client/requests/index.ts @@ -0,0 +1,4 @@ +export { UpdateCollectionRequest } from "./UpdateCollectionRequest"; +export { EditRoyaltyInformationRequest } from "./EditRoyaltyInformationRequest"; +export { SetBaseUriRequest } from "./SetBaseUriRequest"; +export { SetTransferabilityRequest } from "./SetTransferabilityRequest"; diff --git a/src/serialization/resources/nftCollections/index.ts b/src/serialization/resources/nftCollections/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/nftCollections/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts b/src/serialization/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts new file mode 100644 index 0000000..01243fb --- /dev/null +++ b/src/serialization/resources/nftCollections/types/EditRoyaltyInformationRequestRecipientsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const EditRoyaltyInformationRequestRecipientsItem: core.serialization.ObjectSchema< + serializers.EditRoyaltyInformationRequestRecipientsItem.Raw, + Crossmint.EditRoyaltyInformationRequestRecipientsItem +> = core.serialization.object({ + address: core.serialization.string().optional(), + basisPoints: core.serialization.number().optional(), +}); + +export declare namespace EditRoyaltyInformationRequestRecipientsItem { + interface Raw { + address?: string | null; + basisPoints?: number | null; + } +} diff --git a/src/serialization/resources/nftCollections/types/GetBaseUriResponse.ts b/src/serialization/resources/nftCollections/types/GetBaseUriResponse.ts new file mode 100644 index 0000000..0165b9b --- /dev/null +++ b/src/serialization/resources/nftCollections/types/GetBaseUriResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetBaseUriResponse: core.serialization.ObjectSchema< + serializers.GetBaseUriResponse.Raw, + Crossmint.GetBaseUriResponse +> = core.serialization.object({ + uri: core.serialization.string().optional(), +}); + +export declare namespace GetBaseUriResponse { + interface Raw { + uri?: string | null; + } +} diff --git a/src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponse.ts b/src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponse.ts new file mode 100644 index 0000000..4366dc4 --- /dev/null +++ b/src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { GetRoyaltyInformationResponseRecipientsItem } from "./GetRoyaltyInformationResponseRecipientsItem"; + +export const GetRoyaltyInformationResponse: core.serialization.ObjectSchema< + serializers.GetRoyaltyInformationResponse.Raw, + Crossmint.GetRoyaltyInformationResponse +> = core.serialization.object({ + recipients: core.serialization.list(GetRoyaltyInformationResponseRecipientsItem).optional(), +}); + +export declare namespace GetRoyaltyInformationResponse { + interface Raw { + recipients?: GetRoyaltyInformationResponseRecipientsItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts b/src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts new file mode 100644 index 0000000..90ee0b6 --- /dev/null +++ b/src/serialization/resources/nftCollections/types/GetRoyaltyInformationResponseRecipientsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetRoyaltyInformationResponseRecipientsItem: core.serialization.ObjectSchema< + serializers.GetRoyaltyInformationResponseRecipientsItem.Raw, + Crossmint.GetRoyaltyInformationResponseRecipientsItem +> = core.serialization.object({ + address: core.serialization.string().optional(), + basisPoints: core.serialization.number().optional(), +}); + +export declare namespace GetRoyaltyInformationResponseRecipientsItem { + interface Raw { + address?: string | null; + basisPoints?: number | null; + } +} diff --git a/src/serialization/resources/nftCollections/types/GetTransferabilityResponse.ts b/src/serialization/resources/nftCollections/types/GetTransferabilityResponse.ts new file mode 100644 index 0000000..e5e3182 --- /dev/null +++ b/src/serialization/resources/nftCollections/types/GetTransferabilityResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetTransferabilityResponse: core.serialization.ObjectSchema< + serializers.GetTransferabilityResponse.Raw, + Crossmint.GetTransferabilityResponse +> = core.serialization.object({ + value: core.serialization.boolean().optional(), +}); + +export declare namespace GetTransferabilityResponse { + interface Raw { + value?: boolean | null; + } +} diff --git a/src/serialization/resources/nftCollections/types/ListCollectionsResponse.ts b/src/serialization/resources/nftCollections/types/ListCollectionsResponse.ts new file mode 100644 index 0000000..b067b84 --- /dev/null +++ b/src/serialization/resources/nftCollections/types/ListCollectionsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { GetCollectionResponse } from "../../../types/GetCollectionResponse"; + +export const ListCollectionsResponse: core.serialization.ObjectSchema< + serializers.ListCollectionsResponse.Raw, + Crossmint.ListCollectionsResponse +> = core.serialization.object({ + results: core.serialization.list(GetCollectionResponse).optional(), +}); + +export declare namespace ListCollectionsResponse { + interface Raw { + results?: GetCollectionResponse.Raw[] | null; + } +} diff --git a/src/serialization/resources/nftCollections/types/index.ts b/src/serialization/resources/nftCollections/types/index.ts new file mode 100644 index 0000000..9a8870b --- /dev/null +++ b/src/serialization/resources/nftCollections/types/index.ts @@ -0,0 +1,6 @@ +export * from "./ListCollectionsResponse"; +export * from "./GetRoyaltyInformationResponseRecipientsItem"; +export * from "./GetRoyaltyInformationResponse"; +export * from "./EditRoyaltyInformationRequestRecipientsItem"; +export * from "./GetBaseUriResponse"; +export * from "./GetTransferabilityResponse"; diff --git a/src/serialization/resources/nftTemplates/client/getAllTemplates.ts b/src/serialization/resources/nftTemplates/client/getAllTemplates.ts new file mode 100644 index 0000000..a97af87 --- /dev/null +++ b/src/serialization/resources/nftTemplates/client/getAllTemplates.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { TemplateResponse } from "../../../types/TemplateResponse"; + +export const Response: core.serialization.Schema< + serializers.nftTemplates.getAllTemplates.Response.Raw, + Crossmint.TemplateResponse[] +> = core.serialization.list(TemplateResponse); + +export declare namespace Response { + type Raw = TemplateResponse.Raw[]; +} diff --git a/src/serialization/resources/nftTemplates/client/index.ts b/src/serialization/resources/nftTemplates/client/index.ts new file mode 100644 index 0000000..8f917c7 --- /dev/null +++ b/src/serialization/resources/nftTemplates/client/index.ts @@ -0,0 +1 @@ +export * as getAllTemplates from "./getAllTemplates"; diff --git a/src/serialization/resources/nftTemplates/index.ts b/src/serialization/resources/nftTemplates/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/nftTemplates/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/nftTemplates/types/EditTemplateRequest.ts b/src/serialization/resources/nftTemplates/types/EditTemplateRequest.ts new file mode 100644 index 0000000..d861ab8 --- /dev/null +++ b/src/serialization/resources/nftTemplates/types/EditTemplateRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { MintingMetadata } from "../../../types/MintingMetadata"; +import { Supply } from "../../../types/Supply"; + +export const EditTemplateRequest: core.serialization.Schema< + serializers.EditTemplateRequest.Raw, + Crossmint.EditTemplateRequest +> = core.serialization.undiscriminatedUnion([MintingMetadata, Supply]); + +export declare namespace EditTemplateRequest { + type Raw = MintingMetadata.Raw | Supply.Raw; +} diff --git a/src/serialization/resources/nftTemplates/types/index.ts b/src/serialization/resources/nftTemplates/types/index.ts new file mode 100644 index 0000000..b2f8f64 --- /dev/null +++ b/src/serialization/resources/nftTemplates/types/index.ts @@ -0,0 +1 @@ +export * from "./EditTemplateRequest"; diff --git a/src/serialization/resources/quotePrice/index.ts b/src/serialization/resources/quotePrice/index.ts new file mode 100644 index 0000000..eea524d --- /dev/null +++ b/src/serialization/resources/quotePrice/index.ts @@ -0,0 +1 @@ +export * from "./types"; diff --git a/src/serialization/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts b/src/serialization/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts new file mode 100644 index 0000000..4d7d43c --- /dev/null +++ b/src/serialization/resources/quotePrice/types/QuoteRequestQuoteCurrency.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const QuoteRequestQuoteCurrency: core.serialization.Schema< + serializers.QuoteRequestQuoteCurrency.Raw, + Crossmint.QuoteRequestQuoteCurrency +> = core.serialization.enum_(["usd", "eur", "gbp", "aud", "sgd", "hkd", "krw", "inr", "vnd", "jpy"]); + +export declare namespace QuoteRequestQuoteCurrency { + type Raw = "usd" | "eur" | "gbp" | "aud" | "sgd" | "hkd" | "krw" | "inr" | "vnd" | "jpy"; +} diff --git a/src/serialization/resources/quotePrice/types/index.ts b/src/serialization/resources/quotePrice/types/index.ts new file mode 100644 index 0000000..b5ecb0f --- /dev/null +++ b/src/serialization/resources/quotePrice/types/index.ts @@ -0,0 +1 @@ +export * from "./QuoteRequestQuoteCurrency"; diff --git a/src/serialization/resources/registration/client/index.ts b/src/serialization/resources/registration/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/registration/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/registration/client/requests/RegisterNftCollectionRequest.ts b/src/serialization/resources/registration/client/requests/RegisterNftCollectionRequest.ts new file mode 100644 index 0000000..7736b0a --- /dev/null +++ b/src/serialization/resources/registration/client/requests/RegisterNftCollectionRequest.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { RegisterNftCollectionRequestChain } from "../../types/RegisterNftCollectionRequestChain"; +import { RegisterNftCollectionRequestContractType } from "../../types/RegisterNftCollectionRequestContractType"; +import { RegisterNftCollectionRequestArgs } from "../../types/RegisterNftCollectionRequestArgs"; +import { RegisterNftCollectionRequestMetadata } from "../../types/RegisterNftCollectionRequestMetadata"; +import { RegisterNftCollectionRequestOwnership } from "../../types/RegisterNftCollectionRequestOwnership"; +import { RegisterNftCollectionRequestCategory } from "../../types/RegisterNftCollectionRequestCategory"; +import { RegisterNftCollectionRequestScopesItem } from "../../types/RegisterNftCollectionRequestScopesItem"; + +export const RegisterNftCollectionRequest: core.serialization.Schema< + serializers.RegisterNftCollectionRequest.Raw, + Crossmint.RegisterNftCollectionRequest +> = core.serialization.object({ + chain: RegisterNftCollectionRequestChain, + contractType: RegisterNftCollectionRequestContractType, + args: RegisterNftCollectionRequestArgs, + metadata: RegisterNftCollectionRequestMetadata, + ownership: RegisterNftCollectionRequestOwnership, + category: RegisterNftCollectionRequestCategory, + scopes: core.serialization.list(RegisterNftCollectionRequestScopesItem), +}); + +export declare namespace RegisterNftCollectionRequest { + interface Raw { + chain: RegisterNftCollectionRequestChain.Raw; + contractType: RegisterNftCollectionRequestContractType.Raw; + args: RegisterNftCollectionRequestArgs.Raw; + metadata: RegisterNftCollectionRequestMetadata.Raw; + ownership: RegisterNftCollectionRequestOwnership.Raw; + category: RegisterNftCollectionRequestCategory.Raw; + scopes: RegisterNftCollectionRequestScopesItem.Raw[]; + } +} diff --git a/src/serialization/resources/registration/client/requests/UpdateNftCollectionRequest.ts b/src/serialization/resources/registration/client/requests/UpdateNftCollectionRequest.ts new file mode 100644 index 0000000..752def8 --- /dev/null +++ b/src/serialization/resources/registration/client/requests/UpdateNftCollectionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { UpdateNftCollectionRequestMetadata } from "../../types/UpdateNftCollectionRequestMetadata"; + +export const UpdateNftCollectionRequest: core.serialization.Schema< + serializers.UpdateNftCollectionRequest.Raw, + Crossmint.UpdateNftCollectionRequest +> = core.serialization.object({ + clientId: core.serialization.string(), + metadata: UpdateNftCollectionRequestMetadata, +}); + +export declare namespace UpdateNftCollectionRequest { + interface Raw { + clientId: string; + metadata: UpdateNftCollectionRequestMetadata.Raw; + } +} diff --git a/src/serialization/resources/registration/client/requests/index.ts b/src/serialization/resources/registration/client/requests/index.ts new file mode 100644 index 0000000..f0a486b --- /dev/null +++ b/src/serialization/resources/registration/client/requests/index.ts @@ -0,0 +1,2 @@ +export { RegisterNftCollectionRequest } from "./RegisterNftCollectionRequest"; +export { UpdateNftCollectionRequest } from "./UpdateNftCollectionRequest"; diff --git a/src/serialization/resources/registration/index.ts b/src/serialization/resources/registration/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/registration/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/registration/types/Evm.ts b/src/serialization/resources/registration/types/Evm.ts new file mode 100644 index 0000000..f3c0b53 --- /dev/null +++ b/src/serialization/resources/registration/types/Evm.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const Evm: core.serialization.ObjectSchema = core.serialization.object({ + contractAddress: core.serialization.string(), + abi: core.serialization.string(), + mintFunctionName: core.serialization.string(), + toParamName: core.serialization.string(), + quantityParamName: core.serialization.string().optional(), +}); + +export declare namespace Evm { + interface Raw { + contractAddress: string; + abi: string; + mintFunctionName: string; + toParamName: string; + quantityParamName?: string | null; + } +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestArgs.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestArgs.ts new file mode 100644 index 0000000..c4d5e1d --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestArgs.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { RegisterNftCollectionRequestArgsCandyMachineId } from "./RegisterNftCollectionRequestArgsCandyMachineId"; +import { Evm } from "./Evm"; + +export const RegisterNftCollectionRequestArgs: core.serialization.Schema< + serializers.RegisterNftCollectionRequestArgs.Raw, + Crossmint.RegisterNftCollectionRequestArgs +> = core.serialization.undiscriminatedUnion([RegisterNftCollectionRequestArgsCandyMachineId, Evm]); + +export declare namespace RegisterNftCollectionRequestArgs { + type Raw = RegisterNftCollectionRequestArgsCandyMachineId.Raw | Evm.Raw; +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts new file mode 100644 index 0000000..71cd148 --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestArgsCandyMachineId.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestArgsCandyMachineId: core.serialization.ObjectSchema< + serializers.RegisterNftCollectionRequestArgsCandyMachineId.Raw, + Crossmint.RegisterNftCollectionRequestArgsCandyMachineId +> = core.serialization.object({ + candyMachineId: core.serialization.string(), +}); + +export declare namespace RegisterNftCollectionRequestArgsCandyMachineId { + interface Raw { + candyMachineId: string; + } +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestCategory.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestCategory.ts new file mode 100644 index 0000000..21a738a --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestCategory.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestCategory: core.serialization.Schema< + serializers.RegisterNftCollectionRequestCategory.Raw, + Crossmint.RegisterNftCollectionRequestCategory +> = core.serialization.enum_(["loyalty", "art", "music", "gaming", "ticketing", "charity", "other"]); + +export declare namespace RegisterNftCollectionRequestCategory { + type Raw = "loyalty" | "art" | "music" | "gaming" | "ticketing" | "charity" | "other"; +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestChain.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestChain.ts new file mode 100644 index 0000000..aa3e4ad --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestChain.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestChain: core.serialization.Schema< + serializers.RegisterNftCollectionRequestChain.Raw, + Crossmint.RegisterNftCollectionRequestChain +> = core.serialization.enum_(["solana", "ethereum", "polygon", "bsc"]); + +export declare namespace RegisterNftCollectionRequestChain { + type Raw = "solana" | "ethereum" | "polygon" | "bsc"; +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestContractType.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestContractType.ts new file mode 100644 index 0000000..b83fa91 --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestContractType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestContractType: core.serialization.Schema< + serializers.RegisterNftCollectionRequestContractType.Raw, + Crossmint.RegisterNftCollectionRequestContractType +> = core.serialization.enum_(["candy-machine", "erc-721", "erc-1155", "thirdweb-drop"]); + +export declare namespace RegisterNftCollectionRequestContractType { + type Raw = "candy-machine" | "erc-721" | "erc-1155" | "thirdweb-drop"; +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadata.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadata.ts new file mode 100644 index 0000000..8e8947f --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadata.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { RegisterNftCollectionRequestMetadataSocial } from "./RegisterNftCollectionRequestMetadataSocial"; + +export const RegisterNftCollectionRequestMetadata: core.serialization.ObjectSchema< + serializers.RegisterNftCollectionRequestMetadata.Raw, + Crossmint.RegisterNftCollectionRequestMetadata +> = core.serialization.object({ + title: core.serialization.string(), + description: core.serialization.string(), + imageUrl: core.serialization.string(), + social: RegisterNftCollectionRequestMetadataSocial.optional(), +}); + +export declare namespace RegisterNftCollectionRequestMetadata { + interface Raw { + title: string; + description: string; + imageUrl: string; + social?: RegisterNftCollectionRequestMetadataSocial.Raw | null; + } +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts new file mode 100644 index 0000000..6f2af30 --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestMetadataSocial.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestMetadataSocial: core.serialization.ObjectSchema< + serializers.RegisterNftCollectionRequestMetadataSocial.Raw, + Crossmint.RegisterNftCollectionRequestMetadataSocial +> = core.serialization.object({ + twitter: core.serialization.string().optional(), + discord: core.serialization.string().optional(), +}); + +export declare namespace RegisterNftCollectionRequestMetadataSocial { + interface Raw { + twitter?: string | null; + discord?: string | null; + } +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestOwnership.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestOwnership.ts new file mode 100644 index 0000000..b1e27e0 --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestOwnership.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestOwnership: core.serialization.Schema< + serializers.RegisterNftCollectionRequestOwnership.Raw, + Crossmint.RegisterNftCollectionRequestOwnership +> = core.serialization.enum_(["external", "self"]); + +export declare namespace RegisterNftCollectionRequestOwnership { + type Raw = "external" | "self"; +} diff --git a/src/serialization/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts b/src/serialization/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts new file mode 100644 index 0000000..a928b69 --- /dev/null +++ b/src/serialization/resources/registration/types/RegisterNftCollectionRequestScopesItem.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const RegisterNftCollectionRequestScopesItem: core.serialization.Schema< + serializers.RegisterNftCollectionRequestScopesItem.Raw, + Crossmint.RegisterNftCollectionRequestScopesItem +> = core.serialization.enum_(["payments:credit-card", "payments:cross-chain"]); + +export declare namespace RegisterNftCollectionRequestScopesItem { + type Raw = "payments:credit-card" | "payments:cross-chain"; +} diff --git a/src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadata.ts b/src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadata.ts new file mode 100644 index 0000000..6161510 --- /dev/null +++ b/src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadata.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { UpdateNftCollectionRequestMetadataSocial } from "./UpdateNftCollectionRequestMetadataSocial"; + +export const UpdateNftCollectionRequestMetadata: core.serialization.ObjectSchema< + serializers.UpdateNftCollectionRequestMetadata.Raw, + Crossmint.UpdateNftCollectionRequestMetadata +> = core.serialization.object({ + title: core.serialization.string(), + imageUrl: core.serialization.string(), + social: UpdateNftCollectionRequestMetadataSocial.optional(), +}); + +export declare namespace UpdateNftCollectionRequestMetadata { + interface Raw { + title: string; + imageUrl: string; + social?: UpdateNftCollectionRequestMetadataSocial.Raw | null; + } +} diff --git a/src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts b/src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts new file mode 100644 index 0000000..c47fe07 --- /dev/null +++ b/src/serialization/resources/registration/types/UpdateNftCollectionRequestMetadataSocial.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const UpdateNftCollectionRequestMetadataSocial: core.serialization.ObjectSchema< + serializers.UpdateNftCollectionRequestMetadataSocial.Raw, + Crossmint.UpdateNftCollectionRequestMetadataSocial +> = core.serialization.object({ + twitter: core.serialization.string().optional(), + discord: core.serialization.string().optional(), +}); + +export declare namespace UpdateNftCollectionRequestMetadataSocial { + interface Raw { + twitter?: string | null; + discord?: string | null; + } +} diff --git a/src/serialization/resources/registration/types/index.ts b/src/serialization/resources/registration/types/index.ts new file mode 100644 index 0000000..64461dc --- /dev/null +++ b/src/serialization/resources/registration/types/index.ts @@ -0,0 +1,12 @@ +export * from "./RegisterNftCollectionRequestChain"; +export * from "./RegisterNftCollectionRequestContractType"; +export * from "./RegisterNftCollectionRequestArgsCandyMachineId"; +export * from "./Evm"; +export * from "./RegisterNftCollectionRequestArgs"; +export * from "./RegisterNftCollectionRequestMetadataSocial"; +export * from "./RegisterNftCollectionRequestMetadata"; +export * from "./RegisterNftCollectionRequestOwnership"; +export * from "./RegisterNftCollectionRequestCategory"; +export * from "./RegisterNftCollectionRequestScopesItem"; +export * from "./UpdateNftCollectionRequestMetadataSocial"; +export * from "./UpdateNftCollectionRequestMetadata"; diff --git a/src/serialization/resources/sign/client/index.ts b/src/serialization/resources/sign/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/sign/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/sign/client/requests/SignMessageRequest.ts b/src/serialization/resources/sign/client/requests/SignMessageRequest.ts new file mode 100644 index 0000000..d6cdc87 --- /dev/null +++ b/src/serialization/resources/sign/client/requests/SignMessageRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const SignMessageRequest: core.serialization.Schema< + serializers.SignMessageRequest.Raw, + Crossmint.SignMessageRequest +> = core.serialization.object({ + message: core.serialization.string(), +}); + +export declare namespace SignMessageRequest { + interface Raw { + message: string; + } +} diff --git a/src/serialization/resources/sign/client/requests/index.ts b/src/serialization/resources/sign/client/requests/index.ts new file mode 100644 index 0000000..4e382fa --- /dev/null +++ b/src/serialization/resources/sign/client/requests/index.ts @@ -0,0 +1 @@ +export { SignMessageRequest } from "./SignMessageRequest"; diff --git a/src/serialization/resources/sign/index.ts b/src/serialization/resources/sign/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/sign/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/sign/types/SignMessageResponse.ts b/src/serialization/resources/sign/types/SignMessageResponse.ts new file mode 100644 index 0000000..b6bbbd6 --- /dev/null +++ b/src/serialization/resources/sign/types/SignMessageResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const SignMessageResponse: core.serialization.ObjectSchema< + serializers.SignMessageResponse.Raw, + Crossmint.SignMessageResponse +> = core.serialization.object({ + signedMessage: core.serialization.string().optional(), +}); + +export declare namespace SignMessageResponse { + interface Raw { + signedMessage?: string | null; + } +} diff --git a/src/serialization/resources/sign/types/index.ts b/src/serialization/resources/sign/types/index.ts new file mode 100644 index 0000000..602ef7e --- /dev/null +++ b/src/serialization/resources/sign/types/index.ts @@ -0,0 +1 @@ +export * from "./SignMessageResponse"; diff --git a/src/serialization/resources/verifiableCredentials/client/getVc.ts b/src/serialization/resources/verifiableCredentials/client/getVc.ts new file mode 100644 index 0000000..ab00f96 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/getVc.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema< + serializers.verifiableCredentials.getVc.Response.Raw, + Record +> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); + +export declare namespace Response { + type Raw = Record; +} diff --git a/src/serialization/resources/verifiableCredentials/client/getVcById.ts b/src/serialization/resources/verifiableCredentials/client/getVcById.ts new file mode 100644 index 0000000..3b41976 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/getVcById.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema< + serializers.verifiableCredentials.getVcById.Response.Raw, + Record +> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); + +export declare namespace Response { + type Raw = Record; +} diff --git a/src/serialization/resources/verifiableCredentials/client/getVcByLocator.ts b/src/serialization/resources/verifiableCredentials/client/getVcByLocator.ts new file mode 100644 index 0000000..414b64c --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/getVcByLocator.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema< + serializers.verifiableCredentials.getVcByLocator.Response.Raw, + Record +> = core.serialization.record(core.serialization.string(), core.serialization.unknown()); + +export declare namespace Response { + type Raw = Record; +} diff --git a/src/serialization/resources/verifiableCredentials/client/index.ts b/src/serialization/resources/verifiableCredentials/client/index.ts new file mode 100644 index 0000000..a6a29bf --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/index.ts @@ -0,0 +1,5 @@ +export * as vcCreateTemplate from "./vcCreateTemplate"; +export * as getVc from "./getVc"; +export * as getVcById from "./getVcById"; +export * as getVcByLocator from "./getVcByLocator"; +export * from "./requests"; diff --git a/src/serialization/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts b/src/serialization/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts new file mode 100644 index 0000000..5d46bc3 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/requests/CreateTypeIdempotentRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CreateTypeIdempotentRequestCredentialSubjectSchemaItem } from "../../types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem"; +import { CreateTypeIdempotentRequestNestedTypeSchemaItem } from "../../types/CreateTypeIdempotentRequestNestedTypeSchemaItem"; + +export const CreateTypeIdempotentRequest: core.serialization.Schema< + serializers.CreateTypeIdempotentRequest.Raw, + Crossmint.CreateTypeIdempotentRequest +> = core.serialization.object({ + credentialSubjectSchema: core.serialization.list(CreateTypeIdempotentRequestCredentialSubjectSchemaItem), + nestedTypeSchema: core.serialization.list(CreateTypeIdempotentRequestNestedTypeSchemaItem).optional(), +}); + +export declare namespace CreateTypeIdempotentRequest { + interface Raw { + credentialSubjectSchema: CreateTypeIdempotentRequestCredentialSubjectSchemaItem.Raw[]; + nestedTypeSchema?: CreateTypeIdempotentRequestNestedTypeSchemaItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts b/src/serialization/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts new file mode 100644 index 0000000..aad4ad2 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/requests/CreateTypeRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CreateTypeRequestCredentialSubjectSchemaItem } from "../../types/CreateTypeRequestCredentialSubjectSchemaItem"; +import { CreateTypeRequestNestedTypeSchemaItem } from "../../types/CreateTypeRequestNestedTypeSchemaItem"; + +export const CreateTypeRequest: core.serialization.Schema< + serializers.CreateTypeRequest.Raw, + Crossmint.CreateTypeRequest +> = core.serialization.object({ + credentialSubjectSchema: core.serialization.list(CreateTypeRequestCredentialSubjectSchemaItem), + nestedTypeSchema: core.serialization.list(CreateTypeRequestNestedTypeSchemaItem).optional(), +}); + +export declare namespace CreateTypeRequest { + interface Raw { + credentialSubjectSchema: CreateTypeRequestCredentialSubjectSchemaItem.Raw[]; + nestedTypeSchema?: CreateTypeRequestNestedTypeSchemaItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/client/requests/IssueVcRequest.ts b/src/serialization/resources/verifiableCredentials/client/requests/IssueVcRequest.ts new file mode 100644 index 0000000..51f41e9 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/requests/IssueVcRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { IssueVcRequestMetadata } from "../../types/IssueVcRequestMetadata"; +import { IssueVcRequestCredential } from "../../types/IssueVcRequestCredential"; + +export const IssueVcRequest: core.serialization.Schema = + core.serialization.object({ + recipient: core.serialization.string(), + metadata: IssueVcRequestMetadata.optional(), + credential: IssueVcRequestCredential, + }); + +export declare namespace IssueVcRequest { + interface Raw { + recipient: string; + metadata?: IssueVcRequestMetadata.Raw | null; + credential: IssueVcRequestCredential.Raw; + } +} diff --git a/src/serialization/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts b/src/serialization/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts new file mode 100644 index 0000000..bbc4e4a --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/requests/VcCreateTemplateRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { VcCreateTemplateRequestMetadata } from "../../types/VcCreateTemplateRequestMetadata"; +import { VcCreateTemplateRequestCredentials } from "../../types/VcCreateTemplateRequestCredentials"; + +export const VcCreateTemplateRequest: core.serialization.Schema< + serializers.VcCreateTemplateRequest.Raw, + Crossmint.VcCreateTemplateRequest +> = core.serialization.object({ + metadata: VcCreateTemplateRequestMetadata, + credentials: VcCreateTemplateRequestCredentials, +}); + +export declare namespace VcCreateTemplateRequest { + interface Raw { + metadata: VcCreateTemplateRequestMetadata.Raw; + credentials: VcCreateTemplateRequestCredentials.Raw; + } +} diff --git a/src/serialization/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts b/src/serialization/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts new file mode 100644 index 0000000..520a843 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/requests/VerifyCredentialRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Crossmint from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const VerifyCredentialRequest: core.serialization.Schema< + serializers.VerifyCredentialRequest.Raw, + Crossmint.VerifyCredentialRequest +> = core.serialization.object({ + credential: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace VerifyCredentialRequest { + interface Raw { + credential: Record; + } +} diff --git a/src/serialization/resources/verifiableCredentials/client/requests/index.ts b/src/serialization/resources/verifiableCredentials/client/requests/index.ts new file mode 100644 index 0000000..4abc663 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/requests/index.ts @@ -0,0 +1,5 @@ +export { VerifyCredentialRequest } from "./VerifyCredentialRequest"; +export { VcCreateTemplateRequest } from "./VcCreateTemplateRequest"; +export { IssueVcRequest } from "./IssueVcRequest"; +export { CreateTypeRequest } from "./CreateTypeRequest"; +export { CreateTypeIdempotentRequest } from "./CreateTypeIdempotentRequest"; diff --git a/src/serialization/resources/verifiableCredentials/client/vcCreateTemplate.ts b/src/serialization/resources/verifiableCredentials/client/vcCreateTemplate.ts new file mode 100644 index 0000000..0debbe6 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/client/vcCreateTemplate.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as core from "../../../../core"; + +export const Response: core.serialization.Schema< + serializers.verifiableCredentials.vcCreateTemplate.Response.Raw, + string +> = core.serialization.string(); + +export declare namespace Response { + type Raw = string; +} diff --git a/src/serialization/resources/verifiableCredentials/index.ts b/src/serialization/resources/verifiableCredentials/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts b/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts new file mode 100644 index 0000000..b546050 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestCredentialSubjectSchemaItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateTypeIdempotentRequestCredentialSubjectSchemaItem: core.serialization.ObjectSchema< + serializers.CreateTypeIdempotentRequestCredentialSubjectSchemaItem.Raw, + Crossmint.CreateTypeIdempotentRequestCredentialSubjectSchemaItem +> = core.serialization.object({ + name: core.serialization.string(), + type: core.serialization.string(), +}); + +export declare namespace CreateTypeIdempotentRequestCredentialSubjectSchemaItem { + interface Raw { + name: string; + type: string; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts b/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts new file mode 100644 index 0000000..9498953 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentRequestNestedTypeSchemaItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateTypeIdempotentRequestNestedTypeSchemaItem: core.serialization.ObjectSchema< + serializers.CreateTypeIdempotentRequestNestedTypeSchemaItem.Raw, + Crossmint.CreateTypeIdempotentRequestNestedTypeSchemaItem +> = core.serialization.object({ + name: core.serialization.string(), + type: core.serialization.string(), +}); + +export declare namespace CreateTypeIdempotentRequestNestedTypeSchemaItem { + interface Raw { + name: string; + type: string; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts b/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts new file mode 100644 index 0000000..0c9c678 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/CreateTypeIdempotentResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateTypeIdempotentResponse: core.serialization.ObjectSchema< + serializers.CreateTypeIdempotentResponse.Raw, + Crossmint.CreateTypeIdempotentResponse +> = core.serialization.object({ + id: core.serialization.string().optional(), +}); + +export declare namespace CreateTypeIdempotentResponse { + interface Raw { + id?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts b/src/serialization/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts new file mode 100644 index 0000000..027c8b3 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/CreateTypeRequestCredentialSubjectSchemaItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateTypeRequestCredentialSubjectSchemaItem: core.serialization.ObjectSchema< + serializers.CreateTypeRequestCredentialSubjectSchemaItem.Raw, + Crossmint.CreateTypeRequestCredentialSubjectSchemaItem +> = core.serialization.object({ + name: core.serialization.string(), + type: core.serialization.string(), +}); + +export declare namespace CreateTypeRequestCredentialSubjectSchemaItem { + interface Raw { + name: string; + type: string; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts b/src/serialization/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts new file mode 100644 index 0000000..f710a4f --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/CreateTypeRequestNestedTypeSchemaItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateTypeRequestNestedTypeSchemaItem: core.serialization.ObjectSchema< + serializers.CreateTypeRequestNestedTypeSchemaItem.Raw, + Crossmint.CreateTypeRequestNestedTypeSchemaItem +> = core.serialization.object({ + name: core.serialization.string(), + type: core.serialization.string(), +}); + +export declare namespace CreateTypeRequestNestedTypeSchemaItem { + interface Raw { + name: string; + type: string; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/CreateTypeResponse.ts b/src/serialization/resources/verifiableCredentials/types/CreateTypeResponse.ts new file mode 100644 index 0000000..8d29c43 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/CreateTypeResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateTypeResponse: core.serialization.ObjectSchema< + serializers.CreateTypeResponse.Raw, + Crossmint.CreateTypeResponse +> = core.serialization.object({ + id: core.serialization.string().optional(), +}); + +export declare namespace CreateTypeResponse { + interface Raw { + id?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/GetTypeResponse.ts b/src/serialization/resources/verifiableCredentials/types/GetTypeResponse.ts new file mode 100644 index 0000000..522721a --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/GetTypeResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { GetTypeResponseCredentialSubjectSchemaItem } from "./GetTypeResponseCredentialSubjectSchemaItem"; + +export const GetTypeResponse: core.serialization.ObjectSchema< + serializers.GetTypeResponse.Raw, + Crossmint.GetTypeResponse +> = core.serialization.object({ + name: core.serialization.string().optional(), + credentialSubjectSchema: core.serialization.list(GetTypeResponseCredentialSubjectSchemaItem).optional(), +}); + +export declare namespace GetTypeResponse { + interface Raw { + name?: string | null; + credentialSubjectSchema?: GetTypeResponseCredentialSubjectSchemaItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts b/src/serialization/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts new file mode 100644 index 0000000..a2f6329 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/GetTypeResponseCredentialSubjectSchemaItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const GetTypeResponseCredentialSubjectSchemaItem: core.serialization.ObjectSchema< + serializers.GetTypeResponseCredentialSubjectSchemaItem.Raw, + Crossmint.GetTypeResponseCredentialSubjectSchemaItem +> = core.serialization.object({ + name: core.serialization.string().optional(), + type: core.serialization.string().optional(), +}); + +export declare namespace GetTypeResponseCredentialSubjectSchemaItem { + interface Raw { + name?: string | null; + type?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/IssueVcRequestCredential.ts b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestCredential.ts new file mode 100644 index 0000000..b74c86c --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestCredential.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const IssueVcRequestCredential: core.serialization.ObjectSchema< + serializers.IssueVcRequestCredential.Raw, + Crossmint.IssueVcRequestCredential +> = core.serialization.object({ + subject: core.serialization.record(core.serialization.string(), core.serialization.unknown()), + expiresAt: core.serialization.string().optional(), +}); + +export declare namespace IssueVcRequestCredential { + interface Raw { + subject: Record; + expiresAt?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts new file mode 100644 index 0000000..26697f4 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadata.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { IssueVcRequestMetadataAttributesItem } from "./IssueVcRequestMetadataAttributesItem"; + +export const IssueVcRequestMetadata: core.serialization.ObjectSchema< + serializers.IssueVcRequestMetadata.Raw, + Crossmint.IssueVcRequestMetadata +> = core.serialization.object({ + name: core.serialization.string(), + image: core.serialization.string(), + description: core.serialization.string(), + animationUrl: core.serialization.property("animation_url", core.serialization.string().optional()), + attributes: core.serialization.list(IssueVcRequestMetadataAttributesItem).optional(), +}); + +export declare namespace IssueVcRequestMetadata { + interface Raw { + name: string; + image: string; + description: string; + animation_url?: string | null; + attributes?: IssueVcRequestMetadataAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts new file mode 100644 index 0000000..f7d8910 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItem.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { IssueVcRequestMetadataAttributesItemDisplayType } from "./IssueVcRequestMetadataAttributesItemDisplayType"; + +export const IssueVcRequestMetadataAttributesItem: core.serialization.ObjectSchema< + serializers.IssueVcRequestMetadataAttributesItem.Raw, + Crossmint.IssueVcRequestMetadataAttributesItem +> = core.serialization.object({ + displayType: core.serialization.property( + "display_type", + IssueVcRequestMetadataAttributesItemDisplayType.optional() + ), + traitType: core.serialization.property("trait_type", core.serialization.string()), + value: core.serialization.string(), +}); + +export declare namespace IssueVcRequestMetadataAttributesItem { + interface Raw { + display_type?: IssueVcRequestMetadataAttributesItemDisplayType.Raw | null; + trait_type: string; + value: string; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts new file mode 100644 index 0000000..bb634bf --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/IssueVcRequestMetadataAttributesItemDisplayType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const IssueVcRequestMetadataAttributesItemDisplayType: core.serialization.Schema< + serializers.IssueVcRequestMetadataAttributesItemDisplayType.Raw, + Crossmint.IssueVcRequestMetadataAttributesItemDisplayType +> = core.serialization.enum_(["boost_number", "boost_percentage", "number"]); + +export declare namespace IssueVcRequestMetadataAttributesItemDisplayType { + type Raw = "boost_number" | "boost_percentage" | "number"; +} diff --git a/src/serialization/resources/verifiableCredentials/types/IssueVcResponse.ts b/src/serialization/resources/verifiableCredentials/types/IssueVcResponse.ts new file mode 100644 index 0000000..8ab79ec --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/IssueVcResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { IssueVcResponseOnChain } from "./IssueVcResponseOnChain"; + +export const IssueVcResponse: core.serialization.ObjectSchema< + serializers.IssueVcResponse.Raw, + Crossmint.IssueVcResponse +> = core.serialization.object({ + credentialId: core.serialization.string().optional(), + id: core.serialization.string().optional(), + onChain: IssueVcResponseOnChain.optional(), +}); + +export declare namespace IssueVcResponse { + interface Raw { + credentialId?: string | null; + id?: string | null; + onChain?: IssueVcResponseOnChain.Raw | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts b/src/serialization/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts new file mode 100644 index 0000000..05070d5 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/IssueVcResponseOnChain.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const IssueVcResponseOnChain: core.serialization.ObjectSchema< + serializers.IssueVcResponseOnChain.Raw, + Crossmint.IssueVcResponseOnChain +> = core.serialization.object({ + status: core.serialization.string().optional(), + chain: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace IssueVcResponseOnChain { + interface Raw { + status?: string | null; + chain?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts b/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts new file mode 100644 index 0000000..1bd7f6f --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentials.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { VcCreateTemplateRequestCredentialsDelegatedIssuer } from "./VcCreateTemplateRequestCredentialsDelegatedIssuer"; + +export const VcCreateTemplateRequestCredentials: core.serialization.ObjectSchema< + serializers.VcCreateTemplateRequestCredentials.Raw, + Crossmint.VcCreateTemplateRequestCredentials +> = core.serialization.object({ + type: core.serialization.string(), + storage: core.serialization.string().optional(), + delegatedStorageEndpoint: core.serialization.string().optional(), + encryption: core.serialization.string().optional(), + delegatedIssuer: VcCreateTemplateRequestCredentialsDelegatedIssuer.optional(), +}); + +export declare namespace VcCreateTemplateRequestCredentials { + interface Raw { + type: string; + storage?: string | null; + delegatedStorageEndpoint?: string | null; + encryption?: string | null; + delegatedIssuer?: VcCreateTemplateRequestCredentialsDelegatedIssuer.Raw | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts b/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts new file mode 100644 index 0000000..b15ea26 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestCredentialsDelegatedIssuer.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const VcCreateTemplateRequestCredentialsDelegatedIssuer: core.serialization.ObjectSchema< + serializers.VcCreateTemplateRequestCredentialsDelegatedIssuer.Raw, + Crossmint.VcCreateTemplateRequestCredentialsDelegatedIssuer +> = core.serialization.object({ + did: core.serialization.string().optional(), + endpoint: core.serialization.string().optional(), + token: core.serialization.string().optional(), +}); + +export declare namespace VcCreateTemplateRequestCredentialsDelegatedIssuer { + interface Raw { + did?: string | null; + endpoint?: string | null; + token?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts b/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts new file mode 100644 index 0000000..9175d07 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/VcCreateTemplateRequestMetadata.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const VcCreateTemplateRequestMetadata: core.serialization.ObjectSchema< + serializers.VcCreateTemplateRequestMetadata.Raw, + Crossmint.VcCreateTemplateRequestMetadata +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string(), +}); + +export declare namespace VcCreateTemplateRequestMetadata { + interface Raw { + name: string; + description: string; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/VerifyCredentialResponse.ts b/src/serialization/resources/verifiableCredentials/types/VerifyCredentialResponse.ts new file mode 100644 index 0000000..9040ae4 --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/VerifyCredentialResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const VerifyCredentialResponse: core.serialization.ObjectSchema< + serializers.VerifyCredentialResponse.Raw, + Crossmint.VerifyCredentialResponse +> = core.serialization.object({ + isValid: core.serialization.boolean().optional(), + error: core.serialization.string().optional(), +}); + +export declare namespace VerifyCredentialResponse { + interface Raw { + isValid?: boolean | null; + error?: string | null; + } +} diff --git a/src/serialization/resources/verifiableCredentials/types/index.ts b/src/serialization/resources/verifiableCredentials/types/index.ts new file mode 100644 index 0000000..ff303ad --- /dev/null +++ b/src/serialization/resources/verifiableCredentials/types/index.ts @@ -0,0 +1,18 @@ +export * from "./VerifyCredentialResponse"; +export * from "./VcCreateTemplateRequestMetadata"; +export * from "./VcCreateTemplateRequestCredentialsDelegatedIssuer"; +export * from "./VcCreateTemplateRequestCredentials"; +export * from "./IssueVcRequestMetadataAttributesItemDisplayType"; +export * from "./IssueVcRequestMetadataAttributesItem"; +export * from "./IssueVcRequestMetadata"; +export * from "./IssueVcRequestCredential"; +export * from "./IssueVcResponseOnChain"; +export * from "./IssueVcResponse"; +export * from "./CreateTypeRequestCredentialSubjectSchemaItem"; +export * from "./CreateTypeRequestNestedTypeSchemaItem"; +export * from "./CreateTypeResponse"; +export * from "./GetTypeResponseCredentialSubjectSchemaItem"; +export * from "./GetTypeResponse"; +export * from "./CreateTypeIdempotentRequestCredentialSubjectSchemaItem"; +export * from "./CreateTypeIdempotentRequestNestedTypeSchemaItem"; +export * from "./CreateTypeIdempotentResponse"; diff --git a/src/serialization/resources/wallet/client/fetchWallet.ts b/src/serialization/resources/wallet/client/fetchWallet.ts new file mode 100644 index 0000000..134dfc3 --- /dev/null +++ b/src/serialization/resources/wallet/client/fetchWallet.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { Wallet } from "../../../types/Wallet"; + +export const Response: core.serialization.Schema = + core.serialization.list(Wallet); + +export declare namespace Response { + type Raw = Wallet.Raw[]; +} diff --git a/src/serialization/resources/wallet/client/index.ts b/src/serialization/resources/wallet/client/index.ts new file mode 100644 index 0000000..20d4246 --- /dev/null +++ b/src/serialization/resources/wallet/client/index.ts @@ -0,0 +1 @@ +export * as fetchWallet from "./fetchWallet"; diff --git a/src/serialization/resources/wallet/index.ts b/src/serialization/resources/wallet/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/wallet/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/wallet/types/CreateWalletRequest.ts b/src/serialization/resources/wallet/types/CreateWalletRequest.ts new file mode 100644 index 0000000..a5b7594 --- /dev/null +++ b/src/serialization/resources/wallet/types/CreateWalletRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { Email } from "./Email"; +import { UserId } from "./UserId"; + +export const CreateWalletRequest: core.serialization.Schema< + serializers.CreateWalletRequest.Raw, + Crossmint.CreateWalletRequest +> = core.serialization.undiscriminatedUnion([Email, UserId]); + +export declare namespace CreateWalletRequest { + type Raw = Email.Raw | UserId.Raw; +} diff --git a/src/serialization/resources/wallet/types/CreateWalletResponse.ts b/src/serialization/resources/wallet/types/CreateWalletResponse.ts new file mode 100644 index 0000000..9ecb77a --- /dev/null +++ b/src/serialization/resources/wallet/types/CreateWalletResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; + +export const CreateWalletResponse: core.serialization.ObjectSchema< + serializers.CreateWalletResponse.Raw, + Crossmint.CreateWalletResponse +> = core.serialization.object({ + chain: core.serialization.string().optional(), + publicKey: core.serialization.string().optional(), +}); + +export declare namespace CreateWalletResponse { + interface Raw { + chain?: string | null; + publicKey?: string | null; + } +} diff --git a/src/serialization/resources/wallet/types/Email.ts b/src/serialization/resources/wallet/types/Email.ts new file mode 100644 index 0000000..1a0df58 --- /dev/null +++ b/src/serialization/resources/wallet/types/Email.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { AllChains } from "../../../types/AllChains"; + +export const Email: core.serialization.ObjectSchema = core.serialization.object( + { + email: core.serialization.string(), + chain: AllChains, + } +); + +export declare namespace Email { + interface Raw { + email: string; + chain: AllChains.Raw; + } +} diff --git a/src/serialization/resources/wallet/types/FetchContentFromWalletResponse.ts b/src/serialization/resources/wallet/types/FetchContentFromWalletResponse.ts new file mode 100644 index 0000000..b99b34b --- /dev/null +++ b/src/serialization/resources/wallet/types/FetchContentFromWalletResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { Nftevm } from "../../../types/Nftevm"; +import { NftSolana } from "../../../types/NftSolana"; +import { NftevmItem } from "../../../types/NftevmItem"; +import { NftsolItem } from "../../../types/NftsolItem"; + +export const FetchContentFromWalletResponse: core.serialization.Schema< + serializers.FetchContentFromWalletResponse.Raw, + Crossmint.FetchContentFromWalletResponse +> = core.serialization.undiscriminatedUnion([Nftevm, NftSolana]); + +export declare namespace FetchContentFromWalletResponse { + type Raw = Nftevm.Raw | NftSolana.Raw; +} diff --git a/src/serialization/resources/wallet/types/UserId.ts b/src/serialization/resources/wallet/types/UserId.ts new file mode 100644 index 0000000..b911243 --- /dev/null +++ b/src/serialization/resources/wallet/types/UserId.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Crossmint from "../../../../api/index"; +import * as core from "../../../../core"; +import { AllChains } from "../../../types/AllChains"; + +export const UserId: core.serialization.ObjectSchema = + core.serialization.object({ + userId: core.serialization.string(), + chain: AllChains, + }); + +export declare namespace UserId { + interface Raw { + userId: string; + chain: AllChains.Raw; + } +} diff --git a/src/serialization/resources/wallet/types/index.ts b/src/serialization/resources/wallet/types/index.ts new file mode 100644 index 0000000..9e8bf51 --- /dev/null +++ b/src/serialization/resources/wallet/types/index.ts @@ -0,0 +1,5 @@ +export * from "./Email"; +export * from "./UserId"; +export * from "./CreateWalletRequest"; +export * from "./CreateWalletResponse"; +export * from "./FetchContentFromWalletResponse"; diff --git a/src/serialization/types/AllChains.ts b/src/serialization/types/AllChains.ts new file mode 100644 index 0000000..c584a80 --- /dev/null +++ b/src/serialization/types/AllChains.ts @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const AllChains: core.serialization.Schema = + core.serialization.enum_([ + "arbitrum", + "arbitrumnova", + "arbitrum-sepolia", + "base", + "base-sepolia", + "bsc", + "ethereum", + "ethereum-sepolia", + "optimism", + "optimism-sepolia", + "polygon", + "polygon-amoy", + "skale-nebula", + "skale-nebula-testnet", + "solana", + "zkyoto", + "zora", + "zora-sepolia", + ]); + +export declare namespace AllChains { + type Raw = + | "arbitrum" + | "arbitrumnova" + | "arbitrum-sepolia" + | "base" + | "base-sepolia" + | "bsc" + | "ethereum" + | "ethereum-sepolia" + | "optimism" + | "optimism-sepolia" + | "polygon" + | "polygon-amoy" + | "skale-nebula" + | "skale-nebula-testnet" + | "solana" + | "zkyoto" + | "zora" + | "zora-sepolia"; +} diff --git a/src/serialization/types/BadRequestErrorBody.ts b/src/serialization/types/BadRequestErrorBody.ts new file mode 100644 index 0000000..3dc23c1 --- /dev/null +++ b/src/serialization/types/BadRequestErrorBody.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { OutdatedContract } from "./OutdatedContract"; +import { OldCollection } from "./OldCollection"; +import { SolanaNotSupported } from "./SolanaNotSupported"; +import { ExternalCollection } from "./ExternalCollection"; +import { SftCollection } from "./SftCollection"; + +export const BadRequestErrorBody: core.serialization.Schema< + serializers.BadRequestErrorBody.Raw, + Crossmint.BadRequestErrorBody +> = core.serialization.undiscriminatedUnion([ + OutdatedContract, + OldCollection, + SolanaNotSupported, + ExternalCollection, + SftCollection, +]); + +export declare namespace BadRequestErrorBody { + type Raw = + | OutdatedContract.Raw + | OldCollection.Raw + | SolanaNotSupported.Raw + | ExternalCollection.Raw + | SftCollection.Raw; +} diff --git a/src/serialization/types/BatchError.ts b/src/serialization/types/BatchError.ts new file mode 100644 index 0000000..c490382 --- /dev/null +++ b/src/serialization/types/BatchError.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { ValidationError } from "./ValidationError"; + +export const BatchError: core.serialization.ObjectSchema = + core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), + validationErrors: core.serialization.list(ValidationError).optional(), + }); + +export declare namespace BatchError { + interface Raw { + error?: boolean | null; + message?: string | null; + validationErrors?: ValidationError.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchMintResponse.ts b/src/serialization/types/BatchMintResponse.ts new file mode 100644 index 0000000..196e836 --- /dev/null +++ b/src/serialization/types/BatchMintResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { MintResponseEvm200 } from "./MintResponseEvm200"; + +export const BatchMintResponse: core.serialization.ObjectSchema< + serializers.BatchMintResponse.Raw, + Crossmint.BatchMintResponse +> = core.serialization.object({ + results: core.serialization.list(MintResponseEvm200), +}); + +export declare namespace BatchMintResponse { + interface Raw { + results: MintResponseEvm200.Raw[]; + } +} diff --git a/src/serialization/types/BurnNftResponse.ts b/src/serialization/types/BurnNftResponse.ts new file mode 100644 index 0000000..1ee63fe --- /dev/null +++ b/src/serialization/types/BurnNftResponse.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { BurnNftResponseData } from "./BurnNftResponseData"; + +export const BurnNftResponse: core.serialization.ObjectSchema< + serializers.BurnNftResponse.Raw, + Crossmint.BurnNftResponse +> = core.serialization.object({ + actionId: core.serialization.string().optional(), + action: core.serialization.string().optional(), + status: core.serialization.string().optional(), + data: BurnNftResponseData.optional(), + startedAt: core.serialization.date().optional(), + completedAt: core.serialization.date().optional(), + resource: core.serialization.string().optional(), +}); + +export declare namespace BurnNftResponse { + interface Raw { + actionId?: string | null; + action?: string | null; + status?: string | null; + data?: BurnNftResponseData.Raw | null; + startedAt?: string | null; + completedAt?: string | null; + resource?: string | null; + } +} diff --git a/src/serialization/types/BurnNftResponseData.ts b/src/serialization/types/BurnNftResponseData.ts new file mode 100644 index 0000000..f2adb8d --- /dev/null +++ b/src/serialization/types/BurnNftResponseData.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { BurnNftResponseDataCollection } from "./BurnNftResponseDataCollection"; +import { BurnNftResponseDataToken } from "./BurnNftResponseDataToken"; + +export const BurnNftResponseData: core.serialization.ObjectSchema< + serializers.BurnNftResponseData.Raw, + Crossmint.BurnNftResponseData +> = core.serialization.object({ + chain: core.serialization.string().optional(), + txId: core.serialization.string().optional(), + collection: BurnNftResponseDataCollection.optional(), + token: BurnNftResponseDataToken.optional(), +}); + +export declare namespace BurnNftResponseData { + interface Raw { + chain?: string | null; + txId?: string | null; + collection?: BurnNftResponseDataCollection.Raw | null; + token?: BurnNftResponseDataToken.Raw | null; + } +} diff --git a/src/serialization/types/BurnNftResponseDataCollection.ts b/src/serialization/types/BurnNftResponseDataCollection.ts new file mode 100644 index 0000000..4dfcfb0 --- /dev/null +++ b/src/serialization/types/BurnNftResponseDataCollection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const BurnNftResponseDataCollection: core.serialization.ObjectSchema< + serializers.BurnNftResponseDataCollection.Raw, + Crossmint.BurnNftResponseDataCollection +> = core.serialization.object({ + id: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace BurnNftResponseDataCollection { + interface Raw { + id?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/types/BurnNftResponseDataToken.ts b/src/serialization/types/BurnNftResponseDataToken.ts new file mode 100644 index 0000000..6e5c3a0 --- /dev/null +++ b/src/serialization/types/BurnNftResponseDataToken.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const BurnNftResponseDataToken: core.serialization.ObjectSchema< + serializers.BurnNftResponseDataToken.Raw, + Crossmint.BurnNftResponseDataToken +> = core.serialization.object({ + id: core.serialization.string().optional(), + tokenId: core.serialization.string().optional(), +}); + +export declare namespace BurnNftResponseDataToken { + interface Raw { + id?: string | null; + tokenId?: string | null; + } +} diff --git a/src/serialization/types/Cardano.ts b/src/serialization/types/Cardano.ts new file mode 100644 index 0000000..48df872 --- /dev/null +++ b/src/serialization/types/Cardano.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftcarItem } from "./NftcarItem"; + +export const Cardano: core.serialization.Schema = + core.serialization.list(NftcarItem); + +export declare namespace Cardano { + type Raw = NftcarItem.Raw[]; +} diff --git a/src/serialization/types/Checkout.ts b/src/serialization/types/Checkout.ts new file mode 100644 index 0000000..9030c60 --- /dev/null +++ b/src/serialization/types/Checkout.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { Collection } from "./Collection"; +import { Redirect } from "./Redirect"; +import { MintConfig } from "./MintConfig"; + +export const Checkout: core.serialization.ObjectSchema = + core.serialization.object({ + clientId: core.serialization.string(), + collection: Collection.optional(), + redirect: Redirect.optional(), + mintConfig: MintConfig.optional(), + emailTo: core.serialization.string().optional(), + mintTo: core.serialization.string().optional(), + paymentMethod: core.serialization.string().optional(), + whPassThroughArgs: core.serialization + .record(core.serialization.string(), core.serialization.unknown()) + .optional(), + listingId: core.serialization.string().optional(), + }); + +export declare namespace Checkout { + interface Raw { + clientId: string; + collection?: Collection.Raw | null; + redirect?: Redirect.Raw | null; + mintConfig?: MintConfig.Raw | null; + emailTo?: string | null; + mintTo?: string | null; + paymentMethod?: string | null; + whPassThroughArgs?: Record | null; + listingId?: string | null; + } +} diff --git a/src/serialization/types/CheckoutMintSuccess.ts b/src/serialization/types/CheckoutMintSuccess.ts new file mode 100644 index 0000000..f92f3fc --- /dev/null +++ b/src/serialization/types/CheckoutMintSuccess.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutMintSuccess: core.serialization.ObjectSchema< + serializers.CheckoutMintSuccess.Raw, + Crossmint.CheckoutMintSuccess +> = core.serialization.object({ + checkoutUrl: core.serialization.property("checkoutURL", core.serialization.string().optional()), +}); + +export declare namespace CheckoutMintSuccess { + interface Raw { + checkoutURL?: string | null; + } +} diff --git a/src/serialization/types/Collection.ts b/src/serialization/types/Collection.ts new file mode 100644 index 0000000..f77f694 --- /dev/null +++ b/src/serialization/types/Collection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const Collection: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string().optional(), + description: core.serialization.string().optional(), + photo: core.serialization.string().optional(), + }); + +export declare namespace Collection { + interface Raw { + title?: string | null; + description?: string | null; + photo?: string | null; + } +} diff --git a/src/serialization/types/Compressed.ts b/src/serialization/types/Compressed.ts new file mode 100644 index 0000000..d695735 --- /dev/null +++ b/src/serialization/types/Compressed.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const Compressed: core.serialization.Schema = + core.serialization.boolean(); + +export declare namespace Compressed { + type Raw = boolean; +} diff --git a/src/serialization/types/CreateCollectionBody.ts b/src/serialization/types/CreateCollectionBody.ts new file mode 100644 index 0000000..fc4e2be --- /dev/null +++ b/src/serialization/types/CreateCollectionBody.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { CreateCollectionBodyChain } from "./CreateCollectionBodyChain"; +import { CreateCollectionBodyMetadata } from "./CreateCollectionBodyMetadata"; +import { CreateCollectionBodyFungibility } from "./CreateCollectionBodyFungibility"; +import { PaymentsObject } from "./PaymentsObject"; +import { ReuploadLinkedFiles } from "./ReuploadLinkedFiles"; + +export const CreateCollectionBody: core.serialization.ObjectSchema< + serializers.CreateCollectionBody.Raw, + Crossmint.CreateCollectionBody +> = core.serialization.object({ + chain: CreateCollectionBodyChain, + metadata: CreateCollectionBodyMetadata, + fungibility: CreateCollectionBodyFungibility.optional(), + supplyLimit: core.serialization.number().optional(), + payments: PaymentsObject.optional(), + reuploadLinkedFiles: ReuploadLinkedFiles.optional(), +}); + +export declare namespace CreateCollectionBody { + interface Raw { + chain: CreateCollectionBodyChain.Raw; + metadata: CreateCollectionBodyMetadata.Raw; + fungibility?: CreateCollectionBodyFungibility.Raw | null; + supplyLimit?: number | null; + payments?: PaymentsObject.Raw | null; + reuploadLinkedFiles?: ReuploadLinkedFiles.Raw | null; + } +} diff --git a/src/serialization/types/CreateCollectionBodyChain.ts b/src/serialization/types/CreateCollectionBodyChain.ts new file mode 100644 index 0000000..4909817 --- /dev/null +++ b/src/serialization/types/CreateCollectionBodyChain.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateCollectionBodyChain: core.serialization.Schema< + serializers.CreateCollectionBodyChain.Raw, + Crossmint.CreateCollectionBodyChain +> = core.serialization.enum_([ + "aptos", + "arbitrum", + "arbitrum-sepolia", + "astar-zkevm", + "base", + "base-sepolia", + "bsc", + "ethereum", + "ethereum-sepolia", + "optimism", + "optimism-sepolia", + "polygon", + "polygon-amoy", + "skale-nebula", + "skale-nebula-testnet", + "solana", + "zkyoto", + "zora", + "zora-sepolia", +]); + +export declare namespace CreateCollectionBodyChain { + type Raw = + | "aptos" + | "arbitrum" + | "arbitrum-sepolia" + | "astar-zkevm" + | "base" + | "base-sepolia" + | "bsc" + | "ethereum" + | "ethereum-sepolia" + | "optimism" + | "optimism-sepolia" + | "polygon" + | "polygon-amoy" + | "skale-nebula" + | "skale-nebula-testnet" + | "solana" + | "zkyoto" + | "zora" + | "zora-sepolia"; +} diff --git a/src/serialization/types/CreateCollectionBodyFungibility.ts b/src/serialization/types/CreateCollectionBodyFungibility.ts new file mode 100644 index 0000000..241771b --- /dev/null +++ b/src/serialization/types/CreateCollectionBodyFungibility.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateCollectionBodyFungibility: core.serialization.Schema< + serializers.CreateCollectionBodyFungibility.Raw, + Crossmint.CreateCollectionBodyFungibility +> = core.serialization.enum_(["non-fungible", "semi-fungible"]); + +export declare namespace CreateCollectionBodyFungibility { + type Raw = "non-fungible" | "semi-fungible"; +} diff --git a/src/serialization/types/CreateCollectionBodyMetadata.ts b/src/serialization/types/CreateCollectionBodyMetadata.ts new file mode 100644 index 0000000..75aa9be --- /dev/null +++ b/src/serialization/types/CreateCollectionBodyMetadata.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateCollectionBodyMetadata: core.serialization.ObjectSchema< + serializers.CreateCollectionBodyMetadata.Raw, + Crossmint.CreateCollectionBodyMetadata +> = core.serialization.object({ + name: core.serialization.string(), + imageUrl: core.serialization.string().optional(), + description: core.serialization.string(), + symbol: core.serialization.string().optional(), +}); + +export declare namespace CreateCollectionBodyMetadata { + interface Raw { + name: string; + imageUrl?: string | null; + description: string; + symbol?: string | null; + } +} diff --git a/src/serialization/types/CreateCollectionResponse.ts b/src/serialization/types/CreateCollectionResponse.ts new file mode 100644 index 0000000..059de7c --- /dev/null +++ b/src/serialization/types/CreateCollectionResponse.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { CreateCollectionResponseMetadata } from "./CreateCollectionResponseMetadata"; +import { CreateCollectionResponseOnChain } from "./CreateCollectionResponseOnChain"; + +export const CreateCollectionResponse: core.serialization.ObjectSchema< + serializers.CreateCollectionResponse.Raw, + Crossmint.CreateCollectionResponse +> = core.serialization.object({ + id: core.serialization.string().optional(), + metadata: CreateCollectionResponseMetadata.optional(), + fungibility: core.serialization.string().optional(), + onChain: CreateCollectionResponseOnChain.optional(), + actionId: core.serialization.string().optional(), +}); + +export declare namespace CreateCollectionResponse { + interface Raw { + id?: string | null; + metadata?: CreateCollectionResponseMetadata.Raw | null; + fungibility?: string | null; + onChain?: CreateCollectionResponseOnChain.Raw | null; + actionId?: string | null; + } +} diff --git a/src/serialization/types/CreateCollectionResponseMetadata.ts b/src/serialization/types/CreateCollectionResponseMetadata.ts new file mode 100644 index 0000000..49e2110 --- /dev/null +++ b/src/serialization/types/CreateCollectionResponseMetadata.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateCollectionResponseMetadata: core.serialization.ObjectSchema< + serializers.CreateCollectionResponseMetadata.Raw, + Crossmint.CreateCollectionResponseMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + imageUrl: core.serialization.string().optional(), + symbol: core.serialization.string().optional(), +}); + +export declare namespace CreateCollectionResponseMetadata { + interface Raw { + name?: string | null; + description?: string | null; + imageUrl?: string | null; + symbol?: string | null; + } +} diff --git a/src/serialization/types/CreateCollectionResponseOnChain.ts b/src/serialization/types/CreateCollectionResponseOnChain.ts new file mode 100644 index 0000000..23de505 --- /dev/null +++ b/src/serialization/types/CreateCollectionResponseOnChain.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateCollectionResponseOnChain: core.serialization.ObjectSchema< + serializers.CreateCollectionResponseOnChain.Raw, + Crossmint.CreateCollectionResponseOnChain +> = core.serialization.object({ + chain: core.serialization.string().optional(), + type: core.serialization.string().optional(), +}); + +export declare namespace CreateCollectionResponseOnChain { + interface Raw { + chain?: string | null; + type?: string | null; + } +} diff --git a/src/serialization/types/CreateTemplateBody.ts b/src/serialization/types/CreateTemplateBody.ts new file mode 100644 index 0000000..9b089b0 --- /dev/null +++ b/src/serialization/types/CreateTemplateBody.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { CreateTemplateBodyMetadata } from "./CreateTemplateBodyMetadata"; +import { CreateTemplateBodyOnChain } from "./CreateTemplateBodyOnChain"; +import { CreateTemplateBodySupply } from "./CreateTemplateBodySupply"; +import { ReuploadLinkedFiles } from "./ReuploadLinkedFiles"; + +export const CreateTemplateBody: core.serialization.ObjectSchema< + serializers.CreateTemplateBody.Raw, + Crossmint.CreateTemplateBody +> = core.serialization.object({ + metadata: CreateTemplateBodyMetadata.optional(), + onChain: CreateTemplateBodyOnChain.optional(), + supply: CreateTemplateBodySupply.optional(), + reuploadLinkedFiles: ReuploadLinkedFiles.optional(), +}); + +export declare namespace CreateTemplateBody { + interface Raw { + metadata?: CreateTemplateBodyMetadata.Raw | null; + onChain?: CreateTemplateBodyOnChain.Raw | null; + supply?: CreateTemplateBodySupply.Raw | null; + reuploadLinkedFiles?: ReuploadLinkedFiles.Raw | null; + } +} diff --git a/src/serialization/types/CreateTemplateBodyMetadata.ts b/src/serialization/types/CreateTemplateBodyMetadata.ts new file mode 100644 index 0000000..54eef7c --- /dev/null +++ b/src/serialization/types/CreateTemplateBodyMetadata.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateTemplateBodyMetadata: core.serialization.ObjectSchema< + serializers.CreateTemplateBodyMetadata.Raw, + Crossmint.CreateTemplateBodyMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + image: core.serialization.string().optional(), + description: core.serialization.string().optional(), +}); + +export declare namespace CreateTemplateBodyMetadata { + interface Raw { + name?: string | null; + image?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/CreateTemplateBodyOnChain.ts b/src/serialization/types/CreateTemplateBodyOnChain.ts new file mode 100644 index 0000000..f7e495e --- /dev/null +++ b/src/serialization/types/CreateTemplateBodyOnChain.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateTemplateBodyOnChain: core.serialization.ObjectSchema< + serializers.CreateTemplateBodyOnChain.Raw, + Crossmint.CreateTemplateBodyOnChain +> = core.serialization.object({ + tokenId: core.serialization.string().optional(), +}); + +export declare namespace CreateTemplateBodyOnChain { + interface Raw { + tokenId?: string | null; + } +} diff --git a/src/serialization/types/CreateTemplateBodySupply.ts b/src/serialization/types/CreateTemplateBodySupply.ts new file mode 100644 index 0000000..4cb6374 --- /dev/null +++ b/src/serialization/types/CreateTemplateBodySupply.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const CreateTemplateBodySupply: core.serialization.ObjectSchema< + serializers.CreateTemplateBodySupply.Raw, + Crossmint.CreateTemplateBodySupply +> = core.serialization.object({ + limit: core.serialization.number().optional(), +}); + +export declare namespace CreateTemplateBodySupply { + interface Raw { + limit?: number | null; + } +} diff --git a/src/serialization/types/EditNftResponse.ts b/src/serialization/types/EditNftResponse.ts new file mode 100644 index 0000000..573c060 --- /dev/null +++ b/src/serialization/types/EditNftResponse.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { EditNftResponseData } from "./EditNftResponseData"; + +export const EditNftResponse: core.serialization.ObjectSchema< + serializers.EditNftResponse.Raw, + Crossmint.EditNftResponse +> = core.serialization.object({ + actionId: core.serialization.string().optional(), + action: core.serialization.string().optional(), + status: core.serialization.string().optional(), + data: EditNftResponseData.optional(), + startedAt: core.serialization.date().optional(), + completedAt: core.serialization.date().optional(), + resource: core.serialization.string().optional(), +}); + +export declare namespace EditNftResponse { + interface Raw { + actionId?: string | null; + action?: string | null; + status?: string | null; + data?: EditNftResponseData.Raw | null; + startedAt?: string | null; + completedAt?: string | null; + resource?: string | null; + } +} diff --git a/src/serialization/types/EditNftResponseData.ts b/src/serialization/types/EditNftResponseData.ts new file mode 100644 index 0000000..8693017 --- /dev/null +++ b/src/serialization/types/EditNftResponseData.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { EditNftResponseDataCollection } from "./EditNftResponseDataCollection"; +import { EditNftResponseDataToken } from "./EditNftResponseDataToken"; + +export const EditNftResponseData: core.serialization.ObjectSchema< + serializers.EditNftResponseData.Raw, + Crossmint.EditNftResponseData +> = core.serialization.object({ + txId: core.serialization.string().optional(), + chain: core.serialization.string().optional(), + collection: EditNftResponseDataCollection.optional(), + token: EditNftResponseDataToken.optional(), + changes: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace EditNftResponseData { + interface Raw { + txId?: string | null; + chain?: string | null; + collection?: EditNftResponseDataCollection.Raw | null; + token?: EditNftResponseDataToken.Raw | null; + changes?: string[] | null; + } +} diff --git a/src/serialization/types/EditNftResponseDataCollection.ts b/src/serialization/types/EditNftResponseDataCollection.ts new file mode 100644 index 0000000..6ce71ad --- /dev/null +++ b/src/serialization/types/EditNftResponseDataCollection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const EditNftResponseDataCollection: core.serialization.ObjectSchema< + serializers.EditNftResponseDataCollection.Raw, + Crossmint.EditNftResponseDataCollection +> = core.serialization.object({ + id: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace EditNftResponseDataCollection { + interface Raw { + id?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/types/EditNftResponseDataToken.ts b/src/serialization/types/EditNftResponseDataToken.ts new file mode 100644 index 0000000..7ca299f --- /dev/null +++ b/src/serialization/types/EditNftResponseDataToken.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { EditNftResponseDataTokenOwner } from "./EditNftResponseDataTokenOwner"; + +export const EditNftResponseDataToken: core.serialization.ObjectSchema< + serializers.EditNftResponseDataToken.Raw, + Crossmint.EditNftResponseDataToken +> = core.serialization.object({ + id: core.serialization.string().optional(), + owner: EditNftResponseDataTokenOwner.optional(), + tokenId: core.serialization.string().optional(), +}); + +export declare namespace EditNftResponseDataToken { + interface Raw { + id?: string | null; + owner?: EditNftResponseDataTokenOwner.Raw | null; + tokenId?: string | null; + } +} diff --git a/src/serialization/types/EditNftResponseDataTokenOwner.ts b/src/serialization/types/EditNftResponseDataTokenOwner.ts new file mode 100644 index 0000000..0ac9fd4 --- /dev/null +++ b/src/serialization/types/EditNftResponseDataTokenOwner.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const EditNftResponseDataTokenOwner: core.serialization.ObjectSchema< + serializers.EditNftResponseDataTokenOwner.Raw, + Crossmint.EditNftResponseDataTokenOwner +> = core.serialization.object({ + walletAddress: core.serialization.string().optional(), +}); + +export declare namespace EditNftResponseDataTokenOwner { + interface Raw { + walletAddress?: string | null; + } +} diff --git a/src/serialization/types/NotFoundResponse.ts b/src/serialization/types/Error400Response.ts similarity index 70% rename from src/serialization/types/NotFoundResponse.ts rename to src/serialization/types/Error400Response.ts index 2d60f18..bf1a73e 100644 --- a/src/serialization/types/NotFoundResponse.ts +++ b/src/serialization/types/Error400Response.ts @@ -6,15 +6,15 @@ import * as serializers from "../index"; import * as Crossmint from "../../api/index"; import * as core from "../../core"; -export const NotFoundResponse: core.serialization.ObjectSchema< - serializers.NotFoundResponse.Raw, - Crossmint.NotFoundResponse +export const Error400Response: core.serialization.ObjectSchema< + serializers.Error400Response.Raw, + Crossmint.Error400Response > = core.serialization.object({ error: core.serialization.boolean().optional(), message: core.serialization.string().optional(), }); -export declare namespace NotFoundResponse { +export declare namespace Error400Response { interface Raw { error?: boolean | null; message?: string | null; diff --git a/src/serialization/types/BadRequestResponse.ts b/src/serialization/types/Error403Response.ts similarity index 70% rename from src/serialization/types/BadRequestResponse.ts rename to src/serialization/types/Error403Response.ts index 128e08f..bf44cde 100644 --- a/src/serialization/types/BadRequestResponse.ts +++ b/src/serialization/types/Error403Response.ts @@ -6,15 +6,15 @@ import * as serializers from "../index"; import * as Crossmint from "../../api/index"; import * as core from "../../core"; -export const BadRequestResponse: core.serialization.ObjectSchema< - serializers.BadRequestResponse.Raw, - Crossmint.BadRequestResponse +export const Error403Response: core.serialization.ObjectSchema< + serializers.Error403Response.Raw, + Crossmint.Error403Response > = core.serialization.object({ error: core.serialization.boolean().optional(), message: core.serialization.string().optional(), }); -export declare namespace BadRequestResponse { +export declare namespace Error403Response { interface Raw { error?: boolean | null; message?: string | null; diff --git a/src/serialization/types/UnauthorizedResponse.ts b/src/serialization/types/Error404Response.ts similarity index 69% rename from src/serialization/types/UnauthorizedResponse.ts rename to src/serialization/types/Error404Response.ts index a722bb3..a845a3f 100644 --- a/src/serialization/types/UnauthorizedResponse.ts +++ b/src/serialization/types/Error404Response.ts @@ -6,15 +6,15 @@ import * as serializers from "../index"; import * as Crossmint from "../../api/index"; import * as core from "../../core"; -export const UnauthorizedResponse: core.serialization.ObjectSchema< - serializers.UnauthorizedResponse.Raw, - Crossmint.UnauthorizedResponse +export const Error404Response: core.serialization.ObjectSchema< + serializers.Error404Response.Raw, + Crossmint.Error404Response > = core.serialization.object({ error: core.serialization.boolean().optional(), message: core.serialization.string().optional(), }); -export declare namespace UnauthorizedResponse { +export declare namespace Error404Response { interface Raw { error?: boolean | null; message?: string | null; diff --git a/src/serialization/types/ServiceUnavailabileResponse.ts b/src/serialization/types/Error503Response.ts similarity index 66% rename from src/serialization/types/ServiceUnavailabileResponse.ts rename to src/serialization/types/Error503Response.ts index a76e453..f103c8a 100644 --- a/src/serialization/types/ServiceUnavailabileResponse.ts +++ b/src/serialization/types/Error503Response.ts @@ -6,15 +6,15 @@ import * as serializers from "../index"; import * as Crossmint from "../../api/index"; import * as core from "../../core"; -export const ServiceUnavailabileResponse: core.serialization.ObjectSchema< - serializers.ServiceUnavailabileResponse.Raw, - Crossmint.ServiceUnavailabileResponse +export const Error503Response: core.serialization.ObjectSchema< + serializers.Error503Response.Raw, + Crossmint.Error503Response > = core.serialization.object({ error: core.serialization.boolean().optional(), message: core.serialization.string().optional(), }); -export declare namespace ServiceUnavailabileResponse { +export declare namespace Error503Response { interface Raw { error?: boolean | null; message?: string | null; diff --git a/src/serialization/types/ErrorMsg.ts b/src/serialization/types/ErrorMsg.ts new file mode 100644 index 0000000..71a930d --- /dev/null +++ b/src/serialization/types/ErrorMsg.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const ErrorMsg: core.serialization.ObjectSchema = + core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), + }); + +export declare namespace ErrorMsg { + interface Raw { + error?: boolean | null; + message?: string | null; + } +} diff --git a/src/serialization/types/RecipientEmail.ts b/src/serialization/types/Error_.ts similarity index 53% rename from src/serialization/types/RecipientEmail.ts rename to src/serialization/types/Error_.ts index 2203cfd..ba87ac7 100644 --- a/src/serialization/types/RecipientEmail.ts +++ b/src/serialization/types/Error_.ts @@ -6,13 +6,13 @@ import * as serializers from "../index"; import * as Crossmint from "../../api/index"; import * as core from "../../core"; -export const RecipientEmail: core.serialization.ObjectSchema = +export const Error_: core.serialization.ObjectSchema = core.serialization.object({ - email: core.serialization.string(), + error: core.serialization.string().optional(), }); -export declare namespace RecipientEmail { +export declare namespace Error_ { interface Raw { - email: string; + error?: string | null; } } diff --git a/src/serialization/types/EvmChains.ts b/src/serialization/types/EvmChains.ts new file mode 100644 index 0000000..3b4ab4d --- /dev/null +++ b/src/serialization/types/EvmChains.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const EvmChains: core.serialization.Schema = + core.serialization.enum_([ + "arbitrum", + "arbitrumnova", + "arbitrum-sepolia", + "base", + "base-sepolia", + "bsc", + "ethereum", + "ethereum-sepolia", + "optimism", + "optimism-sepolia", + "polygon", + "polygon-amoy", + "zkyoto", + "zora", + "zora-sepolia", + ]); + +export declare namespace EvmChains { + type Raw = + | "arbitrum" + | "arbitrumnova" + | "arbitrum-sepolia" + | "base" + | "base-sepolia" + | "bsc" + | "ethereum" + | "ethereum-sepolia" + | "optimism" + | "optimism-sepolia" + | "polygon" + | "polygon-amoy" + | "zkyoto" + | "zora" + | "zora-sepolia"; +} diff --git a/src/serialization/types/EvmTransfer.ts b/src/serialization/types/EvmTransfer.ts new file mode 100644 index 0000000..75e50cd --- /dev/null +++ b/src/serialization/types/EvmTransfer.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { EvmChains } from "./EvmChains"; + +export const EvmTransfer: core.serialization.ObjectSchema = + core.serialization.object({ + chain: EvmChains.optional(), + from: core.serialization.string().optional(), + to: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), + tokenId: core.serialization.string().optional(), + quantity: core.serialization.string().optional(), + }); + +export declare namespace EvmTransfer { + interface Raw { + chain?: EvmChains.Raw | null; + from?: string | null; + to?: string | null; + contractAddress?: string | null; + tokenId?: string | null; + quantity?: string | null; + } +} diff --git a/src/serialization/types/ExternalCollection.ts b/src/serialization/types/ExternalCollection.ts new file mode 100644 index 0000000..14e8c1a --- /dev/null +++ b/src/serialization/types/ExternalCollection.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const ExternalCollection: core.serialization.ObjectSchema< + serializers.ExternalCollection.Raw, + Crossmint.ExternalCollection +> = core.serialization.object({ + message: core.serialization.string().optional(), +}); + +export declare namespace ExternalCollection { + interface Raw { + message?: string | null; + } +} diff --git a/src/serialization/types/FourHundredNineResponse.ts b/src/serialization/types/FourHundredNineResponse.ts new file mode 100644 index 0000000..136bc45 --- /dev/null +++ b/src/serialization/types/FourHundredNineResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const FourHundredNineResponse: core.serialization.ObjectSchema< + serializers.FourHundredNineResponse.Raw, + Crossmint.FourHundredNineResponse +> = core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), +}); + +export declare namespace FourHundredNineResponse { + interface Raw { + error?: boolean | null; + message?: string | null; + } +} diff --git a/src/serialization/types/FourHundredTwentyFourResponse.ts b/src/serialization/types/FourHundredTwentyFourResponse.ts new file mode 100644 index 0000000..cce8555 --- /dev/null +++ b/src/serialization/types/FourHundredTwentyFourResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const FourHundredTwentyFourResponse: core.serialization.ObjectSchema< + serializers.FourHundredTwentyFourResponse.Raw, + Crossmint.FourHundredTwentyFourResponse +> = core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), +}); + +export declare namespace FourHundredTwentyFourResponse { + interface Raw { + error?: boolean | null; + message?: string | null; + } +} diff --git a/src/serialization/types/GetCollectionResponse.ts b/src/serialization/types/GetCollectionResponse.ts new file mode 100644 index 0000000..9b64d34 --- /dev/null +++ b/src/serialization/types/GetCollectionResponse.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { GetCollectionResponseMetadata } from "./GetCollectionResponseMetadata"; +import { GetCollectionResponseOnChain } from "./GetCollectionResponseOnChain"; +import { GetCollectionResponsePayments } from "./GetCollectionResponsePayments"; + +export const GetCollectionResponse: core.serialization.ObjectSchema< + serializers.GetCollectionResponse.Raw, + Crossmint.GetCollectionResponse +> = core.serialization.object({ + id: core.serialization.string().optional(), + metadata: GetCollectionResponseMetadata.optional(), + fungibility: core.serialization.string().optional(), + onChain: GetCollectionResponseOnChain.optional(), + supplyLimit: core.serialization.number().optional(), + payments: GetCollectionResponsePayments.optional(), +}); + +export declare namespace GetCollectionResponse { + interface Raw { + id?: string | null; + metadata?: GetCollectionResponseMetadata.Raw | null; + fungibility?: string | null; + onChain?: GetCollectionResponseOnChain.Raw | null; + supplyLimit?: number | null; + payments?: GetCollectionResponsePayments.Raw | null; + } +} diff --git a/src/serialization/types/GetCollectionResponseMetadata.ts b/src/serialization/types/GetCollectionResponseMetadata.ts new file mode 100644 index 0000000..4fbe05d --- /dev/null +++ b/src/serialization/types/GetCollectionResponseMetadata.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const GetCollectionResponseMetadata: core.serialization.ObjectSchema< + serializers.GetCollectionResponseMetadata.Raw, + Crossmint.GetCollectionResponseMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + imageUrl: core.serialization.string().optional(), + symbol: core.serialization.string().optional(), +}); + +export declare namespace GetCollectionResponseMetadata { + interface Raw { + name?: string | null; + description?: string | null; + imageUrl?: string | null; + symbol?: string | null; + } +} diff --git a/src/serialization/types/GetCollectionResponseOnChain.ts b/src/serialization/types/GetCollectionResponseOnChain.ts new file mode 100644 index 0000000..773337c --- /dev/null +++ b/src/serialization/types/GetCollectionResponseOnChain.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const GetCollectionResponseOnChain: core.serialization.ObjectSchema< + serializers.GetCollectionResponseOnChain.Raw, + Crossmint.GetCollectionResponseOnChain +> = core.serialization.object({ + chain: core.serialization.string().optional(), + type: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace GetCollectionResponseOnChain { + interface Raw { + chain?: string | null; + type?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/types/GetCollectionResponsePayments.ts b/src/serialization/types/GetCollectionResponsePayments.ts new file mode 100644 index 0000000..734e091 --- /dev/null +++ b/src/serialization/types/GetCollectionResponsePayments.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const GetCollectionResponsePayments: core.serialization.ObjectSchema< + serializers.GetCollectionResponsePayments.Raw, + Crossmint.GetCollectionResponsePayments +> = core.serialization.object({ + price: core.serialization.string().optional(), + recipientAddress: core.serialization.string().optional(), +}); + +export declare namespace GetCollectionResponsePayments { + interface Raw { + price?: string | null; + recipientAddress?: string | null; + } +} diff --git a/src/serialization/types/MintApiFeatureCollectionNotDeployed.ts b/src/serialization/types/MintApiFeatureCollectionNotDeployed.ts new file mode 100644 index 0000000..c497fe2 --- /dev/null +++ b/src/serialization/types/MintApiFeatureCollectionNotDeployed.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const MintApiFeatureCollectionNotDeployed: core.serialization.ObjectSchema< + serializers.MintApiFeatureCollectionNotDeployed.Raw, + Crossmint.MintApiFeatureCollectionNotDeployed +> = core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), +}); + +export declare namespace MintApiFeatureCollectionNotDeployed { + interface Raw { + error?: boolean | null; + message?: string | null; + } +} diff --git a/src/serialization/types/MintConfig.ts b/src/serialization/types/MintConfig.ts new file mode 100644 index 0000000..5932eaf --- /dev/null +++ b/src/serialization/types/MintConfig.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const MintConfig: core.serialization.ObjectSchema = + core.serialization.object({ + totalPrice: core.serialization.string().optional(), + "": core.serialization.property( + "...", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + }); + +export declare namespace MintConfig { + interface Raw { + totalPrice?: string | null; + "..."?: Record | null; + } +} diff --git a/src/serialization/types/MintResponseEvm200.ts b/src/serialization/types/MintResponseEvm200.ts new file mode 100644 index 0000000..e5c292a --- /dev/null +++ b/src/serialization/types/MintResponseEvm200.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { MintResponseEvm200OnChain } from "./MintResponseEvm200OnChain"; + +export const MintResponseEvm200: core.serialization.ObjectSchema< + serializers.MintResponseEvm200.Raw, + Crossmint.MintResponseEvm200 +> = core.serialization.object({ + id: core.serialization.string().optional(), + onChain: MintResponseEvm200OnChain.optional(), + actionId: core.serialization.string().optional(), +}); + +export declare namespace MintResponseEvm200 { + interface Raw { + id?: string | null; + onChain?: MintResponseEvm200OnChain.Raw | null; + actionId?: string | null; + } +} diff --git a/src/serialization/types/MintResponseEvm200OnChain.ts b/src/serialization/types/MintResponseEvm200OnChain.ts new file mode 100644 index 0000000..f0db3f6 --- /dev/null +++ b/src/serialization/types/MintResponseEvm200OnChain.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const MintResponseEvm200OnChain: core.serialization.ObjectSchema< + serializers.MintResponseEvm200OnChain.Raw, + Crossmint.MintResponseEvm200OnChain +> = core.serialization.object({ + status: core.serialization.string().optional(), + chain: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace MintResponseEvm200OnChain { + interface Raw { + status?: string | null; + chain?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/types/MintResponseEvm200Subsequent.ts b/src/serialization/types/MintResponseEvm200Subsequent.ts new file mode 100644 index 0000000..faee21b --- /dev/null +++ b/src/serialization/types/MintResponseEvm200Subsequent.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectEvm } from "./NftObjectEvm"; + +export const MintResponseEvm200Subsequent: core.serialization.ObjectSchema< + serializers.MintResponseEvm200Subsequent.Raw, + Crossmint.MintResponseEvm200Subsequent +> = core.serialization + .object({ + actionId: core.serialization.string().optional(), + }) + .extend(NftObjectEvm); + +export declare namespace MintResponseEvm200Subsequent { + interface Raw extends NftObjectEvm.Raw { + actionId?: string | null; + } +} diff --git a/src/serialization/types/MintResponseSolana200.ts b/src/serialization/types/MintResponseSolana200.ts new file mode 100644 index 0000000..697cf78 --- /dev/null +++ b/src/serialization/types/MintResponseSolana200.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { MintResponseSolana200OnChain } from "./MintResponseSolana200OnChain"; + +export const MintResponseSolana200: core.serialization.ObjectSchema< + serializers.MintResponseSolana200.Raw, + Crossmint.MintResponseSolana200 +> = core.serialization.object({ + id: core.serialization.string().optional(), + onChain: MintResponseSolana200OnChain.optional(), + actionId: core.serialization.string().optional(), +}); + +export declare namespace MintResponseSolana200 { + interface Raw { + id?: string | null; + onChain?: MintResponseSolana200OnChain.Raw | null; + actionId?: string | null; + } +} diff --git a/src/serialization/types/MintResponseSolana200OnChain.ts b/src/serialization/types/MintResponseSolana200OnChain.ts new file mode 100644 index 0000000..aaab88c --- /dev/null +++ b/src/serialization/types/MintResponseSolana200OnChain.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const MintResponseSolana200OnChain: core.serialization.ObjectSchema< + serializers.MintResponseSolana200OnChain.Raw, + Crossmint.MintResponseSolana200OnChain +> = core.serialization.object({ + status: core.serialization.string().optional(), + chain: core.serialization.string().optional(), +}); + +export declare namespace MintResponseSolana200OnChain { + interface Raw { + status?: string | null; + chain?: string | null; + } +} diff --git a/src/serialization/types/MintResponseSolana200Subsequent.ts b/src/serialization/types/MintResponseSolana200Subsequent.ts new file mode 100644 index 0000000..bbee716 --- /dev/null +++ b/src/serialization/types/MintResponseSolana200Subsequent.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectSolana } from "./NftObjectSolana"; + +export const MintResponseSolana200Subsequent: core.serialization.ObjectSchema< + serializers.MintResponseSolana200Subsequent.Raw, + Crossmint.MintResponseSolana200Subsequent +> = core.serialization + .object({ + actionId: core.serialization.string().optional(), + }) + .extend(NftObjectSolana); + +export declare namespace MintResponseSolana200Subsequent { + interface Raw extends NftObjectSolana.Raw { + actionId?: string | null; + } +} diff --git a/src/serialization/types/MintStatus.ts b/src/serialization/types/MintStatus.ts new file mode 100644 index 0000000..855892e --- /dev/null +++ b/src/serialization/types/MintStatus.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { MintStatusStatus } from "./MintStatusStatus"; + +export const MintStatus: core.serialization.ObjectSchema = + core.serialization.object({ + status: MintStatusStatus.optional(), + mintAddress: core.serialization.string().optional(), + walletAddress: core.serialization.string().optional(), + passThroughArgs: core.serialization.string().optional(), + }); + +export declare namespace MintStatus { + interface Raw { + status?: MintStatusStatus.Raw | null; + mintAddress?: string | null; + walletAddress?: string | null; + passThroughArgs?: string | null; + } +} diff --git a/src/serialization/types/MintStatusSolana200.ts b/src/serialization/types/MintStatusSolana200.ts new file mode 100644 index 0000000..af2d437 --- /dev/null +++ b/src/serialization/types/MintStatusSolana200.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectSolana } from "./NftObjectSolana"; + +export const MintStatusSolana200: core.serialization.ObjectSchema< + serializers.MintStatusSolana200.Raw, + Crossmint.MintStatusSolana200 +> = core.serialization + .object({ + action: core.serialization.string().optional(), + }) + .extend(NftObjectSolana); + +export declare namespace MintStatusSolana200 { + interface Raw extends NftObjectSolana.Raw { + action?: string | null; + } +} diff --git a/src/serialization/types/MintStatusStatus.ts b/src/serialization/types/MintStatusStatus.ts new file mode 100644 index 0000000..c3b6520 --- /dev/null +++ b/src/serialization/types/MintStatusStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const MintStatusStatus: core.serialization.Schema = + core.serialization.enum_(["minting", "success", "error"]); + +export declare namespace MintStatusStatus { + type Raw = "minting" | "success" | "error"; +} diff --git a/src/serialization/types/MintingMetadata.ts b/src/serialization/types/MintingMetadata.ts new file mode 100644 index 0000000..148a3e8 --- /dev/null +++ b/src/serialization/types/MintingMetadata.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const MintingMetadata: core.serialization.ObjectSchema< + serializers.MintingMetadata.Raw, + Crossmint.MintingMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + imageUrl: core.serialization.string().optional(), + description: core.serialization.string().optional(), +}); + +export declare namespace MintingMetadata { + interface Raw { + name?: string | null; + imageUrl?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/Nft.ts b/src/serialization/types/Nft.ts new file mode 100644 index 0000000..30bd84f --- /dev/null +++ b/src/serialization/types/Nft.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftCollection } from "./NftCollection"; +import { NftAttributesItem } from "./NftAttributesItem"; +import { NftProperties } from "./NftProperties"; + +export const Nft: core.serialization.ObjectSchema = core.serialization.object({ + name: core.serialization.string().optional(), + symbol: core.serialization.string().optional(), + description: core.serialization.string().optional(), + image: core.serialization.string().optional(), + collection: NftCollection.optional(), + attributes: core.serialization.list(NftAttributesItem).optional(), + properties: NftProperties.optional(), + mintHash: core.serialization.string().optional(), + sellerFeeBasisPoints: core.serialization.property( + "seller_fee_basis_points", + core.serialization.number().optional() + ), +}); + +export declare namespace Nft { + interface Raw { + name?: string | null; + symbol?: string | null; + description?: string | null; + image?: string | null; + collection?: NftCollection.Raw | null; + attributes?: NftAttributesItem.Raw[] | null; + properties?: NftProperties.Raw | null; + mintHash?: string | null; + seller_fee_basis_points?: number | null; + } +} diff --git a/src/serialization/types/NftAttributesItem.ts b/src/serialization/types/NftAttributesItem.ts new file mode 100644 index 0000000..c5f8cbc --- /dev/null +++ b/src/serialization/types/NftAttributesItem.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftAttributesItemValue } from "./NftAttributesItemValue"; + +export const NftAttributesItem: core.serialization.ObjectSchema< + serializers.NftAttributesItem.Raw, + Crossmint.NftAttributesItem +> = core.serialization.object({ + traitType: core.serialization.string().optional(), + value: NftAttributesItemValue.optional(), +}); + +export declare namespace NftAttributesItem { + interface Raw { + traitType?: string | null; + value?: NftAttributesItemValue.Raw | null; + } +} diff --git a/src/serialization/types/NftAttributesItemValue.ts b/src/serialization/types/NftAttributesItemValue.ts new file mode 100644 index 0000000..83d2bae --- /dev/null +++ b/src/serialization/types/NftAttributesItemValue.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftAttributesItemValue: core.serialization.Schema< + serializers.NftAttributesItemValue.Raw, + Crossmint.NftAttributesItemValue +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.number(), + core.serialization.record(core.serialization.string(), core.serialization.unknown()), + core.serialization.list(core.serialization.unknown()), +]); + +export declare namespace NftAttributesItemValue { + type Raw = string | number | Record | unknown[]; +} diff --git a/src/serialization/types/NftCollection.ts b/src/serialization/types/NftCollection.ts new file mode 100644 index 0000000..c7c3219 --- /dev/null +++ b/src/serialization/types/NftCollection.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftCollection: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optional(), + family: core.serialization.string().optional(), + }); + +export declare namespace NftCollection { + interface Raw { + name?: string | null; + family?: string | null; + } +} diff --git a/src/serialization/types/NftMetadata.ts b/src/serialization/types/NftMetadata.ts new file mode 100644 index 0000000..1993005 --- /dev/null +++ b/src/serialization/types/NftMetadata.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftMetadataAttributesItem } from "./NftMetadataAttributesItem"; + +export const NftMetadata: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string(), + image: core.serialization.string(), + description: core.serialization.string(), + animationUrl: core.serialization.property("animation_url", core.serialization.string().optional()), + attributes: core.serialization.list(NftMetadataAttributesItem).optional(), + }); + +export declare namespace NftMetadata { + interface Raw { + name: string; + image: string; + description: string; + animation_url?: string | null; + attributes?: NftMetadataAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftMetadataAttributesItem.ts b/src/serialization/types/NftMetadataAttributesItem.ts new file mode 100644 index 0000000..6d74aa0 --- /dev/null +++ b/src/serialization/types/NftMetadataAttributesItem.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftMetadataAttributesItemDisplayType } from "./NftMetadataAttributesItemDisplayType"; + +export const NftMetadataAttributesItem: core.serialization.ObjectSchema< + serializers.NftMetadataAttributesItem.Raw, + Crossmint.NftMetadataAttributesItem +> = core.serialization.object({ + displayType: core.serialization.property("display_type", NftMetadataAttributesItemDisplayType.optional()), + traitType: core.serialization.property("trait_type", core.serialization.string()), + value: core.serialization.string(), +}); + +export declare namespace NftMetadataAttributesItem { + interface Raw { + display_type?: NftMetadataAttributesItemDisplayType.Raw | null; + trait_type: string; + value: string; + } +} diff --git a/src/serialization/types/NftMetadataAttributesItemDisplayType.ts b/src/serialization/types/NftMetadataAttributesItemDisplayType.ts new file mode 100644 index 0000000..16a98cf --- /dev/null +++ b/src/serialization/types/NftMetadataAttributesItemDisplayType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftMetadataAttributesItemDisplayType: core.serialization.Schema< + serializers.NftMetadataAttributesItemDisplayType.Raw, + Crossmint.NftMetadataAttributesItemDisplayType +> = core.serialization.enum_(["boost_number", "boost_percentage", "number"]); + +export declare namespace NftMetadataAttributesItemDisplayType { + type Raw = "boost_number" | "boost_percentage" | "number"; +} diff --git a/src/serialization/types/NftMetadataOptions.ts b/src/serialization/types/NftMetadataOptions.ts new file mode 100644 index 0000000..a27e19b --- /dev/null +++ b/src/serialization/types/NftMetadataOptions.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftMetadata } from "./NftMetadata"; +import { NftMetadataSolana } from "./NftMetadataSolana"; +import { NftMetadataOptionsName } from "./NftMetadataOptionsName"; + +export const NftMetadataOptions: core.serialization.Schema< + serializers.NftMetadataOptions.Raw, + Crossmint.NftMetadataOptions +> = core.serialization.undiscriminatedUnion([ + NftMetadata, + core.serialization.string(), + NftMetadataSolana, + NftMetadataOptionsName, +]); + +export declare namespace NftMetadataOptions { + type Raw = NftMetadata.Raw | string | NftMetadataSolana.Raw | NftMetadataOptionsName.Raw; +} diff --git a/src/serialization/types/NftMetadataOptionsName.ts b/src/serialization/types/NftMetadataOptionsName.ts new file mode 100644 index 0000000..65a7563 --- /dev/null +++ b/src/serialization/types/NftMetadataOptionsName.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftMetadataOptionsName: core.serialization.ObjectSchema< + serializers.NftMetadataOptionsName.Raw, + Crossmint.NftMetadataOptionsName +> = core.serialization.object({ + uri: core.serialization.string(), + name: core.serialization.string(), +}); + +export declare namespace NftMetadataOptionsName { + interface Raw { + uri: string; + name: string; + } +} diff --git a/src/serialization/types/NftMetadataSolana.ts b/src/serialization/types/NftMetadataSolana.ts new file mode 100644 index 0000000..5a9e0a4 --- /dev/null +++ b/src/serialization/types/NftMetadataSolana.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftMetadataSolanaAttributesItem } from "./NftMetadataSolanaAttributesItem"; + +export const NftMetadataSolana: core.serialization.ObjectSchema< + serializers.NftMetadataSolana.Raw, + Crossmint.NftMetadataSolana +> = core.serialization.object({ + name: core.serialization.string(), + image: core.serialization.string(), + description: core.serialization.string(), + attributes: core.serialization.list(NftMetadataSolanaAttributesItem).optional(), +}); + +export declare namespace NftMetadataSolana { + interface Raw { + name: string; + image: string; + description: string; + attributes?: NftMetadataSolanaAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftMetadataSolanaAttributesItem.ts b/src/serialization/types/NftMetadataSolanaAttributesItem.ts new file mode 100644 index 0000000..5ab11ec --- /dev/null +++ b/src/serialization/types/NftMetadataSolanaAttributesItem.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftMetadataSolanaAttributesItemDisplayType } from "./NftMetadataSolanaAttributesItemDisplayType"; + +export const NftMetadataSolanaAttributesItem: core.serialization.ObjectSchema< + serializers.NftMetadataSolanaAttributesItem.Raw, + Crossmint.NftMetadataSolanaAttributesItem +> = core.serialization.object({ + displayType: core.serialization.property("display_type", NftMetadataSolanaAttributesItemDisplayType.optional()), + traitType: core.serialization.property("trait_type", core.serialization.string()), + value: core.serialization.string(), +}); + +export declare namespace NftMetadataSolanaAttributesItem { + interface Raw { + display_type?: NftMetadataSolanaAttributesItemDisplayType.Raw | null; + trait_type: string; + value: string; + } +} diff --git a/src/serialization/types/NftMetadataSolanaAttributesItemDisplayType.ts b/src/serialization/types/NftMetadataSolanaAttributesItemDisplayType.ts new file mode 100644 index 0000000..8472109 --- /dev/null +++ b/src/serialization/types/NftMetadataSolanaAttributesItemDisplayType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftMetadataSolanaAttributesItemDisplayType: core.serialization.Schema< + serializers.NftMetadataSolanaAttributesItemDisplayType.Raw, + Crossmint.NftMetadataSolanaAttributesItemDisplayType +> = core.serialization.enum_(["boost_number", "boost_percentage", "number"]); + +export declare namespace NftMetadataSolanaAttributesItemDisplayType { + type Raw = "boost_number" | "boost_percentage" | "number"; +} diff --git a/src/serialization/types/NftObjectEvm.ts b/src/serialization/types/NftObjectEvm.ts new file mode 100644 index 0000000..f259630 --- /dev/null +++ b/src/serialization/types/NftObjectEvm.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectEvmMetadata } from "./NftObjectEvmMetadata"; +import { NftObjectEvmOnChain } from "./NftObjectEvmOnChain"; + +export const NftObjectEvm: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + metadata: NftObjectEvmMetadata.optional(), + onChain: NftObjectEvmOnChain.optional(), + }); + +export declare namespace NftObjectEvm { + interface Raw { + id?: string | null; + metadata?: NftObjectEvmMetadata.Raw | null; + onChain?: NftObjectEvmOnChain.Raw | null; + } +} diff --git a/src/serialization/types/NftObjectEvmMetadata.ts b/src/serialization/types/NftObjectEvmMetadata.ts new file mode 100644 index 0000000..31e2fa6 --- /dev/null +++ b/src/serialization/types/NftObjectEvmMetadata.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftObjectEvmMetadata: core.serialization.ObjectSchema< + serializers.NftObjectEvmMetadata.Raw, + Crossmint.NftObjectEvmMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + image: core.serialization.string().optional(), + description: core.serialization.string().optional(), +}); + +export declare namespace NftObjectEvmMetadata { + interface Raw { + name?: string | null; + image?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/NftObjectEvmOnChain.ts b/src/serialization/types/NftObjectEvmOnChain.ts new file mode 100644 index 0000000..9c3926e --- /dev/null +++ b/src/serialization/types/NftObjectEvmOnChain.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftObjectEvmOnChain: core.serialization.ObjectSchema< + serializers.NftObjectEvmOnChain.Raw, + Crossmint.NftObjectEvmOnChain +> = core.serialization.object({ + status: core.serialization.string().optional(), + tokenId: core.serialization.string().optional(), + owner: core.serialization.string().optional(), + txId: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), + chain: core.serialization.string().optional(), +}); + +export declare namespace NftObjectEvmOnChain { + interface Raw { + status?: string | null; + tokenId?: string | null; + owner?: string | null; + txId?: string | null; + contractAddress?: string | null; + chain?: string | null; + } +} diff --git a/src/serialization/types/NftObjectSolana.ts b/src/serialization/types/NftObjectSolana.ts new file mode 100644 index 0000000..932f67b --- /dev/null +++ b/src/serialization/types/NftObjectSolana.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectSolanaMetadata } from "./NftObjectSolanaMetadata"; +import { NftObjectSolanaOnChain } from "./NftObjectSolanaOnChain"; + +export const NftObjectSolana: core.serialization.ObjectSchema< + serializers.NftObjectSolana.Raw, + Crossmint.NftObjectSolana +> = core.serialization.object({ + id: core.serialization.string().optional(), + metadata: NftObjectSolanaMetadata.optional(), + onChain: NftObjectSolanaOnChain.optional(), +}); + +export declare namespace NftObjectSolana { + interface Raw { + id?: string | null; + metadata?: NftObjectSolanaMetadata.Raw | null; + onChain?: NftObjectSolanaOnChain.Raw | null; + } +} diff --git a/src/serialization/types/NftObjectSolanaMetadata.ts b/src/serialization/types/NftObjectSolanaMetadata.ts new file mode 100644 index 0000000..749e764 --- /dev/null +++ b/src/serialization/types/NftObjectSolanaMetadata.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectSolanaMetadataProperties } from "./NftObjectSolanaMetadataProperties"; +import { NftObjectSolanaMetadataAttributesItem } from "./NftObjectSolanaMetadataAttributesItem"; + +export const NftObjectSolanaMetadata: core.serialization.ObjectSchema< + serializers.NftObjectSolanaMetadata.Raw, + Crossmint.NftObjectSolanaMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + symbol: core.serialization.string().optional(), + sellerFeeBasisPoints: core.serialization.property( + "seller_fee_basis_points", + core.serialization.number().optional() + ), + properties: NftObjectSolanaMetadataProperties.optional(), + description: core.serialization.string().optional(), + image: core.serialization.string().optional(), + attributes: core.serialization.list(NftObjectSolanaMetadataAttributesItem).optional(), +}); + +export declare namespace NftObjectSolanaMetadata { + interface Raw { + name?: string | null; + symbol?: string | null; + seller_fee_basis_points?: number | null; + properties?: NftObjectSolanaMetadataProperties.Raw | null; + description?: string | null; + image?: string | null; + attributes?: NftObjectSolanaMetadataAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftObjectSolanaMetadataAttributesItem.ts b/src/serialization/types/NftObjectSolanaMetadataAttributesItem.ts new file mode 100644 index 0000000..fe73b67 --- /dev/null +++ b/src/serialization/types/NftObjectSolanaMetadataAttributesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftObjectSolanaMetadataAttributesItem: core.serialization.ObjectSchema< + serializers.NftObjectSolanaMetadataAttributesItem.Raw, + Crossmint.NftObjectSolanaMetadataAttributesItem +> = core.serialization.object({ + traitType: core.serialization.property("trait_type", core.serialization.string().optional()), + value: core.serialization.string().optional(), +}); + +export declare namespace NftObjectSolanaMetadataAttributesItem { + interface Raw { + trait_type?: string | null; + value?: string | null; + } +} diff --git a/src/serialization/types/NftObjectSolanaMetadataProperties.ts b/src/serialization/types/NftObjectSolanaMetadataProperties.ts new file mode 100644 index 0000000..2055758 --- /dev/null +++ b/src/serialization/types/NftObjectSolanaMetadataProperties.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftObjectSolanaMetadataPropertiesFilesItem } from "./NftObjectSolanaMetadataPropertiesFilesItem"; +import { NftObjectSolanaMetadataPropertiesCreatorsItem } from "./NftObjectSolanaMetadataPropertiesCreatorsItem"; + +export const NftObjectSolanaMetadataProperties: core.serialization.ObjectSchema< + serializers.NftObjectSolanaMetadataProperties.Raw, + Crossmint.NftObjectSolanaMetadataProperties +> = core.serialization.object({ + files: core.serialization.list(NftObjectSolanaMetadataPropertiesFilesItem).optional(), + category: core.serialization.string().optional(), + creators: core.serialization.list(NftObjectSolanaMetadataPropertiesCreatorsItem).optional(), +}); + +export declare namespace NftObjectSolanaMetadataProperties { + interface Raw { + files?: NftObjectSolanaMetadataPropertiesFilesItem.Raw[] | null; + category?: string | null; + creators?: NftObjectSolanaMetadataPropertiesCreatorsItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts b/src/serialization/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts new file mode 100644 index 0000000..6f0ed9c --- /dev/null +++ b/src/serialization/types/NftObjectSolanaMetadataPropertiesCreatorsItem.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftObjectSolanaMetadataPropertiesCreatorsItem: core.serialization.ObjectSchema< + serializers.NftObjectSolanaMetadataPropertiesCreatorsItem.Raw, + Crossmint.NftObjectSolanaMetadataPropertiesCreatorsItem +> = core.serialization.object({ + address: core.serialization.string().optional(), + verified: core.serialization.boolean().optional(), + share: core.serialization.number().optional(), +}); + +export declare namespace NftObjectSolanaMetadataPropertiesCreatorsItem { + interface Raw { + address?: string | null; + verified?: boolean | null; + share?: number | null; + } +} diff --git a/src/serialization/types/NftObjectSolanaMetadataPropertiesFilesItem.ts b/src/serialization/types/NftObjectSolanaMetadataPropertiesFilesItem.ts new file mode 100644 index 0000000..fc7b51b --- /dev/null +++ b/src/serialization/types/NftObjectSolanaMetadataPropertiesFilesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftObjectSolanaMetadataPropertiesFilesItem: core.serialization.ObjectSchema< + serializers.NftObjectSolanaMetadataPropertiesFilesItem.Raw, + Crossmint.NftObjectSolanaMetadataPropertiesFilesItem +> = core.serialization.object({ + uri: core.serialization.string().optional(), + type: core.serialization.string().optional(), +}); + +export declare namespace NftObjectSolanaMetadataPropertiesFilesItem { + interface Raw { + uri?: string | null; + type?: string | null; + } +} diff --git a/src/serialization/types/NftObjectSolanaOnChain.ts b/src/serialization/types/NftObjectSolanaOnChain.ts new file mode 100644 index 0000000..44c7184 --- /dev/null +++ b/src/serialization/types/NftObjectSolanaOnChain.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftObjectSolanaOnChain: core.serialization.ObjectSchema< + serializers.NftObjectSolanaOnChain.Raw, + Crossmint.NftObjectSolanaOnChain +> = core.serialization.object({ + status: core.serialization.string().optional(), + mintHash: core.serialization.string().optional(), + txId: core.serialization.string().optional(), + owner: core.serialization.string().optional(), + chain: core.serialization.string().optional(), +}); + +export declare namespace NftObjectSolanaOnChain { + interface Raw { + status?: string | null; + mintHash?: string | null; + txId?: string | null; + owner?: string | null; + chain?: string | null; + } +} diff --git a/src/serialization/types/NftProperties.ts b/src/serialization/types/NftProperties.ts new file mode 100644 index 0000000..b337fdf --- /dev/null +++ b/src/serialization/types/NftProperties.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftPropertiesCreatorsItem } from "./NftPropertiesCreatorsItem"; +import { NftPropertiesFilesItem } from "./NftPropertiesFilesItem"; + +export const NftProperties: core.serialization.ObjectSchema = + core.serialization.object({ + category: core.serialization.string().optional(), + creators: core.serialization.list(NftPropertiesCreatorsItem).optional(), + files: core.serialization.list(NftPropertiesFilesItem).optional(), + }); + +export declare namespace NftProperties { + interface Raw { + category?: string | null; + creators?: NftPropertiesCreatorsItem.Raw[] | null; + files?: NftPropertiesFilesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftPropertiesCreatorsItem.ts b/src/serialization/types/NftPropertiesCreatorsItem.ts new file mode 100644 index 0000000..adb3d14 --- /dev/null +++ b/src/serialization/types/NftPropertiesCreatorsItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftPropertiesCreatorsItem: core.serialization.ObjectSchema< + serializers.NftPropertiesCreatorsItem.Raw, + Crossmint.NftPropertiesCreatorsItem +> = core.serialization.object({ + address: core.serialization.string().optional(), + share: core.serialization.number().optional(), +}); + +export declare namespace NftPropertiesCreatorsItem { + interface Raw { + address?: string | null; + share?: number | null; + } +} diff --git a/src/serialization/types/NftPropertiesFilesItem.ts b/src/serialization/types/NftPropertiesFilesItem.ts new file mode 100644 index 0000000..f9b6320 --- /dev/null +++ b/src/serialization/types/NftPropertiesFilesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftPropertiesFilesItem: core.serialization.ObjectSchema< + serializers.NftPropertiesFilesItem.Raw, + Crossmint.NftPropertiesFilesItem +> = core.serialization.object({ + uri: core.serialization.string().optional(), + type: core.serialization.string().optional(), +}); + +export declare namespace NftPropertiesFilesItem { + interface Raw { + uri?: string | null; + type?: string | null; + } +} diff --git a/src/serialization/types/NftSolana.ts b/src/serialization/types/NftSolana.ts new file mode 100644 index 0000000..bd10c0b --- /dev/null +++ b/src/serialization/types/NftSolana.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftsolItem } from "./NftsolItem"; + +export const NftSolana: core.serialization.Schema = + core.serialization.list(NftsolItem); + +export declare namespace NftSolana { + type Raw = NftsolItem.Raw[]; +} diff --git a/src/serialization/types/NftcarItem.ts b/src/serialization/types/NftcarItem.ts new file mode 100644 index 0000000..d1b5ac7 --- /dev/null +++ b/src/serialization/types/NftcarItem.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftcarItemMetadata } from "./NftcarItemMetadata"; + +export const NftcarItem: core.serialization.ObjectSchema = + core.serialization.object({ + chain: core.serialization.string().optional(), + assetId: core.serialization.string().optional(), + metadata: NftcarItemMetadata.optional(), + locator: core.serialization.string().optional(), + }); + +export declare namespace NftcarItem { + interface Raw { + chain?: string | null; + assetId?: string | null; + metadata?: NftcarItemMetadata.Raw | null; + locator?: string | null; + } +} diff --git a/src/serialization/types/NftcarItemMetadata.ts b/src/serialization/types/NftcarItemMetadata.ts new file mode 100644 index 0000000..67690b0 --- /dev/null +++ b/src/serialization/types/NftcarItemMetadata.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftcarItemMetadataAttributesItem } from "./NftcarItemMetadataAttributesItem"; + +export const NftcarItemMetadata: core.serialization.ObjectSchema< + serializers.NftcarItemMetadata.Raw, + Crossmint.NftcarItemMetadata +> = core.serialization.object({ + assetId: core.serialization.string().optional(), + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + image: core.serialization.string().optional(), + attributes: core.serialization.list(NftcarItemMetadataAttributesItem).optional(), +}); + +export declare namespace NftcarItemMetadata { + interface Raw { + assetId?: string | null; + name?: string | null; + description?: string | null; + image?: string | null; + attributes?: NftcarItemMetadataAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftcarItemMetadataAttributesItem.ts b/src/serialization/types/NftcarItemMetadataAttributesItem.ts new file mode 100644 index 0000000..942fdec --- /dev/null +++ b/src/serialization/types/NftcarItemMetadataAttributesItem.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftcarItemMetadataAttributesItem: core.serialization.ObjectSchema< + serializers.NftcarItemMetadataAttributesItem.Raw, + Crossmint.NftcarItemMetadataAttributesItem +> = core.serialization.object({ + traitType: core.serialization.property("trait_type", core.serialization.string().optional()), + value: core.serialization.string().optional(), +}); + +export declare namespace NftcarItemMetadataAttributesItem { + interface Raw { + trait_type?: string | null; + value?: string | null; + } +} diff --git a/src/serialization/types/Nftevm.ts b/src/serialization/types/Nftevm.ts new file mode 100644 index 0000000..eefa7c2 --- /dev/null +++ b/src/serialization/types/Nftevm.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftevmItem } from "./NftevmItem"; + +export const Nftevm: core.serialization.Schema = + core.serialization.list(NftevmItem); + +export declare namespace Nftevm { + type Raw = NftevmItem.Raw[]; +} diff --git a/src/serialization/types/NftevmItem.ts b/src/serialization/types/NftevmItem.ts new file mode 100644 index 0000000..802e787 --- /dev/null +++ b/src/serialization/types/NftevmItem.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftevmItemMetadata } from "./NftevmItemMetadata"; + +export const NftevmItem: core.serialization.ObjectSchema = + core.serialization.object({ + chain: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), + tokenId: core.serialization.string().optional(), + metadata: NftevmItemMetadata.optional(), + locator: core.serialization.string().optional(), + tokenStandard: core.serialization.string().optional(), + }); + +export declare namespace NftevmItem { + interface Raw { + chain?: string | null; + contractAddress?: string | null; + tokenId?: string | null; + metadata?: NftevmItemMetadata.Raw | null; + locator?: string | null; + tokenStandard?: string | null; + } +} diff --git a/src/serialization/types/NftevmItemMetadata.ts b/src/serialization/types/NftevmItemMetadata.ts new file mode 100644 index 0000000..ccdd8d3 --- /dev/null +++ b/src/serialization/types/NftevmItemMetadata.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftevmItemMetadataAttributesItem } from "./NftevmItemMetadataAttributesItem"; + +export const NftevmItemMetadata: core.serialization.ObjectSchema< + serializers.NftevmItemMetadata.Raw, + Crossmint.NftevmItemMetadata +> = core.serialization.object({ + attributes: core.serialization.list(NftevmItemMetadataAttributesItem).optional(), + collection: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + description: core.serialization.string().optional(), + image: core.serialization.string().optional(), + animationUrl: core.serialization.property("animation_url", core.serialization.string().optional()), + name: core.serialization.string().optional(), +}); + +export declare namespace NftevmItemMetadata { + interface Raw { + attributes?: NftevmItemMetadataAttributesItem.Raw[] | null; + collection?: Record | null; + description?: string | null; + image?: string | null; + animation_url?: string | null; + name?: string | null; + } +} diff --git a/src/serialization/types/NftevmItemMetadataAttributesItem.ts b/src/serialization/types/NftevmItemMetadataAttributesItem.ts new file mode 100644 index 0000000..95fc3bf --- /dev/null +++ b/src/serialization/types/NftevmItemMetadataAttributesItem.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftevmItemMetadataAttributesItem: core.serialization.ObjectSchema< + serializers.NftevmItemMetadataAttributesItem.Raw, + Crossmint.NftevmItemMetadataAttributesItem +> = core.serialization.object({ + traitType: core.serialization.property("trait_type", core.serialization.string().optional()), + value: core.serialization.string().optional(), + displayType: core.serialization.property("display_type", core.serialization.string().optional()), +}); + +export declare namespace NftevmItemMetadataAttributesItem { + interface Raw { + trait_type?: string | null; + value?: string | null; + display_type?: string | null; + } +} diff --git a/src/serialization/types/NftsolItem.ts b/src/serialization/types/NftsolItem.ts new file mode 100644 index 0000000..a7400df --- /dev/null +++ b/src/serialization/types/NftsolItem.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftsolItemMetadata } from "./NftsolItemMetadata"; + +export const NftsolItem: core.serialization.ObjectSchema = + core.serialization.object({ + chain: core.serialization.string().optional(), + mintHash: core.serialization.string().optional(), + metadata: NftsolItemMetadata.optional(), + locator: core.serialization.string().optional(), + }); + +export declare namespace NftsolItem { + interface Raw { + chain?: string | null; + mintHash?: string | null; + metadata?: NftsolItemMetadata.Raw | null; + locator?: string | null; + } +} diff --git a/src/serialization/types/NftsolItemMetadata.ts b/src/serialization/types/NftsolItemMetadata.ts new file mode 100644 index 0000000..e18dda5 --- /dev/null +++ b/src/serialization/types/NftsolItemMetadata.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftsolItemMetadataAttributesItem } from "./NftsolItemMetadataAttributesItem"; + +export const NftsolItemMetadata: core.serialization.ObjectSchema< + serializers.NftsolItemMetadata.Raw, + Crossmint.NftsolItemMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + image: core.serialization.string().optional(), + attributes: core.serialization.list(NftsolItemMetadataAttributesItem).optional(), +}); + +export declare namespace NftsolItemMetadata { + interface Raw { + name?: string | null; + description?: string | null; + image?: string | null; + attributes?: NftsolItemMetadataAttributesItem.Raw[] | null; + } +} diff --git a/src/serialization/types/NftsolItemMetadataAttributesItem.ts b/src/serialization/types/NftsolItemMetadataAttributesItem.ts new file mode 100644 index 0000000..1848616 --- /dev/null +++ b/src/serialization/types/NftsolItemMetadataAttributesItem.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { NftsolItemMetadataAttributesItemValue } from "./NftsolItemMetadataAttributesItemValue"; + +export const NftsolItemMetadataAttributesItem: core.serialization.ObjectSchema< + serializers.NftsolItemMetadataAttributesItem.Raw, + Crossmint.NftsolItemMetadataAttributesItem +> = core.serialization.object({ + value: NftsolItemMetadataAttributesItemValue.optional(), + traitType: core.serialization.property("trait_type", core.serialization.string().optional()), +}); + +export declare namespace NftsolItemMetadataAttributesItem { + interface Raw { + value?: NftsolItemMetadataAttributesItemValue.Raw | null; + trait_type?: string | null; + } +} diff --git a/src/serialization/types/NftsolItemMetadataAttributesItemValue.ts b/src/serialization/types/NftsolItemMetadataAttributesItemValue.ts new file mode 100644 index 0000000..d2c910f --- /dev/null +++ b/src/serialization/types/NftsolItemMetadataAttributesItemValue.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NftsolItemMetadataAttributesItemValue: core.serialization.Schema< + serializers.NftsolItemMetadataAttributesItemValue.Raw, + Crossmint.NftsolItemMetadataAttributesItemValue +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.number(), + core.serialization.boolean(), + core.serialization.record(core.serialization.string(), core.serialization.unknown()), +]); + +export declare namespace NftsolItemMetadataAttributesItemValue { + type Raw = string | number | boolean | Record; +} diff --git a/src/serialization/types/NotFoundErrorBody.ts b/src/serialization/types/NotFoundErrorBody.ts new file mode 100644 index 0000000..d99034a --- /dev/null +++ b/src/serialization/types/NotFoundErrorBody.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NotFoundErrorBody: core.serialization.ObjectSchema< + serializers.NotFoundErrorBody.Raw, + Crossmint.NotFoundErrorBody +> = core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), +}); + +export declare namespace NotFoundErrorBody { + interface Raw { + error?: boolean | null; + message?: string | null; + } +} diff --git a/src/serialization/types/NotImplementedErrorBody.ts b/src/serialization/types/NotImplementedErrorBody.ts new file mode 100644 index 0000000..cb14b3f --- /dev/null +++ b/src/serialization/types/NotImplementedErrorBody.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const NotImplementedErrorBody: core.serialization.ObjectSchema< + serializers.NotImplementedErrorBody.Raw, + Crossmint.NotImplementedErrorBody +> = core.serialization.object({ + error: core.serialization.boolean().optional(), + message: core.serialization.string().optional(), +}); + +export declare namespace NotImplementedErrorBody { + interface Raw { + error?: boolean | null; + message?: string | null; + } +} diff --git a/src/serialization/types/OldCollection.ts b/src/serialization/types/OldCollection.ts new file mode 100644 index 0000000..348e2d3 --- /dev/null +++ b/src/serialization/types/OldCollection.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const OldCollection: core.serialization.ObjectSchema = + core.serialization.object({ + message: core.serialization.string().optional(), + }); + +export declare namespace OldCollection { + interface Raw { + message?: string | null; + } +} diff --git a/src/serialization/types/OutdatedContract.ts b/src/serialization/types/OutdatedContract.ts new file mode 100644 index 0000000..ba3309f --- /dev/null +++ b/src/serialization/types/OutdatedContract.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const OutdatedContract: core.serialization.ObjectSchema< + serializers.OutdatedContract.Raw, + Crossmint.OutdatedContract +> = core.serialization.object({ + message: core.serialization.string().optional(), +}); + +export declare namespace OutdatedContract { + interface Raw { + message?: string | null; + } +} diff --git a/src/serialization/types/PaymentsObject.ts b/src/serialization/types/PaymentsObject.ts new file mode 100644 index 0000000..ab2b704 --- /dev/null +++ b/src/serialization/types/PaymentsObject.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const PaymentsObject: core.serialization.ObjectSchema = + core.serialization.object({ + price: core.serialization.string().optional(), + recipientAddress: core.serialization.string().optional(), + currency: core.serialization.string().optional(), + }); + +export declare namespace PaymentsObject { + interface Raw { + price?: string | null; + recipientAddress?: string | null; + currency?: string | null; + } +} diff --git a/src/serialization/types/QuoteResponse.ts b/src/serialization/types/QuoteResponse.ts new file mode 100644 index 0000000..6d5fe8d --- /dev/null +++ b/src/serialization/types/QuoteResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const QuoteResponse: core.serialization.ObjectSchema = + core.serialization.object({ + currency: core.serialization.string().optional(), + price: core.serialization.number().optional(), + }); + +export declare namespace QuoteResponse { + interface Raw { + currency?: string | null; + price?: number | null; + } +} diff --git a/src/serialization/types/Recipient.ts b/src/serialization/types/Recipient.ts index 96d0205..95a667b 100644 --- a/src/serialization/types/Recipient.ts +++ b/src/serialization/types/Recipient.ts @@ -5,12 +5,10 @@ import * as serializers from "../index"; import * as Crossmint from "../../api/index"; import * as core from "../../core"; -import { RecipientEmail } from "./RecipientEmail"; -import { RecipientWallet } from "./RecipientWallet"; export const Recipient: core.serialization.Schema = - core.serialization.undiscriminatedUnion([RecipientEmail, RecipientWallet]); + core.serialization.string(); export declare namespace Recipient { - type Raw = RecipientEmail.Raw | RecipientWallet.Raw; + type Raw = string; } diff --git a/src/serialization/types/RecipientWallet.ts b/src/serialization/types/RecipientWallet.ts deleted file mode 100644 index b274751..0000000 --- a/src/serialization/types/RecipientWallet.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Crossmint from "../../api/index"; -import * as core from "../../core"; - -export const RecipientWallet: core.serialization.ObjectSchema< - serializers.RecipientWallet.Raw, - Crossmint.RecipientWallet -> = core.serialization.object({ - walletAddress: core.serialization.string(), -}); - -export declare namespace RecipientWallet { - interface Raw { - walletAddress: string; - } -} diff --git a/src/serialization/types/Redirect.ts b/src/serialization/types/Redirect.ts new file mode 100644 index 0000000..6c14ef8 --- /dev/null +++ b/src/serialization/types/Redirect.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const Redirect: core.serialization.ObjectSchema = + core.serialization.object({ + continue: core.serialization.string().optional(), + cancel: core.serialization.string().optional(), + }); + +export declare namespace Redirect { + interface Raw { + continue?: string | null; + cancel?: string | null; + } +} diff --git a/src/serialization/types/ReuploadLinkedFiles.ts b/src/serialization/types/ReuploadLinkedFiles.ts new file mode 100644 index 0000000..d4b871b --- /dev/null +++ b/src/serialization/types/ReuploadLinkedFiles.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const ReuploadLinkedFiles: core.serialization.Schema< + serializers.ReuploadLinkedFiles.Raw, + Crossmint.ReuploadLinkedFiles +> = core.serialization.boolean(); + +export declare namespace ReuploadLinkedFiles { + type Raw = boolean; +} diff --git a/src/serialization/types/SftCollection.ts b/src/serialization/types/SftCollection.ts new file mode 100644 index 0000000..d5d1f59 --- /dev/null +++ b/src/serialization/types/SftCollection.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const SftCollection: core.serialization.ObjectSchema = + core.serialization.object({ + message: core.serialization.string().optional(), + }); + +export declare namespace SftCollection { + interface Raw { + message?: string | null; + } +} diff --git a/src/serialization/types/Solana.ts b/src/serialization/types/Solana.ts new file mode 100644 index 0000000..853ea96 --- /dev/null +++ b/src/serialization/types/Solana.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const Solana: core.serialization.ObjectSchema = + core.serialization.object({ + chain: core.serialization.stringLiteral("solana").optional(), + from: core.serialization.string().optional(), + to: core.serialization.string().optional(), + tokenMintAddress: core.serialization.string().optional(), + }); + +export declare namespace Solana { + interface Raw { + chain?: "solana" | null; + from?: string | null; + to?: string | null; + tokenMintAddress?: string | null; + } +} diff --git a/src/serialization/types/SolanaNotSupported.ts b/src/serialization/types/SolanaNotSupported.ts new file mode 100644 index 0000000..475d672 --- /dev/null +++ b/src/serialization/types/SolanaNotSupported.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const SolanaNotSupported: core.serialization.ObjectSchema< + serializers.SolanaNotSupported.Raw, + Crossmint.SolanaNotSupported +> = core.serialization.object({ + message: core.serialization.string().optional(), +}); + +export declare namespace SolanaNotSupported { + interface Raw { + message?: string | null; + } +} diff --git a/src/serialization/types/Supply.ts b/src/serialization/types/Supply.ts new file mode 100644 index 0000000..92555fd --- /dev/null +++ b/src/serialization/types/Supply.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { SupplySupply } from "./SupplySupply"; + +export const Supply: core.serialization.ObjectSchema = + core.serialization.object({ + supply: SupplySupply.optional(), + }); + +export declare namespace Supply { + interface Raw { + supply?: SupplySupply.Raw | null; + } +} diff --git a/src/serialization/types/SupplySupply.ts b/src/serialization/types/SupplySupply.ts new file mode 100644 index 0000000..6cd27f2 --- /dev/null +++ b/src/serialization/types/SupplySupply.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const SupplySupply: core.serialization.ObjectSchema = + core.serialization.object({ + limit: core.serialization.number().optional(), + }); + +export declare namespace SupplySupply { + interface Raw { + limit?: number | null; + } +} diff --git a/src/serialization/types/TemplateResponse.ts b/src/serialization/types/TemplateResponse.ts new file mode 100644 index 0000000..07d8e45 --- /dev/null +++ b/src/serialization/types/TemplateResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { TemplateResponseMetadata } from "./TemplateResponseMetadata"; +import { TemplateResponseOnChain } from "./TemplateResponseOnChain"; +import { TemplateResponseSupply } from "./TemplateResponseSupply"; + +export const TemplateResponse: core.serialization.ObjectSchema< + serializers.TemplateResponse.Raw, + Crossmint.TemplateResponse +> = core.serialization.object({ + templateId: core.serialization.string().optional(), + metadata: TemplateResponseMetadata.optional(), + onChain: TemplateResponseOnChain.optional(), + supply: TemplateResponseSupply.optional(), +}); + +export declare namespace TemplateResponse { + interface Raw { + templateId?: string | null; + metadata?: TemplateResponseMetadata.Raw | null; + onChain?: TemplateResponseOnChain.Raw | null; + supply?: TemplateResponseSupply.Raw | null; + } +} diff --git a/src/serialization/types/TemplateResponseMetadata.ts b/src/serialization/types/TemplateResponseMetadata.ts new file mode 100644 index 0000000..ec86259 --- /dev/null +++ b/src/serialization/types/TemplateResponseMetadata.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const TemplateResponseMetadata: core.serialization.ObjectSchema< + serializers.TemplateResponseMetadata.Raw, + Crossmint.TemplateResponseMetadata +> = core.serialization.object({ + name: core.serialization.string().optional(), + image: core.serialization.string().optional(), + description: core.serialization.string().optional(), +}); + +export declare namespace TemplateResponseMetadata { + interface Raw { + name?: string | null; + image?: string | null; + description?: string | null; + } +} diff --git a/src/serialization/types/TemplateResponseOnChain.ts b/src/serialization/types/TemplateResponseOnChain.ts new file mode 100644 index 0000000..2e1d3a1 --- /dev/null +++ b/src/serialization/types/TemplateResponseOnChain.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const TemplateResponseOnChain: core.serialization.ObjectSchema< + serializers.TemplateResponseOnChain.Raw, + Crossmint.TemplateResponseOnChain +> = core.serialization.object({ + tokenId: core.serialization.number().optional(), +}); + +export declare namespace TemplateResponseOnChain { + interface Raw { + tokenId?: number | null; + } +} diff --git a/src/serialization/types/TemplateResponseSupply.ts b/src/serialization/types/TemplateResponseSupply.ts new file mode 100644 index 0000000..fd238c1 --- /dev/null +++ b/src/serialization/types/TemplateResponseSupply.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const TemplateResponseSupply: core.serialization.ObjectSchema< + serializers.TemplateResponseSupply.Raw, + Crossmint.TemplateResponseSupply +> = core.serialization.object({ + limit: core.serialization.number().optional(), + minted: core.serialization.number().optional(), +}); + +export declare namespace TemplateResponseSupply { + interface Raw { + limit?: number | null; + minted?: number | null; + } +} diff --git a/src/serialization/types/TransferPendingVerification.ts b/src/serialization/types/TransferPendingVerification.ts new file mode 100644 index 0000000..9815448 --- /dev/null +++ b/src/serialization/types/TransferPendingVerification.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const TransferPendingVerification: core.serialization.ObjectSchema< + serializers.TransferPendingVerification.Raw, + Crossmint.TransferPendingVerification +> = core.serialization.object({ + personaUrl: core.serialization.string().optional(), +}); + +export declare namespace TransferPendingVerification { + interface Raw { + personaUrl?: string | null; + } +} diff --git a/src/serialization/types/UpdateCollectionResponse.ts b/src/serialization/types/UpdateCollectionResponse.ts new file mode 100644 index 0000000..6cc485d --- /dev/null +++ b/src/serialization/types/UpdateCollectionResponse.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { UpdateCollectionResponseData } from "./UpdateCollectionResponseData"; + +export const UpdateCollectionResponse: core.serialization.ObjectSchema< + serializers.UpdateCollectionResponse.Raw, + Crossmint.UpdateCollectionResponse +> = core.serialization.object({ + actionId: core.serialization.string().optional(), + action: core.serialization.string().optional(), + status: core.serialization.string().optional(), + data: UpdateCollectionResponseData.optional(), + startedAt: core.serialization.date().optional(), + resource: core.serialization.string().optional(), +}); + +export declare namespace UpdateCollectionResponse { + interface Raw { + actionId?: string | null; + action?: string | null; + status?: string | null; + data?: UpdateCollectionResponseData.Raw | null; + startedAt?: string | null; + resource?: string | null; + } +} diff --git a/src/serialization/types/UpdateCollectionResponseData.ts b/src/serialization/types/UpdateCollectionResponseData.ts new file mode 100644 index 0000000..26fadfd --- /dev/null +++ b/src/serialization/types/UpdateCollectionResponseData.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { UpdateCollectionResponseDataCollection } from "./UpdateCollectionResponseDataCollection"; + +export const UpdateCollectionResponseData: core.serialization.ObjectSchema< + serializers.UpdateCollectionResponseData.Raw, + Crossmint.UpdateCollectionResponseData +> = core.serialization.object({ + chain: core.serialization.string().optional(), + collection: UpdateCollectionResponseDataCollection.optional(), + changes: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace UpdateCollectionResponseData { + interface Raw { + chain?: string | null; + collection?: UpdateCollectionResponseDataCollection.Raw | null; + changes?: string[] | null; + } +} diff --git a/src/serialization/types/UpdateCollectionResponseDataCollection.ts b/src/serialization/types/UpdateCollectionResponseDataCollection.ts new file mode 100644 index 0000000..b6d4beb --- /dev/null +++ b/src/serialization/types/UpdateCollectionResponseDataCollection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const UpdateCollectionResponseDataCollection: core.serialization.ObjectSchema< + serializers.UpdateCollectionResponseDataCollection.Raw, + Crossmint.UpdateCollectionResponseDataCollection +> = core.serialization.object({ + id: core.serialization.string().optional(), + contractAddress: core.serialization.string().optional(), +}); + +export declare namespace UpdateCollectionResponseDataCollection { + interface Raw { + id?: string | null; + contractAddress?: string | null; + } +} diff --git a/src/serialization/types/UsageResponse.ts b/src/serialization/types/UsageResponse.ts new file mode 100644 index 0000000..fb6dce2 --- /dev/null +++ b/src/serialization/types/UsageResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { UsageResponseData } from "./UsageResponseData"; + +export const UsageResponse: core.serialization.ObjectSchema = + core.serialization.object({ + data: UsageResponseData.optional(), + }); + +export declare namespace UsageResponse { + interface Raw { + data?: UsageResponseData.Raw | null; + } +} diff --git a/src/serialization/types/UsageResponseData.ts b/src/serialization/types/UsageResponseData.ts new file mode 100644 index 0000000..856b2fa --- /dev/null +++ b/src/serialization/types/UsageResponseData.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { UsageResponseDataUsage } from "./UsageResponseDataUsage"; + +export const UsageResponseData: core.serialization.ObjectSchema< + serializers.UsageResponseData.Raw, + Crossmint.UsageResponseData +> = core.serialization.object({ + dimension: core.serialization.string().optional(), + usage: UsageResponseDataUsage.optional(), +}); + +export declare namespace UsageResponseData { + interface Raw { + dimension?: string | null; + usage?: UsageResponseDataUsage.Raw | null; + } +} diff --git a/src/serialization/types/UsageResponseDataUsage.ts b/src/serialization/types/UsageResponseDataUsage.ts new file mode 100644 index 0000000..74ec1a1 --- /dev/null +++ b/src/serialization/types/UsageResponseDataUsage.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const UsageResponseDataUsage: core.serialization.ObjectSchema< + serializers.UsageResponseDataUsage.Raw, + Crossmint.UsageResponseDataUsage +> = core.serialization.object({ + month: core.serialization.string().optional(), + activeWallets: core.serialization.number().optional(), +}); + +export declare namespace UsageResponseDataUsage { + interface Raw { + month?: string | null; + activeWallets?: number | null; + } +} diff --git a/src/serialization/types/ValidationError.ts b/src/serialization/types/ValidationError.ts new file mode 100644 index 0000000..8272ca5 --- /dev/null +++ b/src/serialization/types/ValidationError.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const ValidationError: core.serialization.ObjectSchema< + serializers.ValidationError.Raw, + Crossmint.ValidationError +> = core.serialization.object({ + index: core.serialization.number().optional(), + id: core.serialization.string().optional(), + message: core.serialization.string().optional(), +}); + +export declare namespace ValidationError { + interface Raw { + index?: number | null; + id?: string | null; + message?: string | null; + } +} diff --git a/src/serialization/types/VerificationRequestSent.ts b/src/serialization/types/VerificationRequestSent.ts new file mode 100644 index 0000000..4e76b60 --- /dev/null +++ b/src/serialization/types/VerificationRequestSent.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const VerificationRequestSent: core.serialization.ObjectSchema< + serializers.VerificationRequestSent.Raw, + Crossmint.VerificationRequestSent +> = core.serialization.object({ + message: core.serialization.string().optional(), + actionId: core.serialization.string().optional(), +}); + +export declare namespace VerificationRequestSent { + interface Raw { + message?: string | null; + actionId?: string | null; + } +} diff --git a/src/serialization/types/Wallet.ts b/src/serialization/types/Wallet.ts new file mode 100644 index 0000000..b714b82 --- /dev/null +++ b/src/serialization/types/Wallet.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const Wallet: core.serialization.ObjectSchema = + core.serialization.object({ + chain: core.serialization.string().optional(), + publicKey: core.serialization.string().optional(), + }); + +export declare namespace Wallet { + interface Raw { + chain?: string | null; + publicKey?: string | null; + } +} diff --git a/src/serialization/types/WalletsRequest.ts b/src/serialization/types/WalletsRequest.ts new file mode 100644 index 0000000..061a05e --- /dev/null +++ b/src/serialization/types/WalletsRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; +import { EvmTransfer } from "./EvmTransfer"; +import { Solana } from "./Solana"; + +export const WalletsRequest: core.serialization.Schema = + core.serialization.undiscriminatedUnion([EvmTransfer, Solana]); + +export declare namespace WalletsRequest { + type Raw = EvmTransfer.Raw | Solana.Raw; +} diff --git a/src/serialization/types/WalletsTransfer.ts b/src/serialization/types/WalletsTransfer.ts new file mode 100644 index 0000000..e845d3d --- /dev/null +++ b/src/serialization/types/WalletsTransfer.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Crossmint from "../../api/index"; +import * as core from "../../core"; + +export const WalletsTransfer: core.serialization.ObjectSchema< + serializers.WalletsTransfer.Raw, + Crossmint.WalletsTransfer +> = core.serialization.object({ + chain: core.serialization.string(), + tokenId: core.serialization.string().optional(), + fromAddress: core.serialization.string(), + toAddress: core.serialization.string(), + tokenMintAddress: core.serialization.string(), +}); + +export declare namespace WalletsTransfer { + interface Raw { + chain: string; + tokenId?: string | null; + fromAddress: string; + toAddress: string; + tokenMintAddress: string; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index b648801..9608d08 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -1,5 +1,20 @@ -export * from "./RecipientEmail"; -export * from "./RecipientWallet"; +export * from "./BadRequestErrorBody"; +export * from "./NotFoundErrorBody"; +export * from "./NotImplementedErrorBody"; +export * from "./OutdatedContract"; +export * from "./OldCollection"; +export * from "./SolanaNotSupported"; +export * from "./ExternalCollection"; +export * from "./SftCollection"; +export * from "./EvmTransfer"; +export * from "./Solana"; +export * from "./WalletsRequest"; +export * from "./UsageResponseDataUsage"; +export * from "./UsageResponseData"; +export * from "./UsageResponse"; +export * from "./Error_"; +export * from "./ValidationError"; +export * from "./BatchError"; export * from "./Recipient"; export * from "./Locale"; export * from "./EvmPaymentMethods"; @@ -30,8 +45,109 @@ export * from "./OrderObjectQuote"; export * from "./OrderObjectPaymentPreparation"; export * from "./OrderObjectPayment"; export * from "./OrderObject"; -export * from "./BadRequestResponse"; -export * from "./UnauthorizedResponse"; -export * from "./NotFoundResponse"; -export * from "./ServiceUnavailabileResponse"; +export * from "./Error400Response"; +export * from "./Error403Response"; +export * from "./Error404Response"; +export * from "./Error503Response"; export * from "./TimeoutResponse"; +export * from "./ReuploadLinkedFiles"; +export * from "./Compressed"; +export * from "./PaymentsObject"; +export * from "./NftMetadataOptionsName"; +export * from "./NftMetadataOptions"; +export * from "./NftMetadataAttributesItemDisplayType"; +export * from "./NftMetadataAttributesItem"; +export * from "./NftMetadata"; +export * from "./NftMetadataSolanaAttributesItemDisplayType"; +export * from "./NftMetadataSolanaAttributesItem"; +export * from "./NftMetadataSolana"; +export * from "./CreateCollectionBodyChain"; +export * from "./CreateCollectionBodyMetadata"; +export * from "./CreateCollectionBodyFungibility"; +export * from "./CreateCollectionBody"; +export * from "./CreateTemplateBodyMetadata"; +export * from "./CreateTemplateBodyOnChain"; +export * from "./CreateTemplateBodySupply"; +export * from "./CreateTemplateBody"; +export * from "./SupplySupply"; +export * from "./Supply"; +export * from "./MintingMetadata"; +export * from "./EditNftResponseDataCollection"; +export * from "./EditNftResponseDataTokenOwner"; +export * from "./EditNftResponseDataToken"; +export * from "./EditNftResponseData"; +export * from "./EditNftResponse"; +export * from "./MintResponseSolana200OnChain"; +export * from "./MintResponseSolana200"; +export * from "./MintResponseEvm200OnChain"; +export * from "./MintResponseEvm200"; +export * from "./MintResponseSolana200Subsequent"; +export * from "./MintStatusSolana200"; +export * from "./NftObjectSolanaMetadataPropertiesFilesItem"; +export * from "./NftObjectSolanaMetadataPropertiesCreatorsItem"; +export * from "./NftObjectSolanaMetadataProperties"; +export * from "./NftObjectSolanaMetadataAttributesItem"; +export * from "./NftObjectSolanaMetadata"; +export * from "./NftObjectSolanaOnChain"; +export * from "./NftObjectSolana"; +export * from "./MintResponseEvm200Subsequent"; +export * from "./NftObjectEvmMetadata"; +export * from "./NftObjectEvmOnChain"; +export * from "./NftObjectEvm"; +export * from "./CreateCollectionResponseMetadata"; +export * from "./CreateCollectionResponseOnChain"; +export * from "./CreateCollectionResponse"; +export * from "./GetCollectionResponseMetadata"; +export * from "./GetCollectionResponseOnChain"; +export * from "./GetCollectionResponsePayments"; +export * from "./GetCollectionResponse"; +export * from "./UpdateCollectionResponseDataCollection"; +export * from "./UpdateCollectionResponseData"; +export * from "./UpdateCollectionResponse"; +export * from "./BurnNftResponseDataCollection"; +export * from "./BurnNftResponseDataToken"; +export * from "./BurnNftResponseData"; +export * from "./BurnNftResponse"; +export * from "./TemplateResponseMetadata"; +export * from "./TemplateResponseOnChain"; +export * from "./TemplateResponseSupply"; +export * from "./TemplateResponse"; +export * from "./BatchMintResponse"; +export * from "./FourHundredNineResponse"; +export * from "./FourHundredTwentyFourResponse"; +export * from "./MintApiFeatureCollectionNotDeployed"; +export * from "./QuoteResponse"; +export * from "./Checkout"; +export * from "./Collection"; +export * from "./MintConfig"; +export * from "./MintStatusStatus"; +export * from "./MintStatus"; +export * from "./NftCollection"; +export * from "./NftAttributesItemValue"; +export * from "./NftAttributesItem"; +export * from "./NftPropertiesCreatorsItem"; +export * from "./NftPropertiesFilesItem"; +export * from "./NftProperties"; +export * from "./Nft"; +export * from "./Redirect"; +export * from "./WalletsTransfer"; +export * from "./Wallet"; +export * from "./CheckoutMintSuccess"; +export * from "./TransferPendingVerification"; +export * from "./ErrorMsg"; +export * from "./AllChains"; +export * from "./EvmChains"; +export * from "./NftevmItemMetadataAttributesItem"; +export * from "./NftevmItemMetadata"; +export * from "./NftevmItem"; +export * from "./Nftevm"; +export * from "./NftsolItemMetadataAttributesItemValue"; +export * from "./NftsolItemMetadataAttributesItem"; +export * from "./NftsolItemMetadata"; +export * from "./NftsolItem"; +export * from "./NftSolana"; +export * from "./NftcarItemMetadataAttributesItem"; +export * from "./NftcarItemMetadata"; +export * from "./NftcarItem"; +export * from "./Cardano"; +export * from "./VerificationRequestSent"; diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts new file mode 100644 index 0000000..db04526 --- /dev/null +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -0,0 +1,47 @@ +import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +describe("Test fetcherImpl", () => { + let mockCreateUrl: jest.Mock; + let mockGetBody: jest.Mock; + let mockGetFetchFn: jest.Mock; + let mockRequestWithRetries: jest.Mock; + let mockGetResponseBody: jest.Mock; + + beforeEach(() => { + mockCreateUrl = jest.fn(); + mockGetBody = jest.fn(); + mockGetFetchFn = jest.fn(); + mockRequestWithRetries = jest.fn(); + mockGetResponseBody = jest.fn(); + + jest.mock("../../../src/core/fetcher/Fetcher", () => ({ + createUrl: mockCreateUrl, + getBody: mockGetBody, + getFetchFn: mockGetFetchFn, + requestWithRetries: mockRequestWithRetries, + getResponseBody: mockGetResponseBody, + })); + }); + + it("should handle successful request", async () => { + const mockArgs: Fetcher.Args = { + url: "https://httpbin.org/post", + method: "POST", + headers: { "X-Test": "x-test-header" }, + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + }; + + mockCreateUrl.mockReturnValue("https://test.com"); + mockGetBody.mockResolvedValue(JSON.stringify({ data: "test" })); + mockGetFetchFn.mockResolvedValue(() => Promise.resolve()); + mockRequestWithRetries.mockResolvedValue({ status: 200 }); + mockGetResponseBody.mockResolvedValue({ result: "success" }); + + const result = await fetcherImpl(mockArgs); + expect(result.ok).toBe(true); + // @ts-expect-error + expect(result.body.json).toEqual({ data: "test" }); + }); +}); diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts new file mode 100644 index 0000000..f2cd24b --- /dev/null +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -0,0 +1,51 @@ +import { createRequestUrl } from "../../../src/core/fetcher/createRequestUrl"; + +describe("Test createRequestUrl", () => { + it("should return the base URL when no query parameters are provided", () => { + const baseUrl = "https://api.example.com"; + expect(createRequestUrl(baseUrl)).toBe(baseUrl); + }); + + it("should append simple query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { key: "value", another: "param" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?key=value&another=param"); + }); + + it("should handle array query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { items: ["a", "b", "c"] }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?items=a&items=b&items=c"); + }); + + it("should handle object query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { filter: { name: "John", age: 30 } }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30" + ); + }); + + it("should handle mixed types of query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + simple: "value", + array: ["x", "y"], + object: { key: "value" }, + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value" + ); + }); + + it("should handle empty query parameters object", () => { + const baseUrl = "https://api.example.com"; + expect(createRequestUrl(baseUrl, {})).toBe(baseUrl); + }); + + it("should encode special characters in query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { special: "a&b=c d" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d"); + }); +}); diff --git a/tests/unit/fetcher/getFetchFn.test.ts b/tests/unit/fetcher/getFetchFn.test.ts new file mode 100644 index 0000000..9b315ad --- /dev/null +++ b/tests/unit/fetcher/getFetchFn.test.ts @@ -0,0 +1,22 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getFetchFn } from "../../../src/core/fetcher/getFetchFn"; + +describe("Test for getFetchFn", () => { + it("should get node-fetch function", async () => { + if (RUNTIME.type == "node") { + if (RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + expect(await getFetchFn()).toBe(fetch); + } else { + expect(await getFetchFn()).toEqual((await import("node-fetch")).default as any); + } + } + }); + + it("should get fetch function", async () => { + if (RUNTIME.type == "browser") { + const fetchFn = await getFetchFn(); + expect(typeof fetchFn).toBe("function"); + expect(fetchFn.name).toBe("fetch"); + } + }); +}); diff --git a/tests/unit/fetcher/getRequestBody.test.ts b/tests/unit/fetcher/getRequestBody.test.ts new file mode 100644 index 0000000..1b1462c --- /dev/null +++ b/tests/unit/fetcher/getRequestBody.test.ts @@ -0,0 +1,81 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getRequestBody } from "../../../src/core/fetcher/getRequestBody"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test getRequestBody", () => { + it("should return FormData as is in Node environment", async () => { + if (RUNTIME.type === "node") { + const formData = new (await import("formdata-node")).FormData(); + formData.append("key", "value"); + const result = await getRequestBody({ + body: formData, + type: "file", + }); + expect(result).toBe(formData); + } + }); + + it("should stringify body if not FormData in Node environment", async () => { + if (RUNTIME.type === "node") { + const body = { key: "value" }; + const result = await getRequestBody({ + body, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + } + }); + + it("should return FormData in browser environment", async () => { + if (RUNTIME.type === "browser") { + const formData = new (await import("form-data")).default(); + formData.append("key", "value"); + const result = await getRequestBody({ + body: formData, + type: "file", + }); + expect(result).toBe(formData); + } + }); + + it("should stringify body if not FormData in browser environment", async () => { + if (RUNTIME.type === "browser") { + const body = { key: "value" }; + const result = await getRequestBody({ + body, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + } + }); + + it("should return the Uint8Array", async () => { + const input = new Uint8Array([1, 2, 3]); + const result = await getRequestBody({ + body: input, + type: "bytes", + }); + expect(result).toBe(input); + }); + + it("should return the input for content-type 'application/x-www-form-urlencoded'", async () => { + const input = "key=value&another=param"; + const result = await getRequestBody({ + body: input, + type: "other", + }); + expect(result).toBe(input); + }); + + it("should JSON stringify objects", async () => { + const input = { key: "value" }; + const result = await getRequestBody({ + body: input, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + }); +}); diff --git a/tests/unit/fetcher/getResponseBody.test.ts b/tests/unit/fetcher/getResponseBody.test.ts new file mode 100644 index 0000000..f3563ff --- /dev/null +++ b/tests/unit/fetcher/getResponseBody.test.ts @@ -0,0 +1,57 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getResponseBody } from "../../../src/core/fetcher/getResponseBody"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test getResponseBody", () => { + it("should handle blob response type", async () => { + const mockBlob = new Blob(["test"], { type: "text/plain" }); + const mockResponse = new Response(mockBlob); + const result = await getResponseBody(mockResponse, "blob"); + // @ts-expect-error + expect(result.constructor.name).toBe("Blob"); + }); + + it("should handle streaming response type", async () => { + if (RUNTIME.type === "node") { + const mockStream = new ReadableStream(); + const mockResponse = new Response(mockStream); + const result = await getResponseBody(mockResponse, "streaming"); + expect(result).toBe(mockStream); + } + }); + + it("should handle text response type", async () => { + const mockResponse = new Response("test text"); + const result = await getResponseBody(mockResponse, "text"); + expect(result).toBe("test text"); + }); + + it("should handle JSON response", async () => { + const mockJson = { key: "value" }; + const mockResponse = new Response(JSON.stringify(mockJson)); + const result = await getResponseBody(mockResponse); + expect(result).toEqual(mockJson); + }); + + it("should handle empty response", async () => { + const mockResponse = new Response(""); + const result = await getResponseBody(mockResponse); + expect(result).toBeUndefined(); + }); + + it("should handle non-JSON response", async () => { + const mockResponse = new Response("invalid json"); + const result = await getResponseBody(mockResponse); + expect(result).toEqual({ + ok: false, + error: { + reason: "non-json", + statusCode: 200, + rawBody: "invalid json", + }, + }); + }); +}); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts new file mode 100644 index 0000000..5969d51 --- /dev/null +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -0,0 +1,58 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { makeRequest } from "../../../src/core/fetcher/makeRequest"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test makeRequest", () => { + const mockPostUrl = "https://httpbin.org/post"; + const mockGetUrl = "https://httpbin.org/get"; + const mockHeaders = { "Content-Type": "application/json" }; + const mockBody = JSON.stringify({ key: "value" }); + + let mockFetch: jest.Mock; + + beforeEach(() => { + mockFetch = jest.fn(); + mockFetch.mockResolvedValue(new Response(JSON.stringify({ test: "successful" }), { status: 200 })); + }); + + it("should handle POST request correctly", async () => { + const response = await makeRequest(mockFetch, mockPostUrl, "POST", mockHeaders, mockBody); + const responseBody = await response.json(); + expect(responseBody).toEqual({ test: "successful" }); + expect(mockFetch).toHaveBeenCalledTimes(1); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe(mockPostUrl); + expect(calledOptions).toEqual( + expect.objectContaining({ + method: "POST", + headers: mockHeaders, + body: mockBody, + credentials: undefined, + }) + ); + expect(calledOptions.signal).toBeDefined(); + expect(calledOptions.signal).toBeInstanceOf(AbortSignal); + }); + + it("should handle GET request correctly", async () => { + const response = await makeRequest(mockFetch, mockGetUrl, "GET", mockHeaders, undefined); + const responseBody = await response.json(); + expect(responseBody).toEqual({ test: "successful" }); + expect(mockFetch).toHaveBeenCalledTimes(1); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe(mockGetUrl); + expect(calledOptions).toEqual( + expect.objectContaining({ + method: "GET", + headers: mockHeaders, + body: undefined, + credentials: undefined, + }) + ); + expect(calledOptions.signal).toBeDefined(); + expect(calledOptions.signal).toBeInstanceOf(AbortSignal); + }); +}); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts new file mode 100644 index 0000000..b53e043 --- /dev/null +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -0,0 +1,85 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; + +if (RUNTIME.type === "browser") { + require("jest-fetch-mock").enableMocks(); +} + +describe("Test exponential backoff", () => { + let mockFetch: jest.Mock; + let originalSetTimeout: typeof setTimeout; + + beforeEach(() => { + mockFetch = jest.fn(); + originalSetTimeout = global.setTimeout; + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + global.setTimeout = originalSetTimeout; + }); + + it("should retry on 408, 409, 429, 500+", async () => { + mockFetch + .mockResolvedValueOnce(new Response("", { status: 408 })) + .mockResolvedValueOnce(new Response("", { status: 409 })) + .mockResolvedValueOnce(new Response("", { status: 429 })) + .mockResolvedValueOnce(new Response("", { status: 500 })) + .mockResolvedValueOnce(new Response("", { status: 502 })) + .mockResolvedValueOnce(new Response("", { status: 200 })) + .mockResolvedValueOnce(new Response("", { status: 408 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 10); + + await jest.advanceTimersByTimeAsync(10000); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(6); + expect(response.status).toBe(200); + }); + + it("should retry max 3 times", async () => { + mockFetch + .mockResolvedValueOnce(new Response("", { status: 408 })) + .mockResolvedValueOnce(new Response("", { status: 409 })) + .mockResolvedValueOnce(new Response("", { status: 429 })) + .mockResolvedValueOnce(new Response("", { status: 429 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + + await jest.advanceTimersByTimeAsync(10000); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(4); + expect(response.status).toBe(429); + }); + it("should not retry on 200", async () => { + mockFetch + .mockResolvedValueOnce(new Response("", { status: 200 })) + .mockResolvedValueOnce(new Response("", { status: 409 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + + await jest.advanceTimersByTimeAsync(10000); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(1); + expect(response.status).toBe(200); + }); + + it("should retry with exponential backoff timing", async () => { + mockFetch.mockResolvedValue(new Response("", { status: 500 })); + const maxRetries = 7; + const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); + expect(mockFetch).toHaveBeenCalledTimes(1); + + const delays = [1, 2, 4, 8, 16, 32, 64]; + for (let i = 0; i < delays.length; i++) { + await jest.advanceTimersByTimeAsync(delays[i] as number); + expect(mockFetch).toHaveBeenCalledTimes(Math.min(i + 2, maxRetries + 1)); + } + const response = await responsePromise; + expect(response.status).toBe(500); + }); +}); diff --git a/tests/unit/fetcher/signals.test.ts b/tests/unit/fetcher/signals.test.ts new file mode 100644 index 0000000..9cabfa0 --- /dev/null +++ b/tests/unit/fetcher/signals.test.ts @@ -0,0 +1,69 @@ +import { anySignal, getTimeoutSignal } from "../../../src/core/fetcher/signals"; + +describe("Test getTimeoutSignal", () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + + it("should return an object with signal and abortId", () => { + const { signal, abortId } = getTimeoutSignal(1000); + + expect(signal).toBeDefined(); + expect(abortId).toBeDefined(); + expect(signal).toBeInstanceOf(AbortSignal); + expect(signal.aborted).toBe(false); + }); + + it("should create a signal that aborts after the specified timeout", () => { + const timeoutMs = 5000; + const { signal } = getTimeoutSignal(timeoutMs); + + expect(signal.aborted).toBe(false); + + jest.advanceTimersByTime(timeoutMs - 1); + expect(signal.aborted).toBe(false); + + jest.advanceTimersByTime(1); + expect(signal.aborted).toBe(true); + }); +}); + +describe("Test anySignal", () => { + it("should return an AbortSignal", () => { + const signal = anySignal(new AbortController().signal); + expect(signal).toBeInstanceOf(AbortSignal); + }); + + it("should abort when any of the input signals is aborted", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + const signal = anySignal(controller1.signal, controller2.signal); + + expect(signal.aborted).toBe(false); + controller1.abort(); + expect(signal.aborted).toBe(true); + }); + + it("should handle an array of signals", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + const signal = anySignal([controller1.signal, controller2.signal]); + + expect(signal.aborted).toBe(false); + controller2.abort(); + expect(signal.aborted).toBe(true); + }); + + it("should abort immediately if one of the input signals is already aborted", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + controller1.abort(); + + const signal = anySignal(controller1.signal, controller2.signal); + expect(signal.aborted).toBe(true); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts new file mode 100644 index 0000000..91e0684 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts @@ -0,0 +1,157 @@ +import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; + +describe("Node18UniversalStreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const dest = new WritableStream({ + write(chunk) { + expect(chunk).toEqual(new TextEncoder().encode("test")); + }, + }); + + stream.pipe(dest); + }); + + it("should write to dest when calling pipe to node writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const dest = new (await import("stream")).Writable({ + write(chunk, encoding, callback) { + expect(chunk.toString()).toEqual("test"); + callback(); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new WritableStream({ + write(chunk) { + buffer.push(chunk); + }, + }); + + stream.pipe(dest); + stream.unpipe(dest); + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalled(); + }); + + it("should pause and resume the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + const resumeSpy = jest.spyOn(stream, "resume"); + + expect(stream.isPaused).toBe(false); + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + + expect(pauseSpy).toHaveBeenCalled(); + expect(resumeSpy).toHaveBeenCalled(); + }); + + it("should read the stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.read(); + + expect(data).toEqual(new TextEncoder().encode("test")); + }); + + it("should read the stream as text", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("test"); + }); + + it("should read the stream as json", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode(JSON.stringify({ test: "test" }))); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts new file mode 100644 index 0000000..5f1e012 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts @@ -0,0 +1,114 @@ +import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; + +describe("NodePre18StreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to node writable stream", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const dest = new (await import("stream")).Writable({ + write(chunk, encoding, callback) { + expect(chunk.toString()).toEqual("test"); + callback(); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new (await import("stream")).Writable({ + write(chunk, encoding, callback) { + buffer.push(chunk); + callback(); + }, + }); + stream.pipe(dest); + stream.unpipe(); + + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalledWith(); + }); + + it("should pause the stream and resume", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + expect(stream.isPaused).toBe(false); + + expect(pauseSpy).toHaveBeenCalledWith(); + }); + + it("should read the stream", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.read(); + + expect(data).toEqual("test"); + }); + + it("should read the stream as text", async () => { + const rawStream = (await import("stream")).Readable.from(["test"]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("test"); + }); + + it("should read the stream as json", async () => { + const rawStream = (await import("stream")).Readable.from([JSON.stringify({ test: "test" })]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts new file mode 100644 index 0000000..3d65cfd --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts @@ -0,0 +1,134 @@ +import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; + +describe("UndiciStreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + const dest = new WritableStream({ + write(chunk) { + expect(chunk).toEqual(new TextEncoder().encode("test")); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new WritableStream({ + write(chunk) { + buffer.push(chunk); + }, + }); + stream.pipe(dest); + stream.unpipe(dest); + + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalled(); + }); + + it("should pause and resume the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + const resumeSpy = jest.spyOn(stream, "resume"); + + expect(stream.isPaused).toBe(false); + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + + expect(pauseSpy).toHaveBeenCalled(); + expect(resumeSpy).toHaveBeenCalled(); + }); + + it("should read the stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.read(); + + expect(data).toEqual(new TextEncoder().encode("test")); + }); + + it("should read the stream as text", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("test"); + }); + + it("should read the stream as json", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode(JSON.stringify({ test: "test" }))); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts new file mode 100644 index 0000000..aff7579 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts @@ -0,0 +1,43 @@ +import { RUNTIME } from "../../../../src/core/runtime"; +import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; +import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; +import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; +import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; + +describe("chooseStreamWrapper", () => { + beforeEach(() => { + RUNTIME.type = "unknown"; + RUNTIME.parsedVersion = 0; + }); + + it('should return a Node18UniversalStreamWrapper when RUNTIME.type is "node" and RUNTIME.parsedVersion is not null and RUNTIME.parsedVersion is greater than or equal to 18', async () => { + const expected = new Node18UniversalStreamWrapper(new ReadableStream()); + RUNTIME.type = "node"; + RUNTIME.parsedVersion = 18; + + const result = await chooseStreamWrapper(new ReadableStream()); + + expect(JSON.stringify(result)).toBe(JSON.stringify(expected)); + }); + + it('should return a NodePre18StreamWrapper when RUNTIME.type is "node" and RUNTIME.parsedVersion is not null and RUNTIME.parsedVersion is less than 18', async () => { + const stream = await import("stream"); + const expected = new NodePre18StreamWrapper(new stream.Readable()); + + RUNTIME.type = "node"; + RUNTIME.parsedVersion = 16; + + const result = await chooseStreamWrapper(new stream.Readable()); + + expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)); + }); + + it('should return a Undici when RUNTIME.type is not "node"', async () => { + const expected = new UndiciStreamWrapper(new ReadableStream()); + RUNTIME.type = "browser"; + + const result = await chooseStreamWrapper(new ReadableStream()); + + expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)); + }); +}); diff --git a/tests/unit/zurg/date/date.test.ts b/tests/unit/zurg/date/date.test.ts new file mode 100644 index 0000000..2790268 --- /dev/null +++ b/tests/unit/zurg/date/date.test.ts @@ -0,0 +1,31 @@ +import { date } from "../../../../src/core/schemas/builders/date"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("date", () => { + itSchema("converts between raw ISO string and parsed Date", date(), { + raw: "2022-09-29T05:41:21.939Z", + parsed: new Date("2022-09-29T05:41:21.939Z"), + }); + + itValidateParse("non-string", date(), 42, [ + { + message: "Expected string. Received 42.", + path: [], + }, + ]); + + itValidateParse("non-ISO", date(), "hello world", [ + { + message: 'Expected ISO 8601 date string. Received "hello world".', + path: [], + }, + ]); + + itValidateJson("non-Date", date(), "hello", [ + { + message: 'Expected Date object. Received "hello".', + path: [], + }, + ]); +}); diff --git a/tests/unit/zurg/enum/enum.test.ts b/tests/unit/zurg/enum/enum.test.ts new file mode 100644 index 0000000..ab0df02 --- /dev/null +++ b/tests/unit/zurg/enum/enum.test.ts @@ -0,0 +1,30 @@ +import { enum_ } from "../../../../src/core/schemas/builders/enum"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("enum", () => { + itSchemaIdentity(enum_(["A", "B", "C"]), "A"); + + itSchemaIdentity(enum_(["A", "B", "C"]), "D" as any, { + opts: { allowUnrecognizedEnumValues: true }, + }); + + itValidate("invalid enum", enum_(["A", "B", "C"]), "D", [ + { + message: 'Expected enum. Received "D".', + path: [], + }, + ]); + + itValidate( + "non-string", + enum_(["A", "B", "C"]), + [], + [ + { + message: "Expected string. Received list.", + path: [], + }, + ] + ); +}); diff --git a/tests/unit/zurg/lazy/lazy.test.ts b/tests/unit/zurg/lazy/lazy.test.ts new file mode 100644 index 0000000..6906bf4 --- /dev/null +++ b/tests/unit/zurg/lazy/lazy.test.ts @@ -0,0 +1,57 @@ +import { Schema } from "../../../../src/core/schemas/Schema"; +import { lazy, list, object, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("lazy", () => { + it("doesn't run immediately", () => { + let wasRun = false; + lazy(() => { + wasRun = true; + return string(); + }); + expect(wasRun).toBe(false); + }); + + it("only runs first time", async () => { + let count = 0; + const schema = lazy(() => { + count++; + return string(); + }); + await schema.parse("hello"); + await schema.json("world"); + expect(count).toBe(1); + }); + + itSchemaIdentity( + lazy(() => object({})), + { foo: "hello" }, + { + title: "passes opts through", + opts: { unrecognizedObjectKeys: "passthrough" }, + } + ); + + itSchemaIdentity( + lazy(() => object({ foo: string() })), + { foo: "hello" } + ); + + // eslint-disable-next-line jest/expect-expect + it("self-referencial schema doesn't compile", () => { + () => { + // @ts-expect-error + const a = lazy(() => object({ foo: a })); + }; + }); + + // eslint-disable-next-line jest/expect-expect + it("self-referencial compiles with explicit type", () => { + () => { + interface TreeNode { + children: TreeNode[]; + } + const TreeNode: Schema = lazy(() => object({ children: list(TreeNode) })); + }; + }); +}); diff --git a/tests/unit/zurg/lazy/lazyObject.test.ts b/tests/unit/zurg/lazy/lazyObject.test.ts new file mode 100644 index 0000000..8813cc9 --- /dev/null +++ b/tests/unit/zurg/lazy/lazyObject.test.ts @@ -0,0 +1,18 @@ +import { lazyObject, number, object, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("lazy", () => { + itSchemaIdentity( + lazyObject(() => object({ foo: string() })), + { foo: "hello" } + ); + + itSchemaIdentity( + lazyObject(() => object({ foo: string() })).extend(object({ bar: number() })), + { + foo: "hello", + bar: 42, + }, + { title: "returned schema has object utils" } + ); +}); diff --git a/tests/unit/zurg/lazy/recursive/a.ts b/tests/unit/zurg/lazy/recursive/a.ts new file mode 100644 index 0000000..8b7d5e4 --- /dev/null +++ b/tests/unit/zurg/lazy/recursive/a.ts @@ -0,0 +1,7 @@ +import { object } from "../../../../../src/core/schemas/builders/object"; +import { schemaB } from "./b"; + +// @ts-expect-error +export const schemaA = object({ + b: schemaB, +}); diff --git a/tests/unit/zurg/lazy/recursive/b.ts b/tests/unit/zurg/lazy/recursive/b.ts new file mode 100644 index 0000000..fb219d5 --- /dev/null +++ b/tests/unit/zurg/lazy/recursive/b.ts @@ -0,0 +1,8 @@ +import { object } from "../../../../../src/core/schemas/builders/object"; +import { optional } from "../../../../../src/core/schemas/builders/schema-utils"; +import { schemaA } from "./a"; + +// @ts-expect-error +export const schemaB = object({ + a: optional(schemaA), +}); diff --git a/tests/unit/zurg/list/list.test.ts b/tests/unit/zurg/list/list.test.ts new file mode 100644 index 0000000..424ed64 --- /dev/null +++ b/tests/unit/zurg/list/list.test.ts @@ -0,0 +1,41 @@ +import { list, object, property, string } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("list", () => { + itSchemaIdentity(list(string()), ["hello", "world"], { + title: "functions as identity when item type is primitive", + }); + + itSchema( + "converts objects correctly", + list( + object({ + helloWorld: property("hello_world", string()), + }) + ), + { + raw: [{ hello_world: "123" }], + parsed: [{ helloWorld: "123" }], + } + ); + + itValidate("not a list", list(string()), 42, [ + { + path: [], + message: "Expected list. Received 42.", + }, + ]); + + itValidate( + "invalid item type", + list(string()), + [42], + [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ] + ); +}); diff --git a/tests/unit/zurg/literals/stringLiteral.test.ts b/tests/unit/zurg/literals/stringLiteral.test.ts new file mode 100644 index 0000000..fa6c888 --- /dev/null +++ b/tests/unit/zurg/literals/stringLiteral.test.ts @@ -0,0 +1,21 @@ +import { stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("stringLiteral", () => { + itSchemaIdentity(stringLiteral("A"), "A"); + + itValidate("incorrect string", stringLiteral("A"), "B", [ + { + path: [], + message: 'Expected "A". Received "B".', + }, + ]); + + itValidate("non-string", stringLiteral("A"), 42, [ + { + path: [], + message: 'Expected "A". Received 42.', + }, + ]); +}); diff --git a/tests/unit/zurg/object-like/withParsedProperties.test.ts b/tests/unit/zurg/object-like/withParsedProperties.test.ts new file mode 100644 index 0000000..9f5dd0e --- /dev/null +++ b/tests/unit/zurg/object-like/withParsedProperties.test.ts @@ -0,0 +1,57 @@ +import { object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; + +describe("withParsedProperties", () => { + it("Added properties included on parsed object", async () => { + const schema = object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }).withParsedProperties({ + printFoo: (parsed) => () => parsed.foo, + printHelloWorld: () => () => "Hello world", + helloWorld: "Hello world", + }); + + const parsed = await schema.parse({ raw_foo: "value of foo", bar: "bar" }); + if (!parsed.ok) { + throw new Error("Failed to parse"); + } + expect(parsed.value.printFoo()).toBe("value of foo"); + expect(parsed.value.printHelloWorld()).toBe("Hello world"); + expect(parsed.value.helloWorld).toBe("Hello world"); + }); + + it("Added property is removed on raw object", async () => { + const schema = object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }).withParsedProperties({ + printFoo: (parsed) => () => parsed.foo, + }); + + const original = { raw_foo: "value of foo", bar: "bar" } as const; + const parsed = await schema.parse(original); + if (!parsed.ok) { + throw new Error("Failed to parse()"); + } + + const raw = await schema.json(parsed.value); + + if (!raw.ok) { + throw new Error("Failed to json()"); + } + + expect(raw.value).toEqual(original); + }); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with non-object schema", () => { + () => + object({ + foo: string(), + }) + // @ts-expect-error + .withParsedProperties(42); + }); + }); +}); diff --git a/tests/unit/zurg/object/extend.test.ts b/tests/unit/zurg/object/extend.test.ts new file mode 100644 index 0000000..54fc8c4 --- /dev/null +++ b/tests/unit/zurg/object/extend.test.ts @@ -0,0 +1,89 @@ +import { boolean, object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; + +describe("extend", () => { + itSchemaIdentity( + object({ + foo: string(), + }).extend( + object({ + bar: stringLiteral("bar"), + }) + ), + { + foo: "", + bar: "bar", + } as const, + { + title: "extended properties are included in schema", + } + ); + + itSchemaIdentity( + object({ + foo: string(), + }) + .extend( + object({ + bar: stringLiteral("bar"), + }) + ) + .extend( + object({ + baz: boolean(), + }) + ), + { + foo: "", + bar: "bar", + baz: true, + } as const, + { + title: "extensions can be extended", + } + ); + + itSchema( + "converts nested object", + object({ + item: object({ + helloWorld: property("hello_world", string()), + }), + }).extend( + object({ + goodbye: property("goodbye_raw", string()), + }) + ), + { + raw: { item: { hello_world: "yo" }, goodbye_raw: "peace" }, + parsed: { item: { helloWorld: "yo" }, goodbye: "peace" }, + } + ); + + itSchema( + "extensions work with raw/parsed property name conversions", + object({ + item: property("item_raw", string()), + }).extend( + object({ + goodbye: property("goodbye_raw", string()), + }) + ), + { + raw: { item_raw: "hi", goodbye_raw: "peace" }, + parsed: { item: "hi", goodbye: "peace" }, + } + ); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with non-object schema", () => { + () => + object({ + foo: string(), + }) + // @ts-expect-error + .extend([]); + }); + }); +}); diff --git a/tests/unit/zurg/object/object.test.ts b/tests/unit/zurg/object/object.test.ts new file mode 100644 index 0000000..0acf0e2 --- /dev/null +++ b/tests/unit/zurg/object/object.test.ts @@ -0,0 +1,255 @@ +import { any, number, object, property, string, stringLiteral, unknown } from "../../../../src/core/schemas/builders"; +import { itJson, itParse, itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("object", () => { + itSchemaIdentity( + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { + foo: "", + bar: "bar", + }, + { + title: "functions as identity when values are primitives and property() isn't used", + } + ); + + itSchema( + "uses raw key from property()", + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { raw_foo: "foo", bar: "bar" }, + parsed: { foo: "foo", bar: "bar" }, + } + ); + + itSchema( + "keys with unknown type can be omitted", + object({ + foo: unknown(), + }), + { + raw: {}, + parsed: {}, + } + ); + + itSchema( + "keys with any type can be omitted", + object({ + foo: any(), + }), + { + raw: {}, + parsed: {}, + } + ); + + describe("unrecognizedObjectKeys", () => { + describe("parse", () => { + itParse( + 'includes unknown values when unrecognizedObjectKeys === "passthrough"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "passthrough", + }, + } + ); + + itParse( + 'strips unknown values when unrecognizedObjectKeys === "strip"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + }, + opts: { + unrecognizedObjectKeys: "strip", + }, + } + ); + }); + + describe("json", () => { + itJson( + 'includes unknown values when unrecognizedObjectKeys === "passthrough"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "passthrough", + }, + } + ); + + itJson( + 'strips unknown values when unrecognizedObjectKeys === "strip"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "strip", + }, + } + ); + }); + }); + + describe("nullish properties", () => { + itSchema("missing properties are not added", object({ foo: property("raw_foo", string().optional()) }), { + raw: {}, + parsed: {}, + }); + + itSchema("undefined properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }); + + itSchema("null properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }); + + describe("extensions", () => { + itSchema( + "undefined properties are not dropped", + object({}).extend(object({ foo: property("raw_foo", string().optional()) })), + { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + } + ); + + describe("parse()", () => { + itParse( + "null properties are not dropped", + object({}).extend(object({ foo: property("raw_foo", string().optional()) })), + { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + } + ); + }); + }); + }); + + itValidate( + "missing property", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { foo: "hello" }, + [ + { + path: [], + message: 'Missing required key "bar"', + }, + ] + ); + + itValidate( + "extra property", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { foo: "hello", bar: "bar", baz: 42 }, + [ + { + path: ["baz"], + message: 'Unexpected key "baz"', + }, + ] + ); + + itValidate( + "not an object", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ] + ); + + itValidate( + "nested validation error", + object({ + foo: object({ + bar: number(), + }), + }), + { foo: { bar: "hello" } }, + [ + { + path: ["foo", "bar"], + message: 'Expected number. Received "hello".', + }, + ] + ); +}); diff --git a/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts new file mode 100644 index 0000000..d87a65f --- /dev/null +++ b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts @@ -0,0 +1,21 @@ +import { objectWithoutOptionalProperties, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; + +describe("objectWithoutOptionalProperties", () => { + itSchema( + "all properties are required", + objectWithoutOptionalProperties({ + foo: string(), + bar: stringLiteral("bar").optional(), + }), + { + raw: { + foo: "hello", + }, + // @ts-expect-error + parsed: { + foo: "hello", + }, + } + ); +}); diff --git a/tests/unit/zurg/primitives/any.test.ts b/tests/unit/zurg/primitives/any.test.ts new file mode 100644 index 0000000..1adbbe2 --- /dev/null +++ b/tests/unit/zurg/primitives/any.test.ts @@ -0,0 +1,6 @@ +import { any } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("any", () => { + itSchemaIdentity(any(), true); +}); diff --git a/tests/unit/zurg/primitives/boolean.test.ts b/tests/unit/zurg/primitives/boolean.test.ts new file mode 100644 index 0000000..897a829 --- /dev/null +++ b/tests/unit/zurg/primitives/boolean.test.ts @@ -0,0 +1,14 @@ +import { boolean } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("boolean", () => { + itSchemaIdentity(boolean(), true); + + itValidate("non-boolean", boolean(), {}, [ + { + path: [], + message: "Expected boolean. Received object.", + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/number.test.ts b/tests/unit/zurg/primitives/number.test.ts new file mode 100644 index 0000000..2d01415 --- /dev/null +++ b/tests/unit/zurg/primitives/number.test.ts @@ -0,0 +1,14 @@ +import { number } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("number", () => { + itSchemaIdentity(number(), 42); + + itValidate("non-number", number(), "hello", [ + { + path: [], + message: 'Expected number. Received "hello".', + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/string.test.ts b/tests/unit/zurg/primitives/string.test.ts new file mode 100644 index 0000000..57b2368 --- /dev/null +++ b/tests/unit/zurg/primitives/string.test.ts @@ -0,0 +1,14 @@ +import { string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("string", () => { + itSchemaIdentity(string(), "hello"); + + itValidate("non-string", string(), 42, [ + { + path: [], + message: "Expected string. Received 42.", + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/unknown.test.ts b/tests/unit/zurg/primitives/unknown.test.ts new file mode 100644 index 0000000..4d17a7d --- /dev/null +++ b/tests/unit/zurg/primitives/unknown.test.ts @@ -0,0 +1,6 @@ +import { unknown } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("unknown", () => { + itSchemaIdentity(unknown(), true); +}); diff --git a/tests/unit/zurg/record/record.test.ts b/tests/unit/zurg/record/record.test.ts new file mode 100644 index 0000000..7e4ba39 --- /dev/null +++ b/tests/unit/zurg/record/record.test.ts @@ -0,0 +1,34 @@ +import { number, record, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("record", () => { + itSchemaIdentity(record(string(), string()), { hello: "world" }); + itSchemaIdentity(record(number(), string()), { 42: "world" }); + + itValidate( + "non-record", + record(number(), string()), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ] + ); + + itValidate("invalid key type", record(number(), string()), { hello: "world" }, [ + { + path: ["hello (key)"], + message: 'Expected number. Received "hello".', + }, + ]); + + itValidate("invalid value type", record(string(), number()), { hello: "world" }, [ + { + path: ["hello"], + message: 'Expected number. Received "world".', + }, + ]); +}); diff --git a/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts new file mode 100644 index 0000000..da10086 --- /dev/null +++ b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts @@ -0,0 +1,83 @@ +import { object, string } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; + +describe("getSchemaUtils", () => { + describe("optional()", () => { + itSchema("optional fields allow original schema", string().optional(), { + raw: "hello", + parsed: "hello", + }); + + itSchema("optional fields are not required", string().optional(), { + raw: null, + parsed: undefined, + }); + }); + + describe("transform()", () => { + itSchema( + "transorm and untransform run correctly", + string().transform({ + transform: (x) => x + "X", + untransform: (x) => (x as string).slice(0, -1), + }), + { + raw: "hello", + parsed: "helloX", + } + ); + }); + + describe("parseOrThrow()", () => { + it("parses valid value", async () => { + const value = string().parseOrThrow("hello"); + expect(value).toBe("hello"); + }); + + it("throws on invalid value", async () => { + const value = () => object({ a: string(), b: string() }).parseOrThrow({ a: 24 }); + expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + }); + }); + + describe("jsonOrThrow()", () => { + it("serializes valid value", async () => { + const value = string().jsonOrThrow("hello"); + expect(value).toBe("hello"); + }); + + it("throws on invalid value", async () => { + const value = () => object({ a: string(), b: string() }).jsonOrThrow({ a: 24 }); + expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + }); + }); + + describe("omitUndefined", () => { + it("serializes undefined as null", async () => { + const value = object({ + a: string().optional(), + b: string().optional(), + }).jsonOrThrow({ + a: "hello", + b: undefined, + }); + expect(value).toEqual({ a: "hello", b: null }); + }); + + it("omits undefined values", async () => { + const value = object({ + a: string().optional(), + b: string().optional(), + }).jsonOrThrow( + { + a: "hello", + b: undefined, + }, + { + omitUndefined: true, + } + ); + expect(value).toEqual({ a: "hello" }); + }); + }); +}); diff --git a/tests/unit/zurg/schema.test.ts b/tests/unit/zurg/schema.test.ts new file mode 100644 index 0000000..94089a9 --- /dev/null +++ b/tests/unit/zurg/schema.test.ts @@ -0,0 +1,78 @@ +import { + boolean, + discriminant, + list, + number, + object, + string, + stringLiteral, + union, +} from "../../../src/core/schemas/builders"; +import { booleanLiteral } from "../../../src/core/schemas/builders/literals/booleanLiteral"; +import { property } from "../../../src/core/schemas/builders/object/property"; +import { itSchema } from "./utils/itSchema"; + +describe("Schema", () => { + itSchema( + "large nested object", + object({ + a: string(), + b: stringLiteral("b value"), + c: property( + "raw_c", + list( + object({ + animal: union(discriminant("type", "_type"), { + dog: object({ value: boolean() }), + cat: object({ value: property("raw_cat", number()) }), + }), + }) + ) + ), + d: property("raw_d", boolean()), + e: booleanLiteral(true), + }), + { + raw: { + a: "hello", + b: "b value", + raw_c: [ + { + animal: { + _type: "dog", + value: true, + }, + }, + { + animal: { + _type: "cat", + raw_cat: 42, + }, + }, + ], + raw_d: false, + e: true, + }, + parsed: { + a: "hello", + b: "b value", + c: [ + { + animal: { + type: "dog", + value: true, + }, + }, + { + animal: { + type: "cat", + value: 42, + }, + }, + ], + d: false, + e: true, + }, + } + ); +}); diff --git a/tests/unit/zurg/set/set.test.ts b/tests/unit/zurg/set/set.test.ts new file mode 100644 index 0000000..e17f908 --- /dev/null +++ b/tests/unit/zurg/set/set.test.ts @@ -0,0 +1,48 @@ +import { set, string } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("set", () => { + itSchema("converts between raw list and parsed Set", set(string()), { + raw: ["A", "B"], + parsed: new Set(["A", "B"]), + }); + + itValidateParse("not a list", set(string()), 42, [ + { + path: [], + message: "Expected list. Received 42.", + }, + ]); + + itValidateJson( + "not a Set", + set(string()), + [], + [ + { + path: [], + message: "Expected Set. Received list.", + }, + ] + ); + + itValidateParse( + "invalid item type", + set(string()), + [42], + [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ] + ); + + itValidateJson("invalid item type", set(string()), new Set([42]), [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ]); +}); diff --git a/tests/unit/zurg/skipValidation.test.ts b/tests/unit/zurg/skipValidation.test.ts new file mode 100644 index 0000000..5dc8809 --- /dev/null +++ b/tests/unit/zurg/skipValidation.test.ts @@ -0,0 +1,45 @@ +/* eslint-disable no-console */ + +import { boolean, number, object, property, string, undiscriminatedUnion } from "../../../src/core/schemas/builders"; + +describe("skipValidation", () => { + it("allows data that doesn't conform to the schema", async () => { + const warningLogs: string[] = []; + const originalConsoleWarn = console.warn; + console.warn = (...args) => warningLogs.push(args.join(" ")); + + const schema = object({ + camelCase: property("snake_case", string()), + numberProperty: number(), + requiredProperty: boolean(), + anyPrimitive: undiscriminatedUnion([string(), number(), boolean()]), + }); + + const parsed = await schema.parse( + { + snake_case: "hello", + numberProperty: "oops", + anyPrimitive: true, + }, + { + skipValidation: true, + } + ); + + expect(parsed).toEqual({ + ok: true, + value: { + camelCase: "hello", + numberProperty: "oops", + anyPrimitive: true, + }, + }); + + expect(warningLogs).toEqual([ + `Failed to validate. + - numberProperty: Expected number. Received "oops".`, + ]); + + console.warn = originalConsoleWarn; + }); +}); diff --git a/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts new file mode 100644 index 0000000..0e66433 --- /dev/null +++ b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts @@ -0,0 +1,44 @@ +import { number, object, property, string, undiscriminatedUnion } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; + +describe("undiscriminatedUnion", () => { + itSchemaIdentity(undiscriminatedUnion([string(), number()]), "hello world"); + + itSchemaIdentity(undiscriminatedUnion([object({ hello: string() }), object({ goodbye: string() })]), { + goodbye: "foo", + }); + + itSchema( + "Correctly transforms", + undiscriminatedUnion([object({ hello: string() }), object({ helloWorld: property("hello_world", string()) })]), + { + raw: { hello_world: "foo " }, + parsed: { helloWorld: "foo " }, + } + ); + + it("Returns errors for all variants", async () => { + const result = await undiscriminatedUnion([string(), number()]).parse(true); + if (result.ok) { + throw new Error("Unexpectedly passed validation"); + } + expect(result.errors).toEqual([ + { + message: "[Variant 0] Expected string. Received true.", + path: [], + }, + { + message: "[Variant 1] Expected number. Received true.", + path: [], + }, + ]); + }); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with zero members", () => { + // @ts-expect-error + () => undiscriminatedUnion([]); + }); + }); +}); diff --git a/tests/unit/zurg/union/union.test.ts b/tests/unit/zurg/union/union.test.ts new file mode 100644 index 0000000..7901846 --- /dev/null +++ b/tests/unit/zurg/union/union.test.ts @@ -0,0 +1,113 @@ +import { boolean, discriminant, number, object, string, union } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("union", () => { + itSchemaIdentity( + union("type", { + lion: object({ + meows: boolean(), + }), + giraffe: object({ + heightInInches: number(), + }), + }), + { type: "lion", meows: true }, + { title: "doesn't transform discriminant when it's a string" } + ); + + itSchema( + "transforms discriminant when it's a discriminant()", + union(discriminant("type", "_type"), { + lion: object({ meows: boolean() }), + giraffe: object({ heightInInches: number() }), + }), + { + raw: { _type: "lion", meows: true }, + parsed: { type: "lion", meows: true }, + } + ); + + describe("allowUnrecognizedUnionMembers", () => { + itSchema( + "transforms discriminant & passes through values when discriminant value is unrecognized", + union(discriminant("type", "_type"), { + lion: object({ meows: boolean() }), + giraffe: object({ heightInInches: number() }), + }), + { + // @ts-expect-error + raw: { _type: "moose", isAMoose: true }, + // @ts-expect-error + parsed: { type: "moose", isAMoose: true }, + opts: { + allowUnrecognizedUnionMembers: true, + }, + } + ); + }); + + describe("withParsedProperties", () => { + it("Added property is included on parsed object", async () => { + const schema = union("type", { + lion: object({}), + tiger: object({ value: string() }), + }).withParsedProperties({ + printType: (parsed) => () => parsed.type, + }); + + const parsed = await schema.parse({ type: "lion" }); + if (!parsed.ok) { + throw new Error("Failed to parse"); + } + expect(parsed.value.printType()).toBe("lion"); + }); + }); + + itValidate( + "non-object", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ] + ); + + itValidate( + "missing discriminant", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + {}, + [ + { + path: [], + message: 'Missing discriminant ("type")', + }, + ] + ); + + itValidate( + "unrecognized discriminant value", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + { + type: "bear", + }, + [ + { + path: ["type"], + message: 'Expected enum. Received "bear".', + }, + ] + ); +}); diff --git a/tests/unit/zurg/utils/itSchema.ts b/tests/unit/zurg/utils/itSchema.ts new file mode 100644 index 0000000..67b6c92 --- /dev/null +++ b/tests/unit/zurg/utils/itSchema.ts @@ -0,0 +1,78 @@ +/* eslint-disable jest/no-export */ +import { Schema, SchemaOptions } from "../../../../src/core/schemas/Schema"; + +export function itSchemaIdentity( + schema: Schema, + value: T, + { title = "functions as identity", opts }: { title?: string; opts?: SchemaOptions } = {} +): void { + itSchema(title, schema, { raw: value, parsed: value, opts }); +} + +export function itSchema( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + only = false, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + only?: boolean; + } +): void { + // eslint-disable-next-line jest/valid-title + (only ? describe.only : describe)(title, () => { + itParse("parse()", schema, { raw, parsed, opts }); + itJson("json()", schema, { raw, parsed, opts }); + }); +} + +export function itParse( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + } +): void { + // eslint-disable-next-line jest/valid-title + it(title, () => { + const maybeValid = schema.parse(raw, opts); + if (!maybeValid.ok) { + throw new Error("Failed to parse() " + JSON.stringify(maybeValid.errors, undefined, 4)); + } + expect(maybeValid.value).toStrictEqual(parsed); + }); +} + +export function itJson( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + } +): void { + // eslint-disable-next-line jest/valid-title + it(title, () => { + const maybeValid = schema.json(parsed, opts); + if (!maybeValid.ok) { + throw new Error("Failed to json() " + JSON.stringify(maybeValid.errors, undefined, 4)); + } + expect(maybeValid.value).toStrictEqual(raw); + }); +} diff --git a/tests/unit/zurg/utils/itValidate.ts b/tests/unit/zurg/utils/itValidate.ts new file mode 100644 index 0000000..75b2c08 --- /dev/null +++ b/tests/unit/zurg/utils/itValidate.ts @@ -0,0 +1,56 @@ +/* eslint-disable jest/no-export */ +import { Schema, SchemaOptions, ValidationError } from "../../../../src/core/schemas/Schema"; + +export function itValidate( + title: string, + schema: Schema, + input: unknown, + errors: ValidationError[], + opts?: SchemaOptions +): void { + // eslint-disable-next-line jest/valid-title + describe("parse()", () => { + itValidateParse(title, schema, input, errors, opts); + }); + describe("json()", () => { + itValidateJson(title, schema, input, errors, opts); + }); +} + +export function itValidateParse( + title: string, + schema: Schema, + raw: unknown, + errors: ValidationError[], + opts?: SchemaOptions +): void { + describe("parse", () => { + // eslint-disable-next-line jest/valid-title + it(title, async () => { + const maybeValid = await schema.parse(raw, opts); + if (maybeValid.ok) { + throw new Error("Value passed validation"); + } + expect(maybeValid.errors).toStrictEqual(errors); + }); + }); +} + +export function itValidateJson( + title: string, + schema: Schema, + parsed: unknown, + errors: ValidationError[], + opts?: SchemaOptions +): void { + describe("json", () => { + // eslint-disable-next-line jest/valid-title + it(title, async () => { + const maybeValid = await schema.json(parsed, opts); + if (maybeValid.ok) { + throw new Error("Value passed validation"); + } + expect(maybeValid.errors).toStrictEqual(errors); + }); + }); +} diff --git a/yarn.lock b/yarn.lock index cc6e63a..939f6b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,9 +19,9 @@ picocolors "^1.0.0" "@babel/compat-data@^7.24.8": - version "7.24.9" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.9.tgz#53eee4e68f1c1d0282aa0eb05ddb02d033fc43a0" - integrity sha512-e701mcfApCJqMMueQI0Fb68Amflj83+dvAvHawoBpAz+GDjCIyGHzNwnefjsWJ3xiYAqqiQFoWbspGYBdb2/ng== + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.0.tgz#6b226a5da3a686db3c30519750e071dce292ad95" + integrity sha512-P4fwKI2mjEb3ZU5cnMJzvRsRKGBUcs8jvxIoRmr6ufAY9Xk2Bz7JubRTTivkw55c7WQJfTECeqYVa+HZ0FzREg== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": version "7.24.9" @@ -44,12 +44,12 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.24.8", "@babel/generator@^7.24.9", "@babel/generator@^7.7.2": - version "7.24.10" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.10.tgz#a4ab681ec2a78bbb9ba22a3941195e28a81d8e76" - integrity sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg== +"@babel/generator@^7.24.9", "@babel/generator@^7.25.0", "@babel/generator@^7.7.2": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" + integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== dependencies: - "@babel/types" "^7.24.9" + "@babel/types" "^7.25.0" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" @@ -65,28 +65,6 @@ lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-environment-visitor@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz#4b31ba9551d1f90781ba83491dd59cf9b269f7d9" - integrity sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ== - dependencies: - "@babel/types" "^7.24.7" - -"@babel/helper-function-name@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2" - integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA== - dependencies: - "@babel/template" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-hoist-variables@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz#b4ede1cde2fd89436397f30dc9376ee06b0f25ee" - integrity sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ== - dependencies: - "@babel/types" "^7.24.7" - "@babel/helper-module-imports@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" @@ -96,15 +74,14 @@ "@babel/types" "^7.24.7" "@babel/helper-module-transforms@^7.24.9": - version "7.24.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.9.tgz#e13d26306b89eea569180868e652e7f514de9d29" - integrity sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw== + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.25.0.tgz#3ffc23c473a2769a7e40d3274495bd559fdd2ecc" + integrity sha512-bIkOa2ZJYn7FHnepzr5iX9Kmz8FjIz4UKzJ9zhX3dnYuVW0xul9RuR3skBfoLu+FPTQw90EHW9rJsSZhyLQ3fQ== dependencies: - "@babel/helper-environment-visitor" "^7.24.7" "@babel/helper-module-imports" "^7.24.7" "@babel/helper-simple-access" "^7.24.7" - "@babel/helper-split-export-declaration" "^7.24.7" "@babel/helper-validator-identifier" "^7.24.7" + "@babel/traverse" "^7.25.0" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.8.0": version "7.24.8" @@ -119,13 +96,6 @@ "@babel/traverse" "^7.24.7" "@babel/types" "^7.24.7" -"@babel/helper-split-export-declaration@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" - integrity sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA== - dependencies: - "@babel/types" "^7.24.7" - "@babel/helper-string-parser@^7.24.8": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" @@ -142,12 +112,12 @@ integrity sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q== "@babel/helpers@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.8.tgz#2820d64d5d6686cca8789dd15b074cd862795873" - integrity sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ== + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.0.tgz#e69beb7841cb93a6505531ede34f34e6a073650a" + integrity sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw== dependencies: - "@babel/template" "^7.24.7" - "@babel/types" "^7.24.8" + "@babel/template" "^7.25.0" + "@babel/types" "^7.25.0" "@babel/highlight@^7.24.7": version "7.24.7" @@ -159,10 +129,10 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.7", "@babel/parser@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.8.tgz#58a4dbbcad7eb1d48930524a3fd93d93e9084c6f" - integrity sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.8", "@babel/parser@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.0.tgz#9fdc9237504d797b6e7b8f66e78ea7f570d256ad" + integrity sha512-CzdIU9jdP0dg7HdyB+bHvDJGagUv+qtzZt5rYCWwW6tITNqV9odjp6Qu41gkG0ca5UfdDUWrKkiAnHHdGRnOrA== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -262,35 +232,32 @@ dependencies: "@babel/helper-plugin-utils" "^7.24.7" -"@babel/template@^7.24.7", "@babel/template@^7.3.3": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.7.tgz#02efcee317d0609d2c07117cb70ef8fb17ab7315" - integrity sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig== +"@babel/template@^7.24.7", "@babel/template@^7.25.0", "@babel/template@^7.3.3": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a" + integrity sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q== dependencies: "@babel/code-frame" "^7.24.7" - "@babel/parser" "^7.24.7" - "@babel/types" "^7.24.7" + "@babel/parser" "^7.25.0" + "@babel/types" "^7.25.0" -"@babel/traverse@^7.24.7", "@babel/traverse@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.8.tgz#6c14ed5232b7549df3371d820fbd9abfcd7dfab7" - integrity sha512-t0P1xxAPzEDcEPmjprAQq19NWum4K0EQPjMwZQZbHt+GiZqvjCHjj755Weq1YRPVzBI+3zSfvScfpnuIecVFJQ== +"@babel/traverse@^7.24.7", "@babel/traverse@^7.24.8", "@babel/traverse@^7.25.0": + version "7.25.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.1.tgz#64dbc31effc5f3fa3cf10d19df0e6310214743f5" + integrity sha512-LrHHoWq08ZpmmFqBAzN+hUdWwy5zt7FGa/hVwMcOqW6OVtwqaoD5utfuGYU87JYxdZgLUvktAsn37j/sYR9siA== dependencies: "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.24.8" - "@babel/helper-environment-visitor" "^7.24.7" - "@babel/helper-function-name" "^7.24.7" - "@babel/helper-hoist-variables" "^7.24.7" - "@babel/helper-split-export-declaration" "^7.24.7" - "@babel/parser" "^7.24.8" - "@babel/types" "^7.24.8" + "@babel/generator" "^7.25.0" + "@babel/parser" "^7.25.0" + "@babel/template" "^7.25.0" + "@babel/types" "^7.25.0" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.24.9", "@babel/types@^7.3.3": - version "7.24.9" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.9.tgz#228ce953d7b0d16646e755acf204f4cf3d08cc73" - integrity sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.24.9", "@babel/types@^7.25.0", "@babel/types@^7.3.3": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.0.tgz#e6e3656c581f28da8452ed4f69e38008ec0ba41b" + integrity sha512-LcnxQSsd9aXOIgmmSpvZ/1yo46ra2ESYyqLcryaBZOghxy5qqOBjvCWP5JfkI8yl9rlxRgdLTTMCQQRcN2hdCg== dependencies: "@babel/helper-string-parser" "^7.24.8" "@babel/helper-validator-identifier" "^7.24.7" @@ -650,11 +617,11 @@ form-data "^4.0.0" "@types/node@*": - version "20.14.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.11.tgz#09b300423343460455043ddd4d0ded6ac579b74b" - integrity sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA== + version "22.0.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.0.0.tgz#04862a2a71e62264426083abe1e27e87cac05a30" + integrity sha512-VT7KSYudcPOzP5Q0wfbowyNLaVR8QWUdw+088uFWwfvpY6uCWaXpqV6ieLAu9WBcnTa7H4Z5RLK8I5t2FuOcqw== dependencies: - undici-types "~5.26.4" + undici-types "~6.11.1" "@types/node@17.0.33": version "17.0.33" @@ -1057,9 +1024,9 @@ data-urls@^3.0.2: whatwg-url "^11.0.0" debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.3.5" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" - integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== + version "4.3.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" + integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== dependencies: ms "2.1.2" @@ -1110,9 +1077,9 @@ domexception@^4.0.0: webidl-conversions "^7.0.0" electron-to-chromium@^1.4.820: - version "1.5.0" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.0.tgz#0d3123a9f09189b9c7ab4b5d6848d71b3c1fd0e8" - integrity sha512-Vb3xHHYnLseK8vlMJQKJYXJ++t4u1/qJ3vykuVrVjvdiOEhYyT1AuP4x03G8EnPmYvYOhe9T+dADTmthjRQMkA== + version "1.5.2" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.2.tgz#6126ad229ce45e781ec54ca40db0504787f23d19" + integrity sha512-kc4r3U3V3WLaaZqThjYz/Y6z8tJe+7K0bbjUVo3i+LWIypVdMx5nXCkwRe6SWbY6ILqLdc1rKcKmr3HoH7wjSQ== emittery@^0.13.1: version "0.13.1" @@ -2535,10 +2502,10 @@ typescript@4.6.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +undici-types@~6.11.1: + version "6.11.1" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.11.1.tgz#432ea6e8efd54a48569705a699e62d8f4981b197" + integrity sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ== universalify@^0.2.0: version "0.2.0"