Skip to content

Instantly share code, notes, and snippets.

View nCally's full-sized avatar
👋
Hey

Cally Nnamani nCally

👋
Hey
View GitHub Profile
const CryptoJS = require('crypto-js')
const token = ""; // retrieve after login
const accessSecret = ""; // retrieve after login
const timestamp = Date.now()
let requestBody = {}
if(Object.keys(pm.request.body).length > 0){
requestBody = JSON.parse(pm.request.body)
export const setupWeb3 = (networkId: number) => {
let provider = '';
if (networkId === 97) {
provider = 'https://data-seed-prebsc-1-s1.binance.org:8545/';
}
if (networkId === 56) {
provider = 'https://bsc-dataseed1.ninicoin.io';
}
if (networkId === 137) {
const baseuri = Axios.create({
baseURL: `${chooseEnvironment().base}/api`,
headers: {
...getLocation(),
...getDeviceDetails(),
authorization: String(chooseEnvironment().auth),
authentication: `Basic ${retrieveToken().token}`,
},
});
@nCally
nCally / netrw.txt
Created June 11, 2022 06:59 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
export const sendSignedTransaction = async (tx, contractAddress) => {
const privatekey = ""; // your wallets secret key (very private, don't keep online)
const client = "";
const networkId = await web3.eth.net.getId();
const nonce = await web3.eth.getTransactionCount(client);
const gas = await tx.estimateGas({ from: client, nonce });
const gasPrice = await web3.eth.getGasPrice();
const data = tx.encodeABI();
@nCally
nCally / example.js
Last active June 27, 2021 18:59
Line 30 and 31 - Example how to use the function
import createContract from "../create.contract";
import EsusuService from '../abis/EsusuService.json';
import DAITokenAbi from '../abis/DaiContract.json';
import sendSignedTransaction from '../../utils/sendSignedTransaction';
import esusuInfo from './info';
export default async function (
cycleId: number,
provider: string,
@nCally
nCally / gist:87d6c27aff4ef5448ec737845e52194a
Created November 11, 2020 10:13
Where I call contract
import createEsusuContract from "./contract-creator";
import Groups from './abis/Groups.json';
import ADDRESS from "./abis/addresses";
async function getGroupsCount() {
const contract = await createEsusuContract(Groups.abi, ADDRESS.GROUPS);
@nCally
nCally / Groups.json
Last active November 11, 2020 10:11
Groups.json
{
"contractName": "Groups",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "oracle",
"type": "address"
}
{
"model": {
"paymentcode": "90106", Required
"customerId": "08034699322", Required
"amount": 200, Required
"emailAddress": "sam@gmail.com",
"phoneNumber": "08034699322", Required
"billerId": "901", Required
"meterNo": "",
"publicKey": "pk_test_5ntwb77rwnjl4k4ts0qk8tfdkgwedpjb", Required
var jwt = require('jsonwebtoken');
function authorizationController(req, res, next){
var header = req.headers['authorization'];
let token;
if(typeof header !== 'undefined'){
const bearer = header.split(' ');
token = bearer[1];
}
if(!token){