-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhancements for TLink & Mooar views
- Loading branch information
1 parent
9c68191
commit 28749b3
Showing
11 changed files
with
172 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ipt/tokenscript-viewer/src/components/viewers/util/getSelectedOriginTokenFromUrlParams.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {TokenScript} from "@tokenscript/engine-js/src"; | ||
|
||
export async function getSelectedOriginTokenFromUrlParams(tokenScript: TokenScript, chain: number, contract: string){ | ||
|
||
const origins = tokenScript.getTokenOriginData(); | ||
|
||
// TODO: Return the origin specified in the URL | ||
|
||
for (const origin of origins) { | ||
if ( | ||
origin.chainId === chain && | ||
origin.contractAddress.toLowerCase() === contract.toLowerCase() //&& | ||
// This is required to handle ST404, where both the erc20 & 721 contract origins are included in the same tokenscript | ||
// TODO: This causes issues for onboarding cards | ||
//((tokenId === null && origin.tokenType === "erc20") || (tokenId !== null && origin.tokenType !== "erc20")) | ||
) { | ||
return origin; | ||
} | ||
} | ||
|
||
throw new Error("Could not find token origin in the tokenscript"); | ||
} |
Oops, something went wrong.