Skip to content

Commit dadc216

Browse files
authored
Merge pull request ProjectOpenSea#153 from ProjectOpenSea/roy/private-listings
Remove special order handling for Private Sales
2 parents 6b2b9ab + d8a9b6f commit dadc216

File tree

11 files changed

+41
-88
lines changed

11 files changed

+41
-88
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Full changelog coming soon. For now, here are the most important changes for doing major migrations:
44

5+
## Migrating to version 1.2
6+
- `OpenSeaPort::computeFees()` No longer accepts an `isPrivate` parameter.
7+
58
## Migrating to version 1.1
69
- `OpenSeaPort::computeFees()` No longer accepts a `fees` parameter, relying solely on `asset`.
710

lib/seaport.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,12 @@ export declare class OpenSeaPort {
510510
* @param asset Asset to use for fees. May be blank ONLY for multi-collection bundles.
511511
* @param side The side of the order (buy or sell)
512512
* @param accountAddress The account to check fees for (useful if fees differ by account, like transfer fees)
513-
* @param isPrivate Whether the order is private or not (known taker)
514513
* @param extraBountyBasisPoints The basis points to add for the bounty. Will throw if it exceeds the assets' contract's OpenSea fee.
515514
*/
516-
computeFees({ asset, side, accountAddress, isPrivate, extraBountyBasisPoints }: {
515+
computeFees({ asset, side, accountAddress, extraBountyBasisPoints }: {
517516
asset?: OpenSeaAsset;
518517
side: OrderSide;
519518
accountAddress?: string;
520-
isPrivate?: boolean;
521519
extraBountyBasisPoints?: number;
522520
}): Promise<ComputedFees>;
523521
/**

lib/seaport.js

Lines changed: 11 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/seaport.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opensea-js",
3-
"version": "1.1.13",
3+
"version": "1.2.0",
44
"description": "JavaScript SDK for the OpenSea marketplace. Let users buy or sell crypto collectibles and other cryptogoods, all on your own site!",
55
"files": [
66
"lib",

src/seaport.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,15 +1527,13 @@ export class OpenSeaPort {
15271527
* @param asset Asset to use for fees. May be blank ONLY for multi-collection bundles.
15281528
* @param side The side of the order (buy or sell)
15291529
* @param accountAddress The account to check fees for (useful if fees differ by account, like transfer fees)
1530-
* @param isPrivate Whether the order is private or not (known taker)
15311530
* @param extraBountyBasisPoints The basis points to add for the bounty. Will throw if it exceeds the assets' contract's OpenSea fee.
15321531
*/
15331532
public async computeFees(
1534-
{ asset, side, accountAddress, isPrivate = false, extraBountyBasisPoints = 0 }:
1533+
{ asset, side, accountAddress, extraBountyBasisPoints = 0 }:
15351534
{ asset?: OpenSeaAsset;
15361535
side: OrderSide;
15371536
accountAddress?: string;
1538-
isPrivate?: boolean;
15391537
extraBountyBasisPoints?: number }
15401538
): Promise<ComputedFees> {
15411539

@@ -1578,7 +1576,7 @@ export class OpenSeaPort {
15781576
}
15791577

15801578
// Compute bounty
1581-
let sellerBountyBasisPoints = side == OrderSide.Sell
1579+
const sellerBountyBasisPoints = side == OrderSide.Sell
15821580
? extraBountyBasisPoints
15831581
: 0
15841582

@@ -1592,15 +1590,6 @@ export class OpenSeaPort {
15921590
throw new Error(errorMessage)
15931591
}
15941592

1595-
// Remove fees for private orders
1596-
if (isPrivate) {
1597-
openseaBuyerFeeBasisPoints = 0
1598-
openseaSellerFeeBasisPoints = 0
1599-
devBuyerFeeBasisPoints = 0
1600-
devSellerFeeBasisPoints = 0
1601-
sellerBountyBasisPoints = 0
1602-
}
1603-
16041593
return {
16051594
totalBuyerFeeBasisPoints: openseaBuyerFeeBasisPoints + devBuyerFeeBasisPoints,
16061595
totalSellerFeeBasisPoints: openseaSellerFeeBasisPoints + devSellerFeeBasisPoints,
@@ -1942,13 +1931,12 @@ export class OpenSeaPort {
19421931
const schema = this._getSchema(asset.schemaName)
19431932
const quantityBN = WyvernProtocol.toBaseUnitAmount(makeBigNumber(quantity), asset.decimals || 0)
19441933
const wyAsset = getWyvernAsset(schema, asset, quantityBN)
1945-
const isPrivate = buyerAddress != NULL_ADDRESS
19461934

19471935
const openSeaAsset = await this.api.getAsset(asset)
19481936

19491937
const { totalSellerFeeBasisPoints,
19501938
totalBuyerFeeBasisPoints,
1951-
sellerBountyBasisPoints } = await this.computeFees({ asset: openSeaAsset, side: OrderSide.Sell, isPrivate, extraBountyBasisPoints })
1939+
sellerBountyBasisPoints } = await this.computeFees({ asset: openSeaAsset, side: OrderSide.Sell, extraBountyBasisPoints })
19521940

19531941
const { target, calldata, replacementPattern } = encodeSell(schema, wyAsset, accountAddress)
19541942

@@ -2189,16 +2177,14 @@ export class OpenSeaPort {
21892177
bundle.description = bundleDescription
21902178
bundle.external_link = bundleExternalLink
21912179

2192-
const isPrivate = buyerAddress != NULL_ADDRESS
2193-
21942180
// If all assets are for the same collection, use its fees
21952181
const asset = collection
21962182
? await this.api.getAsset(assets[0])
21972183
: undefined
21982184
const {
21992185
totalSellerFeeBasisPoints,
22002186
totalBuyerFeeBasisPoints,
2201-
sellerBountyBasisPoints } = await this.computeFees({ asset, side: OrderSide.Sell, isPrivate, extraBountyBasisPoints })
2187+
sellerBountyBasisPoints } = await this.computeFees({ asset, side: OrderSide.Sell, extraBountyBasisPoints })
22022188

22032189
const { calldata, replacementPattern } = encodeAtomicizedSell(orderedSchemas, bundle.assets, accountAddress, this._wyvernProtocol, this._networkName)
22042190

test/api/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ suite('api', () => {
3333
})
3434

3535
test('API fetches bundles and prefetches sell orders', async () => {
36-
const { bundles } = await apiToTest.getBundles({asset_contract_address: CK_RINKEBY_ADDRESS, on_sale: true})
36+
const { bundles } = await apiToTest.getBundles({asset_contract_address: CK_RINKEBY_ADDRESS})
3737
assert.isArray(bundles)
3838

3939
const bundle = bundles[0]
@@ -131,7 +131,7 @@ suite('api', () => {
131131
if (!order.asset) {
132132
return
133133
}
134-
const url = `https://rinkeby.opensea.io/assets/${order.asset.assetContract.address}/${order.asset.tokenId}`
134+
const url = `https://testnets.opensea.io/assets/${order.asset.assetContract.address}/${order.asset.tokenId}`
135135
assert.equal(order.asset.openseaLink, url)
136136
})
137137

@@ -209,7 +209,7 @@ suite('api', () => {
209209
})
210210

211211
test('API excludes cancelledOrFinalized and markedInvalid orders', async () => {
212-
const {orders} = await apiToTest.getOrders({limit: 100})
212+
const {orders} = await apiToTest.getOrders({limit: 50})
213213
const finishedOrders = orders.filter(o => o.cancelledOrFinalized)
214214
assert.isEmpty(finishedOrders)
215215
const invalidOrders = orders.filter(o => o.markedInvalid)

test/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { OpenSeaAPI } from '../src/api'
22
import { Network } from '../src/types'
33
import {CK_ADDRESS, CK_RINKEBY_ADDRESS} from '../src/constants'
44

5-
export const MAINNET_API_KEY = "testKeyMainnet"
6-
export const RINKEBY_API_KEY = "testKeyRinkeby"
5+
export const MAINNET_API_KEY = "f657f0172a3b4b61bffec08c376dbaf8"
6+
export const RINKEBY_API_KEY = "af3f190b8f2d4d98b51499ae40315829"
77

88
export const mainApi = new OpenSeaAPI({
99
apiKey: MAINNET_API_KEY,

0 commit comments

Comments
 (0)