diff --git a/src/market.ts b/src/market.ts index 1395ad81..7132db3f 100644 --- a/src/market.ts +++ b/src/market.ts @@ -25,10 +25,9 @@ import { isOrderExpired, } from "./utils"; import * as types from "./types"; -import { EventType, OrderbookEvent } from "./events"; +import { EventType } from "./events"; import { assetToIndex } from "./assets"; import { Asset } from "./constants"; -import { getDecodedMarket } from "./serum/generate-decoded"; export class ZetaGroupMarkets { /** diff --git a/src/serum/MARKET-STORE.mainnet.json b/src/serum/MARKET-STORE.mainnet.json index 9f4d14d4..2c592603 100644 --- a/src/serum/MARKET-STORE.mainnet.json +++ b/src/serum/MARKET-STORE.mainnet.json @@ -15,10 +15,10 @@ "baseMint": "2ZLdhFsrkAtdn9Kud4SZvqchQFvn5jVCHUdJ83vumKyR", "quoteMint": "BKt2FdgBahn77joeawhNidswFxfgasPYCHWghRL4AKBR", "baseVault": "BEjGhNFnKT5weGtpBoFs5Y1mDN47Ntvag5aMV59nZRpk", - "baseDepositsTotal": "50059425", + "baseDepositsTotal": "23756541", "baseFeesAccrued": "0", "quoteVault": "CHBUBfU3zscTNsihdK3x44TbpTza1hwcsTUaZfk751b5", - "quoteDepositsTotal": "7399270967832800", + "quoteDepositsTotal": "4502130129414000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "EaNR74nCjrYyNDsuoWmq19pH76QSd1nuTzvJSr3RDQ6x", @@ -33,8 +33,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "257900933" + "epochStartTs": "1717475745", + "startEpochSeqNum": "275594095" } }, "BTC": { @@ -53,10 +53,10 @@ "baseMint": "63DZkAzoDXmzGzn9esoWSYpMLo4YB9oPHXreHKwuu4HA", "quoteMint": "DhMH8oRQoAAb6poHVsvCqq3NCMj6aKUH2tGQG5Lo4bCg", "baseVault": "DbzL5mT4nBaxuAs8ti4UeT2qougRBdujxa7GhLndM5Jz", - "baseDepositsTotal": "57516", + "baseDepositsTotal": "43801", "baseFeesAccrued": "0", "quoteVault": "7M9xhY2ARnrkCaBK5SNM3Lyd3FdbTu2EWBwG4TQcqpsv", - "quoteDepositsTotal": "3881586661511600", + "quoteDepositsTotal": "3047487083558900", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "6JSdqUr24mBt4MCQrZHRoSfeZbjgALx4MQunZwD8Uarg", @@ -71,8 +71,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "168987180" + "epochStartTs": "1717475745", + "startEpochSeqNum": "186610212" } }, "ETH": { @@ -91,10 +91,10 @@ "baseMint": "2Stzi7XE3btUQXaauTVB9brPAtPmGnrEDSJmp3w5VY2j", "quoteMint": "5Ehp2LtTRmjug39GphXhFEeguz7hGeg41N1U49wU8Kov", "baseVault": "9YVE9r9cHFZNwm91p3Js8NBWVznesLSM8FZyswG2MG1B", - "baseDepositsTotal": "821070", + "baseDepositsTotal": "772360", "baseFeesAccrued": "0", "quoteVault": "DecjLCYjb7jdDp2UqA2MS4xjgDjZfvdgMjvkRW7oWs9L", - "quoteDepositsTotal": "2800423104416000", + "quoteDepositsTotal": "2998037721549000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "A7D8zuxAmtui3XKz2VcxthAZ5HuwLbN74rrDapMJ3Z5d", @@ -109,8 +109,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "181686059" + "epochStartTs": "1717475745", + "startEpochSeqNum": "196997817" } }, "APT": { @@ -129,10 +129,10 @@ "baseMint": "GuNWJSV4k95FZdwhAcjdaPGGoh9cArc27yV4P54QwWdg", "quoteMint": "6S6WYL1mQFmVxsf3ft5MEH8hzxJA1LcUDzgwdJDj3yxc", "baseVault": "GqCVQuGMf8YkiaJkSrD98D3WZxFfktcKzAwdBEQsx1th", - "baseDepositsTotal": "34995900", + "baseDepositsTotal": "46655300", "baseFeesAccrued": "0", "quoteVault": "2BpEtArGNotp97DjVKwhYZ86WEq2Y5bLtGGDvicuJ9br", - "quoteDepositsTotal": "265743086740000", + "quoteDepositsTotal": "489395169670000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "EPf7hymYW7bnwiBYGTRF4Ji2jJ2yTdn4XMTpR6N4zsGA", @@ -147,8 +147,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "179532152" + "epochStartTs": "1717475745", + "startEpochSeqNum": "184652823" } }, "ARB": { @@ -167,10 +167,10 @@ "baseMint": "Eqt3anUy8nqDvzJaNvWvqBM32Ln4UUnLkfvdd9Ztfj81", "quoteMint": "7j1N5UiXLFxaxFWq5tzZc5R3sjPHcF7jqfHJgAtE74q8", "baseVault": "GnSRgncxFbtxqZ4HmfnF6daCmgkc8tuQz9i37hUmwV5t", - "baseDepositsTotal": "534497000", + "baseDepositsTotal": "371260500", "baseFeesAccrued": "0", "quoteVault": "6JjDgGzqzU6Az7ZmTARAvBSwBxfXsqbVG3Rc9JGU9i4L", - "quoteDepositsTotal": "499814023800000", + "quoteDepositsTotal": "419379744250000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "gP91avgCrV9KB2ATgRtMCNN2AN7oU9hK1frENe17QkR", @@ -185,8 +185,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "164903696" + "epochStartTs": "1717475745", + "startEpochSeqNum": "173908411" } }, "BNB": { @@ -205,10 +205,10 @@ "baseMint": "B6sV248kSsj6n72osn3Wcuz87JX3RFMD7FZpgwdYGQTm", "quoteMint": "5DPKMXmf9WK1C6N1MoJLWjYApiP4KR8zNf1oofevGEub", "baseVault": "GNp5Q8fwD45azybdXKfuYYTHRkUh2krX9ejYuNKMFNmR", - "baseDepositsTotal": "268080", + "baseDepositsTotal": "636030", "baseFeesAccrued": "0", "quoteVault": "DZdqa3nVJmyPc2ei397Cr1TufzZiNG3G6aRrV1AZ52p7", - "quoteDepositsTotal": "165449298914000", + "quoteDepositsTotal": "459284425874000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "Ao4fdNfwP1KPUwxoKbKVZ3Jp12MiCsK8gvvxbumn75by", @@ -223,8 +223,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "31500313" + "epochStartTs": "1717475745", + "startEpochSeqNum": "35129965" } }, "PYTH": { @@ -243,10 +243,10 @@ "baseMint": "5Q245C352ChdBGWmNbiYmFneAUiMjhnbPwUqmdHWJ8U6", "quoteMint": "7Pnbf6WLGpsYjbjnQN4t8wMCzdDGsx9ZAyuLd4vZmN49", "baseVault": "7cdY8U9Q5T5ktvF8VtkkZ1E7bt5mqbcQJQUw4433uEaV", - "baseDepositsTotal": "1152586000", + "baseDepositsTotal": "1291630000", "baseFeesAccrued": "0", "quoteVault": "137rR2TJ7ryu7nBxNNCeCdXqEt79jQLo4YvTzhEoAEh4", - "quoteDepositsTotal": "414654945893900", + "quoteDepositsTotal": "653040152100000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "DCSXWke6HzdA8J6FhcxxM7mrdr4mkNhN32KjVAPtCZeG", @@ -261,8 +261,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "55836739" + "epochStartTs": "1717475745", + "startEpochSeqNum": "61567686" } }, "TIA": { @@ -281,10 +281,10 @@ "baseMint": "Bm6PXLobn7LBudgNdJKzUUNumAKAnEWuCoLVafsvPBda", "quoteMint": "JB7F3kQvRYcQj8kogwGR78CMshg857E96ef4LQYDzSu1", "baseVault": "CXWkPH6BzU8dhNy3LQkaCH54jSxQATyp11wHuhsAzT9n", - "baseDepositsTotal": "74626690", + "baseDepositsTotal": "53618990", "baseFeesAccrued": "0", "quoteVault": "2x1c7fXQdL5TDK9jbMvJ5VYM7wmPKUAQXrLAAFjvxSoc", - "quoteDepositsTotal": "656933285040000", + "quoteDepositsTotal": "664473297150000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "6xkyhooKT2wnciP7xjipque9SDwHwPPamwsprsoVXgg9", @@ -299,8 +299,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "49554801" + "epochStartTs": "1717475745", + "startEpochSeqNum": "55474265" } }, "JTO": { @@ -319,10 +319,10 @@ "baseMint": "Avy1abPkJKJdadFVieTuF8oeN6ZFWsKNtKzU1a8tgn6Z", "quoteMint": "GZycSPLqxhZuQYmv5wWjdwK4v3T1WStBpGxYem691vMG", "baseVault": "2BXEjZqnRBhj3BrRbMERWnToEKErzxZmLPzLEmBHKdJT", - "baseDepositsTotal": "212063100", + "baseDepositsTotal": "165916500", "baseFeesAccrued": "0", "quoteVault": "9g3YcLnENdQKYCxg88o1VUhSXJQVD3Kf7uMVB7d1SyuG", - "quoteDepositsTotal": "861520705330000", + "quoteDepositsTotal": "655940447190000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "9uYZdYf8aQd9YK6UrGUmz78pYpHscgHdD5f4cZojvmpH", @@ -337,8 +337,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "49297352" + "epochStartTs": "1717475745", + "startEpochSeqNum": "59566722" } }, "ONEMBONK": { @@ -357,10 +357,10 @@ "baseMint": "GdAX1L7jNsMmfN3kcCijk774aE2UtARV8frTozeUWT2E", "quoteMint": "J7yjhCLdftzL95kGetry8pyX4eXn4Tjjh7KoWo599Sry", "baseVault": "gn46ys7QKtWqQAW2MsuSV475AcFGn7gdNnSCLgw71DL", - "baseDepositsTotal": "53394700", + "baseDepositsTotal": "23574100", "baseFeesAccrued": "0", "quoteVault": "HTN3dEduTUp2VuFgo885BJ3KTp8WrPrZgEPiCVg2cVtD", - "quoteDepositsTotal": "1516061971620000", + "quoteDepositsTotal": "975917339990000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "CgUMT14wR6WHX9mKMS5BWtd4tk39hRxbxtNRvp4BdMHf", @@ -375,8 +375,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "36258903" + "epochStartTs": "1717475745", + "startEpochSeqNum": "43181080" } }, "SEI": { @@ -395,10 +395,10 @@ "baseMint": "EU9uvnDuqNgunfmnxNAjhYi8iEKV3m7gnr5vatg2tgPj", "quoteMint": "9Lsei9qMonizuuusFgdh94djt7fpgktGmh9PRi2j2GUQ", "baseVault": "5xSPk47YF3HCoU4wA4HR6KmzQK9whiA8HeUMBcGo9HXn", - "baseDepositsTotal": "1738932000", + "baseDepositsTotal": "1445696000", "baseFeesAccrued": "0", "quoteVault": "BWhHgAgRXoyLfTU33iZ31ME2bk6WTYZxSr74eUqJsJUM", - "quoteDepositsTotal": "657443764600000", + "quoteDepositsTotal": "714871560100000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "APx2hFAqRAtbN6N7LdvYzDCtqGMGWySqVuvg9iMWfkZ8", @@ -413,8 +413,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "29018277" + "epochStartTs": "1717475745", + "startEpochSeqNum": "34763218" } }, "JUP": { @@ -433,10 +433,10 @@ "baseMint": "2Vaf7yEBXi86SGhDM79w1dRQxz5NC2YFWshm5NxkRUDB", "quoteMint": "DdFzaannSyXs12sB517GbtCsZihh8X9RS2ZKJKuTp5sG", "baseVault": "5raajUcFKgaRbyh6yRkAKWroLe6PwtgCAU1vT7wmmpFu", - "baseDepositsTotal": "1339611000", + "baseDepositsTotal": "981640000", "baseFeesAccrued": "0", "quoteVault": "7Hz86pfpm5hxmzuJbNFbfJ8LEU8EnLL7fc3oyFgVrm5G", - "quoteDepositsTotal": "1508989059400000", + "quoteDepositsTotal": "1407672839100000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "GkjperyMoy6MCUyg73KzZy4WbfaRhKYAoTBjW3JRjYuG", @@ -451,8 +451,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "25352629" + "epochStartTs": "1717475745", + "startEpochSeqNum": "31842037" } }, "DYM": { @@ -471,10 +471,10 @@ "baseMint": "MPT1KEM3kE5XQZCYrMrvQqEVUJwdnkgbAhrrwvYeYa1", "quoteMint": "7cwSf9v33vH7HDcbD9fLTa7Dwr6e91f8C3aUMHuNkvHg", "baseVault": "4E2zitVTKfaJB91DJ3JvCR9yr3KcRAKmHee3GQcqmqMu", - "baseDepositsTotal": "254516500", + "baseDepositsTotal": "97097900", "baseFeesAccrued": "0", "quoteVault": "APNsyPLc1dNRzwk9C6puX8s7vtUFC6U2o7wyZ7kxk3GV", - "quoteDepositsTotal": "697789824390000", + "quoteDepositsTotal": "310969595020000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "Er174YjnV2nuAacfV4nYCAFBgJ6cTgJNaYNp5xPwGZUq", @@ -489,8 +489,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "13615794" + "epochStartTs": "1717475745", + "startEpochSeqNum": "17869528" } }, "STRK": { @@ -509,10 +509,10 @@ "baseMint": "EV1UdC9dSz7a66hqYW5TkVe6JihSAyfEwVLwYzy1cGXz", "quoteMint": "ygRrmycNpMzEsqLYRpDMS9J1SHaFMG4Rm3tjkyVGVnc", "baseVault": "CdES4frNaF9AvE1Hyso6wbW3jaB1jR7HpZiSNSP4bC7m", - "baseDepositsTotal": "423850000", + "baseDepositsTotal": "406947000", "baseFeesAccrued": "0", "quoteVault": "4qdMQ6iLN8Mm4Sa8geNkF1E2PmYN4zB9mGdeW4kxMGBY", - "quoteDepositsTotal": "461758161600000", + "quoteDepositsTotal": "595582326800000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "2SgUVRAWs1yuUjiYW8JCHb4g7R2gBHdEk5x9KJgn9zNy", @@ -527,8 +527,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "13021289" + "epochStartTs": "1717475745", + "startEpochSeqNum": "17902443" } }, "WIF": { @@ -547,10 +547,10 @@ "baseMint": "H3j7orNNo7pzzHJZ1WFsrpJAxWCiE8QW3aatbGufu2PC", "quoteMint": "GpvkM2TeZXqQzFtBBgqoJYfc3BPScEHaSk41dwMrsKiW", "baseVault": "FnDtHqrTuySW94Yy3QFYjMtvyYuJkRp3H6xtDDG1Ehi", - "baseDepositsTotal": "335387000", + "baseDepositsTotal": "160804000", "baseFeesAccrued": "0", "quoteVault": "KsUoxhYnaTUFTJ6SuAdAAmUBVrExhCq7SXE7BCu5irh", - "quoteDepositsTotal": "1413713538900000", + "quoteDepositsTotal": "416126787800000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "AXrWGEh3c8Jiz2Uhr6kiUxYypjgVYanm48jSWhXjudV8", @@ -565,8 +565,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "4667201" + "epochStartTs": "1717475745", + "startEpochSeqNum": "10566459" } }, "RNDR": { @@ -585,10 +585,10 @@ "baseMint": "AofYjza6fUWPMUnrXt2mpFs1Z19Pbqpt6jddMLZtP3c9", "quoteMint": "GdCnmCAMVmWkEBBXhzT6wjtjuWYT6kxatQEuRVdmp7rw", "baseVault": "975f8PQYUDjRB2Cb5AMhMvuGdtZ9QTN3BmZ9CwgUeKBc", - "baseDepositsTotal": "0", + "baseDepositsTotal": "50903000", "baseFeesAccrued": "0", "quoteVault": "8cMRt9XEWvvmAHPk4gGrELwjBcGbVwsZBmsw88DJKBui", - "quoteDepositsTotal": "0", + "quoteDepositsTotal": "767711824200000", "quoteFeesAccrued": "0", "quoteDustThreshold": "0", "requestQueue": "Bdbf9vq1uFucPdFCvpqEuDYnJgLhdgDG7qyFuNgyX1yn", @@ -603,8 +603,8 @@ "pruneAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "consumeEventsAuthority": "AVNMK6wiGfppdQNg9WKfMRBXefDPGZFh2f3o1fRbgN8n", "epochLength": "65535", - "epochStartTs": "1715640765", - "startEpochSeqNum": "0" + "epochStartTs": "1717475745", + "startEpochSeqNum": "3782579" } } } diff --git a/src/serum/market.ts b/src/serum/market.ts index 4eac47ea..6cf3200a 100644 --- a/src/serum/market.ts +++ b/src/serum/market.ts @@ -153,9 +153,15 @@ export class Market { programId: PublicKey, layoutOverride?: any ) { + // Use local clock if Exchange.clockTimestamp isn't set yet + let nowTs = Math.floor(Date.now() / 1000); + + if (Exchange.clockTimestamp != undefined && Exchange.clockTimestamp != 0) { + nowTs = Exchange.clockTimestamp; + } + decoded.epochStartTs = new BN( - Exchange.clockTimestamp - - (Exchange.clockTimestamp % decoded.epochLength.toNumber()) + nowTs - (nowTs % decoded.epochLength.toNumber()) ); return new Market(decoded, 0, 6, options, programId, layoutOverride);