Skip to content

Commit

Permalink
Merge branch 'main' into release-please--branches--main--components--…
Browse files Browse the repository at this point in the history
…fork-diff
  • Loading branch information
dionysuzx authored Feb 14, 2024
2 parents e36272e + a19922d commit d54420a
Show file tree
Hide file tree
Showing 16 changed files with 687 additions and 541 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/openai-review.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
export let disabled = false;
let dialogId = `dialog-${uid()}`;
let prevOptionSelected = ProcessingFeeMethod.RECOMMENDED;
let recommendedAmount = BigInt(0);
let calculatingRecommendedAmount = false;
Expand All @@ -33,33 +32,54 @@
let modalOpen = false;
let inputBox: InputBox | undefined;
let tempProcessingFeeMethod = $processingFeeMethod;
let tempprocessingFee = $processingFee;
// Public API
export function resetProcessingFee() {
inputBox?.clear();
$processingFeeMethod = ProcessingFeeMethod.RECOMMENDED;
}
function closeModal() {
// Let's check if we are closing with CUSTOM method selected and zero amount entered
if ($processingFeeMethod === ProcessingFeeMethod.CUSTOM && $processingFee === BigInt(0)) {
// If so, let's switch to RECOMMENDED method
$processingFeeMethod = ProcessingFeeMethod.RECOMMENDED;
function confirmChanges() {
if (tempProcessingFeeMethod === ProcessingFeeMethod.CUSTOM) {
// Let's check if we are closing with CUSTOM method selected and the input box is empty
if (inputBox?.getValue() == '') {
// If so, let's switch to RECOMMENDED method
$processingFeeMethod = ProcessingFeeMethod.RECOMMENDED;
} else {
if ($processingFeeMethod === tempProcessingFeeMethod) {
updateProcessingFee($processingFeeMethod, recommendedAmount);
} else {
$processingFeeMethod = tempProcessingFeeMethod;
}
}
} else {
inputBox?.clear();
$processingFeeMethod = tempProcessingFeeMethod;
}
closeModal();
}
function closeModal() {
removeEscKeyListener();
modalOpen = false;
}
function openModal() {
// Keep track of the selected method before opening the modal
// so if we cancel we can go back to the previous method
prevOptionSelected = $processingFeeMethod;
tempProcessingFeeMethod = $processingFeeMethod;
addEscKeyListener();
modalOpen = true;
}
function cancelModal() {
inputBox?.clear();
$processingFeeMethod = prevOptionSelected;
if (tempProcessingFeeMethod === ProcessingFeeMethod.CUSTOM) {
tempprocessingFee = $processingFee;
}
closeModal();
}
Expand All @@ -68,10 +88,10 @@
}
function inputProcessFee(event: Event) {
if ($processingFeeMethod !== ProcessingFeeMethod.CUSTOM) return;
if (tempProcessingFeeMethod !== ProcessingFeeMethod.CUSTOM) return;
const { value } = event.target as HTMLInputElement;
$processingFee = parseToWei(value);
tempprocessingFee = parseToWei(value);
}
let escKeyListener: (event: KeyboardEvent) => void;
Expand All @@ -97,20 +117,16 @@
switch (method) {
case ProcessingFeeMethod.RECOMMENDED:
$processingFee = recommendedAmount;
inputBox?.clear();
break;
case ProcessingFeeMethod.CUSTOM:
// Get a previous value entered if exists, otherwise default to 0
$processingFee = parseToWei(inputBox?.getValue());
$processingFee = tempprocessingFee;
// We need to wait for Svelte to set the attribute `disabled` on the input
// to false to be able to focus it
tick().then(focusInputBox);
break;
case ProcessingFeeMethod.NONE:
$processingFee = BigInt(0);
inputBox?.clear();
break;
}
Expand Down Expand Up @@ -212,7 +228,7 @@
type="radio"
value={ProcessingFeeMethod.RECOMMENDED}
name="processingFeeMethod"
bind:group={$processingFeeMethod} />
bind:group={tempProcessingFeeMethod} />
</li>

<!-- NONE -->
Expand All @@ -233,7 +249,7 @@
disabled={!hasEnoughEth}
value={ProcessingFeeMethod.NONE}
name="processingFeeMethod"
bind:group={$processingFeeMethod} />
bind:group={tempProcessingFeeMethod} />
</div>

{#if !hasEnoughEth}
Expand All @@ -257,16 +273,16 @@
type="radio"
value={ProcessingFeeMethod.CUSTOM}
name="processingFeeMethod"
bind:group={$processingFeeMethod} />
bind:group={tempProcessingFeeMethod} />
</li>
</ul>
<div class="relative f-items-center my-[20px]">
{#if $processingFeeMethod === ProcessingFeeMethod.CUSTOM}
{#if tempProcessingFeeMethod === ProcessingFeeMethod.CUSTOM}
<InputBox
type="number"
min="0"
placeholder="0.01"
disabled={$processingFeeMethod !== ProcessingFeeMethod.CUSTOM}
disabled={tempProcessingFeeMethod !== ProcessingFeeMethod.CUSTOM}
class="w-full input-box p-6 pr-16 title-subsection-bold placeholder:text-tertiary-content"
on:input={inputProcessFee}
bind:this={inputBox} />
Expand All @@ -277,7 +293,7 @@
<ActionButton on:click={cancelModal} priority="secondary">
<span class="body-bold">{$t('common.cancel')}</span>
</ActionButton>
<ActionButton priority="primary" on:click={closeModal}>
<ActionButton priority="primary" on:click={confirmChanges}>
<span class="body-bold">{$t('common.confirm')}</span>
</ActionButton>
</div>
Expand Down
67 changes: 60 additions & 7 deletions packages/eventindexer/docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by swaggo/swag. DO NOT EDIT
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs

import "github.com/swaggo/swag"
Expand Down Expand Up @@ -52,6 +52,35 @@ const docTemplate = `{
}
}
},
"/chartByTask": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Get time series data for displaying charts",
"operationId": "get-charts-by-task",
"parameters": [
{
"type": "string",
"description": "task to query",
"name": "task",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/eventindexer.ChartResponse"
}
}
}
}
},
"/events": {
"get": {
"consumes": [
Expand Down Expand Up @@ -186,6 +215,28 @@ const docTemplate = `{
}
},
"definitions": {
"eventindexer.ChartItem": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"eventindexer.ChartResponse": {
"type": "object",
"properties": {
"chart": {
"type": "array",
"items": {
"$ref": "#/definitions/eventindexer.ChartItem"
}
}
}
},
"eventindexer.Stat": {
"type": "object",
"properties": {
Expand All @@ -195,20 +246,20 @@ const docTemplate = `{
"averageProofTime": {
"type": "string"
},
"averageProposerReward": {
"feeTokenAddress": {
"type": "string"
},
"id": {
"type": "integer"
},
"numProofs": {
"numBlocksAssigned": {
"type": "integer"
},
"numProposerRewards": {
"numProofs": {
"type": "integer"
},
"numVerifiedBlocks": {
"type": "integer"
"statType": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -298,13 +349,15 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "eventindexer.jolnir.taiko.xyz",
Host: "eventindexer.katla.taiko.xyz",
BasePath: "",
Schemes: []string{},
Title: "Taiko Eventindexer API",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}

func init() {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventindexer/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
window.onload = function () {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "docs/swagger.json", //Location of Open API spec in the repo
url: "/swagger.json", //Location of Open API spec in the repo
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
Expand Down
Loading

0 comments on commit d54420a

Please sign in to comment.