MCPcopy
hub / github.com/bitpay/wallet / graphRequest

Method graphRequest

src/providers/in-app-browser/card.ts:772–805  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

770 }
771
772 async graphRequest(request): Promise<any> {
773 try {
774 request = {
775 ...request,
776 query: request.query.replace(/\r?\n|\r/g, '')
777 };
778
779 const token = await this.persistenceProvider.getBitPayIdPairingToken(
780 Network[this.NETWORK]
781 );
782
783 const { query, variables } = request;
784
785 const json = {
786 query,
787 variables: { ...variables, token }
788 };
789
790 const { priv, pub } = await this.bitpayIdProvider.getAppIdentity();
791
792 let url = `https://bitpay.com/`;
793 const dataToSign = `${url}${JSON.stringify(json)}`;
794 const signedData = bitauthService.sign(dataToSign, priv);
795
796 const headers = [signedData, pub];
797
798 return this.appleWalletProvider.graphRequest(
799 headers,
800 JSON.stringify(json)
801 );
802 } catch (err) {
803 this.logger.error(`graph request failed ${err}`);
804 }
805 }
806
807 async purchaseAttempt(event) {
808 const { invoiceId } = event.data.params;

Callers 1

Calls 5

replaceMethod · 0.80
errorMethod · 0.80
getAppIdentityMethod · 0.45
signMethod · 0.45

Tested by

no test coverage detected