Skip to content

Commit

Permalink
fix: native token transfer resource id for different endorsements
Browse files Browse the repository at this point in the history
  • Loading branch information
BeroBurny committed Sep 19, 2024
1 parent 1e04aaf commit feeb05a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cf-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cf-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
4 changes: 2 additions & 2 deletions src/components/ExplorerTable/ExplorerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type ExplorerTable = {

const ExplorerTable: React.FC<ExplorerTable> = ({ 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) => {
Expand Down Expand Up @@ -112,7 +112,7 @@ const ExplorerTable: React.FC<ExplorerTable> = ({ state, domainMetadata }: Explo
<TableCell className={clsx(classes.row, classes.dataRow)}>
<span className={classes.amountInfo}>
<span>
{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) : "-"}
</span>
</span>
</TableCell>
Expand Down

0 comments on commit feeb05a

Please sign in to comment.