dharmaprotocol / dharma.js Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: Javascript Developer library for interacting with Dharma Protocol
Home Page: https://dharma.io
License: MIT License
DEPRECATED: Javascript Developer library for interacting with Dharma Protocol
Home Page: https://dharma.io
License: MIT License
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
Is this Vue.js issue? is Dharmajs compatible with Vue ?
25 | methods: {
26 | createLoanRequest: function() {
27 | const loanRequest = await LoanRequest.create(dharma, {
| ^
28 | principalAmount: 5,
29 | principalToken: "WETH",
....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.