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 { dropsToXrp } from "xrpl"; | |
type IOU = { currency: string; issuer: string }; | |
type Asset = "XRP" | IOU; | |
type QuoteParams = { | |
side: "buy" | "sell"; | |
base: Asset; // asset you get on buy / sell on sell | |
quote: Asset; // asset you pay on buy / receive on sell | |
mode: "from" | "to"; // which field user typed |
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
/** | |
* XRPL Service | |
* Handles XRPL blockchain operations and XUMM API integration | |
*/ | |
import { | |
Client, | |
Wallet, | |
AccountSet, | |
Payment, |
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
/** | |
* A set of functions called "actions" for `xrpl` | |
*/ | |
import { Client, Wallet } from "xrpl"; | |
import validator from "validator"; | |
import { verify, deriveAddress } from "ripple-keypairs"; | |
export default { | |
// ======================================== |
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
/** | |
* A set of functions called "actions" for `xrpl` | |
*/ | |
import { Client, Wallet } from "xrpl"; | |
import validator from "validator"; | |
import { verify, deriveAddress } from "ripple-keypairs"; | |
export default { | |
// ======================================== |
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 rpcUrl = CHAIN_CONFIGS[1].rpcUrls[0]; | |
const provider = new providers.StaticJsonRpcProvider(rpcUrl, 1); | |
const UniswapV3Pool = await import('../../config/abi/UniswapV3Pool.json'); | |
const sxUsdcPoolAddress = "0xCb3b931E1e02C26399aCc651bFD9c8c4385EECd0"; | |
const ethUsdcPoolAddress = "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8"; | |
const sxUsdcPoolContract = new Contract(sxUsdcPoolAddress, UniswapV3Pool.abi, provider); | |
const ethUsdcPoolContract = new Contract(ethUsdcPoolAddress, UniswapV3Pool.abi, provider); |
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 Web3 from 'web3'; | |
export const getMetamask = (windowObject) => { | |
if(!windowObject.web3) { | |
return false | |
} | |
return windowObject.web3; | |
} |
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
class Spiderman { | |
lookOut() { | |
alert('My Spider-Sense is tingling.'); | |
} | |
} | |
let miles = new Spiderman(); | |
miles.lookOut(); |
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 axios from 'axios'; | |
/** | |
* Pull public gists from a Github user by their username | |
* @param {string} username Github username | |
*/ | |
export const getGistsByUsername = async (username) => { | |
try { | |
let response = await axios({ |
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
// useSockets.js | |
import React, { | |
useState | |
} from 'react'; | |
import io from 'socket.io-client'; | |
export default function useSocket() { | |
const [Socket, setSocket] = useState(null); |
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 RandomNumberGenerator = () => { | |
const [number, setNumber] = useState(Math.random()); | |
const regenerate = () => { | |
setNumber(Math.random()); | |
} | |
const RandomNumber = () => { | |
return number; | |
} | |
return { regenerate, RandomNumber }; |
NewerOlder