Skip to content

Commit

Permalink
Update base58.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufidimaina9989 authored Oct 15, 2023
1 parent 5816ec9 commit 4a601c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/contracts/base58.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class Base58 extends SmartContractLib{

const bebytes : ByteString = payload + hash256(payload)

let addrInt : bigint = Utils.fromLEUnsigned(reverseByteString(bebytes, 24n))
let addrInt : bigint = Utils.fromLEUnsigned(reverseByteString(bebytes, 58n))

let res : ByteString = toByteString('',true)

let done : boolean = false

for(let i = 0; i < 33; i ++){
if (addrInt <= 0){
if (addrInt <= 0n){
done = true
}
if (!done){
Expand All @@ -53,7 +53,7 @@ export class Base58 extends SmartContractLib{
export class Base58Test extends SmartContract {
@method()
public main(addr: ByteString) {
const verbyte: ByteString = Base58.P2PKH_verbyte_mainnet
const verbyte: ByteString = Base58.P2PKH_verbyte_testnet

const result: ByteString = Base58.base58EncodeCheckAddr(addr, verbyte)

Expand Down

0 comments on commit 4a601c2

Please sign in to comment.