Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kwilteam/kwil_db_api
Browse files Browse the repository at this point in the history
  • Loading branch information
brennanjl committed Feb 25, 2022
2 parents c424b8d + 01420fb commit a6c4e9b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const createMoat = require('./src/createMoat.js')
const getMoats = require('./src/getMoats')
const {decryptKey} = require('./src/utils/decryptKey')
const pools = require('./src/fundingPools/index.js')
const getPoolsByMoat = require('./src/getPoolsByMoat');

const KwilDB = {createConnector, createMoat, createConnectorRegistry,getMoats,decryptKey, pools}
const KwilDB = {createConnector, createMoat, createConnectorRegistry,getMoats,decryptKey, pools,getPoolsByMoat}

module.exports = KwilDB
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kwildb",
"version": "1.0.79",
"version": "1.2.0",
"main": "index.js",
"scripts": {
"test": "jest"
Expand Down
4 changes: 2 additions & 2 deletions src/fundingPools/createFundingPool.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { initContract, isValidAddress, getGasPrice } = require('./utils')

const createFundingPool = async (_name,_addr, _validator, _chain, _token, _moat, _privateKey = null) => {
const createFundingPool = async (_name, _addr, _validator, _chain, _token, _moat, _privateKey = null) => {
try {
if (!isValidAddress(_validator)) {
throw new Error(`${_validator} is not a valid address`)
Expand All @@ -18,7 +18,7 @@ const createFundingPool = async (_name,_addr, _validator, _chain, _token, _moat,

} catch(e) {
console.log(e)
return e.toString();
return e.message;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fundingPools/fundPool.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions src/getPoolsByMoat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const axios = require("axios");


getPoolsByMoat = async (_registry,_moat) => {

const params = {
url: _registry+'/getFundingPools',
method: 'post',
timeout: 20000,
data: {
moat:_moat,
}
};

let _params = JSON.parse(JSON.stringify(params))

//Putting a warning here, honestly for my sake more than anything else
const response = await axios(_params)
return response.data
}

module.exports = getPoolsByMoat

0 comments on commit a6c4e9b

Please sign in to comment.