static-address

Crates.iostatic-address
lib.rsstatic-address
version0.2.2
sourcesrc
created_at2022-07-03 17:05:03.663671
updated_at2022-07-22 20:55:49.613683
descriptionA macro used for compile-time parsing of Move account addresses into byte arrays for near 0-cost static addresses.
homepagehttps://moving.wtf
repositoryhttps://github.com/movingco/static-address
max_upload_size
id618445
size4,081
Ian Macalinao (macalinao)

documentation

README

static-address

Crates.io License Build Status Contributors

The static-address crate provides a macro static_address!, used for compile-time parsing of strings into a static address. This provides an efficient way of declaring Move account addresses in source code while incurring almost no runtime cost in programs, without having to declare the byte array yourself. The actual code is adapted from here.

Usage

let key =
    static_address!("0x80809acd8d3bc3d30aea82e5506f45951e3eb53e2fda39da6d772647e52c25cd");
assert_eq!(
    key.to_hex_literal(),
    "0x80809acd8d3bc3d30aea82e5506f45951e3eb53e2fda39da6d772647e52c25cd"
);

An example of using this for an Aptos project is available at crates/static-address-example-aptos.

License

static-address is licensed under the Apache License, version 2.0.

Commit count: 29

cargo fmt