This file contains hidden or 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
| export function handle(state, action) { | |
| const input = action.input; | |
| const posts = state.posts || []; | |
| if (input.function === "createPost") { | |
| /** | |
| * @param {object} pid - Post ID. | |
| * @param {string} author - Author (ETH address). | |
| * @param {string} title - Post title. | |
| * @param {string} description - Post description. |
This file contains hidden or 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
| export function handle(state, action) { | |
| const input = action.input; | |
| const posts = state.posts || []; | |
| if (input.function === "createPost") { | |
| /** | |
| * @param {object} post - Post data. | |
| * @param {string} author - Author (ETH address) | |
| * @param {string} title - Post title. | |
| * @param {string} description - Post description. |
This file contains hidden or 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
| const functions = { click } | |
| export function handle(state, action) { | |
| // Checks if action.input function is defined | |
| if (Object.keys(functions).includes(action.input.function)) { | |
| // Calls input function | |
| return functions[action.input.function](state, action) | |
| } | |
| throw new ContractError('function not defined!') | |
| } |
This file contains hidden or 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
| import { Interface } from 'ethers'; | |
| import { Network, Tenderly, TransactionParameters } from '@tenderly/sdk'; | |
| import * as dotenv from 'dotenv'; | |
| dotenv.config(); | |
| const abiInterface = () => { | |
| const abi = [{ | |
| anonymous: false, | |
| inputs: [ | |
| { |
This file contains hidden or 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
| html, | |
| body { | |
| background-color: #1E1E1E; | |
| /* background-image: url('./src/arc.svg') !important; */ | |
| background-repeat: no-repeat; | |
| background-position-y: bottom; | |
| padding: 0; | |
| margin: 0; | |
| font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, | |
| Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; |
This file contains hidden or 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
| import { Async, AsyncReader } from "./utils.js"; | |
| const { of, ask, lift } = AsyncReader; | |
| /** | |
| * @param {File} file | |
| * @param {string} mimeType | |
| * @returns { AsyncReader } | |
| */ | |
| export function uploadAvatar(file, mimeType) { |
This file contains hidden or 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
| let files = null; | |
| $: if (files && files[0]) { | |
| const target = document.getElementById("preview"); | |
| compressAndResizeImage(files[0], target); | |
| } | |
| function compressAndResizeImage(file, targetElement) { | |
| const reader = new FileReader(); | |
| reader.readAsDataURL(file); |
This file contains hidden or 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
| const functions = { click } | |
| export function handle(state, action) { | |
| // Checks if action.input function is defined | |
| if (Object.keys(functions).includes(action.input.function)) { | |
| // Calls input function | |
| return functions['click'](state, action) | |
| } | |
| throw new ContractError('function not defined!') | |
| } |
NewerOlder