Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lumerin/wallet-core",
"version": "1.0.68",
"version": "1.0.69",
"author": {
"name": "Lumerin",
"email": "developer@lumerin.io",
Expand Down Expand Up @@ -36,7 +36,7 @@
"axios-cookiejar-support": "1.0.1",
"chalk": "^2.4.2",
"cheerio": "^1.0.0-rc.12",
"contracts-js": "github:Lumerin-protocol/contracts-js#v0.0.26",
"contracts-js": "github:Lumerin-protocol/contracts-js#v0.0.27",
"cross-port-killer": "^1.4.0",
"debug": "4.1.1",
"ecies-geth": "^1.6.2",
Expand Down
13 changes: 10 additions & 3 deletions src/plugins/contracts/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async function _loadContractInstance(
_isDeleted: isDead, // check if contract is dead
_balance: balance,
_hasFutureTerms: hasFutureTerms,
_version: version,
} = contract

let futureTerms = null
Expand All @@ -60,6 +61,7 @@ async function _loadContractInstance(
speed: data._speed,
length: data._length,
limit: data._limit,
version: data._version,
}
}

Expand All @@ -84,6 +86,7 @@ async function _loadContractInstance(
hasFutureTerms,
futureTerms,
history: buyerHistory,
version,
},
}
} catch (err) {
Expand Down Expand Up @@ -324,7 +327,7 @@ function setContractDeleteStatus(web3, cloneFactory, onUpdate) {
*/
function purchaseContract(web3, cloneFactory, lumerin) {
return async (params) => {
const { walletId, contractId, url, privateKey, price } = params
const { walletId, contractId, url, privateKey, price, version } = params
const sendOptions = { from: walletId, gas: 1_000_000 }

Comment thread
alex-sandrk marked this conversation as resolved.
//getting pubkey from contract to be purchased
Expand Down Expand Up @@ -355,14 +358,14 @@ function purchaseContract(web3, cloneFactory, lumerin) {
const marketplaceFee = await cloneFactory.methods.marketplaceFee().call();

const purchaseGas = await cloneFactory.methods
.setPurchaseRentalContract(contractId, ciphertext.toString('hex'))
.setPurchaseRentalContract(contractId, ciphertext.toString('hex'), version)
.estimateGas({
from: sendOptions.from,
value: marketplaceFee
})

const purchaseResult = await cloneFactory.methods
.setPurchaseRentalContract(contractId, ciphertext.toString('hex'))
.setPurchaseRentalContract(contractId, ciphertext.toString('hex'), version)
.send({
...sendOptions,
gas: purchaseGas,
Comment thread
alex-sandrk marked this conversation as resolved.
Expand Down Expand Up @@ -396,17 +399,21 @@ function editContract(web3, cloneFactory, lumerin) {
const account = web3.eth.accounts.privateKeyToAccount(privateKey)
web3.eth.accounts.wallet.create(0).add(account)

const marketplaceFee = await cloneFactory.methods.marketplaceFee().call();

const editGas = await cloneFactory.methods
.setUpdateContractInformation(contractId, price, limit, speed, duration)
.estimateGas({
from: sendOptions.from,
value: marketplaceFee,
})

const editResult = await cloneFactory.methods
.setUpdateContractInformation(contractId, price, limit, speed, duration)
.send({
...sendOptions,
gas: editGas,
value: marketplaceFee,
})
Comment thread
alex-sandrk marked this conversation as resolved.

logger.debug('Finished edit contract transaction', editResult)
Expand Down