Skip to content

Commit

Permalink
Add deoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Lavinia Talpas authored and bferenc committed Feb 15, 2024
1 parent 967f8e5 commit 1818e8a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/evm/base58Decoder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Serialization } from "../../src/utils"
import { SerializedType } from "../../src/utils"
import { SerializedEncoding } from "../../src/utils"


const base58Decoder = (item: string) => {
const hexVal: string = serialization.decoder(item, base58 , cb58, hex )
return hexVal
}

const cb58: SerializedType = "cb58"
const base58: SerializedEncoding = "base58"
const hex: SerializedType = "hex"
const serialization: Serialization = Serialization.getInstance()

const main = async (): Promise<any> => {
const base58: string = "2MJd1pvSzdvvFKk3aa6qCa4trgnRfjzNfkTCWHha6TxtthsNfd"

const decoded: string = base58Decoder(base58)
console.log("0x" + decoded)
}

main()

0 comments on commit 1818e8a

Please sign in to comment.