- Install the Git webhook for Push to Deploy
- Custom headers (!!) NEEDS [ ] STATIC to be DISABLED even if static, example: https://github.com/WietseWind/iPubXahau-Homepage
- Make sure you have the nixpacks.toml and the .nix folder, the custom headers (nginx format) are in the .nix folder.
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 fetch from 'node-fetch' | |
import { XrplDefinitions, derive, sign } from 'xrpl-accountlib' | |
const now = new Date() | |
const Server = 'https://xahau-test.net' // can be testnet, xahau-test.net / xahau.network | |
const secret = '{sender secret}' // can be RK secret | |
const Account = derive.familySeed(secret) | |
Account.address = '{sender account r-address}' |
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
// Access: http://{ip}/script/1/prtg | |
HTTPServer.registerEndpoint('prtg', function (request, response) { | |
response.headers = [ | |
['content-type', 'application/json'] | |
] | |
const em = Shelly.getComponentStatus('switch', 0) | |
const ip = Shelly.getComponentStatus('input', 0) |
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
// Shelly: Scripts - create prtg.js with contents below - Start - Scripts main page: "Run on start" | |
// Call with (assuming the first script): http://{shellyip}/script/1/prtg | |
// PRTG: Import HTTP Data Advanced sensor. | |
HTTPServer.registerEndpoint('prtg', function (request, response) { | |
response.headers = [ | |
['content-type', 'application/json'] | |
] | |
const em = Shelly.getComponentStatus('em', 0) |
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 fetch from 'node-fetch' | |
import { hookStateXLFtoBigNumber } from './xfl.mjs' | |
// Credits: https://github.com/tequdev/xahau-reward-claim/blob/main/src/app/ClaimReward.tsx | |
const account = 'rTeLeproT3BVgjWoYrDYpKbBLXPaVMkge' | |
const RPC_ENDPOINT = 'https://xahau.network' | |
const toUnixTimestamp = ts => ts + 946684800 |
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 { getPubKey, xflHexToString } from "./statelib.mjs"; | |
const main = async () => { | |
console.log(getPubKey(process.argv[2])); | |
const options = { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
}, | |
body: JSON.stringify({ |
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 { createECDH } from 'crypto' | |
import elliptic from 'elliptic' | |
import { deriveAddress } from 'ripple-keypairs' | |
const curve = 'secp256k1' | |
const secp256k1 = elliptic.ec(curve) | |
const bytesToHex = a => a.map(byteValue => ('0' + byteValue.toString(16)).slice(-2)).join('') | |
const getPublic = echdObj => bytesToHex(secp256k1.keyFromPrivate(echdObj.getPrivateKey()).getPublic().encodeCompressed()) |
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 { | |
enableEmit, | |
getState, | |
setState, | |
prepareEmit, | |
doEmit, | |
log, | |
AnyJson, | |
} from '@xahau/hooks' |
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 accountlib from 'xrpl-accountlib' | |
import assert from 'assert' | |
const requiredBits = 256 | |
const requiredThrows = Math.ceil(requiredBits / Math.log2(10)) | |
// Adapted from validator keypair dice tool by RichardAH | |
// https://github.com/RichardAH/validator-keys-from-dice/blob/main/dice.js | |
// Random (BAD RANDOM! BAD BAD BAD RANDOM! DO NOT EVER USE THIS!! TESTING PURPOSES ONLY!) |
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 accountlib from 'xrpl-accountlib' | |
import elliptic from 'elliptic' | |
import assert from 'assert' | |
const ec = new elliptic.eddsa('ed25519') | |
// Adapted from validator keypair dice tool by RichardAH | |
// https://github.com/RichardAH/validator-keys-from-dice/blob/main/dice.js | |
// Random (BAD RANDOM! BAD BAD BAD RANDOM! DO NOT EVER USE THIS!! TESTING PURPOSES ONLY!) | |
const dicerolls = Array(78).fill().map(r => Math.floor(Math.random() * 10)) |
NewerOlder