Skip to content

Commit

Permalink
encode and decode base64 string in args class (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thykof authored Nov 18, 2022
1 parent 9753680 commit 8ddaaf1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@
"bn.js": "^5.2.0",
"buffer": "^6.0.3",
"crypto-js": "^4.1.1",
"js-base64": "^3.7.3",
"varint": "^6.0.0"
},
"devDependencies": {
"@massalabs/massa-sc-utils": "^2.1.6",
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.1",
Expand Down Expand Up @@ -88,7 +90,6 @@
"tslint": "^6.1.3",
"typescript": "^4.8.4",
"uglify-js": "^3.15.4",
"uglifyify": "^5.0.2",
"@massalabs/massa-sc-utils": "^2.1.6"
"uglifyify": "^5.0.2"
}
}
6 changes: 4 additions & 2 deletions src/utils/arguments.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { encode, decode} from "js-base64";

/**
* Args for remote function call.
*
Expand All @@ -14,7 +16,7 @@ export default class Args {
* @param {string} serialized
*/
constructor(serialized: string = "") {
this.serialized = this.fromByteString(serialized);
this.serialized = this.fromByteString(decode(serialized));
}

/**
Expand All @@ -23,7 +25,7 @@ export default class Args {
* @return {string} the serialized string
*/
serialize(): string {
return this.toByteString(this.serialized);
return encode(this.toByteString(this.serialized));
}

// Getters
Expand Down

0 comments on commit 8ddaaf1

Please sign in to comment.