@galoymoney/client
Advanced tools
Comparing version 0.1.60 to 0.1.61
@@ -82,2 +82,3 @@ "use strict"; | ||
method: "get", | ||
credentials: "include", | ||
headers: __assign({ "Content-Type": "application/json" }, headers), | ||
@@ -113,2 +114,3 @@ })]; | ||
body: JSON.stringify(variables), | ||
credentials: "include", | ||
headers: { | ||
@@ -147,15 +149,6 @@ "Content-Type": "application/json", | ||
return function (_a) { | ||
var _b = _a === void 0 ? {} : _a, authToken = _b.authToken, onErrorCallback = _b.onError; | ||
var _b = _a === void 0 ? {} : _a, onErrorCallback = _b.onError; | ||
var cache = initData ? new client_1.InMemoryCache().restore(initData) : new client_1.InMemoryCache(); | ||
var errorLink = (0, error_1.onError)(onErrorCallback !== null && onErrorCallback !== void 0 ? onErrorCallback : defaultErrorCallback); | ||
var authLink = new client_1.ApolloLink(function (operation, forward) { | ||
operation.setContext(function (_a) { | ||
var headers = _a.headers; | ||
return ({ | ||
headers: __assign({ authorization: authToken ? "Bearer ".concat(authToken) : "" }, headers), | ||
}); | ||
}); | ||
return forward(operation); | ||
}); | ||
var httpLink = new client_1.HttpLink({ uri: config.graphqlUrl }); | ||
var httpLink = new client_1.HttpLink({ uri: config.graphqlUrl, credentials: "include" }); | ||
var wsLink = new ws_1.WebSocketLink({ | ||
@@ -170,3 +163,3 @@ uri: config.graphqlSubscriptionUrl, | ||
return [2 /*return*/, { | ||
authorization: authToken ? "Bearer ".concat(authToken) : "", | ||
credentials: "include", | ||
}]; | ||
@@ -182,3 +175,3 @@ }); | ||
definition.operation === "subscription"); | ||
}, wsLink, (0, client_1.from)([errorLink, authLink, httpLink])); | ||
}, wsLink, (0, client_1.from)([errorLink, httpLink])); | ||
return new client_1.ApolloClient({ | ||
@@ -185,0 +178,0 @@ cache: cache, |
@@ -17,2 +17,3 @@ import { QueryResult, QueryHookOptions, QueryOptions } from "@apollo/client"; | ||
usernameAvailable: import("@apollo/client").DocumentNode; | ||
currencyList: import("@apollo/client").DocumentNode; | ||
}; | ||
@@ -19,0 +20,0 @@ declare type QueryHelpers = { |
@@ -69,2 +69,3 @@ "use strict"; | ||
var username_available_1 = __importDefault(require("./queries/username-available")); | ||
var currency_list_1 = __importDefault(require("./queries/currency-list")); | ||
var index_1 = require("../index"); | ||
@@ -85,2 +86,3 @@ exports.QUERIES = { | ||
usernameAvailable: username_available_1.default, | ||
currencyList: currency_list_1.default, | ||
}; | ||
@@ -87,0 +89,0 @@ var useQueryWrapper = function (queryName, config) { |
@@ -12,2 +12,3 @@ import bolt11 from "bolt11"; | ||
Lnurl = "lnurl", | ||
Unified = "unified", | ||
Unknown = "unknown" | ||
@@ -14,0 +15,0 @@ } |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.parsePaymentDestination = exports.decodeInvoiceString = exports.getLightningInvoiceExpiryTime = exports.lightningInvoiceHasExpired = exports.InvalidOnchainDestinationReason = exports.InvalidLightningDestinationReason = exports.InvalidLnurlPaymentDestinationReason = exports.PaymentType = exports.getHashFromInvoice = exports.getDestination = exports.getDescription = exports.parseBolt11Network = void 0; | ||
/* eslint-disable max-lines */ | ||
var bolt11_1 = __importDefault(require("bolt11")); | ||
@@ -84,2 +85,3 @@ var url_1 = __importDefault(require("url")); | ||
PaymentType["Lnurl"] = "lnurl"; | ||
PaymentType["Unified"] = "unified"; | ||
PaymentType["Unknown"] = "unknown"; | ||
@@ -150,6 +152,8 @@ })(PaymentType = exports.PaymentType || (exports.PaymentType = {})); | ||
} | ||
if (destinationWithoutProtocol.match(/^ln(bc|tb).{50,}/iu) || | ||
(destinationWithoutProtocol && getLNParam(destinationWithoutProtocol) !== undefined)) { | ||
if (destinationWithoutProtocol.match(/^ln(bc|tb).{50,}/iu)) { | ||
return PaymentType.Lightning; | ||
} | ||
if (destinationWithoutProtocol && getLNParam(destinationWithoutProtocol)) { | ||
return PaymentType.Unified; | ||
} | ||
if (protocol === "onchain" || | ||
@@ -308,2 +312,14 @@ destinationWithoutProtocol.match(/^(1|3|bc1|tb1|bcrt1)/iu)) { | ||
}; | ||
var getUnifiedPayResponse = function (_a) { | ||
var destination = _a.destination, destinationWithoutProtocol = _a.destinationWithoutProtocol, network = _a.network, pubKey = _a.pubKey; | ||
var lightningPaymentResponse = getLightningPayResponse({ | ||
destination: destination, | ||
network: network, | ||
pubKey: pubKey, | ||
}); | ||
if (lightningPaymentResponse.valid) { | ||
return lightningPaymentResponse; | ||
} | ||
return getOnChainPayResponse({ destinationWithoutProtocol: destinationWithoutProtocol, network: network }); | ||
}; | ||
var parsePaymentDestination = function (_a) { | ||
@@ -332,2 +348,9 @@ var destination = _a.destination, network = _a.network, pubKey = _a.pubKey, lnAddressDomains = _a.lnAddressDomains; | ||
return getIntraLedgerPayResponse({ protocol: protocol, destinationWithoutProtocol: destinationWithoutProtocol }); | ||
case PaymentType.Unified: | ||
return getUnifiedPayResponse({ | ||
destination: destination, | ||
destinationWithoutProtocol: destinationWithoutProtocol, | ||
network: network, | ||
pubKey: pubKey, | ||
}); | ||
case PaymentType.Unknown: | ||
@@ -334,0 +357,0 @@ return { paymentType: PaymentType.Unknown }; |
{ | ||
"name": "@galoymoney/client", | ||
"main": "dist/index.js", | ||
"version": "0.1.60", | ||
"version": "0.1.61", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/galoymoney/galoy-client", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188
558368
10013