Skip to content

Commit 68a1c8d

Browse files
Merge pull request #468 from Cryptonomic/as-features
NFT update
2 parents a7cc98b + a9831f6 commit 68a1c8d

File tree

23 files changed

+148
-37
lines changed

23 files changed

+148
-37
lines changed

package-lock.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tezori",
3-
"version": "1.3.0-beta",
3+
"version": "1.3.1-beta",
44
"description": "An open-source wallet framework for the Tezos blockchain.",
55
"main": "./src/main.prod.js",
66
"scripts": {
@@ -194,6 +194,7 @@
194194
"node-sass": "4.14.1",
195195
"opencollective-postinstall": "2.0.2",
196196
"optimize-css-assets-webpack-plugin": "5.0.3",
197+
"pngjs": "^6.0.0",
197198
"prettier": "2.0.5",
198199
"react-hot-loader": "4.12.21",
199200
"react-test-renderer": "16.13.1",

src/components/Media/style.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const ModalBox = styled.div`
3838
& img,
3939
& video,
4040
div {
41-
width: max-content;
41+
width: auto;
4242
height: auto;
4343
max-width: 90vw;
4444
max-height: 90vh;
@@ -81,6 +81,7 @@ export const PreviewIcon = styled.span`
8181
export const StyledImage = styled(Image)`
8282
& > img {
8383
border-radius: 8px;
84+
image-rendering: pixelated;
8485
}
8586
`;
8687

src/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "Tezori",
3-
"version": "1.3.0-beta",
3+
"version": "1.3.1-beta",
44
"blockExplorerHost": "https://arronax.io/tezos",
55
"logo": "tezosLogo.png",
66
"logoLink": "https://github.com/Cryptonomic/T2",
77
"termsService": "https://github.com/Cryptonomic/T2",
88
"privacyPolicy": "https://github.com/Cryptonomic/T2",
99
"tagline": "containers.loginHome.tagline",
10-
"LocalVersionIndex": "56",
10+
"LocalVersionIndex": "57",
1111
"helpUrl": "https://github.com/Cryptonomic/T2",
1212
"aboutUrl": "",
1313
"ledgerAppUrl": "https://support.ledger.com/hc/en-us/articles/360016057774-Tezos-XTZ-",

src/constants/Token.ts

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export const knownTokenContracts: (Token | VaultToken | ArtToken)[] = [
201201
network: 'mainnet',
202202
address: 'KT1K6TyRSsAxukmjDWik1EoExSKsTg9wGEEX',
203203
displayName: 'Tezos Degen Club',
204-
symbol: 'TBC',
204+
symbol: 'TDC',
205205
balance: 0,
206206
transactions: [],
207207
activeTab: COLLECTION,
@@ -587,6 +587,24 @@ export const knownTokenContracts: (Token | VaultToken | ArtToken)[] = [
587587
provider: NFT_PROVIDERS.OBJKT_GENERIC,
588588
hideOnLanding: true,
589589
},
590+
{
591+
network: 'mainnet',
592+
address: 'KT1QYVvQb1NCMWLLSAT7YcYtmmuEiKtTHmwd',
593+
displayName: 'Ottez Oysters',
594+
symbol: 'Ottez Oysters',
595+
balance: 0,
596+
transactions: [],
597+
activeTab: COLLECTION,
598+
kind: TokenKind.objkt,
599+
scale: 0,
600+
precision: 0,
601+
round: 0,
602+
mapid: 137098,
603+
nftMetadataMap: 137100,
604+
holderLocation: 'key',
605+
provider: NFT_PROVIDERS.OBJKT_GENERIC,
606+
hideOnLanding: true,
607+
},
590608
{
591609
network: 'mainnet',
592610
address: 'KT1Qm7MHmbdiBzoRs7xqBiqoRxw7T2cxTTJN',
@@ -774,6 +792,27 @@ export const knownTokenContracts: (Token | VaultToken | ArtToken)[] = [
774792
helpLink: 'https://tzdropz.com',
775793
displayHelpLink: 'tzdropz.com/',
776794
},
795+
{
796+
network: 'mainnet',
797+
address: 'KT1MxDwChiDwd6WBVs24g1NjERUoK622ZEFp',
798+
displayName: '8bidou',
799+
symbol: '8B',
800+
balance: 0,
801+
transactions: [],
802+
activeTab: COLLECTION,
803+
kind: TokenKind.objkt,
804+
scale: 0,
805+
precision: 0,
806+
round: 0,
807+
mapid: 113213,
808+
nftMetadataMap: 113218,
809+
holderLocation: 'key',
810+
balancePath: '$.args[1].int',
811+
provider: NFT_PROVIDERS.EIGHTB,
812+
hideOnLanding: true,
813+
helpLink: 'https://www.8bidou.com',
814+
displayHelpLink: '8bidou.com',
815+
},
777816
{
778817
network: 'mainnet',
779818
address: 'KT1VYsVfmobT7rsMVivvZ4J8i3bPiqz12NaH',
@@ -824,9 +863,29 @@ export const knownTokenContracts: (Token | VaultToken | ArtToken)[] = [
824863
round: 2,
825864
mapid: 103270,
826865
balancePath: '$.args[1].int',
827-
helpLink: 'https://objkt.com/',
866+
helpLink: 'https://objkt.com',
828867
displayHelpLink: 'objkt.com',
829868
},
869+
{
870+
network: 'mainnet',
871+
address: 'KT1AWoUQAuUudqpc75cGukWufbfim3GRn8h6',
872+
displayName: 'Flex Fashion',
873+
symbol: 'FF',
874+
balance: 0,
875+
transactions: [],
876+
activeTab: COLLECTION,
877+
kind: TokenKind.objkt,
878+
scale: 0,
879+
precision: 0,
880+
round: 0,
881+
mapid: 124575,
882+
nftMetadataMap: 124577,
883+
holderLocation: 'key',
884+
provider: NFT_PROVIDERS.OBJKT_GENERIC,
885+
helpLink: 'https://flex.fashion',
886+
displayHelpLink: 'flex.fashion',
887+
hideOnLanding: true,
888+
},
830889
{
831890
network: 'mainnet',
832891
address: 'KT1XpYoPCxQnpgxLM22dkLDXBmTsDLc1S8nZ',
@@ -1634,6 +1693,9 @@ export const knownContractNames = {
16341693
KT1NVXxerB7NFi12CGP79fwoLHhuaxPBV2tQ: 'Dogami Auction',
16351694

16361695
KT1NkWx47WzJeHCSyB62WjLtFn4tRf3uXBur: 'Tezos Degen Club coin flip',
1696+
1697+
KT1BvWGFENd4CXW5F3u4n31xKfJhmBGipoqF: '8bidou Market',
1698+
KT1MxDwChiDwd6WBVs24g1NjERUoK622ZEFp: '8bidou NFT',
16371699
};
16381700

16391701
export const knownMarketMetadata = [

src/contracts/NFT/components/NFTMoreInfo/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export const NFTMoreInfo: FunctionComponent<NFTMoreInfoProps> = ({ nftObject })
6262
openArtifactLink(`https://objkt.com/asset/${nftObject.tokenAddress}/${nftObject.objectId}`);
6363
} else if (nftObject?.provider === NFT_PROVIDERS.DOGAMI) {
6464
openArtifactLink(`https://marketplace.dogami.com/dog/${nftObject.objectId}`);
65+
} else if (nftObject?.provider === NFT_PROVIDERS.EIGHTB) {
66+
openArtifactLink(`https://www.8bidou.com/listing/?id=${nftObject.objectId}`);
6567
}
6668
};
6769

src/contracts/NFT/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const NFT_PROVIDERS = {
2626
FXHASH: 'FXHASH',
2727
VERSUM: 'VERSUM',
2828
RARIBLE: 'RARIBLE',
29+
EIGHTB: 'EIGHTB',
2930
IPFS: 'IPFS',
3031

3132
OBJKT_GENERIC: 'OBJKT_GENERIC',

src/contracts/NFT/util.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ConseilQueryBuilder, ConseilOperator, KeyStore, MultiAssetTokenHelper,
22
import { BigNumber } from 'bignumber.js';
33
import { JSONPath } from 'jsonpath-plus';
44
import { proxyFetch, ImageProxyServer, ImageProxyDataType } from 'nft-image-proxy';
5+
import * as png from 'pngjs';
56

67
import { NFT_ACTION_TYPES, NFT_ERRORS, NFT_PROVIDERS } from './constants';
78
import { TransferNFTError } from './exceptions';
@@ -580,9 +581,38 @@ export async function getObjktNFTDetails(tezosUrl: string, objectId: number | st
580581
};
581582
}
582583

584+
export async function get8bidouDetails(tezosUrl: string, objectId: number | string, metadataMap: number) {
585+
const packedNftId = TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtils.writePackedData(objectId, 'int'), 'hex'));
586+
const nftInfo = await TezosNodeReader.getValueForBigMapKey(tezosUrl, metadataMap, packedNftId);
587+
588+
const creatorBytes = JSONPath({ path: '$.args[2].bytes', json: nftInfo })[0]; // $.args[1].string
589+
const descriptionBytes = JSONPath({ path: '$.args[4].bytes', json: nftInfo })[0];
590+
const nameBytes = JSONPath({ path: '$.args[3].bytes', json: nftInfo })[0];
591+
const imageDataBytes = JSONPath({ path: '$.args[5].string', json: nftInfo })[0];
592+
593+
const nftCreators = Buffer.from(creatorBytes, 'hex').toString();
594+
const nftDescription = Buffer.from(descriptionBytes, 'hex').toString();
595+
const nftName = Buffer.from(nameBytes, 'hex').toString();
596+
597+
const image = new png.PNG({ width: 8, height: 8, bitDepth: 8, colorType: 2, inputColorType: 2, inputHasAlpha: false });
598+
image.data = Buffer.from(imageDataBytes, 'hex');
599+
const buffer = png.PNG.sync.write(image, { width: 8, height: 8, bitDepth: 8, colorType: 2, inputColorType: 2, inputHasAlpha: false });
600+
const artifactUrl = `data:image/png;base64,${buffer.toString('base64')}`;
601+
602+
return {
603+
name: nftName,
604+
description: nftDescription,
605+
creators: nftCreators,
606+
artifactUrl,
607+
artifactType: 'image/png',
608+
artifactModerationMessage: undefined,
609+
thumbnailUri: artifactUrl,
610+
};
611+
}
612+
583613
export async function getDogamiDetails(tezosUrl: string, objectId: number | string, metadataMap: number) {
584614
const packedNftId = TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtils.writePackedData(objectId, 'int'), 'hex'));
585-
const nftInfo = await TezosNodeReader.getValueForBigMapKey(tezosUrl, metadataMap, packedNftId); // TODO: store in token definition
615+
const nftInfo = await TezosNodeReader.getValueForBigMapKey(tezosUrl, metadataMap, packedNftId);
586616

587617
const artifactUrlBytes = JSONPath({ path: '$.args[1][0].args[1].bytes', json: nftInfo })[0];
588618
const creatorBytes = JSONPath({ path: '$.args[1][2].args[1].bytes', json: nftInfo })[0];
@@ -855,6 +885,9 @@ export async function getCollection(tokenAddress: string, tokenMapId: number, qu
855885
if (metadataMapId === 115420) {
856886
// HACK: dogami
857887
objectDetails = await getDogamiDetails(node.tezosUrl, objectId, metadataMapId);
888+
} else if (metadataMapId === 113218) {
889+
// HACK 8bidou
890+
objectDetails = await get8bidouDetails(node.tezosUrl, objectId, metadataMapId);
858891
} else {
859892
objectDetails = await getObjktNFTDetails(node.tezosUrl, objectId, metadataMapId, urlPath);
860893
}

src/featureModals/Beacon/BeaconAuthorization.tsx

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,9 @@ import { createMessageAction } from '../../reduxContent/message/actions';
3333
import { ModalWrapper, ModalContainer, Container, ButtonContainer, InvokeButton, WhiteBtn, Footer } from '../style';
3434

3535
import { estimateOperationGroupFee, sendOperations, queryHicEtNuncSwap } from './thunks';
36-
import { WrapPassword, OperationDetailHeader } from './style';
36+
import { WrapPassword, OperationDetailHeader, LabelText } from './style';
3737
import { beaconClient } from './BeaconMessageRouter';
3838

39-
const AddCircleWrapper = styled(AddCircle)<{ active: number }>`
40-
&&& {
41-
fill: #7b91c0;
42-
width: ${ms(1)};
43-
height: ${ms(1)};
44-
opacity: ${({ active }) => (active ? 1 : 0.5)};
45-
cursor: ${({ active }) => (active ? 'pointer' : 'default')};
46-
}
47-
`;
48-
49-
export const LabelText = styled.span`
50-
display: block;
51-
margin-bottom: 0px;
52-
font-size: 12px;
53-
color: ${({ theme: { colors } }) => colors.gray5};
54-
font-weight: 400;
55-
`;
56-
5739
interface Props {
5840
open: boolean;
5941
managerBalance: number;
@@ -149,12 +131,15 @@ const BeaconAuthorize = ({ open, managerBalance, onClose }: Props) => {
149131
useEffect(() => {
150132
if (!estimates.estimatedFee) {
151133
setFee('0');
152-
} else if (typeof estimates.estimatedFee === 'string') {
153-
setFeeError(estimates.estimatedFee);
134+
setFeeError('');
135+
} else if (estimates.feeError && estimates.feeError.length > 0) {
136+
setFeeError(estimates.feeError);
154137
} else {
138+
setFeeError('');
155139
setFee(formatAmount(estimates.estimatedFee));
156140
setCustomFee(formatAmount(estimates.estimatedFee));
157141
}
142+
158143
if (typeof estimates.estimatedStorage === 'number') {
159144
setCustomStorageLimit(estimates.estimatedStorage);
160145
}

src/featureModals/Beacon/style.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ export const OperationDetailHeader = styled.div`
1010
font-size: 12px;
1111
float: left;
1212
`;
13+
14+
export const LabelText = styled.span`
15+
display: block;
16+
margin-bottom: 0px;
17+
font-size: 12px;
18+
color: ${({ theme: { colors } }) => colors.gray5};
19+
font-weight: 400;
20+
`;

0 commit comments

Comments
 (0)