mirror of https://github.com/status-im/js-waku.git
Merge #16
16: Update nim-waku, `0x` now optional in RPC requests r=D4nte a=D4nte Confirms resolution of https://github.com/status-im/nim-waku/issues/415 Co-authored-by: Franck Royer <franck@royer.one>
This commit is contained in:
commit
fdff7c43b8
2
nim-waku
2
nim-waku
|
@ -1 +1 @@
|
||||||
Subproject commit 4ae1cd4737dacdd30f879eea199e0a89a9c1532e
|
Subproject commit d1c1a0ca13e3aa2690a6550faca13210e1f46877
|
|
@ -22,7 +22,7 @@ it('Correctly serialized arguments', function () {
|
||||||
|
|
||||||
it('Convert utf-8 string to hex', function () {
|
it('Convert utf-8 string to hex', function () {
|
||||||
const str = 'This is an utf-8 string.';
|
const str = 'This is an utf-8 string.';
|
||||||
const expected = '0x5468697320697320616e207574662d3820737472696e672e';
|
const expected = '5468697320697320616e207574662d3820737472696e672e';
|
||||||
|
|
||||||
const actual = strToHex(str);
|
const actual = strToHex(str);
|
||||||
expect(actual).deep.equal(expected);
|
expect(actual).deep.equal(expected);
|
||||||
|
@ -55,7 +55,7 @@ it('Convert buffer to hex', function () {
|
||||||
0x67,
|
0x67,
|
||||||
0x2e,
|
0x2e,
|
||||||
]);
|
]);
|
||||||
const expected = '0x5468697320697320616e207574662d3820737472696e672e';
|
const expected = '5468697320697320616e207574662d3820737472696e672e';
|
||||||
|
|
||||||
const actual = bufToHex(buf);
|
const actual = bufToHex(buf);
|
||||||
expect(actual).to.deep.equal(expected);
|
expect(actual).to.deep.equal(expected);
|
||||||
|
|
|
@ -243,16 +243,13 @@ export function strToHex(str: string): string {
|
||||||
hex = str;
|
hex = str;
|
||||||
console.log('invalid text input: ' + str);
|
console.log('invalid text input: ' + str);
|
||||||
}
|
}
|
||||||
return '0x' + hex;
|
return hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function bufToHex(buffer: Uint8Array) {
|
export function bufToHex(buffer: Uint8Array) {
|
||||||
return (
|
return Array.prototype.map
|
||||||
'0x' +
|
.call(buffer, (x) => ('00' + x.toString(16)).slice(-2))
|
||||||
Array.prototype.map
|
.join('');
|
||||||
.call(buffer, (x) => ('00' + x.toString(16)).slice(-2))
|
|
||||||
.join('')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RpcInfoResponse {
|
interface RpcInfoResponse {
|
||||||
|
|
Loading…
Reference in New Issue