-
Notifications
You must be signed in to change notification settings - Fork 972
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added Collection verification status to api.getAsset (#729) Added SafelistStatus Enum Added safelistRequestStatus to OpenSeaCollection Added safelistRequestStatus to collectionFromJSON * Add getCollection integration test * Move shared initialization logic for integration test to common file --------- Co-authored-by: William Dashan Gan <[email protected]>
- Loading branch information
1 parent
abe5e95
commit 56b51da
Showing
7 changed files
with
80 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { assert } from "chai"; | ||
import { suite, test } from "mocha"; | ||
import { sdk } from "./init"; | ||
import { SafelistStatus } from "../types"; | ||
|
||
suite("SDK: getCollection", () => { | ||
test("Get Verified Collection", async () => { | ||
const slug = "cool-cats-nft"; | ||
const collection = await sdk.api.getCollection(slug); | ||
|
||
assert(collection, "Collection should not be null"); | ||
assert(collection.name, "Collection name should exist"); | ||
assert(collection.slug === slug, "Collection slug should match."); | ||
assert( | ||
collection.safelistRequestStatus === SafelistStatus.VERIFIED, | ||
"Collection should be verified." | ||
); | ||
}); | ||
}); |
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,35 @@ | ||
import { ethers } from "ethers"; | ||
import Web3 from "web3"; | ||
import { Network } from "wyvern-js/lib/types"; | ||
import { | ||
ALCHEMY_API_KEY, | ||
MAINNET_API_KEY, | ||
WALLET_PRIV_KEY, | ||
} from "../__tests__/constants"; | ||
import { OpenSeaSDK } from "../sdk"; | ||
|
||
export const TOKEN_ADDRESS = process.env.SELL_ORDER_CONTRACT_ADDRESS; | ||
export const TOKEN_ID = process.env.SELL_ORDER_TOKEN_ID; | ||
export const LISTING_AMOUNT = process.env.LISTING_AMOUNT; | ||
|
||
const webProvider = new Web3.providers.HttpProvider( | ||
`https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}` | ||
); | ||
|
||
const rpcProvider = new ethers.providers.JsonRpcProvider( | ||
`https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}` | ||
); | ||
|
||
const wallet = new ethers.Wallet(WALLET_PRIV_KEY ?? "", rpcProvider); | ||
|
||
export const walletAddress = wallet.address; | ||
|
||
export const sdk = new OpenSeaSDK( | ||
webProvider, | ||
{ | ||
networkName: Network.Main, | ||
apiKey: MAINNET_API_KEY, | ||
}, | ||
(line) => console.info(`MAINNET: ${line}`), | ||
wallet | ||
); |
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