How to use the bytebuffer.atob function in bytebuffer

To help you get started, we’ve selected a few bytebuffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-network / lino-js / lib / lino-js.esm.js View on Github external
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;
github lino-network / lino-js / src / transport / index.ts View on Github external
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);
    });
  }
github lino-network / lino-js / lib / lino-js.esm.js View on Github external
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));
        });
    }
github lino-network / lino-js / lib / lino-js.esm.js View on Github external
                ? v.block.data.txs.map(tx => JSON.parse(ByteBuffer.atob(tx)))
                : [];
github lino-network / lino-js / src / transport / index.ts View on Github external
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;
github lino-network / lino-js / lib / lino-js.esm.js View on Github external
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;
        });
    }
github lino-network / lino-js / src / transport / index.ts View on Github external
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;
github lino-network / lino-js / lib / lino-js.esm.js View on Github external
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);
github lino-network / lino-js / src / query / index.ts View on Github external
        ? v.block.data.txs.map(tx => JSON.parse(ByteBuffer.atob(tx)))
        : [];
github lino-network / lino-js / src / transport / index.ts View on Github external
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;
    });
  }