Skip to content

Commit

Permalink
Merge pull request #18 from sprotest/feature/remove-old-smartcontract…
Browse files Browse the repository at this point in the history
…-methods

remove outdated methods of old smart contract
  • Loading branch information
slavas490 authored Oct 24, 2023
2 parents a5e9d02 + 26ef319 commit 7bff03b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 111 deletions.
5 changes: 0 additions & 5 deletions ui/wallet/src/ProxeusEthereum/WalletInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,6 @@ class WalletInterface {
}
}

async XESAmountPerFile ({ providers }) {
const tokensRaw = await this.proxeusFS.XESAmountPerFile({ providers })
return this.metamaskUtil.formatBalance(this.web3.utils.toHex(tokensRaw))
}

async verifyHash (hash) {
const result = await this.proxeusFS.fileVerify(hash)

Expand Down
129 changes: 23 additions & 106 deletions ui/wallet/src/ProxeusEthereum/services/ProxeusFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,10 @@ export default class {
this.contract = proxeusFSContract
}

async XESAmountPerFile ({ providers }) {
return this.contract.methods.getXESPrice().call()
}

/**
** Free calls
**/

/*
* Returns expiry information of a file
*/
fileExpiry (hash) {
}

fileGetPerm (hash, address, write) {
return this.contract.methods.fileGetPerm(hash, address, write).call()
}

fileHasSP (hash, spAddress) {
return this.contract.methods.fileHasSP(hash, spAddress).call()
}

/*
* Returns file metadata
*/
fileInfo (hash) {
return this.contract.methods.fileInfo(hash).call()
}

/*
* Returns a list of files
*/
async fileList () {
return this.contract.methods.fileList().call()
}

/*
* Returns a list of signers for a specific file
*/
getFileSigners (hash) {
async getFileSigners (hash) {
return this.contract.methods.getFileSigners(hash).call()
}

Expand All @@ -54,87 +18,40 @@ export default class {
return this.contract.methods.verifyFile(hash).call()
}

/*
* Returns metadata about a Service Provider
*/
spInfo (hash) {
return this.contract.methods.spInfo(hash).call()
}

/*
* Returns a list of storage providers
*/
spList () {
return this.contract.methods.spList().call()
}

/*
* Paid calls
/**
* Sign file
*/

fileRemove (hash) {
return this.contract.methods.fileRemove(hash).send()
}

signFile ({ hash }) {
async signFile ({
hash
}) {
return this.contract.methods.signFile(hash).send()
}

fileSetPerm (hash, address) {
return this.contract.methods.fileSetPerm(hash, address).send()
}

createFileDefinedSigners ({ hash, definedSigners, expiry, replaces, providers }) {
return this.contract.methods.createFileDefinedSigners(
hash,
definedSigners,
expiry / 1000 || 0,
this.web3.utils.fromAscii('0x0'),
providers
).send()
}

createFileUndefinedSigners ({ hash, data, mandatorySigners, expiry, replaces, providers, xes }) {
/**
* Create a file with undefined signers
*/
async createFileUndefinedSigners ({
hash,
data
}) {
return this.contract.methods.registerFile(
hash,
data
).send()
}

createFileUndefinedSignersEstimateGas (
{ from, hash, data, mandatorySigners, expiry, replaces, providers }, cb, xes) {
const opt = from ? { from } : {}
/**
* Estimate gas for freate a file with undefined signers
*/
async createFileUndefinedSignersEstimateGas ({
from,
hash
}, cb, xes) {
const opt = from ? {
from
} : {}
return this.contract.methods.registerFile(
hash
).estimateGas(opt, cb)
}

createFileThumbnail (hash, pParent, pPublic) {
return this.contract.methods.createFileThumbnail(
hash,
pParent,
pPublic
).send()
}

fileRequestSign (hash, address) {
return this.contract.methods.fileRequestSign(hash, address).send()
}

fileRequestAccess () {
}

getRequestSignEvents (address, fromBlock) {
return this.contract.getPastEvents('RequestSign', {
filter: { to: address },
fromBlock: fromBlock || 0
})
}

getNotifySignEvents (hash, address, fromBlock) {
return this.contract.getPastEvents('NotifySign', {
filter: { hash: hash, who: address },
fromBlock: fromBlock || 0
})
}
}

0 comments on commit 7bff03b

Please sign in to comment.