Skip to content

Instantly share code, notes, and snippets.

@janniks
janniks / show-docker.scpt
Created April 9, 2024 09:54
Show the Docker Desktop dashboard from Raycast
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Show Docker
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🐋
# Documentation:
# @raycast.description Go to the dashboard
@janniks
janniks / btc-address-test-vectors
Last active November 17, 2022 14:13
Test Vectors for BTC addresses and their hash bytes
Using test vectors from various sources, we generate and verify addresses and the raw hash bytes of those addresses.
@janniks
janniks / index.js
Created July 1, 2022 17:17
Stacks.js Improvements — global fetch options
import { setFetchOptions } from '@stacks/common';
setFetchOptions({
headers: [
['X-Header', 'Hello header!'],
],
});
@janniks
janniks / deleteFile.ts
Created April 29, 2022 16:49
deleteFile — Stacks Storage
import { AppConfig, UserSession } from "@stacks/connect";
import { Storage } from "@stacks/storage";
const appConfig = new AppConfig(["store_write", "publish_data"]);
const userSession = new UserSession({ appConfig });
const storage = new Storage({ userSession });
let fileName = "car.json";
await storage.deleteFile(fileName);
@janniks
janniks / getFile.ts
Created April 29, 2022 15:48
getFile — Stacks Storage
import { AppConfig, UserSession } from "@stacks/connect";
import { Storage } from "@stacks/storage";
const appConfig = new AppConfig(["store_write", "publish_data"]);
const userSession = new UserSession({ appConfig });
const storage = new Storage({ userSession });
const fileName = "car.json";
const options = {
@janniks
janniks / putFile.ts
Last active April 27, 2022 14:19
putFile — Stacks Storage
import { AppConfig, UserSession } from "@stacks/connect";
import { Storage } from "@stacks/storage";
const appConfig = new AppConfig(["store_write", "publish_data"]);
const userSession = new UserSession({ appConfig });
const storage = new Storage({ userSession });
const fileName = "car.json";
const fileData = {
@janniks
janniks / onFinish.ts
Created April 12, 2022 16:35
onFinish — Stacks Authentication
...
onFinish: (data) => {
const explorerTransactionUrl = "https://explorer.stacks.co/txid/${data.txId}";
console.log("View transaction in explorer:", explorerTransactionUrl);
},
@janniks
janniks / transfer.ts
Created April 12, 2022 16:22
transfer — Stacks Signing
import { openSTXTransfer } from "@stacks/connect";
import { StacksTestnet } from "@stacks/network";
openSTXTransfer({
recipient: "ST2EB9WEQNR9P0K28D2DC352TM75YG3K0GT7V13CV",
amount: "100",
memo: "Reimbursement",
network: new StacksTestnet(), // for mainnet, `new StacksMainnet()`
appDetails: {
name: "My App",
@janniks
janniks / address.ts
Created April 12, 2022 16:20
addresses — Stacks Signing
const address = userSession.loadUserData().profile.stxAddress;
const mainnetAddress = address.mainnet;
// "SP2K5SJNTB6YP3VCTCBE8G35WZBPVN6TDMDJ96QAH"
const testnetAddress = address.testnet;
// "ST2K5SJNTB6YP3VCTCBE8G35WZBPVN6TDMFEVESR6"
@janniks
janniks / authenticate.ts
Created March 25, 2022 12:43
authenticate — Stacks Authentication
import { AppConfig, UserSession, showConnect } from "@stacks/connect";
const appConfig = new AppConfig(["store_write", "publish_data"]);
const userSession = new UserSession({ appConfig });
function authenticate() {
showConnect({
appDetails: {
name: "My App",
icon: window.location.origin + "/my-app-logo.svg",