Documentation
¶
Index ¶
- Constants
- Variables
- func GetHexByteLength(v string) int
- func IsHex(v string) bool
- func IsValidSuiAddress(v string) bool
- func IsValidSuiObjectId(v string) bool
- func IsValidTransactionDigest(v string) bool
- func NormalizeShortSuiAddress(v string) string
- func NormalizeShortSuiCoinType(v string) string
- func NormalizeShortSuiObjectId(v string) string
- func NormalizeSuiAddress(v string) string
- func NormalizeSuiCoinType(v string) string
- func NormalizeSuiObjectId(v string) string
- func SliceToMap[T any, V comparable](src []T, key func(T) V) map[V]T
- func UnsignedIntegerToUint64(v any) uint64
Constants ¶
const ( SuiAddressLength = 32 TxDigestLength = 32 )
Variables ¶
var ( SUI_DECIMALS = 9 MIST_PER_SUI = 1000000000 GAS_SAFE_OVERHEAD uint64 = 1000 MAX_GAS uint64 = 50000000000 MOVE_STDLIB_ADDRESS = NormalizeSuiObjectId("0x1") SUI_FRAMEWORK_ADDRESS = NormalizeSuiObjectId("0x2") SUI_SYSTEM_ADDRESS = NormalizeSuiObjectId("0x3") SUI_CLOCK_OBJECT_ID = NormalizeSuiObjectId("0x6") SUI_SYSTEM_MODULE_NAME = "sui_system" SUI_TYPE_ARG = fmt.Sprintf("%s::sui::SUI", SUI_FRAMEWORK_ADDRESS) SUI_SYSTEM_STATE_OBJECT_ID = NormalizeSuiObjectId("0x5") )
Functions ¶
func GetHexByteLength ¶ added in v0.0.15
func IsValidSuiAddress ¶ added in v0.0.15
func IsValidSuiObjectId ¶ added in v0.0.15
func IsValidTransactionDigest ¶ added in v0.0.15
Returns whether the tx digest is valid based on the serialization format
func NormalizeShortSuiAddress ¶ added in v0.0.15
0x0000000000000000000000000000000000000000000000000000000000000001 -> 0x1
func NormalizeShortSuiCoinType ¶ added in v0.0.15
0x2::sui::SUI -> 0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI
func NormalizeShortSuiObjectId ¶ added in v0.0.15
0x0000000000000000000000000000000000000000000000000000000000000001 -> 0x1
func NormalizeSuiAddress ¶ added in v0.0.15
*
Perform the following operations:
1. Make the address lower case
2. Prepend `0x` if the string does not start with `0x`.
3. Add more zeros if the length of the address(excluding `0x`) is less than `SUI_ADDRESS_LENGTH` *
WARNING: if the address value itself starts with `0x`, e.g., `0x0x`, the default behavior
is to treat the first `0x` not as part of the address. The default behavior can be overridden by
setting `forceAdd0x` to true *
0x1 -> 0x0000000000000000000000000000000000000000000000000000000000000001
func NormalizeSuiCoinType ¶ added in v0.0.15
0x2::sui::SUI -> 0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI
func NormalizeSuiObjectId ¶ added in v0.0.15
0x1 -> 0x0000000000000000000000000000000000000000000000000000000000000001
func SliceToMap ¶ added in v0.0.33
func SliceToMap[T any, V comparable](src []T, key func(T) V) map[V]T
func UnsignedIntegerToUint64 ¶ added in v0.0.33
Types ¶
This section is empty.