File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
packages/wallet/primitives/src Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1- import { Bytes , Hash } from 'ox'
1+ import { Address , Bytes , Hash , PublicKey } from 'ox'
22import { Context } from './context.js'
33import { Config , hashConfiguration } from './config.js'
44
5+ export type Checksummed = Address . Address & { readonly _checksummed : unique symbol }
6+
7+ export function checksum ( address : string ) : Checksummed {
8+ return Address . checksum ( address ) as Checksummed
9+ }
10+
11+ export function isChecksummed ( address : any ) : address is Checksummed {
12+ return typeof address === 'string' && Address . validate ( address ) && address === Address . checksum ( address )
13+ }
14+
15+ export function isEqual ( a : Checksummed , b : Checksummed ) : boolean {
16+ return a === b
17+ }
18+
19+ export function fromPublicKey ( publicKey : PublicKey . PublicKey , options ?: Address . fromPublicKey . Options ) : Checksummed {
20+ return checksum ( Address . fromPublicKey ( publicKey , options ) )
21+ }
22+
523export function from ( configuration : Bytes . Bytes | Config , context : Omit < Context , 'stage2' > ) : Checksummed {
624 const imageHash = configuration instanceof Uint8Array ? configuration : hashConfiguration ( configuration )
725
You can’t perform that action at this time.
0 commit comments