Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cappacity nft #254

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions schemas/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,44 @@
"pHeight": {
"type": "integer",
"description": "Preview/Image height"
},
"nft": {
"type": "object",
"required": [
"price",
"supply",
"image"
],
"properties": {
"price": {
"type": "string"
},
"supply": {
"type": "number"
},
"image": {
"type": "string",
"format": "uri"
},
"attributes": {
"type": "array",
"items": {
"type": "object",
"required": [
"title",
"url"
],
"properties": {
"title": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
}
}
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions src/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ exports.FILES_ARPROPS_FIELD = 'ar3dviewProps';
exports.FILES_CREATION_INFO_FIELD = 'creationInfo';
exports.FILES_PLAYER_SETTINGS_FIELD = 'playerSettings';
exports.FILES_PLAYER_FRAMES_CYCLE_FIELD = 'cycle';
exports.FILES_NFT_FIELD = 'nft';

exports.FIELDS_TO_STRINGIFY = [
exports.FILES_TAGS_FIELD,
Expand All @@ -88,6 +89,7 @@ exports.FIELDS_TO_STRINGIFY = [
exports.FILES_CREATION_INFO_FIELD,
exports.FILES_PLAYER_SETTINGS_FIELD,
exports.FILES_PLAYER_FRAMES_CYCLE_FIELD,
exports.FILES_NFT_FIELD,
];

exports.CAPPASITY_3D_MODEL = 'model';
Expand Down
32 changes: 32 additions & 0 deletions test/suites/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,38 @@ describe('update suite', function suite() {
});
});

describe('update nft', function emptyDescription() {
it('update nft fields', async function test() {
const { uploadId } = this.response;
meta.nft = {
price: '1',
supply: 1,
image: 'http://website.com/image.jpeg',
attributes: [{
title: 'test',
url: 'http://test.com',
}],
};

await this.send({
uploadId,
username,
meta,
}, 45000);

const fileInfo = await getInfo.call(this, {
filename: uploadId,
username,
});

assert.equal(fileInfo.file.nft.price, '1');
assert.equal(fileInfo.file.nft.supply, 1);
assert.equal(fileInfo.file.nft.image, 'http://website.com/image.jpeg');
assert.equal(fileInfo.file.nft.attributes[0].title, 'test');
assert.equal(fileInfo.file.nft.attributes[0].url, 'http://test.com');
});
});

describe('update background image', function afterUpdateSuite() {
before('upload background image', function upload() {
return initAndUpload(backgroundData, false).call(this)
Expand Down