Skip to content

Commit

Permalink
Remove Wyvern Specific Functions (#894)
Browse files Browse the repository at this point in the history
Functions Removed:

* encodeCall
* encodeSell
* encodeAtomicizedBuy
* encodeAtomicizedSell
* _makeMatchingOrder
* _sellOrderValidationAndApprovals
* _validateOrder
* _getMetadata
* authorizeOrder
* getNonce
* getOrderCreateWyvernExchangeAddress
* encodeReplacementPattern
  • Loading branch information
JoshuaSchmidt-OpenSea committed Mar 31, 2023
1 parent 4800c4f commit d2ff1c4
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 646 deletions.
23 changes: 1 addition & 22 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import "isomorphic-unfetch";
import _ from "lodash";
import * as QueryString from "query-string";
import {
API_BASE_MAINNET,
API_BASE_TESTNET,
API_PATH,
ORDERBOOK_PATH,
} from "./constants";
import { API_BASE_MAINNET, API_BASE_TESTNET, API_PATH } from "./constants";
import {
BuildOfferResponse,
FulfillmentDataResponse,
Expand Down Expand Up @@ -272,22 +267,6 @@ export class OpenSeaAPI {
return !!json.success;
}

/**
* Get which version of Wyvern exchange to use to create orders
* Simply return null in case API doesn't give us a good response
*/
public async getOrderCreateWyvernExchangeAddress(): Promise<string | null> {
try {
const result = await this.get(`${ORDERBOOK_PATH}/exchange/`);
return result as string;
} catch (error) {
this.logger(
"Couldn't retrieve Wyvern exchange address for order creation"
);
return null;
}
}

/**
* Fetch an asset from the API, throwing if none is found
* @param tokenAddress Address of the asset's contract
Expand Down
38 changes: 0 additions & 38 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,9 @@ export const API_BASE_MAINNET = "https://api.opensea.io";
export const API_BASE_TESTNET = "https://testnets-api.opensea.io";
export const RPC_URL_PATH = "jsonrpc/v1/";
export const MAINNET_PROVIDER_URL = `${API_BASE_MAINNET}/${RPC_URL_PATH}`;
export const ORDERBOOK_PATH = `/wyvern/v${ORDERBOOK_VERSION}`;
export const API_PATH = `/api/v${ORDERBOOK_VERSION}`;
export const MAX_UINT_256 = new BigNumber(2).pow(256).minus(1);

export const EIP_712_ORDER_TYPES = {
EIP712Domain: [
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
],
Order: [
{ name: "exchange", type: "address" },
{ name: "maker", type: "address" },
{ name: "taker", type: "address" },
{ name: "makerRelayerFee", type: "uint256" },
{ name: "takerRelayerFee", type: "uint256" },
{ name: "makerProtocolFee", type: "uint256" },
{ name: "takerProtocolFee", type: "uint256" },
{ name: "feeRecipient", type: "address" },
{ name: "feeMethod", type: "uint8" },
{ name: "side", type: "uint8" },
{ name: "saleKind", type: "uint8" },
{ name: "target", type: "address" },
{ name: "howToCall", type: "uint8" },
{ name: "calldata", type: "bytes" },
{ name: "replacementPattern", type: "bytes" },
{ name: "staticTarget", type: "address" },
{ name: "staticExtradata", type: "bytes" },
{ name: "paymentToken", type: "address" },
{ name: "basePrice", type: "uint256" },
{ name: "extra", type: "uint256" },
{ name: "listingTime", type: "uint256" },
{ name: "expirationTime", type: "uint256" },
{ name: "salt", type: "uint256" },
{ name: "nonce", type: "uint256" },
],
};

export const EIP_712_WYVERN_DOMAIN_NAME = "Wyvern Exchange Contract";
export const EIP_712_WYVERN_DOMAIN_VERSION = "2.3";
export const MERKLE_VALIDATOR_MAINNET =
"0xbaf2127b49fc93cbca6269fade0f7f31df4c88a7";
export const MERKLE_VALIDATOR_RINKEBY =
Expand Down
12 changes: 2 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
/* eslint-disable import/no-unused-modules */
import { OpenSeaAPI } from "./api";
import { OpenSeaSDK, WyvernProtocol } from "./sdk";
import { OpenSeaSDK } from "./sdk";
import { Network, EventData, EventType } from "./types";
export { orderToJSON, orderFromJSON } from "./utils/utils";
export {
encodeCall,
encodeSell,
encodeAtomicizedBuy,
encodeAtomicizedSell,
encodeDefaultCall,
encodeReplacementPattern,
} from "./utils/schemas/schema";
export { WyvernProtocol };
export { encodeDefaultCall } from "./utils/schemas/schema";

/**
* Example setup:
Expand Down
Loading

0 comments on commit d2ff1c4

Please sign in to comment.