-
Notifications
You must be signed in to change notification settings - Fork 960
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update to seaport v1.6 * update package-lock * fix + lint * update default offer amount * Revert "update default offer amount" This reverts commit 620366c. * fix sepolia weth address to use same one as opensea
- Loading branch information
Showing
9 changed files
with
996 additions
and
1,065 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 |
---|---|---|
@@ -1 +1 @@ | ||
18.19.1 | ||
20.9.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
import { CROSS_CHAIN_SEAPORT_V1_5_ADDRESS } from "@opensea/seaport-js/lib/constants"; | ||
import { assert } from "chai"; | ||
import { | ||
CROSS_CHAIN_SEAPORT_V1_5_ADDRESS, | ||
CROSS_CHAIN_SEAPORT_V1_6_ADDRESS, | ||
} from "@opensea/seaport-js/lib/constants"; | ||
import { expect } from "chai"; | ||
import { ethers } from "ethers"; | ||
import { suite, test } from "mocha"; | ||
import { isValidProtocol } from "../src/utils/utils"; | ||
|
||
suite("Utils: utils", () => { | ||
test("isValidProtocol works with all forms of address", async () => { | ||
const seaport_v1_5 = CROSS_CHAIN_SEAPORT_V1_5_ADDRESS; | ||
const randomAddress = "0x1F7Cf51573Bf5270323a395F0bb5Fd3c3a4DB867"; | ||
const randomAddress = ethers.Wallet.createRandom().address; | ||
|
||
assert.isTrue(isValidProtocol(seaport_v1_5)); | ||
assert.isFalse(isValidProtocol(randomAddress)); | ||
// Mapping of [address, isValid] | ||
const addressesToCheck: [string, boolean][] = [ | ||
[CROSS_CHAIN_SEAPORT_V1_5_ADDRESS, true], | ||
[CROSS_CHAIN_SEAPORT_V1_6_ADDRESS, true], | ||
[randomAddress, false], | ||
]; | ||
|
||
assert.isTrue(isValidProtocol(seaport_v1_5.toLowerCase())); | ||
assert.isFalse(isValidProtocol(randomAddress.toLowerCase())); | ||
// Check default, lowercase, and checksum addresses | ||
const formatsToCheck = (address: string) => [ | ||
address, | ||
address.toLowerCase(), | ||
ethers.getAddress(address), | ||
]; | ||
|
||
assert.isTrue(isValidProtocol(ethers.getAddress(seaport_v1_5))); | ||
assert.isFalse(isValidProtocol(ethers.getAddress(randomAddress))); | ||
for (const [address, isValid] of addressesToCheck) { | ||
for (const formattedAddress of formatsToCheck(address)) { | ||
expect(isValidProtocol(formattedAddress)).to.equal(isValid); | ||
} | ||
} | ||
}); | ||
}); |