Skip to content

Commit

Permalink
shakedex: move LISTING_STATUS to constants file (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithvikvibhu authored Jul 6, 2022
1 parent 566a809 commit fffa250
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
3 changes: 2 additions & 1 deletion app/components/ShakedexDeprecated/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import GenerateListingModal from '../../pages/Exchange/GenerateListingModal';
import Alert from '../Alert';
import MiniModal from '../Modal/MiniModal';
import { HeaderItem, HeaderRow, Table, TableItem, TableRow } from '../Table';
import { cancelExchangeLock, finalizeCancelExchangeLock, getExchangeListings, LISTING_STATUS } from "../../ducks/exchange";
import { cancelExchangeLock, finalizeCancelExchangeLock, getExchangeListings } from "../../ducks/exchange";
import { LISTING_STATUS } from '../../constants/exchange';
import { formatName } from '../../utils/nameHelpers';
import { listingStatusToI18nKey } from '../../utils/shakedex';
import { I18nContext } from '../../utils/i18n';
Expand Down
14 changes: 14 additions & 0 deletions app/constants/exchange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const LISTING_STATUS = {
NOT_FOUND: 'NOT_FOUND',
TRANSFER_CONFIRMING: 'TRANSFER_CONFIRMING',
TRANSFER_CONFIRMED: 'TRANSFER_CONFIRMED',
TRANSFER_CONFIRMED_LOCKUP: 'TRANSFER_CONFIRMED_LOCKUP',
FINALIZE_CONFIRMING: 'FINALIZE_CONFIRMING',
FINALIZE_CONFIRMED: 'FINALIZE_CONFIRMED',
ACTIVE: 'ACTIVE',
SOLD: 'SOLD',
CANCEL_CONFIRMING: 'CANCEL_CONFIRMING',
CANCEL_CONFIRMED: 'CANCEL_CONFIRMED',
FINALIZE_CANCEL_CONFIRMING: 'FINALIZE_CANCEL_CONFIRMING',
FINALIZE_CANCEL_CONFIRMED: 'FINALIZE_CANCEL_CONFIRMED',
};
16 changes: 1 addition & 15 deletions app/ducks/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { clientStub as nodeClientStub } from '../background/node/client.js';
import { showSuccess, showError } from './notifications.js';
import networks from 'hsd/lib/protocol/networks.js';
import {getFinalizeFromTransferTx} from "../utils/shakedex";
import { LISTING_STATUS } from '../constants/exchange.js';

const shakedex = shakedexClientStub(() => require('electron').ipcRenderer);
const nodeClient = nodeClientStub(() => require('electron').ipcRenderer);
Expand Down Expand Up @@ -56,21 +57,6 @@ export const LAUNCH_EXCHANGE_AUCTION_ERR = 'LAUNCH_EXCHANGE_AUCTION/ERR';

export const SET_AUCTIONS_PAGE = 'SET_AUCTION_PAGE';

export const LISTING_STATUS = {
NOT_FOUND: 'NOT_FOUND',
TRANSFER_CONFIRMING: 'TRANSFER_CONFIRMING',
TRANSFER_CONFIRMED: 'TRANSFER_CONFIRMED',
TRANSFER_CONFIRMED_LOCKUP: 'TRANSFER_CONFIRMED_LOCKUP',
FINALIZE_CONFIRMING: 'FINALIZE_CONFIRMING',
FINALIZE_CONFIRMED: 'FINALIZE_CONFIRMED',
ACTIVE: 'ACTIVE',
SOLD: 'SOLD',
CANCEL_CONFIRMING: 'CANCEL_CONFIRMING',
CANCEL_CONFIRMED: 'CANCEL_CONFIRMED',
FINALIZE_CANCEL_CONFIRMING: 'FINALIZE_CANCEL_CONFIRMING',
FINALIZE_CANCEL_CONFIRMED: 'FINALIZE_CANCEL_CONFIRMED',
};

export const FULFILLMENT_STATUS = {
NOT_FOUND: 'NOT_FOUND',
CONFIRMING: 'CONFIRMING',
Expand Down
3 changes: 2 additions & 1 deletion app/pages/Exchange/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import {
FULFILLMENT_STATUS,
getExchangeFullfillments,
getExchangeListings,
LISTING_STATUS, setAuctionPage,
setAuctionPage,
submitToShakedex,
} from "../../ducks/exchange";
import { LISTING_STATUS } from '../../constants/exchange.js';
import {formatName} from "../../utils/nameHelpers";
import {showError} from "../../ducks/notifications";
import {fromAuctionJSON, listingStatusToI18nKey, validateAuction} from "../../utils/shakedex";
Expand Down
2 changes: 1 addition & 1 deletion app/utils/shakedex.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Extract from https://github.com/kurumiimari/shakedex-api/blob/9b6d111afad8b14b4ccf3af7eca4945c3d193bb6/src/service/auctions.js

import { LISTING_STATUS } from '../ducks/exchange';
import { LISTING_STATUS } from '../constants/exchange';

const jsonSchemaValidate = require('jsonschema').validate;

Expand Down

0 comments on commit fffa250

Please sign in to comment.