Skip to content

Commit

Permalink
Merge pull request #2108 from demergent-labs/auto_generate_icrcs
Browse files Browse the repository at this point in the history
Auto generate icrcs
  • Loading branch information
lastmjs authored Sep 20, 2024
2 parents d15234a + 7f1791d commit 17dd175
Show file tree
Hide file tree
Showing 33 changed files with 4,556 additions and 1,182 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { getCrc32 } from '@dfinity/principal/lib/esm/utils/getCrc';
import jsSHA from 'jssha';

import { blob, Principal } from '../../../src/lib/experimental';
import { Address } from '../index';

// TODO we need to review these heavily
export function hexAddressFromPrincipal(
principal: Principal,
subaccount: number
): Address {
): string {
return addressFromPrincipal(principal, subaccount);
}

Expand All @@ -22,7 +21,7 @@ export function binaryAddressFromPrincipal(
);
}

export function binaryAddressFromAddress(address: Address): blob {
export function binaryAddressFromAddress(address: string): blob {
return Uint8Array.from(
address.match(/.{1,2}/g)?.map((x) => parseInt(x, 16)) ?? []
);
Expand All @@ -43,7 +42,7 @@ export function binaryAddressFromAddress(address: Address): blob {
function addressFromPrincipal(
principal: Principal,
subaccount: number
): Address {
): string {
const prefixBytes = new Uint8Array([
10, 97, 99, 99, 111, 117, 110, 116, 45, 105, 100
]); // \0xAaccount-id
Expand Down
Loading

0 comments on commit 17dd175

Please sign in to comment.