Skip to content

Instantly share code, notes, and snippets.

@ademidun
ademidun / repos.js
Last active January 16, 2023 18:18
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
/**
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 January 8, 2023 11:38
Helpful Google Sheets Functions

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 January 6, 2023 05:24
Different Ways to Create Safe Accounts

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 January 5, 2023 23:29
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.

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 December 18, 2022 20:13
How to create a custom typescript definition when using packages that don't already have one.

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 December 19, 2022 17:59
Helper scripts for using browser extensions.
// 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 July 20, 2022 12:27
An example of how to use the axios-mock-adapter
/*
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 July 9, 2022 00:26
Example of how to use the Depay Widget in a React App
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;
}

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.)

/**
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";