-
Notifications
You must be signed in to change notification settings - Fork 970
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add collection offer reads and token id decoding (#1110)
* add collection offer reads and token id decoding * remove dep * add tests and fix helper function * fix util function * fix integ test * fixes * fixes * fixes * fixes * fixes * fixes * fixes
- Loading branch information
Showing
9 changed files
with
3,948 additions
and
2,012 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,25 @@ | ||
import { assert } from "chai"; | ||
import { suite, test } from "mocha"; | ||
import { sdk } from "./setup"; | ||
import { decodeTokenIds } from "../../src/utils/utils"; | ||
|
||
suite("SDK: getCollectionOffers", () => { | ||
test("Get Collection Offers", async () => { | ||
const slug = "cool-cats-nft"; | ||
const response = await sdk.api.getCollectionOffers(slug); | ||
|
||
assert(response, "Response should not be null"); | ||
assert(response.offers, "Collection offers should not be null"); | ||
assert(response.offers.length > 0, "Collection offers should not be empty"); | ||
const offer = response.offers[0]; | ||
assert(offer.order_hash, "Order hash should not be null"); | ||
const tokens = offer.criteria.encoded_token_ids; | ||
assert(tokens, "Criteria should not be null"); | ||
|
||
const encodedTokenIds = offer.criteria.encoded_token_ids; | ||
assert(encodedTokenIds, "Encoded tokens should not be null"); | ||
|
||
const decodedTokenIds = decodeTokenIds(encodedTokenIds); | ||
assert(decodedTokenIds[0], "Decoded tokens should not be null"); | ||
}); | ||
}); |
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