Skip to content

Instantly share code, notes, and snippets.

View ryanleecode's full-sized avatar
🤣
don't worry, be happy

Ryan Lee ryanleecode

🤣
don't worry, be happy
View GitHub Profile
@ryanleecode
ryanleecode / trigger_effect_helpers.ts
Created April 28, 2024 05:02
effect in triggerdotdev v2
import type { IO, IOTask, Json, RunTaskOptions } from '@trigger.dev/sdk';
import { Cause, Deferred, Effect, Exit } from 'effect';
export const runTask =
<T extends Json<T>, E = never>(
cacheKey: string,
effect: (task: IOTask, io: IO) => Effect.Effect<T, E, never>,
options?: RunTaskOptions & {
parseOutput?: (output: unknown) => T;
},
[json-rpc-westend2] json-rpc-response-yielded; response={"jsonrpc":"2.0","method":"chainHead_unstable_followEvent","params":{"subscription":"1","result":{"event":"bestBlockChanged","bestBlockHash":"0xdf7eae1ebc1d708119cb5fd3ac06518ade7db9eddad92d8d4e2aeabe4a391fee"}}}
index.ts:22 [json-rpc-westend2] json-rpc-response-yielded; response={"jsonrpc":"2.0","method":"chainHead_unstable_followEvent","params":{"subscription":"1","result":{"event":"finalized","finalizedBlockHashes":["0xaf85299892565f1cd959a60cdf16de83fafc293e69087daa3826b4746f6fc1cd"],"prunedBlockHashes":[]}}}
index.ts:22 [json-rpc-westend2] json-rpc-request-queued; request={"jsonrpc":"2.0","id":"9-23","method":"chainHead_unstable_unpin","params":["1",["0x70ed5320673ed939f1ff2b9260fc3a178f44245b62c008dca6e16ff9e822db00"]]}
index.ts:22 [json-rpc-westend2] json-rpc-response-yielded; response={"jsonrpc":"2.0","method":"chainHead_unstable_followEvent","params":{"subscription":"1","result":{"event":"bestBlockChanged","bestBlockHash":"0xdf7eae1ebc1d708119cb
@ryanleecode
ryanleecode / force-llm-to-output-json.txt
Created April 13, 2024 02:09
Force LLM to output JSON that adheres to TS interface
{{interface}}
Your output should be a JSON object that strictly adheres to the TypeScript interface provided above. Only include the JSON object in your response, without any additional text, explanations or deviations.

Generate a GitHub profile README for the user with the username "{{username}}" based on their interests: {{interests}}

Include the following sections:

  1. Greeting

    • Display a friendly greeting with the user's name or username
    • Use emojis to add visual appeal
  2. Badges

  • Create badges for the user's top 6-8 skills or areas of interest
import { SS58String, Binary, ResultPayload, StorageDescriptor, PlainDescriptor, AssetDescriptor, TxDescriptor, RuntimeDescriptor, Enum, GetEnum, QueryFromDescriptors, TxFromDescriptors, EventsFromDescriptors, ErrorsFromDescriptors, ConstFromDescriptors } from "@polkadot-api/client";
type AnonymousEnum<T extends {}> = T & {
__anonymous: true;
};
type IEnum<T extends {}> = Enum<{
[K in keyof T & string]: {
type: K;
value: T[K];
};
}[keyof T & string]>;
This file has been truncated, but you can view the full file.
{
"name": "Collectives",
"id": "collectives_polkadot",
"chainType": "Live",
"bootNodes": [
"/dns/polkadot-collectives-connect-ew6-0.polkadot.io/tcp/30334/p2p/12D3KooWLDZT5gAjMtC8fojiCwiz17SC61oeX2C7GWBCqqf9TwVD",
"/dns/polkadot-collectives-connect-ew6-1.polkadot.io/tcp/30334/p2p/12D3KooWC9BwKMDyRUTXsE7teSmoKMgbyxqAp3zi2MTGRJR5nhCL",
"/dns/polkadot-collectives-connect-uw1-0.polkadot.io/tcp/30334/p2p/12D3KooWPrJ9VTn3GEs2e7GQs4zoEFiTFcjXFNbQ2iDxFDQAbstQ",
"/dns/polkadot-collectives-connect-uw1-1.polkadot.io/tcp/30334/p2p/12D3KooWGFYW6hJYn3pkpJawyMk6souXh7sznK8yvPmVQ7ktfHbV",
"/dns/polkadot-collectives-connect-ew6-0.polkadot.io/tcp/443/wss/p2p/12D3KooWLDZT5gAjMtC8fojiCwiz17SC61oeX2C7GWBCqqf9TwVD",
import type { Codec, HexString } from "@polkadot-api/substrate-bindings"
import {
Struct,
u32,
u128,
Hex,
Tuple,
compactBn,
Vector,
Enum,
@ryanleecode
ryanleecode / moonbeam-types.d.ts
Created November 27, 2023 16:59
moonbeam-types.d.ts
import type { HexString } from "@polkadot-api/substrate-bindings";
type IcPallet_balancesTypesAccountData = {
free: bigint;
reserved: bigint;
frozen: bigint;
flags: bigint;
};
type Icdc1 = HexString;
type IcSp_weightsWeight_v2Weight = {
ref_time: bigint;
@ryanleecode
ryanleecode / bundler-specific-plugins.md
Created November 24, 2023 15:49
bundler-specific-plugins.md

Option 2a: Bundler Specific Plugins

Given the following code snippet below, our goal is to find which descriptors are being used. In this case it is the Validators storage key from the Session pallet and the Validators storage key from the Staking pallet.

import { createClient } from "@polkadot-api/client"
import ksm from "./codegen/ksm"
import { getProviderChain } from "./provider"
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © quantifytools
//@version=5
indicator("Ultimate Volume Indicator", overlay=false, max_boxes_count=500, max_lines_count = 500, max_labels_count=500)
import kurtsmock/ArrayMatrixHUD/2 as sa
import kurtsmock/PD/1 as pd
////////////////////////////////////////