Created
February 27, 2022 13:57
-
-
Save harryhare/4ee651cc973cf61be4c66dcc5424851b to your computer and use it in GitHub Desktop.
change gas price for dark forest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remember, you have access these globals: | |
* 1. df - Just like the df object in your console. | |
* 2. ui - For interacting with the game's user interface. | |
* | |
* Let's log these to the console when you run your plugin! | |
*/ | |
console.log(df, ui); | |
class Plugin { | |
constructor() { | |
let container = document.createElement("div"); | |
container.style.width = '100%'; | |
container.style.height = '26px'; | |
container.style.display = 'block'; | |
let input = document.createElement('input'); | |
input.placeholder = 'gas'; | |
input.style.width = '200px'; | |
input.style.textAlign = 'left'; | |
let button = document.createElement('button'); | |
button.innerText = 'set gas'; | |
button.style.height = '26px'; | |
button.style.width = '50px'; | |
button.onclick = () => { | |
let gas = input.value; | |
console.log(`plugin: gas setting to${gas}`); | |
localStorage.setItem(`0x5da117b8ab8b739346f5edc166789e5afb1a7145:${df.account}:GasFeeGwei`, gas); | |
}; | |
container.appendChild(input); | |
container.appendChild(button); | |
this.container = container; | |
} | |
/** | |
* Called when plugin is launched with the "run" button. | |
*/ | |
async render(container) { | |
container.parentElement.style.minHeight = 'unset'; | |
container.style.minHeight = 'unset'; | |
container.style.width = '250px'; | |
container.appendChild(this.container); | |
} | |
/** | |
* Called when plugin modal is closed. | |
*/ | |
destroy() { | |
} | |
} | |
/** | |
* And don't forget to export it! | |
*/ | |
export default Plugin; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment