Skip to content

Commit

Permalink
Add zone parameter to createOffer function for SignedZone support (#1515
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pixelpawnshop committed Jul 12, 2024
1 parent 3c7a834 commit fdb5257
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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

0 comments on commit fdb5257

Please sign in to comment.