Skip to content

Commit

Permalink
chore: add mock data and local storage values for testing and mapRare…
Browse files Browse the repository at this point in the history
…SatsAPIResponseToRareSatsV2 method to map the response for v2 api (#56)

* chore: add mock data and local storage values for testing and mapRareSatsAPIResponseToRareSatsV2 method to map the response for v2 api

* chore: add localstorage value to use prod api

* feat: rare sats tab UI (#57)

* feat: rare sats tab UI

* fix: gallery view UI

* fix: icons

* fix: thousand separator

---------

Co-authored-by: Abdul Haseeb <haseeb4239@gmail.com>
  • Loading branch information
fedeerbes and abdulhaseeb4239 committed Nov 21, 2023
1 parent ec8d560 commit 2fd63a5
Show file tree
Hide file tree
Showing 11 changed files with 677 additions and 72 deletions.
2 changes: 1 addition & 1 deletion src/app/components/rareSatAsset/rareSatAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function RareSatAsset({ item, isCollage = false }: Props) {
<Container>
{isInscription ? (
<InscriptionContainer>
{!isCollage && !!item.rarity_ranking && item.rarity_ranking !== 'common' && (
{!isCollage && !!item.rarity_ranking && item.rarity_ranking !== 'COMMON' && (
<RareSatIconContainer isGallery={isGallery}>
<RareSatIcon
type={item.rarity_ranking}
Expand Down
14 changes: 7 additions & 7 deletions src/app/components/rareSatIcon/rareSatIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ function RareSatIcon({
}: Props) {
const isGallery: boolean = document.documentElement.clientWidth > 360;
const src = {
epic: Epic,
legendary: Legendary,
mythic: Mythic,
rare: Rare,
uncommon: Uncommon,
unknown: Unknown,
EPIC: Epic,
LEGENDARY: Legendary,
MYTHIC: Mythic,
RARE: Rare,
UNCOMMON: Uncommon,
UNKNOWN: Unknown,
BLACK_LEGENDARY: BlackLegendary,
BLACK_EPIC: BlackEpic,
BLACK_RARE: BlackRare,
Expand Down Expand Up @@ -136,7 +136,7 @@ function RareSatIcon({
return (
<Container bgColor={backgroundColor} padding={padding}>
<ImageContainer size={size} dynamicSize={isDynamicSize}>
{glow && type !== 'unknown' && (
{glow && type !== 'UNKNOWN' && (
<Glow color={color} outerColor={outerColor} isCollage={isCollage} isGallery={isGallery} />
)}
<Image src={src} alt={type} />
Expand Down
280 changes: 280 additions & 0 deletions src/app/hooks/queries/ordinals/tempAddressRareSatsMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
import { ApiBundleV2 } from '@utils/rareSats';

export type Response = {
xVersion: number;
limit: number;
offset: number;
total: number;
results: ApiBundleV2[];
};

export const mockData: Response = {
xVersion: 1,
limit: 30,
offset: 0,
total: 1,
results: [
{
block_height: 803128,
txid: 'f5aa0649f2e5d0c6402c2d6b64ba6ea89e8be836a2ad01cbb0cdcc8721e314c7',
value: 21000,
vout: 0,
sat_ranges: [
{
year_mined: 2009,
block: 9,
offset: 0,
range: {
start: '34234320000000',
end: '34234320010000',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 10000,
range: {
start: '34234320010001',
end: '34234320010002',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [
{
content_type: 'text/plain;charset=utf-8',
id: '09c094c3f1ab71c9be7a356a0f1af21b0e552c18d50372fd3799430c890ef135i0',
},
],
},
{
year_mined: 2009,
block: 9,
offset: 10002,
range: {
start: '34234320010002',
end: '34234320020000',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 20001,
range: {
start: '45000000001',
end: '45000000999',
},
satributes: ['BLOCK9', 'NAKAMOTO', 'VINTAGE', 'FIRST_TRANSACTION'],
inscriptions: [],
},
],
},
],
};

// TestCase 1 - Empty response
export const mockTestCase1: Response = {
xVersion: 1,
limit: 30,
offset: 0,
total: 0,
results: [],
};

// TestCase 2 - 3 bundles
export const mockTestCase3: Response = {
xVersion: 1,
limit: 30,
offset: 0,
total: 1,
results: [
{
block_height: 803128,
txid: 'f5aa0649f2e5d0c6402c2d6b64ba6ea89e8be836a2ad01cbb0cdcc8721e314c7',
value: 20997,
vout: 0,
sat_ranges: [
{
year_mined: 2009,
block: 9,
offset: 0,
range: {
start: '34234320000000',
end: '34234320010000',
},
satributes: ['RARE', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 10000,
range: {
start: '34234320010001',
end: '34234320010002',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [
{
content_type: 'text/plain;charset=utf-8',
id: '09c094c3f1ab71c9be7a356a0f1af21b0e552c18d50372fd3799430c890ef135i0',
},
],
},
{
year_mined: 2009,
block: 9,
offset: 10002,
range: {
start: '34234320010002',
end: '34234320020000',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 20001,
range: {
start: '45000000001',
end: '45000000999',
},
satributes: ['BLOCK9', 'NAKAMOTO', 'VINTAGE', 'FIRST_TRANSACTION'],
inscriptions: [],
},
],
},
{
block_height: 803128,
txid: 'f5aa0649f2e5d0c6402c2d6b64ba6ea89e8be836a2ad01cbb0cdcc8721e314c8',
value: 21000,
vout: 0,
sat_ranges: [
{
year_mined: 2009,
block: 9,
offset: 0,
range: {
start: '34234320000000',
end: '34234320010000',
},
satributes: ['BLOCK78'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 10000,
range: {
start: '34234320010001',
end: '34234320010001',
},
satributes: ['PIZZA'],
inscriptions: [
{
content_type: 'text/plain;charset=utf-8',
id: '09c094c3f1ab71c9be7a356a0f1af21b0e552c18d50372fd3799430c890ef135i0',
},
],
},
{
year_mined: 2009,
block: 9,
offset: 10002,
range: {
start: '34234320010002',
end: '34234320020000',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 20001,
range: {
start: '45000000001',
end: '45000000999',
},
satributes: ['BLOCK9', 'NAKAMOTO'],
inscriptions: [],
},
],
},
{
block_height: 803128,
txid: 'f5aa0649f2e5d0c6402c2d6b64ba6ea89e8be836a2ad01cbb0cdcc8721e314c9',
value: 21000,
vout: 0,
sat_ranges: [
{
year_mined: 2009,
block: 9,
offset: 0,
range: {
start: '34234320000000',
end: '34234320000003',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
{
year_mined: 2009,
block: 9,
offset: 3,
range: {
start: '34234320010001',
end: '34234320010001',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [
{
content_type: 'text/plain;charset=utf-8',
id: '09c094c3f1ab71c9be7a356a0f1af21b0e552c18d50372fd3799430c890ef135i0',
},
],
},
{
year_mined: 2009,
block: 9,
offset: 4,
range: {
start: '34234320010002',
end: '34234320010003',
},
satributes: ['HITMAN', 'NAME_PALINDROME', 'NAKAMOTO', 'VINTAGE', 'FIRST_TRANSACTION'],
inscriptions: [],
},
],
},
{
block_height: 803128,
txid: 'f5aa0649f2e5d0c6402c2d6b64ba6ea89e8be836a2ad01cbb0cdcc8721e314d1',
value: 100,
vout: 0,
sat_ranges: [
{
year_mined: 2009,
block: 9,
offset: 0,
range: {
start: '34234320000000',
end: '34234320000003',
},
satributes: ['UNCOMMON', 'PIZZA', 'PALINDROME'],
inscriptions: [],
},
],
},
{
block_height: 803128,
txid: 'f5aa0649f2e5d0c6402c2d6b64ba6ea89e8be836a2ad01cbb0cdcc8721e314d2',
value: 100,
vout: 0,
sat_ranges: [],
},
],
};
Loading

0 comments on commit 2fd63a5

Please sign in to comment.