Skip to content

Instantly share code, notes, and snippets.

View SuperstrongBE's full-sized avatar
🏠
Working from home

RockerOne SuperstrongBE

🏠
Working from home
View GitHub Profile
import { sendAcceptOffer } from "proton-tsc/atomicassets/atomicassets.inline";
import { sendCreateAccount } from "./inlines/create-account.inline";
import { Contract, Name, PublicKey } from "proton-tsc";
@contract
export class FactoryContract extends Contract {
/**----------------------------------------------
* * INFO
@SuperstrongBE
SuperstrongBE / DotWavePattern.vue
Created March 13, 2025 17:59
A super duper dot pattern
<template>
<div class="scene-container" ref="container"></div>
</template>
<script>
import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
import * as THREE from 'three'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
const vertexShader = `
@SuperstrongBE
SuperstrongBE / resync.sh
Last active September 12, 2024 08:48
A simple bash process to perform a XPRNetwork block producer restart for the latest chain state backup
!/bin/bash
./stop.sh
cd ./snapshots && rm -rf ./* && wget https://snapshots.eosusa.io/snapshots/proton/latest.zst && unzstd latest.zst
cd ../ && rm -rf state blocks
./start.sh --snapshot ./snapshots/latest
@SuperstrongBE
SuperstrongBE / proton-tw-dialog-styles.css
Created April 13, 2024 11:33
A gist that showcase XPRNetwork transport/link dialogs styles
html[data-theme="twelvedays"] .proton-link-inner,
html[data-theme="twelvedays"] .wallet-selector-inner,
html[data-theme="twelvedays"] .wallet-selector-connect
{
background-color: #0b211c;
}
html[data-theme="twelvedays"] .proton-link-header,
html[data-theme="twelvedays"] .wallet-selector-title {
@SuperstrongBE
SuperstrongBE / mytest.spec.ts
Last active April 7, 2024 08:14
Abi2ts exemple
// Generating smart contract TS types definition from local abi file with abi2ts
// npx abi2ts betsxpr -f ./target/betxpr.contract.abi > ./tests/interfaces/betxpr.ts
describe("End prediction", () => {
it("Should pick resolvers 4 resolvers (resolverSeeds length + 1) ", async () => {
// {contractName}_actionParams<'{action_name}'> turn a typed action parameters object to an array
const predictionEndParams = betsxpr_actionParams<'gov.endpoll'>({
predictionKey: 0,
resolverSeeds:[0,1,2]
})
@SuperstrongBE
SuperstrongBE / apiService.decorator.ts
Created November 20, 2023 12:52
Research around decorator and api route
import { NextResponse } from "next/server";
import { PostMethodSymbol } from "./http-methods/post";
import { GetMethodSymbol } from "./http-methods/get";
export interface APIService {
GET:()=>void,
POST:()=>void,
}
// How can i fix the return type to avoid type check issue ?
{
"[typescriptreact]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@SuperstrongBE
SuperstrongBE / app.js
Created August 23, 2023 23:31
Attempt to resolve PSR in an expo app
import React, {useState, useEffect} from "react";
import {Api, JsonRpc, JsSignatureProvider} from "@proton/js";
import {SigningRequest} from "@proton/signing-request";
import pako from "pako";
import {Text, View, StyleSheet, Button} from "react-native";
import {BarCodeScanner} from "expo-barcode-scanner";
import * as encodeAndDecodeModule from "fastestsmallesttextencoderdecoder";
const fetch = require("node-fetch"); // ou d'autres alternatives selon l'environnement
const endpoints = ["https://api.protonnz.com"]; // Remplacez par l'URL de votre nœud EOSIO
import { Checksum256,U256,sha256 } from "proton-tsc";
export function u64ArrayToU256(assetIds:u64[]): U256 {
const hash: U256 = new U256()
const sortedAsset: u64[] = (assetIds).sort((a: u64, b: u64) => u32(a - b));
return sortedAsset.reduce((prev: U256, current: u64): U256 => {
return U256.add(prev, U256.fromU64(current));
},new U256())
@SuperstrongBE
SuperstrongBE / ProtonAuthProvider.tsx
Created January 29, 2023 10:05
A proton-web-sdk wrapper for react
"use client"
import React, {
createContext,
useState,
useCallback,
useContext
} from 'react';
import ProtonWebSDK,{ ProtonWebLink, Link,LinkSession } from '@proton/web-sdk';
export interface AuthState {