@unique-nft/sdk
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -13,3 +13,3 @@ import { AxiosInstance } from 'axios'; | ||
/** @example 1 */ | ||
collectionId: number; | ||
collectionId: string | number; | ||
/** @example 1 */ | ||
@@ -439,2 +439,16 @@ tokenId: number; | ||
} | ||
interface NestedToken { | ||
/** @example 1 */ | ||
tokenId: number; | ||
/** @example 1 */ | ||
collectionId: number; | ||
/** @example unjq56sK9skTMR1MyPLsDFXkQdRNNrD1gzE4wRJSYm2k6GjJn */ | ||
owner: string; | ||
/** @example [] */ | ||
attributes: object; | ||
/** @example */ | ||
image: object; | ||
nestingChildTokens: NestedToken[]; | ||
properties: TokenProperty[]; | ||
} | ||
interface GetBundleResponse { | ||
@@ -451,4 +465,3 @@ /** @example 1 */ | ||
image: object; | ||
/** @example [] */ | ||
nestingChildTokens: string[]; | ||
nestingChildTokens: NestedToken[]; | ||
properties: TokenProperty[]; | ||
@@ -563,3 +576,3 @@ } | ||
/** @example 1 */ | ||
collectionId: number; | ||
collectionId: string | number; | ||
/** @example 1 */ | ||
@@ -581,2 +594,18 @@ tokenId: number; | ||
} | ||
interface TokenBalanceQuery { | ||
/** Hash of execution block */ | ||
at?: string; | ||
/** @example 1 */ | ||
collectionId: string | number; | ||
/** @example 1 */ | ||
tokenId: number; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
} | ||
interface TokenBalanceResponse { | ||
amount: number; | ||
} | ||
interface CollectionByIdQuery { | ||
@@ -586,3 +615,3 @@ /** Hash of execution block */ | ||
/** @example 1 */ | ||
collectionId: string; | ||
collectionId: string | number; | ||
} | ||
@@ -1430,3 +1459,3 @@ interface CollectionSponsorship { | ||
* JSON ABI from your smart contract | ||
* @example [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"AddValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"ChangeValue","type":"event"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"addValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] | ||
* @example [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"myNum","type":"uint256"},{"internalType":"string","name":"myStr","type":"string"}],"name":"TestError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"AddValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"ChangeValue","type":"event"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"addValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"boolValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"emptyArr","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"v","type":"uint256"}],"name":"errCustomError","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"errEmptyArrayPop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"errRequire","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"errRequireWithIf","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"errRevert","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"v","type":"int256"}],"name":"errZeroDiv","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bool","name":"test","type":"bool"}],"name":"getTestValue","outputs":[{"internalType":"string","name":"value","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"list","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stringValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] | ||
*/ | ||
@@ -1459,2 +1488,3 @@ abi: AbiItemDto[]; | ||
name: string; | ||
values: object; | ||
} | ||
@@ -1483,3 +1513,3 @@ interface UnknownEventDto { | ||
* JSON ABI from your smart contract | ||
* @example [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"AddValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"ChangeValue","type":"event"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"addValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] | ||
* @example [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"myNum","type":"uint256"},{"internalType":"string","name":"myStr","type":"string"}],"name":"TestError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"AddValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"}],"name":"ChangeValue","type":"event"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"addValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"boolValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"emptyArr","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"v","type":"uint256"}],"name":"errCustomError","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"errEmptyArrayPop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"errRequire","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"errRequireWithIf","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"errRevert","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"v","type":"int256"}],"name":"errZeroDiv","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bool","name":"test","type":"bool"}],"name":"getTestValue","outputs":[{"internalType":"string","name":"value","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"list","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stringValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] | ||
*/ | ||
@@ -1622,2 +1652,12 @@ abi: AbiItemDto[]; | ||
} | ||
interface GetNonceQuery { | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
} | ||
interface GetNonceResponse { | ||
nonce: number; | ||
} | ||
interface ApiGetterParams { | ||
@@ -1693,11 +1733,2 @@ /** @example consts */ | ||
} | ||
interface TokenBalanceQuery { | ||
collectionId: number; | ||
tokenId: number; | ||
address: string; | ||
at?: string; | ||
} | ||
interface TokenBalanceResponse { | ||
amount: number; | ||
} | ||
@@ -1802,12 +1833,12 @@ interface ISection { | ||
get(args: TokenIdQuery): Promise<TokenByIdResponse>; | ||
exists(args: TokenId): Promise<TokenExistsResponse>; | ||
properties(args: TokenId): Promise<TokenPropertiesResponse>; | ||
exists(args: TokenIdQuery): Promise<TokenExistsResponse>; | ||
properties(args: TokenIdQuery): Promise<TokenPropertiesResponse>; | ||
setProperties: IMutation<SetTokenPropertiesBody, SetTokenPropertiesParsed>; | ||
deleteProperties: IMutation<DeleteTokenPropertiesBody, DeleteTokenPropertiesParsed>; | ||
children(args: TokenId): Promise<TokenChildrenResponse>; | ||
parent(args: TokenId): Promise<TokenParentResponse>; | ||
owner(args: TokenId): Promise<TokenOwnerResponse>; | ||
topmostOwner(args: TokenId): Promise<TopmostTokenOwnerResponse>; | ||
isBundle(args: TokenId): Promise<IsBundleResponse>; | ||
getBundle(args: TokenId): Promise<GetBundleResponse>; | ||
children(args: TokenIdQuery): Promise<TokenChildrenResponse>; | ||
parent(args: TokenIdQuery): Promise<TokenParentResponse>; | ||
owner(args: TokenIdQuery): Promise<TokenOwnerResponse>; | ||
topmostOwner(args: TokenIdQuery): Promise<TopmostTokenOwnerResponse>; | ||
isBundle(args: TokenIdQuery): Promise<IsBundleResponse>; | ||
getBundle(args: TokenIdQuery): Promise<GetBundleResponse>; | ||
nest: IMutation<NestTokenBody, TokenId>; | ||
@@ -1842,2 +1873,6 @@ unnest: IMutation<UnnestTokenBody, TokenId>; | ||
} | ||
interface ICommon { | ||
chainProperties(): Promise<ChainPropertiesResponse>; | ||
getNonce(args: GetNonceQuery): Promise<GetNonceResponse>; | ||
} | ||
interface IClient { | ||
@@ -1863,2 +1898,10 @@ instance: AxiosInstance; | ||
declare enum Method { | ||
GET = "GET", | ||
POST = "POST", | ||
DELETE = "DELETE", | ||
PATCH = "PATCH", | ||
PUT = "PUT" | ||
} | ||
/** | ||
@@ -1871,3 +1914,7 @@ * @deprecated use Sdk | ||
instance: AxiosInstance; | ||
/** | ||
* @deprecated use common | ||
*/ | ||
readonly chain: IChain; | ||
readonly common: ICommon; | ||
readonly extrinsics: IExtrinsics; | ||
@@ -1887,2 +1934,2 @@ readonly balance: IBalance; | ||
export { AbiItemDto, AccountTokensQuery, AccountTokensResponse, AddCollectionAdminBody, AddCollectionAdminParsed, AddCollectionAdminResponse, AddToAllowListBody, AddToAllowListParsed, AddToAllowListResponse, AddTokensArgsDto, AddTokensResultDto, AddressDto, AddressWithPrefixQuery, AdminlistResponse, AllBalancesResponse, AllowListBodyResult, AllowListQuery, AllowanceArgumentsQuery, AllowanceResultResponse, AllowedQuery, AllowedResponse, ApiGetterParams, ApiRequestBody, ApproveTokenBody, ApproveTokenParsed, ApproveTokenResponse, AttributeSchemaDto, AudioDto, BalanceResponse, BalanceTransferBody, BalanceTransferParsed, BalanceTransferResponse, BaseQuery, BuildBatchPayloadsResponse, BurnTokenBody, BurnTokenParsed, BurnTokenResponse, ChainPropertiesResponse, Client, ClientParameters, CollectionByIdQuery, CollectionIdQuery, CollectionInfoWithSchemaResponse, CollectionLimitsDto, CollectionNestingPermissionsDto, CollectionPermissionsDto, CollectionPropertiesResponse, CollectionProperty, CollectionPropertyDeletedEvent, CollectionPropertySetEvent, CollectionSponsorship, ConfirmSponsorshipBody, ConfirmSponsorshipParsed, ConfirmSponsorshipResponse, CreateCollectionBody, CreateCollectionParsed, CreateCollectionResponse, CreateERC721CollectionBody, CreateERC721TokenBody, CreateERC721TokenResponse, CreateFungibleCollectionRequest, CreateMultipleTokensBody, CreateTokenBody, CreateTokenPayload, DecodedAttributeDto, DeleteCollectionPropertiesBody, DeleteCollectionPropertiesParsed, DeleteCollectionPropertiesResponse, DeleteTokenPropertiesBody, DeleteTokenPropertiesParsed, DeleteTokenPropertiesResponse, DestroyCollectionBody, DestroyCollectionParsed, DestroyCollectionResponse, EffectiveCollectionLimitsResponse, EthereumAddress, EthereumAddressDto, EvmCallArgumentsDto, EvmCallResponseDto, EvmEventDto, EvmSendArgumentsDto, EvmSendResponse, EvmSendResultParsed, ExtrinsicResultEvent, ExtrinsicResultRequest, ExtrinsicResultResponse, FeeResponse, FungibleCollectionInfoDto, GenerateAccountDataBody, GetAccountDataQuery, GetBalanceQuery, GetBundleResponse, GetCollectionTokensResponse, GetExtrinsicQuery, GetExtrinsicResponse, GetFungibleBalanceArgsRequest, GetStatsResponse, IBalance, IChain, IClient, ICollections, IERC721, IEvm, IExtrinsics, IFungible, IIpfs, IMutation, ISection, ITokens, ImageDto, ImagePreviewDto, IpfsUploadRequest, IpfsUploadResponse, IsBundleResponse, LastTokenIdQuery, LastTokenIdResultDto, MutationOptions, MutationQuery, NestTokenBody, NestTokenResponse, NestingAddressDto, NestingParentId, NextSponsoredQuery, NextSponsoredResponse, OldPropertiesDto, Options, PropertyKeyPermission, PropertyPermission, PropertyPermissionSetEvent, PropertyPermissionsQuery, PropertyPermissionsResponse, RemoveCollectionAdminBody, RemoveCollectionAdminParsed, RemoveCollectionAdminResponse, RemoveFromAllowListBody, RemoveFromAllowListParsed, RemoveFromAllowListResponse, RemoveSponsorshipBody, RemoveSponsorshipParsed, RemoveSponsorshipResponse, Sdk, SetCollectionLimitsBody, SetCollectionLimitsParsed, SetCollectionLimitsResponse, SetCollectionPermissionsBody, SetCollectionPermissionsParsed, SetCollectionPermissionsResponse, SetCollectionPropertiesBody, SetCollectionPropertiesParsed, SetCollectionPropertiesResponse, SetPropertyPermissionsBody, SetPropertyPermissionsParsed, SetPropertyPermissionsResponse, SetSponsorshipBody, SetSponsorshipParsed, SetSponsorshipResponse, SetTokenPropertiesBody, SetTokenPropertiesParsed, SetTokenPropertiesResponse, SetTransfersEnabledBody, SetTransfersEnabledParsed, SetTransfersEnabledResponse, SignResponse, SignTxResultResponse, Signer, SignerPayloadJSONDto, SignerPayloadRawDto, SpatialObjectDto, SubmitResponse, SubmitResultResponse, SubmitTxBody, SubstrateAddress, TokenBalanceQuery, TokenBalanceResponse, TokenByIdResponse, TokenChildrenResponse, TokenExistsResponse, TokenId, TokenIdQuery, TokenOwnerResponse, TokenParentResponse, TokenPropertiesResponse, TokenProperty, TokenPropertyDeletedEvent, TokenPropertySetEvent, TopmostTokenOwnerResponse, TotalSupplyResponse, TransferCollectionBody, TransferCollectionParsed, TransferCollectionResponse, TransferTokenBody, TransferTokenParsed, TransferTokenResponse, TransferTokensArgsDto, TransferTokensResultDto, TxBuildBody, UniqueCollectionSchemaDecodedDto, UniqueCollectionSchemaToCreateDto, UniqueTokenToCreateDto, UnknownEventDto, UnnestTokenBody, UnnestTokenResponse, UnsignedTxPayloadBody, UnsignedTxPayloadResponse, VerificationResultResponse, VideoDto, arrayNumberRecordStringAny }; | ||
export { AbiItemDto, AccountTokensQuery, AccountTokensResponse, AddCollectionAdminBody, AddCollectionAdminParsed, AddCollectionAdminResponse, AddToAllowListBody, AddToAllowListParsed, AddToAllowListResponse, AddTokensArgsDto, AddTokensResultDto, AddressDto, AddressWithPrefixQuery, AdminlistResponse, AllBalancesResponse, AllowListBodyResult, AllowListQuery, AllowanceArgumentsQuery, AllowanceResultResponse, AllowedQuery, AllowedResponse, ApiGetterParams, ApiRequestBody, ApproveTokenBody, ApproveTokenParsed, ApproveTokenResponse, AttributeSchemaDto, AudioDto, BalanceResponse, BalanceTransferBody, BalanceTransferParsed, BalanceTransferResponse, BaseQuery, BuildBatchPayloadsResponse, BurnTokenBody, BurnTokenParsed, BurnTokenResponse, ChainPropertiesResponse, Client, ClientParameters, CollectionByIdQuery, CollectionIdQuery, CollectionInfoWithSchemaResponse, CollectionLimitsDto, CollectionNestingPermissionsDto, CollectionPermissionsDto, CollectionPropertiesResponse, CollectionProperty, CollectionPropertyDeletedEvent, CollectionPropertySetEvent, CollectionSponsorship, ConfirmSponsorshipBody, ConfirmSponsorshipParsed, ConfirmSponsorshipResponse, CreateCollectionBody, CreateCollectionParsed, CreateCollectionResponse, CreateERC721CollectionBody, CreateERC721TokenBody, CreateERC721TokenResponse, CreateFungibleCollectionRequest, CreateMultipleTokensBody, CreateTokenBody, CreateTokenPayload, DecodedAttributeDto, DeleteCollectionPropertiesBody, DeleteCollectionPropertiesParsed, DeleteCollectionPropertiesResponse, DeleteTokenPropertiesBody, DeleteTokenPropertiesParsed, DeleteTokenPropertiesResponse, DestroyCollectionBody, DestroyCollectionParsed, DestroyCollectionResponse, EffectiveCollectionLimitsResponse, EthereumAddress, EthereumAddressDto, EvmCallArgumentsDto, EvmCallResponseDto, EvmEventDto, EvmSendArgumentsDto, EvmSendResponse, EvmSendResultParsed, ExtrinsicResultEvent, ExtrinsicResultRequest, ExtrinsicResultResponse, FeeResponse, FungibleCollectionInfoDto, GenerateAccountDataBody, GetAccountDataQuery, GetBalanceQuery, GetBundleResponse, GetCollectionTokensResponse, GetExtrinsicQuery, GetExtrinsicResponse, GetFungibleBalanceArgsRequest, GetNonceQuery, GetNonceResponse, GetStatsResponse, IBalance, IChain, IClient, ICollections, ICommon, IERC721, IEvm, IExtrinsics, IFungible, IIpfs, IMutation, ISection, ITokens, ImageDto, ImagePreviewDto, IpfsUploadRequest, IpfsUploadResponse, IsBundleResponse, LastTokenIdQuery, LastTokenIdResultDto, Method, MutationOptions, MutationQuery, NestTokenBody, NestTokenResponse, NestedToken, NestingAddressDto, NestingParentId, NextSponsoredQuery, NextSponsoredResponse, OldPropertiesDto, Options, PropertyKeyPermission, PropertyPermission, PropertyPermissionSetEvent, PropertyPermissionsQuery, PropertyPermissionsResponse, RemoveCollectionAdminBody, RemoveCollectionAdminParsed, RemoveCollectionAdminResponse, RemoveFromAllowListBody, RemoveFromAllowListParsed, RemoveFromAllowListResponse, RemoveSponsorshipBody, RemoveSponsorshipParsed, RemoveSponsorshipResponse, Sdk, SetCollectionLimitsBody, SetCollectionLimitsParsed, SetCollectionLimitsResponse, SetCollectionPermissionsBody, SetCollectionPermissionsParsed, SetCollectionPermissionsResponse, SetCollectionPropertiesBody, SetCollectionPropertiesParsed, SetCollectionPropertiesResponse, SetPropertyPermissionsBody, SetPropertyPermissionsParsed, SetPropertyPermissionsResponse, SetSponsorshipBody, SetSponsorshipParsed, SetSponsorshipResponse, SetTokenPropertiesBody, SetTokenPropertiesParsed, SetTokenPropertiesResponse, SetTransfersEnabledBody, SetTransfersEnabledParsed, SetTransfersEnabledResponse, SignResponse, SignTxResultResponse, Signer, SignerPayloadJSONDto, SignerPayloadRawDto, SpatialObjectDto, SubmitResponse, SubmitResultResponse, SubmitTxBody, SubstrateAddress, TokenBalanceQuery, TokenBalanceResponse, TokenByIdResponse, TokenChildrenResponse, TokenExistsResponse, TokenId, TokenIdQuery, TokenOwnerResponse, TokenParentResponse, TokenPropertiesResponse, TokenProperty, TokenPropertyDeletedEvent, TokenPropertySetEvent, TopmostTokenOwnerResponse, TotalSupplyResponse, TransferCollectionBody, TransferCollectionParsed, TransferCollectionResponse, TransferTokenBody, TransferTokenParsed, TransferTokenResponse, TransferTokensArgsDto, TransferTokensResultDto, TxBuildBody, UniqueCollectionSchemaDecodedDto, UniqueCollectionSchemaToCreateDto, UniqueTokenToCreateDto, UnknownEventDto, UnnestTokenBody, UnnestTokenResponse, UnsignedTxPayloadBody, UnsignedTxPayloadResponse, VerificationResultResponse, VideoDto, arrayNumberRecordStringAny }; |
457
index.js
import Axios from 'axios'; | ||
import FormData from 'form-data'; | ||
var Method = /* @__PURE__ */ ((Method2) => { | ||
Method2["GET"] = "GET"; | ||
Method2["POST"] = "POST"; | ||
Method2["DELETE"] = "DELETE"; | ||
Method2["PATCH"] = "PATCH"; | ||
Method2["PUT"] = "PUT"; | ||
return Method2; | ||
})(Method || {}); | ||
class Section { | ||
constructor(client) { | ||
this.client = client; | ||
this.client.options.baseUrl = this.client.options.baseUrl.replace(/\/$/, ""); | ||
} | ||
async query(url, params) { | ||
const response = await this.client.instance({ | ||
method: Method.GET, | ||
baseURL: this.baseUrl, | ||
url, | ||
params | ||
}); | ||
return response.data; | ||
} | ||
} | ||
const isUnsignedTxPayloadResponse = (args) => typeof args === "object" && !!args && "signerPayloadJSON" in args; | ||
@@ -108,25 +133,19 @@ const isSubmitTxBody = (args) => isUnsignedTxPayloadResponse(args) && !!args && "signature" in args; | ||
class Section { | ||
constructor(client) { | ||
this.client = client; | ||
this.client.options.baseUrl = this.client.options.baseUrl.replace(/\/$/, ""); | ||
class Balance extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "balance"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.transfer = new Mutation(this.client, Method.POST, `${this.path}/transfer`); | ||
this.get = (args) => this.query("", args); | ||
} | ||
} | ||
class Balance extends Section { | ||
class Chain extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "balance"; | ||
this.path = "chain"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.transfer = new Mutation(this.client, "POST", `${this.path}/transfer`); | ||
this.properties = () => this.query("properties"); | ||
} | ||
async get(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
} | ||
@@ -139,253 +158,53 @@ | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.setProperties = new Mutation(this.client, "POST", `${this.path}/properties`); | ||
this.deleteProperties = new Mutation(this.client, "DELETE", `${this.path}/properties`); | ||
this.setPropertyPermissions = new Mutation(this.client, "POST", `${this.path}/property-permissions`); | ||
this.creation = new Mutation(this.client, "POST", this.path); | ||
this.setLimits = new Mutation(this.client, "POST", `${this.path}/set-limits`); | ||
this.transfer = new Mutation(this.client, "PATCH", `${this.path}/transfer`); | ||
this.destroy = new Mutation(this.client, "DELETE", this.path); | ||
this.setTransfersEnabled = new Mutation(this.client, "POST", `${this.path}/transfers-enabled`); | ||
this.setPermissions = new Mutation(this.client, "POST", `${this.path}/permissions`); | ||
this.addToAllowList = new Mutation(this.client, "POST", `${this.path}/add-allow-list`); | ||
this.removeFromAllowList = new Mutation(this.client, "POST", `${this.path}/remove-from-allow-list`); | ||
this.addAdmin = new Mutation(this.client, "POST", `${this.path}/admins`); | ||
this.removeAdmin = new Mutation(this.client, "DELETE", `${this.path}/admins`); | ||
this.setSponsorship = new Mutation(this.client, "POST", `${this.path}/sponsorship`); | ||
this.confirmSponsorship = new Mutation(this.client, "POST", `${this.path}/sponsorship/confirm`); | ||
this.removeSponsorship = new Mutation(this.client, "DELETE", `${this.path}/sponsorship`); | ||
this.setProperties = new Mutation(this.client, Method.POST, `${this.path}/properties`); | ||
this.deleteProperties = new Mutation(this.client, Method.DELETE, `${this.path}/properties`); | ||
this.setPropertyPermissions = new Mutation(this.client, Method.POST, `${this.path}/property-permissions`); | ||
this.properties = (args) => this.query("properties", args); | ||
this.tokens = (args) => this.query("tokens", args); | ||
this.propertyPermissions = (args) => this.query("property-permissions", args); | ||
this.creation = new Mutation(this.client, Method.POST, this.path); | ||
this.getLimits = (args) => this.query("limits", args); | ||
this.setLimits = new Mutation(this.client, Method.POST, `${this.path}/set-limits`); | ||
this.get = (args) => this.query("", args); | ||
this.transfer = new Mutation(this.client, Method.PATCH, `${this.path}/transfer`); | ||
this.destroy = new Mutation(this.client, Method.DELETE, this.path); | ||
this.stats = () => this.query("stats"); | ||
this.setTransfersEnabled = new Mutation(this.client, Method.POST, `${this.path}/transfers-enabled`); | ||
this.setPermissions = new Mutation(this.client, Method.POST, `${this.path}/permissions`); | ||
this.nextSponsored = (args) => this.query("next-sponsored", args); | ||
this.lastTokenId = (args) => this.query("last-token-id", args); | ||
this.allowList = (args) => this.query("allow-list", args); | ||
this.allowed = (args) => this.query("allowed", args); | ||
this.addToAllowList = new Mutation(this.client, Method.POST, `${this.path}/add-allow-list`); | ||
this.removeFromAllowList = new Mutation(this.client, Method.POST, `${this.path}/remove-from-allow-list`); | ||
this.admins = (args) => this.query("admins", args); | ||
this.addAdmin = new Mutation(this.client, Method.POST, `${this.path}/admins`); | ||
this.removeAdmin = new Mutation(this.client, Method.DELETE, `${this.path}/admins`); | ||
this.setSponsorship = new Mutation(this.client, Method.POST, `${this.path}/sponsorship`); | ||
this.confirmSponsorship = new Mutation(this.client, Method.POST, `${this.path}/sponsorship/confirm`); | ||
this.removeSponsorship = new Mutation(this.client, Method.DELETE, `${this.path}/sponsorship`); | ||
this.totalSupply = ({ | ||
collectionId | ||
}) => this.query("total-supply", { collectionId }); | ||
} | ||
async properties(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "properties", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
class ERC721 extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "erc721"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.createCollection = new Mutation(this.client, Method.POST, `${this.path}/collection`); | ||
this.createToken = new Mutation(this.client, Method.POST, `${this.path}/token`); | ||
} | ||
async tokens(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "tokens", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async propertyPermissions(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "property-permissions", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async getLimits(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "limits", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async get(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async stats() { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "stats" | ||
}); | ||
return response.data; | ||
} | ||
async nextSponsored(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "next-sponsored", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async lastTokenId(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "last-token-id", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async allowList(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "allow-list", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async allowed(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "allowed", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async admins(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "admins", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async totalSupply({ | ||
collectionId | ||
}) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "total-supply", | ||
params: { collectionId } | ||
}); | ||
return response.data; | ||
} | ||
} | ||
class Tokens extends Section { | ||
class Evm extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "tokens"; | ||
this.path = "evm"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.setProperties = new Mutation(this.client, "POST", `${this.path}/properties`); | ||
this.deleteProperties = new Mutation(this.client, "DELETE", `${this.path}/properties`); | ||
this.create = new Mutation(this.client, "POST", this.path); | ||
this.createMultiple = new Mutation(this.client, "POST", `${this.path}/create-multiple`); | ||
this.nest = new Mutation(this.client, "POST", `${this.path}/nest`); | ||
this.unnest = new Mutation(this.client, "POST", `${this.path}/unnest`); | ||
this.burn = new Mutation(this.client, "DELETE", this.path); | ||
this.transfer = new Mutation(this.client, "PATCH", `${this.path}/transfer`); | ||
this.approve = new Mutation(this.client, "POST", `${this.path}/approve`); | ||
this.send = new Mutation(this.client, Method.POST, `${this.path}/send`); | ||
this.call = (args) => this.query("call", args); | ||
} | ||
async properties(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "properties", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async accountTokens(args) { | ||
const { data } = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "account-tokens", | ||
params: args | ||
}); | ||
return data; | ||
} | ||
async get(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async exists(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "exists", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async children(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "children", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async parent(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "parent", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async owner(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "owner", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async topmostOwner(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "topmost-owner", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async allowance(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "allowance", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async isBundle(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "is-bundle", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async getBundle(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "get-bundle", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async balance(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "balance", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
} | ||
@@ -401,3 +220,3 @@ | ||
const response = await this.client.instance({ | ||
method: "POST", | ||
method: Method.POST, | ||
baseURL: this.baseUrl, | ||
@@ -411,3 +230,3 @@ url: "build", | ||
const response = await this.client.instance({ | ||
method: "POST", | ||
method: Method.POST, | ||
baseURL: this.baseUrl, | ||
@@ -426,3 +245,3 @@ url: "calculate-fee", | ||
const response = await this.client.instance({ | ||
method: "POST", | ||
method: Method.POST, | ||
baseURL: this.baseUrl, | ||
@@ -436,3 +255,3 @@ url: "submit", | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
method: Method.GET, | ||
baseURL: this.baseUrl, | ||
@@ -446,3 +265,3 @@ url: "status", | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
method: Method.GET, | ||
baseURL: this.baseUrl, | ||
@@ -461,25 +280,9 @@ url: "", | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.transfer = new Mutation(this.client, "POST", `${this.path}/transfer`); | ||
this.createCollection = new Mutation(this.client, "POST", `${this.path}/collection`); | ||
this.addTokens = new Mutation(this.client, "POST", `${this.path}/tokens`); | ||
this.transferTokens = new Mutation(this.client, "POST", `${this.path}/tokens/transfer`); | ||
this.transfer = new Mutation(this.client, Method.POST, `${this.path}/transfer`); | ||
this.getCollection = (args) => this.query("collection", args); | ||
this.createCollection = new Mutation(this.client, Method.POST, `${this.path}/collection`); | ||
this.getBalance = (args) => this.query("balance", args); | ||
this.addTokens = new Mutation(this.client, Method.POST, `${this.path}/tokens`); | ||
this.transferTokens = new Mutation(this.client, Method.POST, `${this.path}/tokens/transfer`); | ||
} | ||
async getCollection(args) { | ||
const { data } = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "collection", | ||
params: args | ||
}); | ||
return data; | ||
} | ||
async getBalance(args) { | ||
const { data } = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "balance", | ||
params: args | ||
}); | ||
return data; | ||
} | ||
} | ||
@@ -497,3 +300,3 @@ | ||
const response = await this.client.instance({ | ||
method: "post", | ||
method: Method.POST, | ||
url: `${this.baseUrl}/upload-file`, | ||
@@ -511,3 +314,3 @@ data: form, | ||
const response = await this.client.instance({ | ||
method: "post", | ||
method: Method.POST, | ||
url: `${this.baseUrl}/upload-zip`, | ||
@@ -523,46 +326,31 @@ data: form, | ||
class Evm extends Section { | ||
class Tokens extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "evm"; | ||
this.path = "tokens"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.send = new Mutation(this.client, "POST", `${this.path}/send`); | ||
this.setProperties = new Mutation(this.client, Method.POST, `${this.path}/properties`); | ||
this.deleteProperties = new Mutation(this.client, Method.DELETE, `${this.path}/properties`); | ||
this.properties = (args) => this.query("properties", args); | ||
this.create = new Mutation(this.client, Method.POST, this.path); | ||
this.createMultiple = new Mutation(this.client, Method.POST, `${this.path}/create-multiple`); | ||
this.accountTokens = (args) => this.query("account-tokens", args); | ||
this.get = (args) => this.query("", args); | ||
this.exists = (args) => this.query("exists", args); | ||
this.children = (args) => this.query("children", args); | ||
this.parent = (args) => this.query("parent", args); | ||
this.owner = (args) => this.query("owner", args); | ||
this.topmostOwner = (args) => this.query("topmost-owner", args); | ||
this.nest = new Mutation(this.client, Method.POST, `${this.path}/nest`); | ||
this.unnest = new Mutation(this.client, Method.POST, `${this.path}/unnest`); | ||
this.burn = new Mutation(this.client, Method.DELETE, this.path); | ||
this.transfer = new Mutation(this.client, Method.PATCH, `${this.path}/transfer`); | ||
this.approve = new Mutation(this.client, Method.POST, `${this.path}/approve`); | ||
this.allowance = (args) => this.query("allowance", args); | ||
this.isBundle = (args) => this.query("is-bundle", args); | ||
this.getBundle = (args) => this.query("get-bundle", args); | ||
this.balance = (args) => this.query("balance", args); | ||
} | ||
async call(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "call", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
} | ||
class Chain extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "chain"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
} | ||
async properties() { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "properties" | ||
}); | ||
return response.data; | ||
} | ||
} | ||
class ERC721 extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "erc721"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.createCollection = new Mutation(this.client, "POST", `${this.path}/collection`); | ||
this.createToken = new Mutation(this.client, "POST", `${this.path}/token`); | ||
} | ||
} | ||
class ApiError extends Error { | ||
@@ -579,2 +367,12 @@ constructor(responseError) { | ||
class Common extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "common"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
this.chainProperties = () => this.query("properties"); | ||
this.getNonce = (args) => this.query("get-nonce", args); | ||
} | ||
} | ||
class Client { | ||
@@ -584,2 +382,3 @@ constructor(options) { | ||
this.chain = new Chain(this); | ||
this.common = new Common(this); | ||
this.extrinsics = new Extrinsics(this); | ||
@@ -602,3 +401,5 @@ this.balance = new Balance(this); | ||
this.instance = Axios.create({ | ||
baseURL: this.options.baseUrl | ||
baseURL: this.options.baseUrl, | ||
maxContentLength: Infinity, | ||
maxBodyLength: Infinity | ||
}); | ||
@@ -617,2 +418,2 @@ this.instance.interceptors.response.use((response) => response, (exception) => { | ||
export { Client, Sdk }; | ||
export { Client, Method, Sdk }; |
{ | ||
"name": "@unique-nft/sdk", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -57,3 +57,3 @@ <div align="center"> | ||
```shell | ||
https://rest.unique.network/opal | ||
https://rest.unique.network/opal/v1 | ||
``` | ||
@@ -63,3 +63,3 @@ | ||
```shell | ||
https://rest.unique.network/quartz | ||
https://rest.unique.network/quartz/v1 | ||
``` | ||
@@ -69,3 +69,3 @@ | ||
```shell | ||
https://rest.unique.network/unique | ||
https://rest.unique.network/unique/v1 | ||
``` | ||
@@ -72,0 +72,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96090
2728