mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
fix url
This commit is contained in:
parent
b1c134df20
commit
9efbe00ba3
@ -176,21 +176,24 @@ export class Assets extends Instantiable {
|
||||
public async download(
|
||||
dtAddress: string,
|
||||
serviceEndpoint: string,
|
||||
txId: string,
|
||||
account: string
|
||||
): Promise<string> {
|
||||
|
||||
let consumeUrl = serviceEndpoint
|
||||
// consumeUrl += `&consumerAddress=${account}`
|
||||
// consumeUrl += `&serviceAgreementId=${dtAddress}`
|
||||
consumeUrl += `?`
|
||||
consumeUrl += `consumerAddress=${account}`
|
||||
consumeUrl += `&tokenAddress=${dtAddress}`
|
||||
consumeUrl += `&transferTxId=${txId}`
|
||||
|
||||
let serviceConnector = new WebServiceConnector(this.logger)
|
||||
|
||||
try {
|
||||
await serviceConnector.downloadFile(consumeUrl)
|
||||
} catch (e) {
|
||||
this.logger.error('Error consuming assets')
|
||||
this.logger.error(e)
|
||||
throw e
|
||||
} catch (e) {
|
||||
this.logger.error('Error consuming assets')
|
||||
this.logger.error(e)
|
||||
throw e
|
||||
}
|
||||
|
||||
return serviceEndpoint
|
||||
|
@ -20,6 +20,7 @@ describe('Simple flow', () => {
|
||||
let contracts
|
||||
let datatoken
|
||||
let tokenAddress
|
||||
let transactionId
|
||||
|
||||
let tokenAmount = 100
|
||||
let transferAmount = 1
|
||||
@ -38,21 +39,22 @@ describe('Simple flow', () => {
|
||||
it('Alice publishes a dataset', async () => {
|
||||
// Alice creates a Datatoken
|
||||
datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
||||
tokenAddress = await datatoken.create(config.providerUri, alice)
|
||||
tokenAddress = await datatoken.create(blob, alice)
|
||||
})
|
||||
|
||||
it('Alice mints 100 tokens', async () => {
|
||||
datatoken.mint(tokenAddress, alice, tokenAmount)
|
||||
await datatoken.mint(tokenAddress, alice, tokenAmount)
|
||||
})
|
||||
|
||||
it('Alice transfers 1 token to Bob', async () => {
|
||||
datatoken.transfer(tokenAddress, bob, tokenAmount, alice)
|
||||
const ts = await datatoken.transfer(tokenAddress, bob, tokenAmount, alice)
|
||||
transactionId = ts['transactionHash']
|
||||
})
|
||||
|
||||
it('Bob consumes dataset', async () => {
|
||||
const config = new Config()
|
||||
let ocean = await Ocean.getInstance(config)
|
||||
ocean.assets.download(tokenAddress, blob, bob)
|
||||
await ocean.assets.download(tokenAddress, blob, bob, transactionId)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user