Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return this._rpc.abciQuery(path, subspace).then(result => {
if (!result.response || !result.response.value) {
throw new Error('QuerySubspace failed: Empty result');
}
const resValStr = ByteBuffer.atob(result.response.value);
let resKVs = JSON.parse(resValStr);
let rst = [];
if (resKVs === null) {
return rst;
}
for (let i = 0; i < resKVs.length; i++) {
const rawKey = ByteBuffer.atob(resKVs[i].key);
let keyStr = '';
switch (getKeyBy) {
case GetKeyBy.GetHexSubstringAfterKeySeparator: {
keyStr = Keys$1.getHexSubstringAfterKeySeparator(rawKey);
break;
}
case GetKeyBy.GetSubstringAfterKeySeparator: {
keyStr = Keys$1.getSubstringAfterKeySeparator(rawKey);
break;
return this._rpc.abciQuery(path, '').then(result => {
if (!result.response || !result.response.value) {
throw new Error('Query failed: Empty result');
}
const jsonStr = ByteBuffer.atob(result.response.value);
return decodeObject(JSON.parse(jsonStr) as T);
});
}
return this._rpc.abciQuery(path, '').then(result => {
if (!result.response || !result.response.value) {
throw new Error('Query failed: Empty result');
}
const jsonStr = ByteBuffer.atob(result.response.value);
return decodeObject(JSON.parse(jsonStr));
});
}
? v.block.data.txs.map(tx => JSON.parse(ByteBuffer.atob(tx)))
: [];
return this._rpc.abciQuery(path, subspace).then(result => {
if (!result.response || !result.response.value) {
throw new Error('QuerySubspace failed: Empty result');
}
const resValStr = ByteBuffer.atob(result.response.value);
let resKVs = JSON.parse(resValStr);
let rst: ResultKV[] = [];
if (resKVs === null) {
return rst;
}
for (let i = 0; i < resKVs.length; i++) {
const rawKey = ByteBuffer.atob(resKVs[i].key);
let keyStr: string = '';
switch (getKeyBy) {
case GetKeyBy.GetHexSubstringAfterKeySeparator: {
keyStr = Keys.getHexSubstringAfterKeySeparator(rawKey);
break;
}
case GetKeyBy.GetSubstringAfterKeySeparator: {
keyStr = Keys.getSubstringAfterKeySeparator(rawKey);
break;
}
default: {
keyStr = rawKey;
}
}
const jsonValueStr = ByteBuffer.atob(resKVs[i].value);
let value = JSON.parse(jsonValueStr) as V;
const rawKey = ByteBuffer.atob(resKVs[i].key);
let keyStr = '';
switch (getKeyBy) {
case GetKeyBy.GetHexSubstringAfterKeySeparator: {
keyStr = Keys$1.getHexSubstringAfterKeySeparator(rawKey);
break;
}
case GetKeyBy.GetSubstringAfterKeySeparator: {
keyStr = Keys$1.getSubstringAfterKeySeparator(rawKey);
break;
}
default: {
keyStr = rawKey;
}
}
const jsonValueStr = ByteBuffer.atob(resKVs[i].value);
let value = JSON.parse(jsonValueStr);
let item = { key: keyStr, value: decodeObject(value) };
rst.push(item);
}
return rst;
});
}
return this._rpc.abciQuery(path, subspace).then(result => {
if (!result.response || !result.response.value) {
throw new Error('QuerySubspace failed: Empty result');
}
const resValStr = ByteBuffer.atob(result.response.value);
let resKVs = JSON.parse(resValStr);
let rst: ResultKV[] = [];
if (resKVs === null) {
return rst;
}
for (let i = 0; i < resKVs.length; i++) {
const rawKey = ByteBuffer.atob(resKVs[i].key);
let keyStr: string = '';
switch (getKeyBy) {
case GetKeyBy.GetHexSubstringAfterKeySeparator: {
keyStr = Keys.getHexSubstringAfterKeySeparator(rawKey);
break;
}
case GetKeyBy.GetSubstringAfterKeySeparator: {
keyStr = Keys.getSubstringAfterKeySeparator(rawKey);
break;
return this._rpc.abciQuery(path, subspace).then(result => {
if (!result.response || !result.response.value) {
throw new Error('QuerySubspace failed: Empty result');
}
const resValStr = ByteBuffer.atob(result.response.value);
let resKVs = JSON.parse(resValStr);
let rst = [];
if (resKVs === null) {
return rst;
}
for (let i = 0; i < resKVs.length; i++) {
const rawKey = ByteBuffer.atob(resKVs[i].key);
let keyStr = '';
switch (getKeyBy) {
case GetKeyBy.GetHexSubstringAfterKeySeparator: {
keyStr = Keys$1.getHexSubstringAfterKeySeparator(rawKey);
break;
}
case GetKeyBy.GetSubstringAfterKeySeparator: {
keyStr = Keys$1.getSubstringAfterKeySeparator(rawKey);
break;
}
default: {
keyStr = rawKey;
}
}
const jsonValueStr = ByteBuffer.atob(resKVs[i].value);
let value = JSON.parse(jsonValueStr);
? v.block.data.txs.map(tx => JSON.parse(ByteBuffer.atob(tx)))
: [];
const rawKey = ByteBuffer.atob(resKVs[i].key);
let keyStr: string = '';
switch (getKeyBy) {
case GetKeyBy.GetHexSubstringAfterKeySeparator: {
keyStr = Keys.getHexSubstringAfterKeySeparator(rawKey);
break;
}
case GetKeyBy.GetSubstringAfterKeySeparator: {
keyStr = Keys.getSubstringAfterKeySeparator(rawKey);
break;
}
default: {
keyStr = rawKey;
}
}
const jsonValueStr = ByteBuffer.atob(resKVs[i].value);
let value = JSON.parse(jsonValueStr) as V;
let item: ResultKV = { key: keyStr, value: decodeObject(value) };
rst.push(item);
}
return rst;
});
}