mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Updating nftOwner in Order
This commit is contained in:
parent
f045416dbe
commit
a40997f006
@ -30,6 +30,7 @@
|
||||
"test-users": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/users.test.ts'",
|
||||
"test-ve": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/VeOcean.test.ts'",
|
||||
"test-df": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/DFRewards.test.ts'",
|
||||
"test-dt": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/Datatoken.test.ts'",
|
||||
"test-zend": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/ZEnding.test.ts'",
|
||||
"lint": "eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx .",
|
||||
"lint:fix": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx . --fix",
|
||||
|
@ -38,6 +38,12 @@ export function handleOrderStarted(event: OrderStarted): void {
|
||||
const consumer = getUser(event.params.consumer.toHex())
|
||||
order.consumer = consumer.id
|
||||
|
||||
if (token.nft) {
|
||||
const nft = Nft.load(token.nft as string) as Nft
|
||||
const nftOwner = getUser(nft.owner)
|
||||
order.nftOwner = nftOwner.id
|
||||
}
|
||||
|
||||
const payer = getUser(event.params.payer.toHex())
|
||||
payer.totalOrders = payer.totalOrders.plus(integer.ONE)
|
||||
payer.save()
|
||||
|
@ -368,7 +368,7 @@ describe('Datatoken tests', async () => {
|
||||
assert(Number(user2balance) === 0, 'Invalid user2 balance')
|
||||
|
||||
const query = {
|
||||
query: `query {token(id: "${newDtAddress.toLowerCase()}"){id,orderCount,orders {id}}}`
|
||||
query: `query {token(id: "${newDtAddress.toLowerCase()}"){id,orderCount,orders {id, nftOwner{id}}}}`
|
||||
}
|
||||
|
||||
await sleep(2000)
|
||||
@ -428,5 +428,6 @@ describe('Datatoken tests', async () => {
|
||||
assert(token, 'Invalid token')
|
||||
assert(token.orderCount === '1', 'Invalid orderCount after order')
|
||||
assert(token.orders[0].id === orderId)
|
||||
assert(token.orders[0].nftOwner.id === publisher, 'invalid nftOwner')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user