diff --git a/packages/checkout/sdk/src/Checkout.test.ts b/packages/checkout/sdk/src/Checkout.test.ts index d5245643a6..5eb987a153 100644 --- a/packages/checkout/sdk/src/Checkout.test.ts +++ b/packages/checkout/sdk/src/Checkout.test.ts @@ -465,23 +465,6 @@ describe('Connect', () => { expect(buy).toBeCalledWith(checkout.config, provider, [{ id: '1', takerFees: [] }]); }); - it('should throw error for buy function if is production', async () => { - const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); - - (validateProvider as jest.Mock).mockResolvedValue(provider); - - const checkout = new Checkout({ - baseConfig: { environment: Environment.PRODUCTION }, - }); - - await expect(checkout.buy({ - provider, - orders: [{ id: '1' }], - })).rejects.toThrow('This endpoint is not currently available.'); - - expect(buy).toBeCalledTimes(0); - }); - it('should call sell function', async () => { const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); const sellResult = {}; @@ -523,38 +506,6 @@ describe('Connect', () => { ); }); - it('should throw error for sell function if is production', async () => { - const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); - (validateProvider as jest.Mock).mockResolvedValue(provider); - - const checkout = new Checkout({ - baseConfig: { environment: Environment.PRODUCTION }, - }); - - await expect(checkout.sell({ - provider, - orders: [{ - sellToken: { - id: '0', - collectionAddress: '0xERC721', - }, - buyToken: { - type: ItemType.NATIVE, - amount: '10', - }, - makerFees: [ - { - amount: { percentageDecimal: 0.025 }, - recipient: '0x222', - }, - ], - }], - - })).rejects.toThrow('This endpoint is not currently available.'); - - expect(sell).toBeCalledTimes(0); - }); - it('should call cancel function', async () => { const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); @@ -578,22 +529,6 @@ describe('Connect', () => { ); }); - it('should throw error for cancel function if is production', async () => { - const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); - (validateProvider as jest.Mock).mockResolvedValue(provider); - - const checkout = new Checkout({ - baseConfig: { environment: Environment.PRODUCTION }, - }); - - await expect(checkout.cancel({ - provider, - orderIds: ['1234'], - })).rejects.toThrow('This endpoint is not currently available.'); - - expect(cancel).toBeCalledTimes(0); - }); - it('should call smartCheckout function', async () => { const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); const smartCheckoutResult = {}; @@ -628,34 +563,6 @@ describe('Connect', () => { ); }); - it('should throw error for smartCheckout function if is production', async () => { - const provider = new Web3Provider(providerMock, ChainId.SEPOLIA); - const smartCheckoutResult = {}; - - (validateProvider as jest.Mock).mockResolvedValue(provider); - (smartCheckout as jest.Mock).mockResolvedValue(smartCheckoutResult); - - const checkout = new Checkout({ - baseConfig: { environment: Environment.PRODUCTION }, - }); - - const params: SmartCheckoutParams = { - provider, - itemRequirements: [], - transactionOrGasAmount: { - type: TransactionOrGasType.GAS, - gasToken: { - type: GasTokenType.NATIVE, - limit: BigNumber.from('1'), - }, - }, - }; - - await expect(checkout.smartCheckout(params)).rejects.toThrow('This endpoint is not currently available.'); - - expect(smartCheckout).toBeCalledTimes(0); - }); - it('should throw error for smartCheckout function if cannot get itemRequirements', async () => { const provider = new Web3Provider(providerMock, ChainId.IMTBL_ZKEVM_TESTNET); const smartCheckoutResult = {}; diff --git a/packages/checkout/sdk/src/Checkout.ts b/packages/checkout/sdk/src/Checkout.ts index f8094aa99a..aed8ee8f0e 100644 --- a/packages/checkout/sdk/src/Checkout.ts +++ b/packages/checkout/sdk/src/Checkout.ts @@ -291,13 +291,6 @@ export class Checkout { public async buy( params: BuyParams, ): Promise { - if (this.config.isProduction) { - throw new Error('This endpoint is not currently available.'); - } - - // eslint-disable-next-line no-console - console.warn('This endpoint is currently under construction.'); - if (params.orders.length > 1) { // eslint-disable-next-line no-console console.warn('This endpoint currently only processes the first order in the array.'); @@ -320,13 +313,6 @@ export class Checkout { public async sell( params: SellParams, ): Promise { - if (this.config.isProduction) { - throw new Error('This endpoint is not currently available.'); - } - - // eslint-disable-next-line no-console - console.warn('This endpoint is currently under construction.'); - if (params.orders.length > 1) { // eslint-disable-next-line no-console console.warn('This endpoint currently only processes the first order in the array.'); @@ -351,13 +337,6 @@ export class Checkout { public async cancel( params: CancelParams, ): Promise { - if (this.config.isProduction) { - throw new Error('This endpoint is not currently available.'); - } - - // eslint-disable-next-line no-console - console.warn('This endpoint is currently under construction.'); - // eslint-disable-next-line no-console console.warn('This endpoint currently only processes the first order in the array.'); @@ -376,13 +355,6 @@ export class Checkout { public async smartCheckout( params: SmartCheckoutParams, ): Promise { - if (this.config.isProduction) { - throw new Error('This endpoint is not currently available.'); - } - - // eslint-disable-next-line no-console - console.warn('This endpoint is currently under construction.'); - const web3Provider = await provider.validateProvider( this.config, params.provider,