Package com.swmansion.starknet.data
Object ContractAddressCalculator
-
- All Implemented Interfaces:
public class ContractAddressCalculator
Toolkit offering address related functionalities.
-
-
Field Summary
Fields Modifier and Type Field Description public final static ContractAddressCalculator
INSTANCE
-
Method Summary
Modifier and Type Method Description final static Felt
calculateAddressFromHash(Felt classHash, List<Felt> calldata, Felt salt, Felt deployerAddress)
Calculate address of a contract on Starknet. final static Felt
calculateAddressFromHash(Felt classHash, List<Felt> calldata, Felt salt)
Calculate address of a contract on Starknet. final static Boolean
isChecksumAddressValid(String address)
Checks if provided string is in a checksum address format. final static String
calculateChecksumAddress(Felt address)
Outputs formatted checksum address. -
-
Method Detail
-
calculateAddressFromHash
final static Felt calculateAddressFromHash(Felt classHash, List<Felt> calldata, Felt salt, Felt deployerAddress)
Calculate address of a contract on Starknet.
- Parameters:
classHash
- hash of the contract codecalldata
- constructor calldata used for deploymentsalt
- salt used to calculate addressdeployerAddress
- address that deployed contract
-
calculateAddressFromHash
final static Felt calculateAddressFromHash(Felt classHash, List<Felt> calldata, Felt salt)
Calculate address of a contract on Starknet. Doesn't require deployerAddress.
- Parameters:
classHash
- hash of the contract codecalldata
- constructor calldata used for deploymentsalt
- salt used to calculate address
-
isChecksumAddressValid
final static Boolean isChecksumAddressValid(String address)
Checks if provided string is in a checksum address format.
- Parameters:
address
- to check
-
calculateChecksumAddress
final static String calculateChecksumAddress(Felt address)
Outputs formatted checksum address.
Follows implementation of starknet.js. EIP55 was an inspiration, but it is not compatible as it treats hex string as encoded number, instead of encoding it as ASCII string. Example checksum address - 0x02Fd23d9182193775423497fc0c472E156C57C69E4089A1967fb288A2d84e914.
- Parameters:
address
- to encode
-
-
-
-