catchain/ton-address
最新稳定版本:1.0.0
Composer 安装命令:
composer require catchain/ton-address
包简介
Utility functions for working with TON blockchain addresses
README 文档
README
This package contains some PHP utility functions for working with TON blockchain addresses.
Installation
composer require catchain/ton-address
Usage
Checking address validity:
use Catchain\Ton\Address\Address; Address::isValid('EQB/tWkYGPdyPxqz8TXjVaSTKfr1gOOPqOez4d07vHFqUMuk'); // >>> true Address::isValid('this-is-definitely-not-an-address'); // >>> false
Creating Address object:
$address = Address::parse('-1:811ced271f8f449cb51eb5920090b92cb200b20f07170676e9db6fbe9da516cf'); // or in any other format: $address = Address::parse('Uf+BHO0nH49EnLUetZIAkLkssgCyDwcXBnbp22++naUWz5id');
Object structure:
Catchain\Ton\Address\Address {
+wc: -1,
+hashPart: b"ü\x1CÝ'\x1FÅD£Á\x1EÁÆ\0É╣,▓\0▓\x0F\x07\x17\x06vÚ█o¥ØÑ\x16¤",
+isTestOnly: true,
+isBounceable: true,
+isUserFriendly: true,
+isUrlSafe: true,
}
Serializing to string (arguments are self-explanatory):
$address->toString( userFriendly: true, urlSafe: true, bounceable: true, testOnly: false, ); // >>> Ef-BHO0nH49EnLUetZIAkLkssgCyDwcXBnbp22--naUWz8VY
Serializing to the long format:
$address->toString(userFriendly: false); // >>> -1:811ced271f8f449cb51eb5920090b92cb200b20f07170676e9db6fbe9da516cf
By default the object is serialized to the same format that it was created from:
Address::parse('Uf+BHO0nH49EnLUetZIAkLkssgCyDwcXBnbp22++naUWz5id')->toString(); // >>> Uf+BHO0nH49EnLUetZIAkLkssgCyDwcXBnbp22++naUWz5id Address::parse('kf-BHO0nH49EnLUetZIAkLkssgCyDwcXBnbp22--naUWz37S')->toString(); // >>> kf-BHO0nH49EnLUetZIAkLkssgCyDwcXBnbp22--naUWz37S
统计信息
- 总下载量: 8.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-26