Skip to content

Instantly share code, notes, and snippets.

@o-az
o-az / @cosmjs+amino+0.31.3.patch
Created February 22, 2024 08:28
cosmjs patch in order to support bn254 key type
diff --git a/node_modules/@cosmjs/amino/build/pubkeys.js b/node_modules/@cosmjs/amino/build/pubkeys.js
index e9844ef..86101f8 100644
--- a/node_modules/@cosmjs/amino/build/pubkeys.js
+++ b/node_modules/@cosmjs/amino/build/pubkeys.js
@@ -9,6 +9,10 @@ function isSecp256k1Pubkey(pubkey) {
return pubkey.type === "tendermint/PubKeySecp256k1";
}
exports.isSecp256k1Pubkey = isSecp256k1Pubkey;
+function isBn254Pubkey(pubkey) {
+ return pubkey.type === "tendermint/PubKeyBn254";
@o-az
o-az / buildNpmPackage.md
Last active February 7, 2024 06:13
All possible fields

Based on the Nix expression from https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/node/build-npm-package/default.nix, the buildNpmPackage function takes the following fields as inputs:

  • name: The name of the package. It defaults to a combination of pname and version from args.
  • src: The source of the package if it's a single source. Defaults to null.
  • srcs: The sources of the package if there are multiple. Defaults to null.
  • sourceRoot: The root directory of the source. Defaults to null.
  • prePatch: Commands to run before applying patches. Defaults to an empty string.
  • patches: A list of patches to be applied to the source. Defaults to an empty list.
  • postPatch: Commands to run after applying patches. Defaults to an empty string.
  • nativeBuildInputs: A list of native build dependencies. Defaults to an empty list.
@o-az
o-az / union-demo.ts
Last active February 23, 2024 07:44
import { raise } from '#/utilities'
import { unionActions } from '#/actions.ts'
import { mnemonicToAccount } from 'viem/accounts'
import { http, publicActions, createWalletClient } from 'viem'
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing'
import { UCS01_EVM_ADDRESS, demoMnemonic, chain } from '#/constants'
main().catch(_ => {
console.error(_)
process.exit(1)
@o-az
o-az / wagmi-actions.ts
Created January 9, 2024 03:31
wagmi cli action plugin codegen
import {
createReadContract,
createWriteContract,
createSimulateContract,
createWatchContractEvent,
} from 'wagmi/codegen'
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// EFPAccountMetadata
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* hide scrollbar */
*::-webkit-scrollbar {
height: 0.3rem;
width: 0rem;
}
*::-webkit-scrollbar-track {
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
@o-az
o-az / _ansi-color-codes.md
Last active November 26, 2023 01:41
ANSI color codes in various file formats (.sh, .json, .ts)
ansi colors demo
@o-az
o-az / reset-to-initial-commit.sh
Created November 16, 2023 00:06
Reset the current branch to the initial commit, keeping the working directory as it is
git reset --soft `git rev-list --max-parents=0 HEAD`
@o-az
o-az / hide-scrollbar.js
Created November 2, 2023 11:54
Hide ugly default browser scrollbar without affecting functionality
// ==UserScript==
// @name Hide Scrollbar
// @namespace http://example.com
// @version 1
// @grant GM_addStyle
// @include https://twitter.com/*
// @include https://x.com/*
// @include https://warpcast.com/*
// ==/UserScript==
@o-az
o-az / discord-bot-send-message.sh
Created October 21, 2023 06:37
Sends a message to a Discord channel via a Discord bot using cURL cli command
# replace CHANNEL_ID and BOT_SECRET with your values
curl --include \
--request POST "https://discord.com/api/channels/CHANNEL_ID/messages" \
--header "Content-Type: application/json" \
--header "Authorization: Bot BOT_SECRET" \
--data '{ "content": "lorem ipsum" }'
@o-az
o-az / suppress-warnings.cjs
Last active October 6, 2023 04:17
Suppress all Node.js warnings (including deprecation warnings)
const { emit: originalEmit } = process;
/**
* @param {string} event
* @param {{ name: string; }} error
*/
function suppresser(event, error) {
return event === "warning" && error.name === "ExperimentalWarning"
? false
: originalEmit.apply(process, arguments);