Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError this.provider.sendAsync #334

Open
wilbarnes opened this issue Feb 10, 2019 · 1 comment
Open

TypeError this.provider.sendAsync #334

wilbarnes opened this issue Feb 10, 2019 · 1 comment

Comments

@wilbarnes
Copy link

Hello,

I was working through the tutorial https://developer.dharma.io/tutorials/create

dharma-chain running on 8545

const { Dharma, Web3 } = require("@dharmaprotocol/dharma.js");
const BigNumber = require("bignumber.js");

const host = "http://localhost:8545";
const dharma = new Dharma(host);

async function loanreq() {

    const { LoanRequest } = Dharma.Types;

    const loanRequest = await LoanRequest.create(dharma, {
        principalAmount: new BigNumber(1),
        principalToken: "WETH",
        collateralAmount: new BigNumber(20),
        collateralToken: "REP",
        interestRate: new BigNumber(3),
        termDuration: new BigNumber(3),
        termUnit: "months",
        expiresInDuration: new BigNumber(1),
        expiresInUnit: "weeks"
    });
    console.log(loanRequest);
}

loanreq()

Output

(node:8362) UnhandledPromiseRejectionWarning: TypeError: this.provider.sendAsync is not a function
    at RequestManager.sendAsync (/xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:88601:19)
    at Object.send (/xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:14677:42)
    at /xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:5610:10
    at new Promise (<anonymous>)
    at new F (/xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:36181:28)
    at /xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:5592:12
    at BlockchainAPI.<anonymous> (/xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:301244:72)
    at step (/xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:301081:23)
    at Object.next (/xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:301062:53)
    at /xyz/xyz/xyz/projects/dharma/dharmajs/node_modules/@dharmaprotocol/dharma.js/dist/dharma.umd.js:301056:71
(node:8362) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8362) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled wil terminate the Node.js process with a non-zero exit code.

Was simply trying to print the loanRequest

@jahosh
Copy link

jahosh commented Feb 18, 2019

@wilbarnes I'm experiencing this as well when using the dharma-chain - I believe it may be related to the fact that the version of web3 dharma.js is using ("web3": "~0.20.7") expects a Web3.Provider instead of a "string" as the tutorial suggests. https://github.com/ethereum/web3.js/tree/master#usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants