Skip to content

Instantly share code, notes, and snippets.

View ducphamle2's full-sized avatar
🎯
Focusing

Duc Pham ducphamle2

🎯
Focusing
View GitHub Profile
const moderators = [
new PublicKey("FcfgHRQPs8ZNnNegVQpHcY1czcb9vgci2JNZpFaxoMQe"),
new PublicKey("GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU"),
];
const maxAddress = new PublicKey(
"6EPdGj7TgLjCPth3XSkWFuoTjGXSR6pV6Sn7LKmKCDYE"
);
const maxAta = getAssociatedTokenAddressSync(currencyMint, maxAddress);
const maxTokenAccount = await connection.getTokenAccountBalance(maxAta);
let currentMaxTokenValue = maxTokenAccount.value.uiAmount;
import {
signerIdentity,
createSignerFromKeypair,
publicKey,
} from "@metaplex-foundation/umi";
import base58 from "bs58";
import dotenv from "dotenv";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
import { mplTokenMetadata } from "@metaplex-foundation/mpl-token-metadata";
import {
@ducphamle2
ducphamle2 / precompute-solana-tx-signatures.ts
Created December 2, 2024 18:47
Pre-compute a simple Sol transfer transaction on Solana
import {
signerIdentity,
createSignerFromKeypair,
Instruction,
publicKey,
} from "@metaplex-foundation/umi";
import { LAMPORTS_PER_SOL, SystemProgram, Connection } from "@solana/web3.js";
import base58 from "bs58";
import dotenv from "dotenv";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
@ducphamle2
ducphamle2 / subscribe-agent-lands-tokens.ts
Created November 25, 2024 02:28
Subscribe to new agents.land tokens
import {
Connection,
Logs,
ParsedInnerInstruction,
ParsedInstruction,
ParsedTransactionWithMeta,
PartiallyDecodedInstruction,
PublicKey,
} from "@solana/web3.js";
import { Metaplex } from "@metaplex-foundation/js";
@ducphamle2
ducphamle2 / unjail-script.mjs
Last active November 15, 2024 18:40
unjail a validator on Oraichain
import {
AminoTypes,
defaultRegistryTypes,
GasPrice,
SigningStargateClient
} from "@cosmjs/stargate";
import { DirectSecp256k1HdWallet, Registry } from "@cosmjs/proto-signing";
import dotenv from "dotenv";
import { ORAI } from "@oraichain/common";
import { cosmos } from "@oraichain/proto";
import { stringToPath } from '@cosmjs/crypto';
import { coins, DirectSecp256k1HdWallet, EncodeObject } from '@cosmjs/proto-signing';
import { SigningStargateClient, GasPrice } from '@cosmjs/stargate';
import { OfflineDirectSigner } from '@keplr-wallet/types';
import { PeriodicAllowance } from 'cosmjs-types/cosmos/feegrant/v1beta1/feegrant';
import { MsgGrantAllowance } from 'cosmjs-types/cosmos/feegrant/v1beta1/tx';
import dotenv from 'dotenv';
dotenv.config();
const numOfMsToExpiration = (numOfMs: number) => {
@ducphamle2
ducphamle2 / signEvmWithKeplr.ts
Created August 28, 2024 02:36 — forked from phips28/signEvmWithKeplr.ts
Sign Cosmos-EVM chains with Keplr
import { SigningStargateClient } from '@cosmjs/stargate'
import { fromBase64, toBase64 } from '@cosmjs/encoding'
import { makeAuthInfoBytes, makeSignDoc } from '@cosmjs/proto-signing'
import { Int53 } from '@cosmjs/math'
import { Any } from 'cosmjs-types/google/protobuf/any'
import { PubKey } from 'cosmjs-types/cosmos/crypto/secp256k1/keys'
import { AuthInfo, Fee, Tx, TxBody, TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx'
import { isDev } from '@/helpers/env'
import { OfflineDirectSigner } from '@cosmjs/proto-signing/build/signer'
import { StdFee } from '@cosmjs/amino'

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

Verified commits on Github master branch Private network for internal communication .dockerignore, .gitignore file for environments and keys Passcode for secret information do not setup a password, use SSH key-based authentication instead updates timely to act upon zero day vulnerabilities Have your code review done by a senior developer Setup GPG key for Github account Protect important branches