@relay-protocol/hub-utils 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +27212 -0
- package/dist/index.mjs +27206 -0
- package/package.json +8 -8
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TokenIdComponents, TokenId, VirtualAddressComponents, VirtualAddress } from '@relay-protocol/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generates a token ID based on the chain type, chain ID, and address
|
|
5
|
+
* @param components The token components (family, chainId, address)
|
|
6
|
+
* @returns The keccak256 hash of the token components
|
|
7
|
+
*/
|
|
8
|
+
declare function generateTokenId(components: TokenIdComponents): TokenId;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generates a virtual Ethereum address from token components
|
|
12
|
+
* @param components The token components (family, chainId, address)
|
|
13
|
+
* @returns A checksummed Ethereum address derived from the token ID
|
|
14
|
+
* @remarks This function first generates a token ID using the components,
|
|
15
|
+
* then converts the last 20 bytes of the hash to an Ethereum address.
|
|
16
|
+
* This is equivalent to the Solidity: address(uint160(uint256(addressHash)))
|
|
17
|
+
*/
|
|
18
|
+
declare function generateAddress(components: VirtualAddressComponents): VirtualAddress;
|
|
19
|
+
|
|
20
|
+
declare const generateIntentAddress: (intentId: string) => VirtualAddress;
|
|
21
|
+
|
|
22
|
+
export { generateAddress, generateIntentAddress, generateTokenId };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TokenIdComponents, TokenId, VirtualAddressComponents, VirtualAddress } from '@relay-protocol/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generates a token ID based on the chain type, chain ID, and address
|
|
5
|
+
* @param components The token components (family, chainId, address)
|
|
6
|
+
* @returns The keccak256 hash of the token components
|
|
7
|
+
*/
|
|
8
|
+
declare function generateTokenId(components: TokenIdComponents): TokenId;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generates a virtual Ethereum address from token components
|
|
12
|
+
* @param components The token components (family, chainId, address)
|
|
13
|
+
* @returns A checksummed Ethereum address derived from the token ID
|
|
14
|
+
* @remarks This function first generates a token ID using the components,
|
|
15
|
+
* then converts the last 20 bytes of the hash to an Ethereum address.
|
|
16
|
+
* This is equivalent to the Solidity: address(uint160(uint256(addressHash)))
|
|
17
|
+
*/
|
|
18
|
+
declare function generateAddress(components: VirtualAddressComponents): VirtualAddress;
|
|
19
|
+
|
|
20
|
+
declare const generateIntentAddress: (intentId: string) => VirtualAddress;
|
|
21
|
+
|
|
22
|
+
export { generateAddress, generateIntentAddress, generateTokenId };
|