@unique-nft/utils
Version:
A tiny library to work with Substrate and Ethereum addresses and do some more
60 lines (55 loc) • 2.34 kB
text/typescript
export { i as Address, c as constants } from './index-XOBz1zC0.mjs';
import * as utfHelpers from 'utf-helpers';
export { utfHelpers as StringUtils };
import * as coinFormat from 'coin-format';
export { Coin, ICoin, ICoinFormats } from 'coin-format';
export { A as AddressType, C as CrossAccountId, e as CrossAccountIdOrString, d as CrossAccountIdUncapitalized, f as CrossAccountIdUncapitalizedOrString, c as EnhancedCrossAccountId, E as EthAddressObj, b as EthAddressObjUncapitalized, g as EthCrossAccountId, S as SubAddressObj, a as SubAddressObjUncapitalized } from './types-DG4aSWMh.mjs';
import 'base-x';
import '@noble/hashes/sha3';
import '@noble/hashes/blake2b';
function _mergeNamespaces(n, m) {
m.forEach(function (e) {
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
if (k !== 'default' && !(k in n)) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
});
return Object.freeze(n);
}
var coin = /*#__PURE__*/_mergeNamespaces({
__proto__: null
}, [coinFormat]);
declare const HexString: {
fromArray: (bytes: number[] | Uint8Array) => string;
fromU8a: (bytes: number[] | Uint8Array) => string;
toArray(hexString: string): number[];
toU8a: (hexString: string) => Uint8Array;
};
declare const Utf8: {
stringToU8a(str: string): Uint8Array;
stringToNumberArray(str: string): number[];
u8aToString(u8a: Uint8Array): string;
numberArrayToString(arr: number[] | Uint8Array): string;
stringToHexString(str: string): string;
hexStringToString(hexString: string): string;
lengthInBytes(str: string): number;
};
declare const Utf16: {
stringToU16a(str: string): Uint16Array;
stringToNumberArray(str: string): number[];
numberArrayToString(arr: number[] | Uint16Array): string;
u16aToString(arr: number[] | Uint16Array): string;
lengthInBytes(str: string): number;
};
declare const HexUtils: {
fromArray: (bytes: number[] | Uint8Array) => string;
fromU8a: (bytes: number[] | Uint8Array) => string;
toArray(hexString: string): number[];
toU8a: (hexString: string) => Uint8Array;
};
export { coin as CoinUtils, HexString, HexUtils, Utf16, Utf8 };