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

Remove Wyvern Specific Functions #894

Merged
merged 3 commits into from
Mar 31, 2023
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
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