Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zone parameter to createOffer function for SignedZone support #1515

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const API_BASE_MAINNET = "https://api.opensea.io";
export const API_BASE_TESTNET = "https://testnets-api.opensea.io";

export const DEFAULT_ZONE = ZeroAddress;
export const SIGNED_ZONE = "0x000056f7000000ece9003ca63978907a00ffd100";
export const ENGLISH_AUCTION_ZONE_MAINNETS =
"0x110b2b128a9ed1be5ef3232d8e4e41640df5c2cd";
export const ENGLISH_AUCTION_ZONE_TESTNETS =
Expand Down
5 changes: 4 additions & 1 deletion src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { CollectionOffer, Listing, NFT, Order } from "./api/types";
import {
INVERSE_BASIS_POINT,
DEFAULT_ZONE,
SIGNED_ZONE,
ENGLISH_AUCTION_ZONE_MAINNETS,
ENGLISH_AUCTION_ZONE_TESTNETS,
} from "./constants";
Expand Down Expand Up @@ -342,6 +343,7 @@ export class OpenSeaSDK {
* @param options.expirationTime Expiration time for the order, in UTC seconds
* @param options.paymentTokenAddress ERC20 address for the payment token in the order. If unspecified, defaults to WETH
* @param options.excludeOptionalCreatorFees If true, optional creator fees will be excluded from the offer. Default: false.
* @param options.zone The zone to use for the order. If unspecified, defaults to SIGNED_ZONE.
* @returns The {@link OrderV2} that was created.
*
* @throws Error if the asset does not contain a token id.
Expand All @@ -359,6 +361,7 @@ export class OpenSeaSDK {
expirationTime,
paymentTokenAddress = getWETHAddress(this.chain),
excludeOptionalCreatorFees = false,
zone = SIGNED_ZONE, // Add the zone parameter with default value SIGNED_ZONE
}: {
asset: AssetWithTokenId;
accountAddress: string;
Expand All @@ -369,6 +372,7 @@ export class OpenSeaSDK {
expirationTime?: BigNumberish;
paymentTokenAddress?: string;
excludeOptionalCreatorFees?: boolean;
zone?: string; // Add the zone type
}): Promise<OrderV2> {
await this._requireAccountIsAvailable(accountAddress);

Expand All @@ -394,7 +398,6 @@ export class OpenSeaSDK {
excludeOptionalCreatorFees,
});

let zone = DEFAULT_ZONE;
if (collection.requiredZone) {
zone = collection.requiredZone;
}
Expand Down
Loading