-
Notifications
You must be signed in to change notification settings - Fork 302
feat: HTS NFT support #8476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: HTS NFT support #8476
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,6 +224,18 @@ async function getGasLimitFromRPC(query: Record<string, string>, rpcUrl: string) | |
| return response.body; | ||
| } | ||
|
|
||
| /** | ||
| * Check if an EVM address is an HTS (Hedera Token Service) native address. | ||
| * HTS entities on Hedera EVM use "long-zero" addresses where the first 12 bytes are all zeros | ||
| * and the entity number occupies the last 8 bytes (e.g. 0x00000000000000000000000000000000007ac203). | ||
| * Standard Solidity contracts have normal EVM addresses derived from public key hashes. | ||
| */ | ||
| export function isHtsEvmAddress(address: string): boolean { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this address format common for all EVM coins?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it is only for hedera native token, which is compatiable with erc20/erc721 standard but has different address format, other evm chain has address derrived from deployer Address and salt. |
||
| const normalized = address.toLowerCase(); | ||
| // First 12 bytes (24 hex chars) after '0x' prefix are all zeros | ||
| return /^0x0{24}[0-9a-f]{16}$/.test(normalized); | ||
| } | ||
|
|
||
| export function validateHederaAccountId(address: string): { valid: boolean; error: string | null } { | ||
| const parts = address.split('.'); | ||
| if (parts.length !== 3) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this check be made coin agnostic?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped the coinFamily check, since isHtsEvmAddress is sufficient to detect native token on hederaEVM chain and no other evm coin has this address format.