Skip to content

Instantly share code, notes, and snippets.

View tms1337's full-sized avatar
๐ŸŒ
aloha

Faruk Mustafic tms1337

๐ŸŒ
aloha
  • Sarajevo, Bosnia & Herzegovina
View GitHub Profile
console.log( "Understanding rather than just pattern memorization." );
console.log( "Concepts are more important than specific implementation." );
console.log( "Apply the same concept in different technologies." );
console.log( "Learn once, use anywhere ยฎ" );
assert.ok( valueAdded === MAX_VALUE );
console.log( "Understanding rather than just pattern memorization." );
console.log( "Concepts are more important than specific implementation." );
console.log( "Apply the same concept in different technologies." );
console.log( "Learn once, use anywhere ยฎ" );
assert.ok( valueAdded === MAX_VALUE );
1% better every day 1% worse every day
1 1
1.01 0.99
1.0201 0.9801
1.030301 0.9702989999999999
1.04060401 0.96059601
1.0510100501 0.9509900498999999
1.0615201506010001 0.9414801494009999
1.0721353521070098 0.9320653479069899
1.0828567056280802 0.92274469442792
good bad
1 1
1.01 0.99
1.0201 0.9801
1.030301 0.9702989999999999
1.04060401 0.96059601
1.0510100501 0.9509900498999999
1.0615201506010001 0.9414801494009999
1.0721353521070098 0.9320653479069899
1.0828567056280802 0.92274469442792
const filterTransactionsByRecipient = ({ addresses, transactions }) => {
return transactions.filter((tx) => addresses.includes(tx.to));
};
export default filterTransactionsByRecipient;
import filterTransactionsByRecipient from ".";
describe("filterTransactionsByRecipient", () => {
it("correctly detects if in addresses", () => {
const addresses = ["0x12341"];
const transactions = [
{
from: "0x123",
to: "0x12341",
},
// connectors
import createGetAddresses from "../../services/argent/getAddresses";
import createGetTransactionsForBlock from "../../services/eth/getTransactionsForBlock";
// core
import filterTransactionsByRecipient from "./core/filterTransactionsByRecipient";
// function
const createFilterTransactions = ({
getTransactionsForBlock = createGetTransactionsForBlock(),
// connectors
import createGetAddresses from "../../services/argent/getAddresses";
import createGetTransactionsForBlock from "../../services/eth/getTransactionsForBlock";
// function
const createFilterTransactions = ({
getTransactionsForBlock = createGetTransactionsForBlock(),
getAddresses = createGetAddresses(),
} = {}) => async ({ blockNumber }) => {
// input
// function
import createFilterTransactions from "../functions/filterTransactions";
// fake services
import { createFakeGetAddresses } from "../services/argent/getAddresses";
import { createFakeGetTransactionsForBlock } from "../services/eth/getTransactionsForBlock";
describe("filterTransactions", () => {
it("correctly filters transactions", async (done) => {
const transactions = [
require("dotenv").config();
const { ETH_NETWORK: network, ALCHEMY_API_KEY: alchemy } = process.env;
import { ethers } from "ethers";
const { getDefaultProvider } = ethers;
const createGetTransactionsForBlock = ({
provider = getDefaultProvider(network, { alchemy }),
} = {}) => async ({ blockNumber }) => {