Skip to content

Instantly share code, notes, and snippets.

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.
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.
@PBillingsby
PBillingsby / contract.js
Created August 6, 2023 01:00
warp forTestnet
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!')
}
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: [
{
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;
import { Async, AsyncReader } from "./utils.js";
const { of, ask, lift } = AsyncReader;
/**
* @param {File} file
* @param {string} mimeType
* @returns { AsyncReader }
*/
export function uploadAvatar(file, mimeType) {
@PBillingsby
PBillingsby / img.svelte
Created February 21, 2023 23:17
Image compression and resize for Swag Stamps
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);
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!')
}