Skip to content

Commit

Permalink
Merge #16
Browse files Browse the repository at this point in the history
16: Update nim-waku, `0x` now optional in RPC requests r=D4nte a=D4nte

Confirms resolution of waku-org/nwaku#415

Co-authored-by: Franck Royer <franck@royer.one>
  • Loading branch information
bors[bot] and D4nte authored Mar 29, 2021
2 parents 46869e9 + c4d3c7f commit fdff7c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion nim-waku
4 changes: 2 additions & 2 deletions src/test_utils/nim_waku.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ it('Correctly serialized arguments', function () {

it('Convert utf-8 string to hex', function () {
const str = 'This is an utf-8 string.';
const expected = '0x5468697320697320616e207574662d3820737472696e672e';
const expected = '5468697320697320616e207574662d3820737472696e672e';

const actual = strToHex(str);
expect(actual).deep.equal(expected);
Expand Down Expand Up @@ -55,7 +55,7 @@ it('Convert buffer to hex', function () {
0x67,
0x2e,
]);
const expected = '0x5468697320697320616e207574662d3820737472696e672e';
const expected = '5468697320697320616e207574662d3820737472696e672e';

const actual = bufToHex(buf);
expect(actual).to.deep.equal(expected);
Expand Down
11 changes: 4 additions & 7 deletions src/test_utils/nim_waku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,13 @@ export function strToHex(str: string): string {
hex = str;
console.log('invalid text input: ' + str);
}
return '0x' + hex;
return hex;
}

export function bufToHex(buffer: Uint8Array) {
return (
'0x' +
Array.prototype.map
.call(buffer, (x) => ('00' + x.toString(16)).slice(-2))
.join('')
);
return Array.prototype.map
.call(buffer, (x) => ('00' + x.toString(16)).slice(-2))
.join('');
}

interface RpcInfoResponse {
Expand Down

0 comments on commit fdff7c4

Please sign in to comment.