-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.js
More file actions
33 lines (27 loc) · 817 Bytes
/
web.js
File metadata and controls
33 lines (27 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const RequestNetwork = require('@requestnetwork/request-network.js');
// Initialize the Request Network library
const requestNetwork = new RequestNetwork.default({
provider: web3.currentProvider, // metamask
ethNetworkId: 4,
useIpfsPublic: false,
});
// Create a request as payer:
const payeeAddress = '0x0Db609A4F1A4b40De5Aa157026d9a522EE40E56c'; // random address
const payerAddress = web3.eth.defaultAccount;
const payerInfo = {
idAddress: payerAddress,
refundAddress: payerAddress,
};
const payeesInfo = [{
idAddress: payeeAddress,
paymentAddress: payeeAddress,
expectedAmount: 150000,
}]
requestNetwork.createRequest(
RequestNetwork.Types.Role.Payer,
RequestNetwork.Types.Currency.ETH,
payeesInfo,
payerInfo,
).then(
request => console.log(request)
);