-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Homogenize example and remove reference to borsh-js
The current examples differ on what they encode / decode, but more importantly, they refer to a `borsh-js` package that does not exist I have modified the dependencies to use the actual Borsh encoding, and homogenized the code so they execute exactly the same code
- Loading branch information
Guillermo Alejandro Gallardo Diez
authored and
Guillermo Alejandro Gallardo Diez
committed
Dec 20, 2024
1 parent
95c5e68
commit 88d0822
Showing
4 changed files
with
21 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import * as borsh from 'borsh-js'; | ||
import * as borsh from 'borsh'; | ||
|
||
const encodedU16 = borsh.serialize('u16', 2); | ||
const decodedU16 = borsh.deserialize('u16', encodedU16); | ||
console.log(decodedU16); | ||
|
||
const encodedStr = borsh.serialize('u64', '100000000000000000'); | ||
const decodedStr = borsh.deserialize('u64', encodedStr); | ||
console.log(decodedStr); | ||
const encodedStr = borsh.serialize('string', 'testing'); | ||
const decodedStr = borsh.deserialize('string', encodedStr); | ||
console.log(decodedStr); | ||
|
||
const encodedU64 = borsh.serialize('u64', '100000000000000000'); | ||
const decodedU64 = borsh.deserialize('u64', encodedU64); | ||
console.log(decodedU64); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters