This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async processTrancationJito( | |
jitoTip: number, // in ui | |
tx: Transaction, | |
luts?: AddressLookupTableAccount[], | |
priorityFee?: number, // priorityFeeUi | |
) { | |
console.log(`this.provider.connection.commitment :: ${this.provider.connection.commitment}`); | |
const jitoTipInLamport = jitoTip * LAMPORTS_PER_SOL; | |
console.log(`jitoTipInLamport :: ${jitoTipInLamport}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use spl_associated_token_account::instruction::create_associated_token_account_idempotent; | |
use spl_token::instruction::close_account; | |
pub fn make_wrap_sol_ixs(config: &Config) -> Result<()> { | |
println!("sol transfer :: {}", config.payer.pubkey()); | |
// ata get -> ata create_idempotent -> trasnfer -> sync | |
let deposit_ata = anchor_spl::associated_token::get_associated_token_address( | |
&config.payer.pubkey(), | |
&pubkey!("So11111111111111111111111111111111111111112"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs/promises'; | |
import * as path from 'path'; | |
const writeKeypairToFile = async (sk: Uint8Array, fileName: string): Promise<void> => { | |
const filePath = path.join('tests/keys', `${fileName}.json`); | |
try { | |
await fs.writeFile(filePath, JSON.stringify(Array.from(sk))); | |
console.log(`Keypair written to file: ${filePath}`); | |
} catch (error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const credential = (await | |
navigator | |
.credentials.create({ | |
publicKey: { | |
challenge: new Uint8Array(16), | |
rp: { | |
name: "0xdeep.com", | |
}, | |
user: { | |
id: new Uint8Array(16), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as anchor from "@project-serum/anchor"; | |
import { Program } from "@project-serum/anchor"; | |
import { HelloSupersec } from "../target/types/hello_supersec"; | |
describe("hello-supersec", () => { | |
// Configure the client to use the local cluster. | |
const provider = anchor.AnchorProvider.env(); | |
anchor.setProvider(provider); | |
const program = anchor.workspace.HelloSupersec as Program<HelloSupersec>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define the size of each chunk | |
const chunkSize = 1000; | |
// Create a function to iterate over the items in chunks | |
async function iterateInChunks(items: any[], callback: (chunk: any[]) => void) { | |
// Calculate the number of chunks | |
const numChunks = Math.ceil(items.length / chunkSize); | |
// Create an array to hold the promises for the async operations | |
const promises = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.7.0 <0.9.0; | |
import "@openzeppelin/contracts/utils/math/SafeMath.sol"; | |
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
contract AMM is ReentrancyGuard{ | |
using Counters for Counters.Counter; | |
Counters.Counter private caseID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
header: { | |
numRequiredSignatures: 2, | |
numReadonlySignedAccounts: 0, | |
numReadonlyUnsignedAccounts: 2 | |
}, | |
accountKeys: [ | |
PublicKey { | |
_bn: <BN: ac0c28f702f61dca52e1e6260991e7db6bc3abbc0956434c9cbf0046b384ed5> | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await fetch("https://account.proton.me/api/users/available?Name=0xdeepmehta%40protonmail.com&ParseDomain=1", { | |
"headers": { | |
"accept": "application/vnd.protonmail.v1+json", | |
"accept-language": "en-GB,en;q=0.6", | |
"cache-control": "no-cache", | |
"pragma": "no-cache", | |
"sec-fetch-dest": "empty", | |
"sec-fetch-mode": "cors", | |
"sec-fetch-site": "same-origin", | |
"sec-gpc": "1", |
NewerOlder