fix
This commit is contained in:
parent
74d40f9f75
commit
b99ebf99cd
|
@ -9,7 +9,7 @@
|
|||
"@project-serum/associated-token": "0.1.0",
|
||||
"@project-serum/awesome-serum": "1.0.1",
|
||||
"@project-serum/pool": "^0.2.0",
|
||||
"@project-serum/serum": "^0.13.14",
|
||||
"@project-serum/serum": "^0.13.15",
|
||||
"@project-serum/sol-wallet-adapter": "^0.1.1",
|
||||
"@solana/web3.js": "0.86.1",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
|
|
|
@ -102,23 +102,27 @@ export default function TradeForm({
|
|||
|
||||
useEffect(() => {
|
||||
const warmUpCache = async () => {
|
||||
if (!wallet || !wallet.publicKey || !market) {
|
||||
console.log(`Skipping refreshing accounts`);
|
||||
return;
|
||||
try {
|
||||
if (!wallet || !wallet.publicKey || !market) {
|
||||
console.log(`Skipping refreshing accounts`);
|
||||
return;
|
||||
}
|
||||
const startTime = getUnixTs();
|
||||
console.log(`Refreshing accounts for ${market.address}`);
|
||||
await market?.findOpenOrdersAccountsForOwner(
|
||||
sendConnection,
|
||||
wallet.publicKey,
|
||||
);
|
||||
await market?.findBestFeeDiscountKey(sendConnection, wallet.publicKey);
|
||||
const endTime = getUnixTs();
|
||||
console.log(
|
||||
`Finished refreshing accounts for ${market.address} after ${
|
||||
endTime - startTime
|
||||
}`,
|
||||
);
|
||||
} catch (e) {
|
||||
console.log(`Encountered error when refreshing trading accounts: ${e}`);
|
||||
}
|
||||
const startTime = getUnixTs();
|
||||
console.log(`Refreshing accounts for ${market.address}`);
|
||||
await market.findOpenOrdersAccountsForOwner(
|
||||
sendConnection,
|
||||
wallet.publicKey,
|
||||
);
|
||||
await market.findBestFeeDiscountKey(sendConnection, wallet.publicKey);
|
||||
const endTime = getUnixTs();
|
||||
console.log(
|
||||
`Finished refreshing accounts for ${market.address} after ${
|
||||
endTime - startTime
|
||||
}`,
|
||||
);
|
||||
};
|
||||
warmUpCache();
|
||||
const id = setInterval(warmUpCache, 30_000);
|
||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -1582,7 +1582,16 @@
|
|||
bn.js "^5.1.2"
|
||||
buffer-layout "^1.2.0"
|
||||
|
||||
"@project-serum/serum@^0.13.14", "@project-serum/serum@^0.13.8":
|
||||
"@project-serum/serum@^0.13.15":
|
||||
version "0.13.15"
|
||||
resolved "https://registry.yarnpkg.com/@project-serum/serum/-/serum-0.13.15.tgz#a7a0330fbf4c077ee0cc9d3ddec64a6bf443cceb"
|
||||
integrity sha512-CIBSXqTKjNqa7VH2n5692sh7gGrKRcbYhPZnh3NHfsv84JxcoachF7v2diPQPDZNE4owCfRMyb3jQNGFNAf9zA==
|
||||
dependencies:
|
||||
"@solana/web3.js" "0.86.1"
|
||||
bn.js "^5.1.2"
|
||||
buffer-layout "^1.2.0"
|
||||
|
||||
"@project-serum/serum@^0.13.8":
|
||||
version "0.13.14"
|
||||
resolved "https://registry.yarnpkg.com/@project-serum/serum/-/serum-0.13.14.tgz#f39e6d3d1aaab811fbec17a304c926522e477299"
|
||||
integrity sha512-a/Irc8L+K2rOsJcl2xRKWJtc8WCqf6O4iWhlOOKhI+e0mTEvRUmecXn0yzqnUIUwgRmtavmirJAzXFnjCpbKww==
|
||||
|
|
Loading…
Reference in New Issue