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(
|
public async download(
|
||||||
dtAddress: string,
|
dtAddress: string,
|
||||||
serviceEndpoint: string,
|
serviceEndpoint: string,
|
||||||
|
txId: string,
|
||||||
account: string
|
account: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
|
||||||
let consumeUrl = serviceEndpoint
|
let consumeUrl = serviceEndpoint
|
||||||
// consumeUrl += `&consumerAddress=${account}`
|
consumeUrl += `?`
|
||||||
// consumeUrl += `&serviceAgreementId=${dtAddress}`
|
consumeUrl += `consumerAddress=${account}`
|
||||||
|
consumeUrl += `&tokenAddress=${dtAddress}`
|
||||||
|
consumeUrl += `&transferTxId=${txId}`
|
||||||
|
|
||||||
let serviceConnector = new WebServiceConnector(this.logger)
|
let serviceConnector = new WebServiceConnector(this.logger)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await serviceConnector.downloadFile(consumeUrl)
|
await serviceConnector.downloadFile(consumeUrl)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error('Error consuming assets')
|
this.logger.error('Error consuming assets')
|
||||||
this.logger.error(e)
|
this.logger.error(e)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
return serviceEndpoint
|
return serviceEndpoint
|
||||||
|
@ -20,6 +20,7 @@ describe('Simple flow', () => {
|
|||||||
let contracts
|
let contracts
|
||||||
let datatoken
|
let datatoken
|
||||||
let tokenAddress
|
let tokenAddress
|
||||||
|
let transactionId
|
||||||
|
|
||||||
let tokenAmount = 100
|
let tokenAmount = 100
|
||||||
let transferAmount = 1
|
let transferAmount = 1
|
||||||
@ -38,21 +39,22 @@ describe('Simple flow', () => {
|
|||||||
it('Alice publishes a dataset', async () => {
|
it('Alice publishes a dataset', async () => {
|
||||||
// Alice creates a Datatoken
|
// Alice creates a Datatoken
|
||||||
datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
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 () => {
|
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 () => {
|
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 () => {
|
it('Bob consumes dataset', async () => {
|
||||||
const config = new Config()
|
const config = new Config()
|
||||||
let ocean = await Ocean.getInstance(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