Skip to content

Commit

Permalink
Merge branch 'main' into DX-2465/rename-x-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSchwert authored Jan 15, 2024
2 parents 5b849f6 + 451cd9d commit 9f8d3a9
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
10 changes: 4 additions & 6 deletions packages/checkout/sdk/src/availability/availability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ describe('availabilityService', () => {
});

describe('checkDexAvailability', () => {
it('should return true when status is 204', async () => {
const mockResponse = {
status: 204,
};
it('should return true when status is 2xx', async () => {
const mockResponse = {};
mockedAxios.post.mockResolvedValueOnce(mockResponse);
const response = await availabilityService(true, false).checkDexAvailability();

Expand All @@ -26,7 +24,7 @@ describe('availabilityService', () => {
const mockResponse = {
status: 403,
};
mockedAxios.post.mockResolvedValueOnce(mockResponse);
mockedAxios.post.mockRejectedValueOnce({ response: mockResponse });
const response = await availabilityService(true, false).checkDexAvailability();

expect(mockedAxios.post).toHaveBeenCalledTimes(1);
Expand All @@ -38,7 +36,7 @@ describe('availabilityService', () => {
status: 500,
statusText: 'error message',
};
mockedAxios.post.mockResolvedValueOnce(mockResponse);
mockedAxios.post.mockRejectedValueOnce({ response: mockResponse });

await expect(availabilityService(true, false).checkDexAvailability())
.rejects
Expand Down
21 changes: 11 additions & 10 deletions packages/checkout/sdk/src/availability/availability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@ export const availabilityService = (
try {
response = await axios.post(`${postEndpoint()}/v1/availability/checkout/swap`);
} catch (error: any) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
response = error.response;
}

if (response.status === 403) {
return false;
}
if (response.status === 204) {
return true;
// If 403 then the service is geo-blocked
if (response.status === 403) return false;

throw new CheckoutError(
`Error fetching from api: ${response.status} ${response.statusText}`,
CheckoutErrorType.API_ERROR,
);
}
throw new CheckoutError(
`Error fetching from api: ${response.status} ${response.statusText}`,
CheckoutErrorType.API_ERROR,
);

return true;
};

return {
Expand Down
6 changes: 4 additions & 2 deletions packages/checkout/widgets-lib/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,10 @@
"fiatPricePrefix": "~ USD $"
},
"BRIDGE_FAILURE": {
"statusText": "Transaction failed",
"actionText": "Review & Try again"
"bridgeFailureText": {
"statusText": "Transaction failed",
"actionText": "Review & Try again"
}
},
"APPROVE_TRANSACTION": {
"content": {
Expand Down
2 changes: 2 additions & 0 deletions packages/checkout/widgets-lib/src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,10 @@
"fiatPricePrefix": "~ USD $"
},
"BRIDGE_FAILURE": {
"bridgeFailureText": {
"statusText": "トランザクションが失敗しました",
"actionText": "再確認してもう一度試す"
}
},
"APPROVE_TRANSACTION": {
"content": {
Expand Down
6 changes: 4 additions & 2 deletions packages/checkout/widgets-lib/src/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,10 @@
"fiatPricePrefix": "~ USD $"
},
"BRIDGE_FAILURE": {
"statusText": "거래 실패",
"actionText": "검토하고 다시 시도하세요"
"bridgeFailureText": {
"statusText": "거래 실패",
"actionText": "검토하고 다시 시도하세요"
}
},
"APPROVE_TRANSACTION": {
"content": {
Expand Down
6 changes: 4 additions & 2 deletions packages/checkout/widgets-lib/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,10 @@
"fiatPricePrefix": "~ 美元 $"
},
"BRIDGE_FAILURE": {
"statusText": "交易失败",
"actionText": "审查并重试"
"bridgeFailureText": {
"statusText": "交易失败",
"actionText": "审查并重试"
}
},
"APPROVE_TRANSACTION": {
"content": {
Expand Down
8 changes: 4 additions & 4 deletions packages/orderbook/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export function getOrderbookConfig(
switch (environment) {
case Environment.SANDBOX:
return {
seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
seaportContractAddress: '0x7d117aA8BD6D31c4fa91722f246388f38ab1942c',
zoneContractAddress: '0x8831867E347AB87FA30199C5B695F0A31604Bb52',
apiEndpoint: 'https://api.sandbox.immutable.com',
chainName: TESTNET_CHAIN_NAME,
provider: new providers.JsonRpcProvider(
Expand All @@ -37,8 +37,8 @@ export function getOrderbookConfig(
// not yet deployed
case Environment.PRODUCTION:
return {
seaportContractAddress: '',
zoneContractAddress: '',
seaportContractAddress: '0x6c12aD6F0bD274191075Eb2E78D7dA5ba6453424',
zoneContractAddress: '0x00338b92Bec262078B3e49BF12bbEA058916BF91',
apiEndpoint: 'https://api.immutable.com',
chainName: MAINNET_CHAIN_NAME,
provider: new providers.JsonRpcProvider(
Expand Down

0 comments on commit 9f8d3a9

Please sign in to comment.