Skip to content

Commit

Permalink
Merge branch 'ofir/platf-3661-better-opensea-api-key-errors-alerts' i…
Browse files Browse the repository at this point in the history
…nto staging
  • Loading branch information
nofir committed May 23, 2024
2 parents 67b4924 + 1fd6fda commit 04ab488
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/continuous-delivery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,7 @@ jobs:
./prod/platform/relayer-amoy.yaml \
${{ github.sha }} \
relayer-amoy
./utils/version_update.sh \
./prod/platform/relayer-cyber.yaml \
${{ github.sha }} \
relayer-cyber
9 changes: 9 additions & 0 deletions src/jobs/seaport-sync/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ export const fetchOrders = async (
await new Promise((resolve) => setTimeout(resolve, 5000));
continue;
}
} else if (error.response?.status === 401) {
logger.error(
"fetch_orders_seaport",
JSON.stringify({
message: `UnauthorizedError. context=fetchOrders, message=${error.message}, url=${error.config?.url}`,
requestHeaders: error.config?.headers,
responseData: JSON.stringify(error.response?.data),
})
);
} else {
logger.error(
"fetch_orders_seaport",
Expand Down
2 changes: 1 addition & 1 deletion src/jobs/sync-token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ if (config.doBackgroundWork) {
const network = config.openseaChainName;

if (!hostname) {
logger.debug("fast_sync_token",`${config.chainId} not supported`);
logger.debug("fast_sync_token", `${config.chainId} not supported`);
return;
}

Expand Down
41 changes: 41 additions & 0 deletions src/tests/element/element.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,45 @@ describe("Element", () => {
}
}
});

test("parseNewOrder", async () => {
const parsed = await element.parseOrder({
chain: "eth",
chainId: "0x1",
orderHash:
"0x3faecdffbbe4de382e8087fddec9a3227615baa1618fd51293f7503e4a651766_1",
orderId: "1442690384920285728",
expirationTime: 1718118712,
listingTime: 1715526658,
createTime: 1715526723,
maker: "0xdb2ab5671bf17ca408fe75e90571fbe675d01c00",
taker: "0x0000000000000000000000000000000000000000",
side: 1,
saleKind: 3,
paymentToken: "0x0000000000000000000000000000000000000000",
quantity: "1",
priceBase: 0.0025,
priceUSD: 7.319725,
price: 0.0025,
standard: "element-ex-v3",
contractAddress: "0x0a252663dbcc0b073063d6420a40319e438cfa59",
tokenId: "62708",
schema: "ERC721",
extra: null,
exchangeData:
'{"basicCollections":[{"nftAddress":"0x0a252663dbcc0b073063d6420a40319e438cfa59","platformFee":50,"royaltyFeeRecipient":"0x0000000000000000000000000000000000000000","royaltyFee":0,"items":[{"erc20TokenAmount":"2500000000000000","nftId":"62708"}]}],"collections":null,"startNonce":1,"nonce":1,"hashNonce":"0","platformFeeRecipient":"0x00ca62445b06a9adc1879a44485b4efdcb7b75f3","v":0,"r":"","s":"","listingTime":1715526658,"expirationTime":1718118712,"maker":"0xdb2ab5671bf17ca408fe75e90571fbe675d01c00","hash":"0x3faecdffbbe4de382e8087fddec9a3227615baa1618fd51293f7503e4a651766","paymentToken":"0x0000000000000000000000000000000000000000","signatureType":0,"oracleSignature":1,"extraData":""}',
} as any);

// console.log(
// "parsed",
// JSON.stringify({
// orders: [
// {
// kind: "element",
// data: parsed?.params,
// },
// ],
// })
// );
});
});
16 changes: 13 additions & 3 deletions src/utils/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export type ElementOrder = {
listingTime: number;

orderHash: string;
orderId?: string;

maker: string;
taker: string;

Expand Down Expand Up @@ -120,8 +122,10 @@ export class Element {
}

const json = JSON.parse(params.exchangeData);

let order: Sdk.Element.Order;
if (params.saleKind === SaleKind.BatchSignedOrder) {
return new Sdk.Element.Order(config.chainId, {
order = new Sdk.Element.Order(config.chainId, {
...json,
erc20Token: json.paymentToken,
});
Expand All @@ -130,7 +134,7 @@ export class Element {
params.schema.toLowerCase() === "erc721"
? json.order.nftProperties
: json.order.erc1155TokenProperties;
return new Sdk.Element.Order(config.chainId, {
order = new Sdk.Element.Order(config.chainId, {
direction:
params.side === 1
? Sdk.Element.Types.TradeDirection.SELL
Expand All @@ -146,8 +150,14 @@ export class Element {
: String(params.quantity),
});
}

if (json.oracleSignature) {
(order.params as any).elementId = params.orderId;
}

return order;
} catch {
// Skip any errors
// Skip errors
}
}
}

0 comments on commit 04ab488

Please sign in to comment.