Interface: AssetsModule
AssetsModule is exposed by the main context under 'assets' object
Table of contents
Properties
- downloadAsset
- downloadNFT
- findOne
- getCustomErc20Token
- nftDetails
- orderAsset
- orderNFT1155
- orderNFT721
- query
- transfer
- uploadAssetToFilecoin
Properties
downloadAsset
• downloadAsset: (did
: string
) => Promise
<boolean
>
Type declaration
▸ (did
): Promise
<boolean
>
Download an asset already ordered and transfered to the buyer, if the user is the owner of the asset
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the NFT (721 & 1155) asset |
Returns
Promise
<boolean
>
if the NFT is downloaded successfully the method will return a true
Defined in
downloadNFT
• downloadNFT: (did
: string
) => Promise
<boolean
>
Type declaration
▸ (did
): Promise
<boolean
>
Download a NFT asset already ordered and transfered to the buyer, if the user is the owner of the asset
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the NFT (721 & 1155) asset |
Returns
Promise
<boolean
>
if the NFT is downloaded successfully the method will return a true
Defined in
findOne
• findOne: (did
: string
) => Promise
<DDO
>
Type declaration
▸ (did
): Promise
<DDO
>
Get the asset object by the did given
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the asset |
Returns
Promise
<DDO
>
Defined in
getCustomErc20Token
• getCustomErc20Token: (customErc20TokenAddress
: string
) => Promise
<CustomErc20Token
>
Type declaration
▸ (customErc20TokenAddress
): Promise
<CustomErc20Token
>
Get all the details about a custom erc20 token
Parameters
Name | Type | Description |
---|---|---|
customErc20TokenAddress | string | The custom token address |
Returns
Promise
<CustomErc20Token
>
Custom token details
Defined in
nftDetails
• nftDetails: (did
: string
) => Promise
<NFTDetails
>
Type declaration
▸ (did
): Promise
<NFTDetails
>
Get the aggreement details of the NFT asset (owner, nfts supplay, royalties, etc...)
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the NFT (721 & 1155) asset |
Returns
Promise
<NFTDetails
>
Agreement details of the NFT asset
Defined in
orderAsset
• orderAsset: (did
: string
) => Promise
<string
>
Type declaration
▸ (did
): Promise
<string
>
This method order a asset to allow after transfer to the buyer (the method only order but not transfer)
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the asset |
Returns
Promise
<string
>
In case the order is completed successfully it returns the agreementId which is needed to transfer the asset to the buyer
Defined in
orderNFT1155
• orderNFT1155: (did
: string
, amount
: default
) => Promise
<string
>
Type declaration
▸ (did
, amount
): Promise
<string
>
This method order a NFT1155 asset to allow after transfer to the buyer (the method only order but not transfer)
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the NFT1155 asset |
amount | default | Amount of NFT1155 assets to order |
Returns
Promise
<string
>
In case the order is completed successfully it returns the agreementId which is needed to transfer the NFT1155 asset to the buyer
Defined in
orderNFT721
• orderNFT721: (did
: string
, nftTokenAddress
: string
) => Promise
<string
>
Type declaration
▸ (did
, nftTokenAddress
): Promise
<string
>
This method order a NFT721 asset to allow after transfer to the buyer (the method only order but not transfer)
Parameters
Name | Type | Description |
---|---|---|
did | string | id of the NFT721 asset |
nftTokenAddress | string | - |
Returns
Promise
<string
>
In case the order is completed successfully it returns the agreementId which is needed to transfer the NFT721 asset to the buyer
Defined in
query
• query: (q
: SearchQuery
) => Promise
<QueryResult
>
Type declaration
▸ (q
): Promise
<QueryResult
>
Parameters
Name | Type | Description |
---|---|---|
q | SearchQuery | Query to custom the search: order result, filtering, etc... |
Returns
Promise
<QueryResult
>
List of assets according with the query given
Defined in
transfer
• transfer: (assetInfo
: { amount
: number
; did
: string
}) => Promise
<boolean
>
Type declaration
▸ (assetInfo
): Promise
<boolean
>
Transfer the ownership of the asset to other account
Parameters
Name | Type | Description |
---|---|---|
assetInfo | Object | |
assetInfo.amount | number | The amount of asset to transfer |
assetInfo.did | string | The id of the asset |
Returns
Promise
<boolean
>
Return true if asset was transferred successfully
Defined in
uploadAssetToFilecoin
• uploadAssetToFilecoin: (File
: File
, filecoinUrl
: string
) => Promise
<string
>
Type declaration
▸ (File
, filecoinUrl
): Promise
<string
>
Upload files to Filecoin
Parameters
Name | Type | Description |
---|---|---|
File | File | - |
filecoinUrl | string | The url of the Filecoin server |
Returns
Promise
<string
>
The url where is located the file already uploaded