syntax cleanup

This commit is contained in:
gozzy 2022-11-14 21:25:34 +00:00
parent fb62cf3796
commit d11b01d83b
3 changed files with 41 additions and 27 deletions

View File

@ -293,6 +293,10 @@
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M297.216 243.2c0 15.616-11.52 28.416-26.112 28.416-14.336 0-26.112-12.8-26.112-28.416s11.52-28.416 26.112-28.416c14.592 0 26.112 12.8 26.112 28.416zm-119.552-28.416c-14.592 0-26.112 12.8-26.112 28.416s11.776 28.416 26.112 28.416c14.592 0 26.112-12.8 26.112-28.416.256-15.616-11.52-28.416-26.112-28.416zM448 52.736V512c-64.494-56.994-43.868-38.128-118.784-107.776l13.568 47.36H52.48C23.552 451.584 0 428.032 0 398.848V52.736C0 23.552 23.552 0 52.48 0h343.04C424.448 0 448 23.552 448 52.736zm-72.96 242.688c0-82.432-36.864-149.248-36.864-149.248-36.864-27.648-71.936-26.88-71.936-26.88l-3.584 4.096c43.52 13.312 63.744 32.512 63.744 32.512-60.811-33.329-132.244-33.335-191.232-7.424-9.472 4.352-15.104 7.424-15.104 7.424s21.248-20.224 67.328-33.536l-2.56-3.072s-35.072-.768-71.936 26.88c0 0-36.864 66.816-36.864 149.248 0 0 21.504 37.12 78.08 38.912 0 0 9.472-11.52 17.152-21.248-32.512-9.728-44.8-30.208-44.8-30.208 3.766 2.636 9.976 6.053 10.496 6.4 43.21 24.198 104.588 32.126 159.744 8.96 8.96-3.328 18.944-8.192 29.44-15.104 0 0-12.8 20.992-46.336 30.464 7.68 9.728 16.896 20.736 16.896 20.736 56.576-1.792 78.336-38.912 78.336-38.912z'%3E%3C/path%3E%3C/svg%3E");
}
&-git {
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='92pt' height='92pt' viewBox='0 0 92 92'%3E%3Cpath style='stroke:none;fill-rule:nonzero;fill:%6b6b6b;fill-opacity:1' d='M90.156 41.965 50.036 1.848a5.918 5.918 0 0 0-8.372 0l-8.328 8.332 10.566 10.566a7.03 7.03 0 0 1 7.23 1.684 7.034 7.034 0 0 1 1.669 7.277l10.187 10.184a7.028 7.028 0 0 1 7.278 1.672 7.04 7.04 0 0 1 0 9.957 7.05 7.05 0 0 1-9.965 0 7.044 7.044 0 0 1-1.528-7.66l-9.5-9.497V59.36a7.04 7.04 0 0 1 1.86 11.29 7.04 7.04 0 0 1-9.957 0 7.04 7.04 0 0 1 0-9.958 7.06 7.06 0 0 1 2.304-1.539V33.926a7.049 7.049 0 0 1-3.82-9.234L29.242 14.272 1.73 41.777a5.925 5.925 0 0 0 0 8.371L41.852 90.27a5.925 5.925 0 0 0 8.37 0l39.934-39.934a5.925 5.925 0 0 0 0-8.371'/%3E%3C/svg%3E");
}
&-discourse {
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M225.9 32C103.3 32 0 130.5 0 252.1 0 256 .1 480 .1 480l225.8-.2c122.7 0 222.1-102.3 222.1-223.9C448 134.3 348.6 32 225.9 32zM224 384c-19.4 0-37.9-4.3-54.4-12.1L88.5 392l22.9-75c-9.8-18.1-15.4-38.9-15.4-61 0-70.7 57.3-128 128-128s128 57.3 128 128-57.3 128-128 128z'%3E%3C/path%3E%3C/svg%3E");
}

View File

@ -34,6 +34,14 @@
rel="noopener noreferrer"
icon-right="stats"
></b-button>
<b-button
tag="a"
type="is-icon"
href="https://development.tornadocash.community/tornadocash/classic-ui"
target="_blank"
rel="noopener noreferrer"
icon-right="git"
></b-button>
<b-button
tag="a"
type="is-icon"

View File

@ -39,11 +39,13 @@ class EventService {
}
updateEventProgress(percentage, type) {
if (store) {
store.dispatch('loading/updateProgress', {
message: `Fetching past ${type} events`,
progress: Math.ceil(percentage * 100)
})
}
}
async getEvents(type) {
let cachedEvents = await this.getEventsFromDB(type)
@ -54,6 +56,7 @@ class EventService {
return cachedEvents
}
async updateEvents(type, cachedEvents) {
const { deployedBlock } = networkConfig[`netId${this.netId}`]
@ -244,18 +247,8 @@ class EventService {
}
}
async getEventsPartFromRpc({ fromBlock, toBlock, type }, shouldRetry = false, i = 0) {
try {
const { currentBlockNumber } = await this.getBlocksDiff({ fromBlock })
if (fromBlock > currentBlockNumber) {
return {
events: [],
lastBlock: fromBlock
}
}
const rpcRequest = new Promise((resolve, reject) => {
getPastEvents({ fromBlock, toBlock, type }) {
return new Promise((resolve, reject) => {
const repsonse = this.contract.getPastEvents(capitalizeFirstLetter(type), {
fromBlock,
toBlock
@ -267,15 +260,26 @@ class EventService {
reject(new Error())
}
})
}
async getEventsPartFromRpc({ fromBlock, toBlock, type }, shouldRetry = false, i = 0) {
try {
const { currentBlockNumber } = await this.getBlocksDiff({ fromBlock })
if (fromBlock > currentBlockNumber) {
return {
events: [],
lastBlock: fromBlock
}
}
let events = []
try {
events = await this.getPastEvents({ fromBlock, toBlock, type })
} catch (e) {
if (shouldRetry) {
i = i + 1
try {
events = await Promise.resolve(rpcRequest)
} catch (e) {
// maximum 10 second buffer for rate-limiting
await sleep(2000 * i)
@ -289,8 +293,6 @@ class EventService {
i
)
}
} else {
events = await Promise.resolve(rpcRequest)
}
if (!events?.length) {
@ -310,7 +312,7 @@ class EventService {
createBatchRequest({ batchIndex, batchSize, batchBlocks, blockDenom, type }) {
return new Array(batchSize).fill('').map(
(e, i) =>
(_, i) =>
new Promise(async (resolve) => {
const toBlock = batchBlocks[batchIndex * batchSize + i]
const fromBlock = toBlock - blockDenom
@ -342,7 +344,7 @@ class EventService {
const batchCount = Math.ceil(batchDigest / batchSize)
const blocks = new Array(batchCount * batchSize).fill('')
const batchBlocks = blocks.map((e, i) => (i + 1) * blockDenom + fromBlock)
const batchBlocks = blocks.map((_, i) => (i + 1) * blockDenom + fromBlock)
let events = []