-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.ts
More file actions
24 lines (17 loc) · 929 Bytes
/
query.ts
File metadata and controls
24 lines (17 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ts-node
/* eslint-disable no-console */
import { ethers } from 'ethers'
import { MarketplaceV2, SaleDetails } from './lib'
const provider = new ethers.providers.JsonRpcProvider('https://rpc.ftm.tools/')
const marketplace = new MarketplaceV2(provider)
const QueryID = 68897 // https://paintswap.finance/marketplace/68897
marketplace.getNextMarketplaceId().then((next: ethers.BigNumber) => {
const current = next.sub(1)
console.log(`The latest sale on the marketplace is ID ${current} : https://paintswap.finance/marketplace/${current}`)
})
marketplace.getSaleDetails(ethers.BigNumber.from(QueryID)).then((details: SaleDetails) => {
console.log(`Sale details for sale ${QueryID}:\n`, details)
})
marketplace.getNextMinimumBidOrOffer(ethers.BigNumber.from(QueryID)).then((next) => {
console.log(`Next minimum bid or offer for sale ${QueryID}: `, `${ethers.utils.formatEther(next.toString())} $FTM`)
})