Skip to content

Commit f87726a

Browse files
committed
Upgrade version to 0.16.0
1 parent 4a79a97 commit f87726a

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightstreams-js-sdk",
3-
"version": "0.15.0",
3+
"version": "0.16.0",
44
"description": "Lightstreams JS SDK for building mainstream DApps with support for Programmable Decentralized Private Storage.",
55
"author": "Gabriel Garrido",
66
"contributors": [

src/contracts/profile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ module.exports.withdrawArtistTokens = (web3, {from, beneficiary, contractAddr, a
238238
});
239239
};
240240

241-
module.exports.buyArtistTokens = async(web3, {from, contractAddr, artistTokenAddr, wphtAddr, amountInPht}) => {
241+
module.exports.buyArtistTokenWrapper = async(web3, {from, contractAddr, artistTokenAddr, wphtAddr, amountInPht}) => {
242242
// Firstly we withdraw from profile contract enough PHT to buy artist token
243243
console.log(`Withdrawing ${amountInPht} from profile contract ${contractAddr}`);
244244
await withdraw(web3, {

test/01_profile.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const ACL = artifacts.require("ACL");
1717

1818
const Web3 = require('../src/web3');
1919
const {
20-
buyArtistTokens,
20+
buyArtistTokenWrapper,
21+
withdrawArtistTokens
2122
} = require('../src/contracts/profile');
2223

2324
const {
@@ -98,19 +99,35 @@ contract('Profile', (accounts) => {
9899
});
99100

100101
console.log(`Buying ${amountInPht} artist tokens`);
101-
const bougthAmount = await buyArtistTokens(web3, {
102+
const bougthAmount = await buyArtistTokenWrapper(web3, {
102103
from: FAN_ACCOUNT,
103104
contractAddr: fanProfileInstance.address,
104105
artistTokenAddr: artistTokenInstance.address,
105106
wphtAddr: wphtInstance.address,
106107
amountInPht
107108
});
108109

109-
const balanceOf = await getBalanceOf(web3, {
110+
const balanceOfContract = await getBalanceOf(web3, {
110111
artistTokenAddr: artistTokenInstance.address,
111112
accountAddr: fanProfileInstance.address
112113
});
113114

114-
assert.equal(bougthAmount, balanceOf);
115+
assert.equal(bougthAmount, balanceOfContract);
116+
117+
// Withdraw artist tokens back to user
118+
await withdrawArtistTokens(web3, {
119+
from: FAN_ACCOUNT,
120+
beneficiary: FAN_ACCOUNT,
121+
contractAddr: fanProfileInstance.address,
122+
amount: balanceOfContract,
123+
artistToken: artistTokenInstance.address
124+
});
125+
126+
const balanceOfUser = await getBalanceOf(web3, {
127+
artistTokenAddr: artistTokenInstance.address,
128+
accountAddr: FAN_ACCOUNT
129+
});
130+
131+
assert.equal(bougthAmount, balanceOfUser);
115132
});
116133
});

0 commit comments

Comments
 (0)