From feeb05a3e1d8a230366532479e402e4ea35e37c2 Mon Sep 17 00:00:00 2001 From: BeroBurny Date: Thu, 19 Sep 2024 16:28:45 +0200 Subject: [PATCH] fix: native token transfer resource id for different endorsements --- .github/workflows/cf-deploy-prod.yml | 1 + .github/workflows/cf-deploy-test.yml | 1 + README.md | 1 + src/components/ExplorerTable/ExplorerTable.tsx | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cf-deploy-prod.yml b/.github/workflows/cf-deploy-prod.yml index d32d24d..e946596 100644 --- a/.github/workflows/cf-deploy-prod.yml +++ b/.github/workflows/cf-deploy-prod.yml @@ -22,6 +22,7 @@ jobs: VITE_INDEXER_URL: "https://api.buildwithsygma.com" VITE_SHARED_CONFIG_URL: "https://sygma-assets-mainnet.s3.us-east-2.amazonaws.com/shared-config-mainnet.json" VITE_EXPLORER_URLS: '[{ "id": 1, "url": "https://etherscan.io" }, { "id": 2, "url": "https://khala.subscan.io" }, {"id": 3, "url": "https://phala.subscan.io" }, { "id": 4, "url": "https://cronoscan.com" }, { "id": 5, "url": "https://basescan.org" }, { "id": 6, "url": "https://gnosisscan.io/" }, { "id": 7, "url": "https://polygonscan.com" }]' + VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID: "0x0000000000000000000000000000000000000000000000000000000000000002" - name: Publish to Cloudflare Pages uses: cloudflare/pages-action@1 with: diff --git a/.github/workflows/cf-deploy-test.yml b/.github/workflows/cf-deploy-test.yml index 2ff8684..a7151eb 100644 --- a/.github/workflows/cf-deploy-test.yml +++ b/.github/workflows/cf-deploy-test.yml @@ -21,6 +21,7 @@ jobs: VITE_INDEXER_URL: "https://api.test.buildwithsygma.com" VITE_SHARED_CONFIG_URL: "https://chainbridge-assets-stage.s3.us-east-2.amazonaws.com/shared-config-test.json" VITE_EXPLORER_URLS: '[{ "id": 2, "url": "https://sepolia.etherscan.io" }, { "id": 3, "url": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frhala-node.phala.network%2Fws#/explorer/query" }, { "id": 5, "url": "https://explorer.cronos.org/testnet" }, { "id": 6, "url": "https://holesky.etherscan.io"}, { "id": 7, "url": "https://mumbai.polygonscan.com" }, { "id": 8, "url": "https://sepolia.arbiscan.io" }, { "id": 9, "url": "https://gnosis-chiado.blockscout.com" }, { "id": 10, "url": "https://sepolia.basescan.org" }, { "id": 11, "url": "https://amoy.polygonscan.com" }, { "id": 12, "url": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Ftestnet-rpc.tangle.tools#/explorer/query" }, { "id": 15, "url": "https://sepolia.explorer.b3.fun" }]' + VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID: "0x1000000000000000000000000000000000000000000000000000000000000000" - name: Publish to Cloudflare Pages uses: cloudflare/pages-action@1 with: diff --git a/README.md b/README.md index 7b9d5cb..f6ca245 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,5 @@ You will need to define the following `env` variables on a `.env` file: VITE_INDEXER_URL="INDEXER_URL" VITE_SHARED_CONFIG_URL="SHARED_CONFIG_URL" VITE_EXPLORER_URLS='[{ "id": number, "url": EXPLORER_URL }]' +VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID: "0x1000000000000000000000000000000000000000000000000000000000000000" ``` \ No newline at end of file diff --git a/src/components/ExplorerTable/ExplorerTable.tsx b/src/components/ExplorerTable/ExplorerTable.tsx index 53076c7..738c9d9 100644 --- a/src/components/ExplorerTable/ExplorerTable.tsx +++ b/src/components/ExplorerTable/ExplorerTable.tsx @@ -37,7 +37,7 @@ type ExplorerTable = { const ExplorerTable: React.FC = ({ state, domainMetadata }: ExplorerTable) => { const { classes } = useStyles() - const NATIVE_RESOURCE_ID = "0x1000000000000000000000000000000000000000000000000000000000000000" + const { VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID } = import.meta.env const renderTransferList = (transferData: Transfer[]): JSX.Element[] => { return transferData.map((transfer: Transfer) => { @@ -112,7 +112,7 @@ const ExplorerTable: React.FC = ({ state, domainMetadata }: Explo - {type !== undefined ? formatTransferType(resourceID !== NATIVE_RESOURCE_ID ? (type as ResourceTypes) : ResourceTypes.NATIVE) : "-"} + {type !== undefined ? formatTransferType(resourceID !== VITE_NATIVE_TOKEN_TRANSFER_RESOURCE_ID ? (type as ResourceTypes) : ResourceTypes.NATIVE) : "-"}