@requestnetwork/payment-detection 0.35.1-next.1781 → 0.35.1-next.1784
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/payment-network-factory.d.ts +19 -36
- package/dist/payment-network-factory.d.ts.map +1 -1
- package/dist/payment-network-factory.js +28 -55
- package/dist/payment-network-factory.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import PaymentNetworkFactory from './payment-network-factory';
|
|
1
|
+
import { PaymentNetworkFactory, PaymentNetworkOptions } from './payment-network-factory';
|
|
2
2
|
import PaymentReferenceCalculator from './payment-reference-calculator';
|
|
3
3
|
import * as BtcPaymentNetwork from './btc';
|
|
4
4
|
import { DeclarativePaymentDetector } from './declarative';
|
|
@@ -14,5 +14,5 @@ import { SuperFluidPaymentDetector } from './erc777/superfluid-detector';
|
|
|
14
14
|
import { EscrowERC20InfoRetriever } from './erc20/escrow-info-retriever';
|
|
15
15
|
import { SuperFluidInfoRetriever } from './erc777/superfluid-retriever';
|
|
16
16
|
export type { TheGraphClient } from './thegraph';
|
|
17
|
-
export { PaymentNetworkFactory, PaymentReferenceCalculator, BtcPaymentNetwork, DeclarativePaymentDetector, Erc20PaymentNetwork, EthInputDataPaymentDetector, EthFeeProxyPaymentDetector, AnyToERC20PaymentDetector, AnyToEthFeeProxyPaymentDetector, FeeReferenceBasedDetector, SuperFluidPaymentDetector, NearNativeTokenPaymentDetector, NearConversionNativeTokenPaymentDetector, EscrowERC20InfoRetriever, SuperFluidInfoRetriever, setProviderFactory, initPaymentDetectionApiKeys, getDefaultProvider, getTheGraphClient, getTheGraphNearClient, networkSupportsTheGraph, parseLogArgs, padAmountForChainlink, unpadAmountFromChainlink, calculateEscrowState, getPaymentNetworkExtension, getPaymentReference, };
|
|
17
|
+
export { PaymentNetworkFactory, PaymentNetworkOptions, PaymentReferenceCalculator, BtcPaymentNetwork, DeclarativePaymentDetector, Erc20PaymentNetwork, EthInputDataPaymentDetector, EthFeeProxyPaymentDetector, AnyToERC20PaymentDetector, AnyToEthFeeProxyPaymentDetector, FeeReferenceBasedDetector, SuperFluidPaymentDetector, NearNativeTokenPaymentDetector, NearConversionNativeTokenPaymentDetector, EscrowERC20InfoRetriever, SuperFluidInfoRetriever, setProviderFactory, initPaymentDetectionApiKeys, getDefaultProvider, getTheGraphClient, getTheGraphNearClient, networkSupportsTheGraph, parseLogArgs, padAmountForChainlink, unpadAmountFromChainlink, calculateEscrowState, getPaymentNetworkExtension, getPaymentReference, };
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,0BAA0B,MAAM,gCAAgC,CAAC;AAExE,OAAO,KAAK,iBAAiB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,mBAAmB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,8BAA8B,EAAE,wCAAwC,EAAE,MAAM,QAAQ,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,EAC9B,wCAAwC,EACxC,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,GACpB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPaymentReference = exports.getPaymentNetworkExtension = exports.calculateEscrowState = exports.unpadAmountFromChainlink = exports.padAmountForChainlink = exports.parseLogArgs = exports.networkSupportsTheGraph = exports.getTheGraphNearClient = exports.getTheGraphClient = exports.getDefaultProvider = exports.initPaymentDetectionApiKeys = exports.setProviderFactory = exports.SuperFluidInfoRetriever = exports.EscrowERC20InfoRetriever = exports.NearConversionNativeTokenPaymentDetector = exports.NearNativeTokenPaymentDetector = exports.SuperFluidPaymentDetector = exports.FeeReferenceBasedDetector = exports.AnyToEthFeeProxyPaymentDetector = exports.AnyToERC20PaymentDetector = exports.EthFeeProxyPaymentDetector = exports.EthInputDataPaymentDetector = exports.Erc20PaymentNetwork = exports.DeclarativePaymentDetector = exports.BtcPaymentNetwork = exports.PaymentReferenceCalculator = exports.PaymentNetworkFactory = void 0;
|
|
4
4
|
const payment_network_factory_1 = require("./payment-network-factory");
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "PaymentNetworkFactory", { enumerable: true, get: function () { return payment_network_factory_1.PaymentNetworkFactory; } });
|
|
6
6
|
const payment_reference_calculator_1 = require("./payment-reference-calculator");
|
|
7
7
|
exports.PaymentReferenceCalculator = payment_reference_calculator_1.default;
|
|
8
8
|
const BtcPaymentNetwork = require("./btc");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uEAAyF;AA2BvF,sGA3BO,+CAAqB,OA2BP;AA1BvB,iFAAwE;AA4BtE,qCA5BK,sCAA0B,CA4BL;AA1B5B,2CAA2C;AA2BzC,8CAAiB;AA1BnB,+CAA2D;AA2BzD,2GA3BO,wCAA0B,OA2BP;AA1B5B,+CAA+C;AA2B7C,kDAAmB;AA1BrB,+BAAmF;AA6BjF,0GA7BO,+BAAyB,OA6BP;AACzB,gHA9BkC,qCAA+B,OA8BlC;AA7BjC,+BAAgF;AA2B9E,2GA3BO,gCAA0B,OA2BP;AAD1B,4GA1BmC,iCAA2B,OA0BnC;AAzB7B,yCAAiG;AAoC/F,4GApCO,sCAA2B,OAoCP;AAD3B,mGAnCoC,6BAAkB,OAmCpC;AAElB,mGArCwD,6BAAkB,OAqCxD;AApCpB,yCAA+F;AAqC7F,kGArCO,4BAAiB,OAqCP;AACjB,sGAtC0B,gCAAqB,OAsC1B;AACrB,wGAvCiD,kCAAuB,OAuCjD;AAtCzB,mCAOiB;AAgCf,6FAtCA,oBAAY,OAsCA;AACZ,sGAtCA,6BAAqB,OAsCA;AACrB,yGAtCA,gCAAwB,OAsCA;AACxB,qGAtCA,4BAAoB,OAsCA;AACpB,2GAtCA,kCAA0B,OAsCA;AAC1B,oGAtCA,2BAAmB,OAsCA;AApCrB,iCAAkG;AAqBhG,+GArBO,qCAA8B,OAqBP;AAC9B,yHAtBuC,+CAAwC,OAsBvC;AArB1C,iFAA2E;AAkBzE,0GAlBO,wDAAyB,OAkBP;AAjB3B,sEAAyE;AAkBvE,0GAlBO,+CAAyB,OAkBP;AAjB3B,yEAAyE;AAoBvE,yGApBO,gDAAwB,OAoBP;AAnB1B,wEAAwE;AAoBtE,wGApBO,8CAAuB,OAoBP"}
|
|
@@ -1,56 +1,39 @@
|
|
|
1
1
|
import { AdvancedLogicTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
2
2
|
import { ICurrencyManager } from '@requestnetwork/currency';
|
|
3
|
-
|
|
3
|
+
export declare type PaymentNetworkOptions = {
|
|
4
|
+
/** override default bitcoin detection provider */
|
|
5
|
+
bitcoinDetectionProvider?: PaymentTypes.IBitcoinDetectionProvider;
|
|
6
|
+
/** the explorer API (eg Etherscan) api keys, for PNs that rely on it. Record by network name */
|
|
7
|
+
explorerApiKeys?: Record<string, string>;
|
|
8
|
+
};
|
|
4
9
|
/** Factory to create the payment network according to the currency and payment network type */
|
|
5
|
-
export
|
|
10
|
+
export declare class PaymentNetworkFactory {
|
|
11
|
+
private readonly advancedLogic;
|
|
12
|
+
private readonly currencyManager;
|
|
13
|
+
private readonly options?;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
17
|
+
* @param currencyManager the currency manager handling supported currencies
|
|
18
|
+
* @param options the payment network options
|
|
19
|
+
*/
|
|
20
|
+
constructor(advancedLogic: AdvancedLogicTypes.IAdvancedLogic, currencyManager: ICurrencyManager, options?: PaymentNetworkOptions | undefined);
|
|
6
21
|
/**
|
|
7
22
|
* Creates a payment network according to payment network creation parameters
|
|
8
23
|
* It throws if the payment network given is not supported by this library
|
|
9
24
|
*
|
|
10
|
-
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
11
25
|
* @param currency the currency of the request
|
|
12
26
|
* @param paymentNetworkCreationParameters creation parameters of payment network
|
|
13
|
-
* @param bitcoinDetectionProvider bitcoin detection provider
|
|
14
|
-
* @param currencyManager the currency manager handling supported currencies
|
|
15
27
|
* @returns the module to handle the payment network
|
|
16
28
|
*/
|
|
17
|
-
|
|
18
|
-
advancedLogic: AdvancedLogicTypes.IAdvancedLogic;
|
|
19
|
-
currency: RequestLogicTypes.ICurrency;
|
|
20
|
-
paymentNetworkCreationParameters: PaymentTypes.IPaymentNetworkCreateParameters;
|
|
21
|
-
bitcoinDetectionProvider?: PaymentTypes.IBitcoinDetectionProvider;
|
|
22
|
-
currencyManager: ICurrencyManager;
|
|
23
|
-
}): PaymentTypes.IPaymentNetwork;
|
|
29
|
+
createPaymentNetwork(paymentNetworkId: PaymentTypes.PAYMENT_NETWORK_ID, currencyType: RequestLogicTypes.CURRENCY, currencyNetwork?: string): PaymentTypes.IPaymentNetwork;
|
|
24
30
|
/**
|
|
25
31
|
* Gets the module to the payment network of a request
|
|
26
32
|
* It throws if the payment network found is not supported by this library
|
|
27
33
|
*
|
|
28
|
-
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
29
34
|
* @param request the request
|
|
30
|
-
* @param bitcoinDetectionProvider bitcoin detection provider
|
|
31
|
-
* @param explorerApiKeys the explorer API (eg Etherscan) api keys, for PNs that rely on it. Record by network name.
|
|
32
|
-
* @param currencyManager the currency manager handling supported currencies
|
|
33
35
|
* @returns the module to handle the payment network or null if no payment network found
|
|
34
36
|
*/
|
|
35
|
-
|
|
36
|
-
advancedLogic: AdvancedLogicTypes.IAdvancedLogic;
|
|
37
|
-
request: RequestLogicTypes.IRequest;
|
|
38
|
-
currencyManager: ICurrencyManager;
|
|
39
|
-
bitcoinDetectionProvider?: PaymentTypes.IBitcoinDetectionProvider;
|
|
40
|
-
explorerApiKeys?: Record<string, string>;
|
|
41
|
-
}): PaymentTypes.IPaymentNetwork | null;
|
|
42
|
-
/**
|
|
43
|
-
* Gets the payment networks supported for a Currency object
|
|
44
|
-
*
|
|
45
|
-
* @param currency The currency to get the supported networks for
|
|
46
|
-
*/
|
|
47
|
-
static supportedPaymentNetworksForCurrency(currency: RequestLogicTypes.ICurrency): IPaymentNetworkModuleByType;
|
|
48
|
-
/**
|
|
49
|
-
* Checks if a networkId is part of the supported networks for given currency
|
|
50
|
-
*
|
|
51
|
-
* @param paymentNetworkId The networkId to check is supported by this currency
|
|
52
|
-
* @param currency The currency to check the supported networks for
|
|
53
|
-
*/
|
|
54
|
-
static currencySupportsPaymentNetwork(paymentNetworkId: PaymentTypes.PAYMENT_NETWORK_ID, currency: RequestLogicTypes.ICurrency): boolean;
|
|
37
|
+
getPaymentNetworkFromRequest(request: RequestLogicTypes.IRequest): PaymentTypes.IPaymentNetwork | null;
|
|
55
38
|
}
|
|
56
39
|
//# sourceMappingURL=payment-network-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-network-factory.d.ts","sourceRoot":"","sources":["../src/payment-network-factory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"payment-network-factory.d.ts","sourceRoot":"","sources":["../src/payment-network-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AA2D5D,oBAAY,qBAAqB,GAAG;IAClC,kDAAkD;IAClD,wBAAwB,CAAC,EAAE,YAAY,CAAC,yBAAyB,CAAC;IAClE,iGAAiG;IACjG,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF,+FAA+F;AAC/F,qBAAa,qBAAqB;IAQ9B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAT3B;;;;;OAKG;gBAEgB,aAAa,EAAE,kBAAkB,CAAC,cAAc,EAChD,eAAe,EAAE,gBAAgB,EACjC,OAAO,CAAC,mCAAuB;IAGlD;;;;;;;OAOG;IACI,oBAAoB,CACzB,gBAAgB,EAAE,YAAY,CAAC,kBAAkB,EACjD,YAAY,EAAE,iBAAiB,CAAC,QAAQ,EACxC,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAAC,eAAe;IAwB/B;;;;;;OAMG;IACI,4BAA4B,CACjC,OAAO,EAAE,iBAAiB,CAAC,QAAQ,GAClC,YAAY,CAAC,eAAe,GAAG,IAAI;CAcvC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentNetworkFactory = void 0;
|
|
3
4
|
const types_1 = require("@requestnetwork/types");
|
|
4
5
|
const mainnet_address_based_1 = require("./btc/mainnet-address-based");
|
|
5
6
|
const testnet_address_based_1 = require("./btc/testnet-address-based");
|
|
@@ -13,6 +14,7 @@ const fee_proxy_detector_1 = require("./eth/fee-proxy-detector");
|
|
|
13
14
|
const any_to_erc20_proxy_1 = require("./any/any-to-erc20-proxy");
|
|
14
15
|
const near_1 = require("./near");
|
|
15
16
|
const any_to_eth_proxy_1 = require("./any/any-to-eth-proxy");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
16
18
|
const PN_ID = types_1.PaymentTypes.PAYMENT_NETWORK_ID;
|
|
17
19
|
/** Register the payment network by currency and type */
|
|
18
20
|
const supportedPaymentNetwork = {
|
|
@@ -55,80 +57,51 @@ const anyCurrencyPaymentNetwork = {
|
|
|
55
57
|
};
|
|
56
58
|
/** Factory to create the payment network according to the currency and payment network type */
|
|
57
59
|
class PaymentNetworkFactory {
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
63
|
+
* @param currencyManager the currency manager handling supported currencies
|
|
64
|
+
* @param options the payment network options
|
|
65
|
+
*/
|
|
66
|
+
constructor(advancedLogic, currencyManager, options) {
|
|
67
|
+
this.advancedLogic = advancedLogic;
|
|
68
|
+
this.currencyManager = currencyManager;
|
|
69
|
+
this.options = options;
|
|
70
|
+
}
|
|
58
71
|
/**
|
|
59
72
|
* Creates a payment network according to payment network creation parameters
|
|
60
73
|
* It throws if the payment network given is not supported by this library
|
|
61
74
|
*
|
|
62
|
-
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
63
75
|
* @param currency the currency of the request
|
|
64
76
|
* @param paymentNetworkCreationParameters creation parameters of payment network
|
|
65
|
-
* @param bitcoinDetectionProvider bitcoin detection provider
|
|
66
|
-
* @param currencyManager the currency manager handling supported currencies
|
|
67
77
|
* @returns the module to handle the payment network
|
|
68
78
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
createPaymentNetwork(paymentNetworkId, currencyType, currencyNetwork) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
const currencyPaymentMap = ((_a = supportedPaymentNetwork[currencyType]) === null || _a === void 0 ? void 0 : _a[currencyNetwork || 'mainnet']) ||
|
|
82
|
+
((_b = supportedPaymentNetwork[currencyType]) === null || _b === void 0 ? void 0 : _b['*']) ||
|
|
83
|
+
{};
|
|
84
|
+
const paymentNetworkMap = Object.assign(Object.assign({}, currencyPaymentMap), anyCurrencyPaymentNetwork);
|
|
85
|
+
if (!paymentNetworkMap[paymentNetworkId]) {
|
|
86
|
+
throw new Error(`the payment network id: ${paymentNetworkId} is not supported for the currency: ${currencyType} on network ${currencyNetwork || 'mainnet'}`);
|
|
73
87
|
}
|
|
74
|
-
return new
|
|
75
|
-
advancedLogic,
|
|
76
|
-
bitcoinDetectionProvider,
|
|
77
|
-
currencyManager,
|
|
78
|
-
});
|
|
88
|
+
return new paymentNetworkMap[paymentNetworkId](Object.assign({ advancedLogic: this.advancedLogic, currencyManager: this.currencyManager }, this.options));
|
|
79
89
|
}
|
|
80
90
|
/**
|
|
81
91
|
* Gets the module to the payment network of a request
|
|
82
92
|
* It throws if the payment network found is not supported by this library
|
|
83
93
|
*
|
|
84
|
-
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
85
94
|
* @param request the request
|
|
86
|
-
* @param bitcoinDetectionProvider bitcoin detection provider
|
|
87
|
-
* @param explorerApiKeys the explorer API (eg Etherscan) api keys, for PNs that rely on it. Record by network name.
|
|
88
|
-
* @param currencyManager the currency manager handling supported currencies
|
|
89
95
|
* @returns the module to handle the payment network or null if no payment network found
|
|
90
96
|
*/
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
if (!extensionPaymentNetwork) {
|
|
97
|
+
getPaymentNetworkFromRequest(request) {
|
|
98
|
+
const pn = (0, utils_1.getPaymentNetworkExtension)(request);
|
|
99
|
+
if (!pn) {
|
|
95
100
|
return null;
|
|
96
101
|
}
|
|
97
|
-
const paymentNetworkId =
|
|
98
|
-
|
|
99
|
-
if (!paymentNetworkForCurrency[paymentNetworkId]) {
|
|
100
|
-
throw new Error(`the payment network id: ${paymentNetworkId} is not supported for the currency: ${currency.type} on network ${currency.network || 'mainnet'}`);
|
|
101
|
-
}
|
|
102
|
-
return new paymentNetworkForCurrency[paymentNetworkId]({
|
|
103
|
-
advancedLogic,
|
|
104
|
-
bitcoinDetectionProvider,
|
|
105
|
-
explorerApiKeys,
|
|
106
|
-
currencyManager,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Gets the payment networks supported for a Currency object
|
|
111
|
-
*
|
|
112
|
-
* @param currency The currency to get the supported networks for
|
|
113
|
-
*/
|
|
114
|
-
static supportedPaymentNetworksForCurrency(currency) {
|
|
115
|
-
if (!supportedPaymentNetwork[currency.type]) {
|
|
116
|
-
return anyCurrencyPaymentNetwork;
|
|
117
|
-
}
|
|
118
|
-
const paymentNetwork = supportedPaymentNetwork[currency.type][currency.network || 'mainnet'] ||
|
|
119
|
-
supportedPaymentNetwork[currency.type]['*'];
|
|
120
|
-
return Object.assign(Object.assign({}, paymentNetwork), anyCurrencyPaymentNetwork);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Checks if a networkId is part of the supported networks for given currency
|
|
124
|
-
*
|
|
125
|
-
* @param paymentNetworkId The networkId to check is supported by this currency
|
|
126
|
-
* @param currency The currency to check the supported networks for
|
|
127
|
-
*/
|
|
128
|
-
static currencySupportsPaymentNetwork(paymentNetworkId, currency) {
|
|
129
|
-
const paymentNetworks = this.supportedPaymentNetworksForCurrency(currency);
|
|
130
|
-
return !!paymentNetworks[paymentNetworkId];
|
|
102
|
+
const paymentNetworkId = pn.id;
|
|
103
|
+
return this.createPaymentNetwork(paymentNetworkId, request.currency.type, request.currency.network);
|
|
131
104
|
}
|
|
132
105
|
}
|
|
133
|
-
exports.
|
|
106
|
+
exports.PaymentNetworkFactory = PaymentNetworkFactory;
|
|
134
107
|
//# sourceMappingURL=payment-network-factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-network-factory.js","sourceRoot":"","sources":["../src/payment-network-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment-network-factory.js","sourceRoot":"","sources":["../src/payment-network-factory.ts"],"names":[],"mappings":";;;AAAA,iDAA4F;AAG5F,uEAA6E;AAC7E,uEAA6E;AAC7E,+CAA2D;AAC3D,yDAAyE;AACzE,mEAA0E;AAC1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sDAwEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@requestnetwork/payment-detection",
|
|
3
|
-
"version": "0.35.1-next.
|
|
3
|
+
"version": "0.35.1-next.1784+400b0d50",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"codegen": "graphql-codegen --config codegen.yml ; graphql-codegen --config codegen-superfluid.yml; graphql-codegen --config codegen-near.yml"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@requestnetwork/currency": "0.8.1-next.
|
|
45
|
-
"@requestnetwork/smart-contracts": "0.28.1-next.
|
|
46
|
-
"@requestnetwork/types": "0.35.1-next.
|
|
47
|
-
"@requestnetwork/utils": "0.35.1-next.
|
|
44
|
+
"@requestnetwork/currency": "0.8.1-next.1784+400b0d50",
|
|
45
|
+
"@requestnetwork/smart-contracts": "0.28.1-next.1784+400b0d50",
|
|
46
|
+
"@requestnetwork/types": "0.35.1-next.1784+400b0d50",
|
|
47
|
+
"@requestnetwork/utils": "0.35.1-next.1784+400b0d50",
|
|
48
48
|
"axios": "0.27.2",
|
|
49
49
|
"ethers": "5.5.1",
|
|
50
50
|
"graphql": "15.5.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@graphql-codegen/typescript-graphql-request": "3.2.1",
|
|
61
61
|
"@graphql-codegen/typescript-operations": "1.18.0",
|
|
62
62
|
"@graphql-codegen/typescript-resolvers": "1.19.2",
|
|
63
|
-
"@requestnetwork/advanced-logic": "0.34.1-next.
|
|
63
|
+
"@requestnetwork/advanced-logic": "0.34.1-next.1784+400b0d50",
|
|
64
64
|
"@types/jest": "26.0.13",
|
|
65
65
|
"jest": "26.4.2",
|
|
66
66
|
"nyc": "15.1.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"ts-node": "9.0.0",
|
|
72
72
|
"typescript": "4.4.4"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "400b0d503ee69b7abd24d6e5ebc310d7c08699a8"
|
|
75
75
|
}
|