-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add function hash order * add orderHash in post order return value * feat: order hash * fix: need result * fix: type error * fix: order id nessesary --------- Co-authored-by: night-scholar <[email protected]>
- Loading branch information
1 parent
797bfc4
commit 5ff1562
Showing
26 changed files
with
299 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require('dotenv').config(); | ||
|
||
import { OrderType } from '@/types'; | ||
import { init } from '../src'; | ||
import Web3 from 'web3'; | ||
|
||
describe('Test order fetcher sdk', () => { | ||
const endpoint = process.env.PROVIDER_URL!, | ||
// address = process.env.ADDRESS!, | ||
// privateKey = process.env.PRIVATE_KEY!, | ||
apiKey = process.env.API_KEY!, | ||
web3Provider = new Web3.providers.HttpProvider(endpoint); | ||
|
||
const contractAddress = '0xED5AF388653567Af2F388E6224dC7C4b3241C544'; | ||
|
||
const sdk = init({ | ||
apiKey, | ||
baseUrl: process.env.BASE_URL, | ||
web3Provider, | ||
// agent: | ||
// walletConfig: { | ||
// address, | ||
// privateKey, | ||
// }, | ||
}); | ||
|
||
it('fetch Azuki Listing NFT', async () => { | ||
const orders = await sdk.orderFetcher.getOrdersByContract({ | ||
contractAddress, | ||
limit: 1, | ||
offset: 0, | ||
orderType: OrderType.Listing, | ||
}); | ||
expect(orders.listingDTOs.length).toBe(1); | ||
expect(typeof orders.listingDTOs?.[0].orderHash).toBe('string'); | ||
}); | ||
|
||
it('fetch orders by ids', async () => { | ||
const orders = await sdk.orderFetcher.getOrdersByIds({ | ||
orders: [ | ||
{ | ||
orderId: '650d79013a36395019514b9d', | ||
orderType: OrderType.Listing, | ||
}, | ||
], | ||
}); | ||
expect(orders.listingDTOs.length).toBe(1); | ||
expect(typeof orders.listingDTOs?.[0].orderHash).toBe('string'); | ||
}); | ||
|
||
it('fetch orders by maker', async () => { | ||
const orders = await sdk.orderFetcher.getOrdersByMaker({ | ||
maker: '0x08c1ae7e46d4a13b766566033b5c47c735e19f6f', | ||
orderType: OrderType.Offer, | ||
includePrivate: true, | ||
}); | ||
console.log(orders, orders.offerDTOs?.[0]?.orderHash); | ||
expect(orders.offerDTOs.length > 0).toBe(true); | ||
expect(typeof orders.offerDTOs?.[0].orderHash).toBe('string'); | ||
}); | ||
|
||
it('fetch orders by NFT', async () => { | ||
const orders = await sdk.orderFetcher.getOrdersByNFT({ | ||
contractAddress: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', | ||
tokenId: '2632', | ||
orderType: OrderType.Offer, | ||
}); | ||
expect(orders.offerDTOs.length > 0).toBe(true); | ||
expect(typeof orders.offerDTOs?.[0].orderHash).toBe('string'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.