File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,11 +9,12 @@ import {
99 sdk ,
1010 sdkPolygon ,
1111 walletAddress ,
12+ getRandomExpiration ,
1213} from "./setup" ;
1314import { ENGLISH_AUCTION_ZONE_MAINNETS } from "../../src/constants" ;
1415import { getWETHAddress } from "../../src/utils" ;
1516import { OFFER_AMOUNT } from "../utils/constants" ;
16- import { expectValidOrder , getRandomExpiration } from "../utils/utils" ;
17+ import { expectValidOrder } from "../utils/utils" ;
1718
1819suite ( "SDK: order posting" , ( ) => {
1920 test ( "Post Offer - Mainnet" , async ( ) => {
Original file line number Diff line number Diff line change 11import { expect } from "chai" ;
22import { suite , test } from "mocha" ;
3- import { OPENSEA_FEE_RECIPIENT } from "../../src/constants" ;
43import {
4+ getRandomExpiration ,
55 LISTING_AMOUNT ,
66 TOKEN_ADDRESS_MAINNET ,
77 TOKEN_ID_MAINNET ,
88 sdk ,
99 walletAddress ,
10- } from "../integration/setup" ;
11- import { expectValidOrder , getRandomExpiration } from "../utils/utils" ;
10+ } from "./setup" ;
11+ import { OPENSEA_FEE_RECIPIENT } from "../../src/constants" ;
12+ import { expectValidOrder } from "../utils/utils" ;
1213
1314suite ( "SDK: Private Listings Integration" , ( ) => {
1415 test ( "Post Private Listing - Mainnet" , async function ( ) {
Original file line number Diff line number Diff line change @@ -50,3 +50,17 @@ export const sdkPolygon = new OpenSeaSDK(
5050 } ,
5151 ( line ) => console . info ( `POLYGON: ${ line } ` ) ,
5252) ;
53+
54+ export const getRandomExpiration = ( ) : number => {
55+ const now = Math . floor ( Date . now ( ) / 1000 ) ;
56+ const fifteenMinutes = 15 * 60 ;
57+ const oneHour = 60 * 60 ;
58+ const range = oneHour - fifteenMinutes + 1 ;
59+
60+ const crypto = require ( "crypto" ) ;
61+ const randomBuffer = crypto . randomBytes ( 4 ) ;
62+ const randomValue = randomBuffer . readUInt32BE ( 0 ) ;
63+ const randomSeconds = ( randomValue % range ) + fifteenMinutes ;
64+
65+ return now + randomSeconds ;
66+ } ;
Original file line number Diff line number Diff line change @@ -26,17 +26,3 @@ export const expectValidOrder = (order: OrderV2) => {
2626 expect ( field in order ) . to . be . true ;
2727 }
2828} ;
29-
30- export const getRandomExpiration = ( ) : number => {
31- const now = Math . floor ( Date . now ( ) / 1000 ) ;
32- const fifteenMinutes = 15 * 60 ;
33- const oneHour = 60 * 60 ;
34- const range = oneHour - fifteenMinutes + 1 ;
35-
36- const crypto = require ( "crypto" ) ;
37- const randomBuffer = crypto . randomBytes ( 4 ) ;
38- const randomValue = randomBuffer . readUInt32BE ( 0 ) ;
39- const randomSeconds = ( randomValue % range ) + fifteenMinutes ;
40-
41- return now + randomSeconds ;
42- } ;
You can’t perform that action at this time.
0 commit comments