Skip to content

Commit

Permalink
construct RPC urls from apiBaseUrl (ProjectOpenSea#209)
Browse files Browse the repository at this point in the history
* construct RPC urls from apiBaseUrl

* 1.2.1
  • Loading branch information
royliu2 authored Oct 18, 2021
1 parent 8f3401a commit 441ca7c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
5 changes: 3 additions & 2 deletions lib/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ export declare const NULL_ADDRESS: string;
export declare const NULL_BLOCK_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000";
export declare const OPENSEA_FEE_RECIPIENT = "0x5b3256965e7c3cf26e11fcaf296dfc8807c01073";
export declare const DEP_INFURA_KEY = "e8695bce67944848aa95459fac052f8e";
export declare const MAINNET_PROVIDER_URL = "https://api.opensea.io/jsonrpc/v1/";
export declare const RINKEBY_PROVIDER_URL = "https://testnets-api.opensea.io/jsonrpc/v1/";
export declare const INVERSE_BASIS_POINT = 10000;
export declare const MAX_UINT_256: BigNumber;
export declare const WYVERN_EXCHANGE_ADDRESS_MAINNET = "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b";
Expand Down Expand Up @@ -46,5 +44,8 @@ export declare const API_BASE_MAINNET = "https://api.opensea.io";
export declare const API_BASE_RINKEBY = "https://testnets-api.opensea.io";
export declare const SITE_HOST_MAINNET = "https://opensea.io";
export declare const SITE_HOST_RINKEBY = "https://rinkeby.opensea.io";
export declare const RPC_URL_PATH = "jsonrpc/v1/";
export declare const MAINNET_PROVIDER_URL: string;
export declare const RINKEBY_PROVIDER_URL: string;
export declare const ORDERBOOK_PATH: string;
export declare const API_PATH: string;
7 changes: 4 additions & 3 deletions lib/constants.js

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

2 changes: 1 addition & 1 deletion lib/constants.js.map

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

2 changes: 1 addition & 1 deletion lib/seaport.js

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

2 changes: 1 addition & 1 deletion lib/seaport.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opensea-js",
"version": "1.2.0",
"version": "1.2.1",
"description": "JavaScript SDK for the OpenSea marketplace. Let users buy or sell crypto collectibles and other cryptogoods, all on your own site!",
"files": [
"lib",
Expand Down
5 changes: 3 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export const NULL_ADDRESS = WyvernProtocol.NULL_ADDRESS
export const NULL_BLOCK_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000'
export const OPENSEA_FEE_RECIPIENT = '0x5b3256965e7c3cf26e11fcaf296dfc8807c01073'
export const DEP_INFURA_KEY = 'e8695bce67944848aa95459fac052f8e'
export const MAINNET_PROVIDER_URL = 'https://api.opensea.io/jsonrpc/v1/'
export const RINKEBY_PROVIDER_URL = 'https://testnets-api.opensea.io/jsonrpc/v1/'
export const INVERSE_BASIS_POINT = 10000
export const MAX_UINT_256 = WyvernProtocol.MAX_UINT_256
export const WYVERN_EXCHANGE_ADDRESS_MAINNET = '0x7be8076f4ea4a4ad08075c2508e481d6c946d12b'
Expand Down Expand Up @@ -48,5 +46,8 @@ export const API_BASE_MAINNET = 'https://api.opensea.io'
export const API_BASE_RINKEBY = 'https://testnets-api.opensea.io'
export const SITE_HOST_MAINNET = 'https://opensea.io'
export const SITE_HOST_RINKEBY = 'https://rinkeby.opensea.io'
export const RPC_URL_PATH = 'jsonrpc/v1/'
export const MAINNET_PROVIDER_URL = `${API_BASE_MAINNET}/${RPC_URL_PATH}`
export const RINKEBY_PROVIDER_URL = `${API_BASE_RINKEBY}/${RPC_URL_PATH}`
export const ORDERBOOK_PATH = `/wyvern/v${ORDERBOOK_VERSION}`
export const API_PATH = `/api/v${ORDERBOOK_VERSION}`
7 changes: 4 additions & 3 deletions src/seaport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import {
DEFAULT_GAS_INCREASE_FACTOR,
DEFAULT_MAX_BOUNTY,
DEFAULT_SELLER_FEE_BASIS_POINTS,
DEFAULT_WRAPPED_NFT_LIQUIDATION_UNISWAP_SLIPPAGE_IN_BASIS_POINTS, ENJIN_COIN_ADDRESS, INVERSE_BASIS_POINT, MAINNET_PROVIDER_URL, MANA_ADDRESS, MIN_EXPIRATION_SECONDS, NULL_ADDRESS, NULL_BLOCK_HASH, OPENSEA_FEE_RECIPIENT,
DEFAULT_WRAPPED_NFT_LIQUIDATION_UNISWAP_SLIPPAGE_IN_BASIS_POINTS, ENJIN_COIN_ADDRESS, INVERSE_BASIS_POINT, MANA_ADDRESS, MIN_EXPIRATION_SECONDS, NULL_ADDRESS, NULL_BLOCK_HASH, OPENSEA_FEE_RECIPIENT,
OPENSEA_SELLER_BOUNTY_BASIS_POINTS,
ORDER_MATCHING_LATENCY_SECONDS, RINKEBY_PROVIDER_URL,
ORDER_MATCHING_LATENCY_SECONDS,
RPC_URL_PATH,
SELL_ORDER_BATCH_SIZE,
STATIC_CALL_CHEEZE_WIZARDS_ADDRESS,
STATIC_CALL_CHEEZE_WIZARDS_RINKEBY_ADDRESS,
Expand Down Expand Up @@ -90,7 +91,7 @@ export class OpenSeaPort {

this._networkName = apiConfig.networkName

const readonlyProvider = new Web3.providers.HttpProvider(this._networkName == Network.Main ? MAINNET_PROVIDER_URL : RINKEBY_PROVIDER_URL)
const readonlyProvider = new Web3.providers.HttpProvider(`${this.api.apiBaseUrl}/${RPC_URL_PATH}`)

// Web3 Config
this.web3 = new Web3(provider)
Expand Down
4 changes: 0 additions & 4 deletions test/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import { Network, OrderSide } from '../../src/types'
import { getOrderHash, makeBigNumber } from '../../src/utils/utils'
import { ALEX_ADDRESS, apiToTest, CK_ADDRESS, CK_RINKEBY_ADDRESS, CK_RINKEBY_SELLER_FEE, CK_RINKEBY_TOKEN_ID, mainApi, MAINNET_API_KEY, MYTHEREUM_ADDRESS, MYTHEREUM_TOKEN_ID, rinkebyApi, RINKEBY_API_KEY, WETH_ADDRESS } from '../constants'





const provider = new Web3.providers.HttpProvider(MAINNET_PROVIDER_URL)

const client = new OpenSeaPort(provider, {
Expand Down

0 comments on commit 441ca7c

Please sign in to comment.