The Ain object for sign and send transaction to AIN blockchain.
The Ainize object for send request to AIN blockchain.
The base url of api server of AINFT Factory.
The subpath of api server request url.
Create AINFT object.
Transaction hash and AINFT object instance.
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs('YOUR-PRIVATE-KEY');
ainftJs.nft.create('nameOfAinftObject', 'symbolOfAinftObject')
.then((res) => {
const { txHash, ainftObject } = res;
console.log(txHash); // 0x...
console.log(ainftObject.id); // 0x...
console.log(ainftObject.appId); // ainft721_0x...
})
.catch((error) =>{
console.log(error);
});
Delete the asset you uploaded.
Get AINFT object instance by ainftObjectId.
The ID of AINFT object.
Returns the AINFT object corresponding to the given ID.
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs('YOUR-PRIVATE-KEY');
ainftJs.nft.get('YOUR-AINFT-OBJECT-ID')
.then((res) => {
const ainftObject = res;
console.log(ainftObject.appId);
})
.catch((error) => {
console.log(error);
})
Get AINFTs by user address.
The ID of AINFT object.
Sets the maximum number of NFTs to retrieve.
Optional cursor to use for pagination.
Returns AINFTs.
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs('YOUR-PRIVATE-KEY');
ainftJs.nft.getAinftsByAccount('TOKEN-OWNER-ADDRESS')
.then((res) => {
const { nfts, isFinal, cursor } = res;
console.log(nfts); // list of nft information.
})
.catch((error) => {
console.log(error);
})
Get AINFTs by AINFT object id.
The ID of AINFT object.
Sets the maximum number of NFTs to retrieve.
Optional cursor to use for pagination.
Returns AINFTs.
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs('YOUR-PRIVATE-KEY');
ainftJs.nft.getAinftsByAinftObject('YOUR-AINFT-OBJECT-ID', 5)
.then((res) => {
const { nfts, isFinal, cursor } = res;
console.log(nfts); // list of nft information.
})
.catch((error) => {
console.log(error);
})
Register AINFT object to factory server. If functions such as mint, transfer, or search do not work well after executing the create function, try executing this function.
The ID of AINFT object.
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs('YOUR-PRIVATE-KEY');
ainftJs.nft.register('YOUR-AINFT-OBJECT-ID')
.catch((error) => {
console.log(error);
})
Searches for AINFT objects created on the AIN Blockchain. This method accesses public data only and does not require signature in the requests.
The parameters to search AINFT object.
Returns searched AINFT objects.
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs();
const params = {
userAddress: '0x...',
name: '...',
symbol: '...',
slug: '...',
limit: 5,
cursor: '...'
}
ainftJs.nft.searchAinftObjects(params)
.then((res) => {
const { ainftObjects, isFinal, cursor } = res;
console.log(ainftObjects); // list of ainftObject information.
})
.catch((error) => {
console.log(error);
})
Searches for AINFTs on the ain blockchain. This method accesses public data only and does not require signature in the requests.
The parameters to search AINFT.
Returns searched AINFTs
import AinftJs from '@ainft-team/ainft-js';
const ainftJs = new AinftJs();
const params = {
userAddress: '0x...',
name: '...',
symbol: '...',
limit: 5,
cursor: '...',
tokenId: '...'
}
ainftJs.nft.searchNfts(params)
.then((res) => {
const { nfts, isFinal, cursor } = res;
console.log(nfts); // list of nfts information.
})
.catch((error) => {
console.log(error);
})
Sends request that include form to api server of AINFT Factory. Used to upload asset data.
The method of Http request.
The suffix of request url.
The string fields of form.
The file fields of form.
Returns response of api request.
Sends request to api server of AINFT Factory. Authenticate by signing data.
The method of Http request.
The suffix of request url.
The data to be included in the api request.
Returns response of api request.
Sends request to api server of AINFT Factory. Used when authentication is not required.
The method of Http request.
The suffix of request url.
The data to be included in the api request.
The headers of Http api request.
Returns response of api request.
Sets base url.
New base url to be set to base url of api server of AINFT Factory.
Sign the data with the private key that the user has registered.
The data to sign.
Returns signature string.
Upload the asset file using the buffer.
Return the asset url.
Upload the asset file using the data url.
Return the asset url.
Generated using TypeDoc
This class supports creating AINFT object, searching AINFTs and things about NFTs.
Do not create it directly; Get it from AinftJs instance.