This file contains hidden or 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
| 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 ); |
This file contains hidden or 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
| 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 ); |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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 filterTransactionsByRecipient = ({ addresses, transactions }) => { | |
| return transactions.filter((tx) => addresses.includes(tx.to)); | |
| }; | |
| export default filterTransactionsByRecipient; |
This file contains hidden or 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 filterTransactionsByRecipient from "."; | |
| describe("filterTransactionsByRecipient", () => { | |
| it("correctly detects if in addresses", () => { | |
| const addresses = ["0x12341"]; | |
| const transactions = [ | |
| { | |
| from: "0x123", | |
| to: "0x12341", | |
| }, |
This file contains hidden or 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
| // connectors | |
| import createGetAddresses from "../../services/argent/getAddresses"; | |
| import createGetTransactionsForBlock from "../../services/eth/getTransactionsForBlock"; | |
| // core | |
| import filterTransactionsByRecipient from "./core/filterTransactionsByRecipient"; | |
| // function | |
| const createFilterTransactions = ({ | |
| getTransactionsForBlock = createGetTransactionsForBlock(), |
This file contains hidden or 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
| // connectors | |
| import createGetAddresses from "../../services/argent/getAddresses"; | |
| import createGetTransactionsForBlock from "../../services/eth/getTransactionsForBlock"; | |
| // function | |
| const createFilterTransactions = ({ | |
| getTransactionsForBlock = createGetTransactionsForBlock(), | |
| getAddresses = createGetAddresses(), | |
| } = {}) => async ({ blockNumber }) => { | |
| // input |
This file contains hidden or 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
| // 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 = [ |
This file contains hidden or 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
| 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 }) => { |
NewerOlder