How to use @taquito/http-utils - 6 common examples

To help you get started, we’ve selected a few @taquito/http-utils 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 ecadlabs / taquito / packages / taquito-indexer / src / taquito-indexer.ts View on Github external
constructor(
    private url: string = defaultIndexerUrl,
    private httpBackend: HttpBackend = new HttpBackend()
  ) {}
github ecadlabs / taquito / packages / taquito-remote-signer / src / taquito-remote-signer.ts View on Github external
  constructor(private pkh: string, private rootUrl: string, private http = new HttpBackend()) {}
github ecadlabs / taquito / packages / taquito-rpc / src / taquito-rpc.ts View on Github external
constructor(
    private url: string = defaultRPC,
    private chain: string = defaultChain,
    private httpBackend: HttpBackend = new HttpBackend()
  ) {}
github ecadlabs / taquito / packages / taquito-remote-signer / src / taquito-remote-signer.ts View on Github external
const decoded = b58cdecode(signature, prefix[pref]);

      return {
        bytes,
        sig: b58cencode(decoded, prefix.sig),
        prefixSig: signature,
        sbytes: bytes + buf2hex(toBuffer(decoded)),
      };
    } catch (ex) {
      if (ex instanceof HttpResponseError) {
        if (ex.status === STATUS_CODE.NOT_FOUND) {
          throw new KeyNotFoundError(`Key not found: ${this.pkh}`, ex);
        } else if (ex.status === STATUS_CODE.FORBIDDEN) {
          throw new OperationNotAuthorizedError('Signing Operation not authorized', ex);
        } else if (ex.status === STATUS_CODE.BAD_REQUEST) {
          throw new BadSigningDataError('Invalid data', ex, {
            bytes,
            watermark,
          });
        }
      }
      throw ex;
    }
  }
}
github ecadlabs / taquito / packages / taquito-remote-signer / src / taquito-remote-signer.ts View on Github external
);
      let pref = signature.startsWith('sig') ? signature.substr(0, 3) : signature.substr(0, 5);

      const decoded = b58cdecode(signature, prefix[pref]);

      return {
        bytes,
        sig: b58cencode(decoded, prefix.sig),
        prefixSig: signature,
        sbytes: bytes + buf2hex(toBuffer(decoded)),
      };
    } catch (ex) {
      if (ex instanceof HttpResponseError) {
        if (ex.status === STATUS_CODE.NOT_FOUND) {
          throw new KeyNotFoundError(`Key not found: ${this.pkh}`, ex);
        } else if (ex.status === STATUS_CODE.FORBIDDEN) {
          throw new OperationNotAuthorizedError('Signing Operation not authorized', ex);
        } else if (ex.status === STATUS_CODE.BAD_REQUEST) {
          throw new BadSigningDataError('Invalid data', ex, {
            bytes,
            watermark,
          });
        }
      }
      throw ex;
    }
  }
}
github ecadlabs / taquito / packages / taquito-remote-signer / src / taquito-remote-signer.ts View on Github external
async publicKey(): Promise {
    try {
      const { public_key } = await this.http.createRequest({
        url: this.createURL(`/keys/${this.pkh}`),
        method: 'GET',
      });
      return public_key;
    } catch (ex) {
      if (ex instanceof HttpResponseError) {
        if (ex.status === STATUS_CODE.NOT_FOUND) {
          throw new KeyNotFoundError(`Key not found: ${this.pkh}`, ex);
        }
      }
      throw ex;
    }
  }