Skip to content

Instantly share code, notes, and snippets.

Avatar

Kaldr, the Ancient Apparition AncientWarden

  • Web3
View GitHub Profile
@AncientWarden
AncientWarden / wardenswapSdkSample.js
Last active Jan 6, 2022
Quick Sample Usage for Warden Swap SDK
View wardenswapSdkSample.js
// npm install @wardenswap/bestrate-sdk ethers
const { WardenBestRate } = require('@wardenswap/bestrate-sdk')
const { ethers } = require('ethers')
// WardenRouter_2_0.abi.json can be found here: https://gist.github.com/AncientWarden/4aeae54509dd21020ab29a13c804cb57
// or BSCScan: https://bscscan.com/address/0x451ef8D6B645a60115EB8b8bEa76B39C0C761004#code
const wardenRouterAbi = require('./WardenRouter_2_0.abi.json')
const WARDEN_ROUTER_ADDRESS = '0x451ef8D6B645a60115EB8b8bEa76B39C0C761004'
@AncientWarden
AncientWarden / App.tsx
Last active Apr 12, 2022
Sample React TypeScript Code for integrating WardenSwap SDK
View App.tsx
import React from 'react';
import { ethers } from 'ethers'
import erc20Abi from './abi/ERC20.abi.json'
import wardenRouter2Abi from './abi/WardenRouter_2_0.abi.json'
import { useWeb3React, Web3ReactProvider } from '@web3-react/core';
import { Web3Provider } from "@ethersproject/providers";
import { WardenBestRate } from '@wardenswap/bestrate-sdk';
import { InjectedConnector } from '@web3-react/injected-connector';
const injected = new InjectedConnector({
View WardenRouterV2.abi.json
[
{
"inputs": [
{
"internalType": "contract IWardenPreTrade2",
"name": "_preTrade",
"type": "address"
},
{
"internalType": "contract IWETH",