@unique-nft/client
Advanced tools
Comparing version 0.1.2 to 0.1.3
190
index.d.ts
@@ -199,2 +199,5 @@ import { AxiosInstance } from 'axios'; | ||
} | ||
interface TokenExistsDto { | ||
isExists: boolean; | ||
} | ||
interface DecodedAttributeDto { | ||
@@ -526,4 +529,5 @@ /** @example {"_":"Hello!","en":"Hello!","fr":"Bonjour!"} */ | ||
interface CollectionNestingPermissionsDto { | ||
tokenOwner: boolean; | ||
collectionAdmin: boolean; | ||
tokenOwner?: boolean; | ||
collectionAdmin?: boolean; | ||
restricted?: number[]; | ||
} | ||
@@ -538,2 +542,8 @@ interface CollectionPermissionsDto { | ||
} | ||
interface EffectiveCollectionLimitsResponse { | ||
/** @example 1 */ | ||
collectionId: number; | ||
/** The collection limits */ | ||
limits: CollectionLimitsDto; | ||
} | ||
interface SetCollectionLimitsBody { | ||
@@ -556,2 +566,37 @@ /** The collection limits */ | ||
} | ||
interface DestroyCollectionBody { | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
/** @example 1 */ | ||
collectionId: number; | ||
} | ||
interface DestroyCollectionParsed { | ||
success: boolean; | ||
} | ||
interface TransferCollectionBody { | ||
/** @example 1 */ | ||
collectionId: number; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
from: string; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
to: string; | ||
} | ||
interface TransferCollectionParsed { | ||
/** @example 1 */ | ||
collectionId: number; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
owner: string; | ||
} | ||
interface CollectionProperty { | ||
@@ -622,2 +667,29 @@ /** @example example */ | ||
} | ||
interface SetCollectionPermissionsBody { | ||
/** @example 1 */ | ||
collectionId: number; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
permissions: CollectionPermissionsDto; | ||
} | ||
interface SetCollectionPermissionsParsed { | ||
collectionId: number; | ||
} | ||
interface SetTransfersEnabledBody { | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
/** @example 1 */ | ||
collectionId: number; | ||
/** @example true */ | ||
isEnabled: boolean; | ||
} | ||
interface SetTransfersEnabledParsed { | ||
success: boolean; | ||
} | ||
interface AttributeSchemaDto { | ||
@@ -785,2 +857,23 @@ /** @example {"_":"Hello!","en":"Hello!","fr":"Bonjour!"} */ | ||
} | ||
interface FungibleCollectionInfoDto { | ||
mode?: 'Nft' | 'Fungible' | 'ReFungible'; | ||
/** @example Sample collection name */ | ||
name: string; | ||
/** @example sample collection description */ | ||
description: string; | ||
/** @example TEST */ | ||
tokenPrefix: string; | ||
sponsorship?: CollectionSponsorship; | ||
limits?: CollectionLimitsDto; | ||
metaUpdatePermission?: 'ItemOwner' | 'Admin' | 'None'; | ||
permissions?: CollectionPermissionsDto; | ||
readOnly: boolean; | ||
decimals: number; | ||
id: number; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
owner: string; | ||
} | ||
interface BalanceResponse { | ||
@@ -798,2 +891,72 @@ /** @example 92485000000000000 */ | ||
} | ||
interface CreateFungibleCollectionRequest { | ||
/** @example Fungible */ | ||
mode?: 'Nft' | 'Fungible' | 'ReFungible'; | ||
/** @example Sample collection name */ | ||
name: string; | ||
/** @example sample collection description */ | ||
description: string; | ||
/** @example TEST */ | ||
tokenPrefix: string; | ||
sponsorship?: CollectionSponsorship; | ||
limits?: CollectionLimitsDto; | ||
metaUpdatePermission?: 'ItemOwner' | 'Admin' | 'None'; | ||
permissions?: CollectionPermissionsDto; | ||
readOnly: boolean; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
schema?: UniqueCollectionSchemaToCreateDto; | ||
/** | ||
* @min 0 | ||
* @max 18 | ||
* @example 10 | ||
*/ | ||
decimals: number; | ||
} | ||
interface AddTokensArgsDto { | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
recipient?: string; | ||
collectionId: number; | ||
amount: number; | ||
} | ||
interface AddTokensResultDto { | ||
recipient: string; | ||
collectionId: number; | ||
amount: number; | ||
} | ||
interface TransferTokensArgsDto { | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
address: string; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
recipient: string; | ||
amount: number; | ||
collectionId: number; | ||
} | ||
interface TransferTokensResultDto { | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
recipient: string; | ||
/** | ||
* The ss-58 encoded address | ||
* @example yGCyN3eydMkze4EPtz59Tn7obwbUbYNZCz48dp8FRdemTaLwm | ||
*/ | ||
sender: string; | ||
amount: number; | ||
collectionId: number; | ||
} | ||
interface TxBuildBody { | ||
@@ -907,2 +1070,16 @@ /** | ||
} | ||
interface IFungible extends ISection { | ||
path: string; | ||
baseUrl: string; | ||
getCollection(args: { | ||
collectionId: number; | ||
}): Promise<FungibleCollectionInfoDto>; | ||
createCollection: IMutation<CreateFungibleCollectionRequest, CreateCollectionParsed>; | ||
getBalance(args: { | ||
collectionId: number; | ||
address: string; | ||
}): Promise<BalanceResponse>; | ||
addTokens: IMutation<AddTokensArgsDto, AddTokensResultDto>; | ||
transferTokens: IMutation<TransferTokensArgsDto, TransferTokensResultDto>; | ||
} | ||
interface ICollections extends ISection { | ||
@@ -919,2 +1096,5 @@ path: string; | ||
}): Promise<CollectionProperty[]>; | ||
getLimits(args: { | ||
collectionId: number; | ||
}): Promise<EffectiveCollectionLimitsResponse>; | ||
setProperties: IMutation<SetCollectionPropertiesBody, CollectionPropertySetEvent[]>; | ||
@@ -926,2 +1106,6 @@ deleteProperties: IMutation<DeleteCollectionPropertiesBody, CollectionPropertyDeletedEvent[]>; | ||
setPropertyPermissions: IMutation<SetPropertyPermissionsBody, PropertyPermissionSetEvent[]>; | ||
setPermissions: IMutation<SetCollectionPermissionsBody, SetCollectionPermissionsParsed>; | ||
destroy: IMutation<DestroyCollectionBody, DestroyCollectionParsed>; | ||
setTransfersEnabled: IMutation<SetTransfersEnabledBody, SetTransfersEnabledParsed>; | ||
transfer: IMutation<TransferCollectionBody, TransferCollectionParsed>; | ||
} | ||
@@ -934,2 +1118,3 @@ interface ITokens extends ISection { | ||
get(args: TokenId): Promise<UniqueTokenDecodedResponse>; | ||
exists(args: TokenId): Promise<TokenExistsDto>; | ||
properties(args: TokenId): Promise<TokenProperty[]>; | ||
@@ -976,2 +1161,3 @@ setProperties: IMutation<SetTokenPropertiesBody, TokenPropertySetEvent[]>; | ||
readonly balance: IBalance; | ||
readonly fungible: IFungible; | ||
readonly collections: ICollections; | ||
@@ -978,0 +1164,0 @@ readonly tokens: ITokens; |
84
index.js
@@ -107,3 +107,6 @@ import Axios from 'axios'; | ||
this.setLimits = new Mutation(this.client, "POST", this.path); | ||
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`); | ||
} | ||
@@ -121,2 +124,13 @@ async properties({ | ||
} | ||
async tokens({ | ||
collectionId | ||
}) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "tokens", | ||
params: { collectionId } | ||
}); | ||
return response.data; | ||
} | ||
async propertyPermissions({ | ||
@@ -133,2 +147,11 @@ collectionId | ||
} | ||
async getLimits(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "limits", | ||
params: { collectionId: args.collectionId } | ||
}); | ||
return response.data; | ||
} | ||
async get(args) { | ||
@@ -143,2 +166,23 @@ const response = await this.client.instance({ | ||
} | ||
async stats() { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "stats" | ||
}); | ||
return response.data; | ||
} | ||
async nextSponsored({ | ||
address, | ||
collectionId, | ||
tokenId | ||
}) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "next-sponsored", | ||
params: { address, collectionId, tokenId } | ||
}); | ||
return response.data; | ||
} | ||
} | ||
@@ -190,2 +234,11 @@ | ||
} | ||
async exists(args) { | ||
const response = await this.client.instance({ | ||
method: "GET", | ||
baseURL: this.baseUrl, | ||
url: "exists", | ||
params: args | ||
}); | ||
return response.data; | ||
} | ||
async children({ collectionId, tokenId }) { | ||
@@ -275,2 +328,32 @@ const response = await this.client.instance({ | ||
class Fungible extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "fungible"; | ||
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`); | ||
} | ||
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; | ||
} | ||
} | ||
class Client { | ||
@@ -281,2 +364,3 @@ constructor(options) { | ||
this.balance = new Balance(this); | ||
this.fungible = new Fungible(this); | ||
this.collections = new Collections(this); | ||
@@ -283,0 +367,0 @@ this.tokens = new Tokens(this); |
{ | ||
"name": "@unique-nft/client", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
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
56948
1887