Skip to content

Instantly share code, notes, and snippets.

Avatar

Tomiwa ademidun

View GitHub Profile
@ademidun
ademidun / repos.js
Last active Jan 16, 2023
a node script that gets the top 10 most starred repos on safe-global github by sending a request to github API and save the name, url, description and star count to a JSON and CSV file
View repos.js
/**
A node script that gets the top 10 most starred repos on safe-global github
by sending a request to github API
and save the name, url, description and star count to a JSON and CSV file
courtesy of ChatGPT: https://i.imgur.com/bQuh1Sr.png **/
const https = require('https');
const fs = require('fs');
const orgName = 'safe-global';
@ademidun
ademidun / google-sheets-functions.md
Created Jan 8, 2023
Helpful Google Sheets Functions
View google-sheets-functions.md

Helpful Google Sheets Functions

  1. Paste your function as a markdown
  2. For the example section, copy your table and convert it to markdown with a Table to Markdown Tool and then paste it here.
  3. You might need to surround html code with backticks `` so it renders the html code and not the formatted html

Display a formatted HTML anchor tag Link with text and url as a variable

Formula

@ademidun
ademidun / different-ways-to-create-safe-accounts.md
Last active Jan 6, 2023
Different Ways to Create Safe Accounts
View different-ways-to-create-safe-accounts.md

Different Ways to Create Safe Accounts

Bloomberg Businessweek famously said that businesses could receive payments on Stripe in 7 lines of code.

Now: anyone can receive payments on Safe in 5 lines of code.

Command Line

Safe CLI: Python

@ademidun
ademidun / safe-deploy-stripe-comparison.md
Created Jan 5, 2023
Bloomberg Businessweek famously said that businesses could receive payments on Stripe in 7 lines of code. With Safe, anyone can deploy a Safe Smart contract wallet to receive payments in 4 lines.
View safe-deploy-stripe-comparison.md

Bloomberg Businessweek famously said that businesses could receive payments on Stripe in 7 lines of code.

With Safe, anyone can deploy a Safe Smart contract wallet to receive payments in 4 lines.

import Safe, { SafeFactory, SafeAccountConfig } from '@safe-global/safe-core-sdk'
const safeFactory = await SafeFactory.create({ ethAdapter });
const safeAccountConfig: SafeAccountConfig = { owners: ['0x...', '0x...', '0x...'], threshold: 3}
const safeSdk: Safe = await safeFactory.deploySafe({ safeAccountConfig })
@ademidun
ademidun / create-typescript-for-installed-project-react.md
Created Dec 18, 2022
How to create a custom typescript definition when using packages that don't already have one.
View create-typescript-for-installed-project-react.md

You have installed a package that doesn't have a typescript definition. Here is how you can create one yourself:

See: Transak/transak-sdk#7 (comment)

Here's how I fixed this:

  1. Create a new file: src/@types/transak-sdk.d.ts
  2. Add the Following: [Transak Declaration File]
  3. Add the Following: [Use Transak Declaration File in component]
@ademidun
ademidun / browser-extension-helpers.js
Last active Dec 19, 2022
Helper scripts for using browser extensions.
View browser-extension-helpers.js
// To test that your extension is working, we can trigger a request account
// copy the following scripts into your browser console
// source: https://gist.github.com/ademidun/29268d38592a84703812c7984f4863cd
ethereum
.request({ method: 'eth_requestAccounts' })
.then((accounts)=>{
console.log({accounts});
})
.catch((error) => {
@ademidun
ademidun / APIMock.js
Last active Jul 20, 2022
An example of how to use the axios-mock-adapter
View APIMock.js
/*
Implementation of https://github.com/ctimmerm/axios-mock-adapter
*/
import Environment from '../Environment';
import ContactsAPI from '../ContactsAPI';
import ContactsQuery1 from './Contacts/ContactsQuery1.json';
import ScholarshipsPreview1 from './Scholarship/ScholarshipsPreview1.json';
import ScholarshipsPreviewOntario1 from './Scholarship/ScholarshipsPreviewOntario1.json';
var axios = require("axios");
@ademidun
ademidun / depay-react-example.tsx
Created Jul 9, 2022
Example of how to use the Depay Widget in a React App
View depay-react-example.tsx
import React from 'react'
import DePayWidgets from '@depay/widgets';// https://github.com/DePayFi/widgets
import { Button } from 'antd';
interface CryptoPaymentWidgetProps {
/** Amount that wallet will receive in USD */
amount: number;
}
View arthouse-optimism-proposal.md

Project Name: Arthouse (github)

Author Name: Tomiwa

Number of OP tokens requested: 50,000

L2 Recipient Address: 0x27F7e8d7C63C414Eae2BB07E1a9B9057a1D382cf

Relevant Usage Metrics: (TVL, transactions, volume, unique addresses, etc.)

View web3-auth.sample.tsx
/**
Working version of https://docs.web3auth.io/quick-start?lang=react&chain=eth&customAuthentication=no&customLogin=no&whitelabel=no
**/
import { ADAPTER_EVENTS, CHAIN_NAMESPACES, SafeEventEmitterProvider } from "@web3auth/base";
import { Web3Auth } from "@web3auth/web3auth";
import { OpenloginAdapter } from "@web3auth/openlogin-adapter";
import { useEffect, useState } from "react";
import "./App.css";
import RPC from "../../services/EVM";