Skip to content

Instantly share code, notes, and snippets.

View sunguru98's full-sized avatar
🏠
Working from home

Sundeep Charan Ramkumar sunguru98

🏠
Working from home
View GitHub Profile
@sunguru98
sunguru98 / task2.ts
Created May 13, 2024 21:45
NAVI Dev Race Bonus Task
import { getFullnodeUrl, SuiClient } from "@mysten/sui.js/client";
import { decodeSuiPrivateKey } from "@mysten/sui.js/cryptography";
import { Ed25519Keypair } from "@mysten/sui.js/keypairs/ed25519";
import { TransactionBlock } from "@mysten/sui.js/transactions";
import { MIST_PER_SUI } from "@mysten/sui.js/utils";
/* NAVI addresses */
const NAVI_PACKAGE_ID =
"0xc6374c7da60746002bfee93014aeb607e023b2d6b25c9e55a152b826dbc8c1ce";
const FLASH_LOAN_CONFIG_ID =
@sunguru98
sunguru98 / task1.ts
Created May 13, 2024 21:43
NAVI Dev Race Round 6 - Task 1
import { getFullnodeUrl, SuiClient } from "@mysten/sui.js/client";
import { decodeSuiPrivateKey } from "@mysten/sui.js/cryptography";
import { Ed25519Keypair } from "@mysten/sui.js/keypairs/ed25519";
import { TransactionBlock } from "@mysten/sui.js/transactions";
import { MIST_PER_SUI } from "@mysten/sui.js/utils";
/* NAVI addresses */
const NAVI_PACKAGE_ID =
"0xc6374c7da60746002bfee93014aeb607e023b2d6b25c9e55a152b826dbc8c1ce";
const STORAGE_ID =
Verify Github on Galaxy. gid:gayDueF3wyePgDacuzJqTm
@sunguru98
sunguru98 / getMints.ts
Last active December 19, 2021 22:26
Get a Mint list based on a Candy machine Address
import { Metadata } from '@metaplex-foundation/mpl-token-metadata';
import { writeJSON } from 'fs-extra';
import { PublicKey } from '@solana/web3.js';
import { PROGRAMS, SOLANA_CONNECTION } from '../constants';
(async function () {
const CANDY_MACHINE_ACCOUNT_KEY = new PublicKey(
'Bi9A9brhkTXRMwq9aBimNZNefLkcMFHobtkwqBjTeqc5'
);
@sunguru98
sunguru98 / uploadToArweave.ts
Created December 18, 2021 17:27
Arweave Upload Snippet
// newJSON -> metadataJSON
// imageBuffer -> Buffer created from canvas
async function uploadToArweave(newJSON: any, imageBuffer: Buffer) {
const sundeepPrivateKey = process.env.MY_WALLET_PRIVATE_KEY!;
if (!sundeepPrivateKey) {
throw new Error('Private Key not found');
}
const solanaSigner = new signers.SolanaSigner(
did:3:bafyreifd3yxwagxxjwss3zeb76qvefj3d2ytw6s6n77kv2xkdwn6env344

Keybase proof

I hereby claim:

  • I am sunguru98 on github.
  • I am pacmanrulez98 (https://keybase.io/pacmanrulez98) on keybase.
  • I have a public key ASBSnB4RQ24aTbS9Icee73hTsn7TsxfZ9_YewnnTo46-rQo

To claim this, I am signing this object:

@sunguru98
sunguru98 / flatternArray.js
Last active January 23, 2020 09:57
Flatten an array without using flat method.
const flattenArray = nestedArr => {
// Checking for the emptiness of array
if (!nestedArr.length) return null;
// Creating a new array for every recursive call
const newArr = [];
// If the current element is an array, we recursively call the function and then push the values present in the returned array.
// Else we just push the current element on to the new Array.
nestedArr.forEach(el =>
Array.isArray(el) ? newArr.push(...flattenArray(el)) : newArr.push(el)
);
@sunguru98
sunguru98 / prepareProduct.js
Created January 23, 2020 09:34
Prepare Prrduct Object instance for MongoDB storage
module.exports = reqBodyObj => {
// Preparing the product object
const {
name,
description,
price,
quantities,
dosages,
sideEffects,
stockAvailable,