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
import os | |
import json | |
import uasyncio as asyncio | |
class Store: | |
is_loading = False | |
is_saving_scheduled = False | |
data = None |
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
import { useCloudStorage } from "@tma.js/sdk-react" | |
import { useEffect, useState } from "react" | |
type OP = 'addItem' | 'getAll' | 'purge' | |
const createKeys = (length: number, idxKey: Function): string[] => Array.from({ length: length }).map((_, idx: number) => idxKey(idx)) | |
export const useCloudDB = (tableName: string, threshold: number) => { | |
const cs = useCloudStorage() | |
const [busy, setBusy] = useState(false) | |
const [threshReached, setThreshReached] = useState(false) |
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
import { BitBuilder, BitReader, Cell, beginCell } from "@ton/ton"; | |
const OFFCHAIN_CONTENT_PREFIX = 0x01; | |
export function encodeOffChainContent(content: string) { | |
let data = Buffer.from(content); | |
let offChainPrefix = Buffer.from([OFFCHAIN_CONTENT_PREFIX]); | |
data = Buffer.concat([offChainPrefix, data]); | |
return makeSnakeCell(data); | |
} |
OlderNewer