@requestnetwork/payment-detection 0.35.1-next.1793 → 0.35.1-next.1796
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/any/any-to-erc20-proxy.d.ts +5 -7
- package/dist/any/any-to-erc20-proxy.d.ts.map +1 -1
- package/dist/any/any-to-erc20-proxy.js +19 -8
- package/dist/any/any-to-erc20-proxy.js.map +1 -1
- package/dist/any/any-to-eth-proxy.d.ts +6 -11
- package/dist/any/any-to-eth-proxy.d.ts.map +1 -1
- package/dist/any/any-to-eth-proxy.js +22 -15
- package/dist/any/any-to-eth-proxy.js.map +1 -1
- package/dist/any-to-any-detector.d.ts +0 -1
- package/dist/any-to-any-detector.d.ts.map +1 -1
- package/dist/any-to-any-detector.js +1 -2
- package/dist/any-to-any-detector.js.map +1 -1
- package/dist/erc20/fee-proxy-contract.d.ts +6 -8
- package/dist/erc20/fee-proxy-contract.d.ts.map +1 -1
- package/dist/erc20/fee-proxy-contract.js +19 -13
- package/dist/erc20/fee-proxy-contract.js.map +1 -1
- package/dist/erc20/proxy-contract.d.ts +5 -5
- package/dist/erc20/proxy-contract.d.ts.map +1 -1
- package/dist/erc20/proxy-contract.js +16 -9
- package/dist/erc20/proxy-contract.js.map +1 -1
- package/dist/erc777/superfluid-detector.d.ts +3 -4
- package/dist/erc777/superfluid-detector.d.ts.map +1 -1
- package/dist/erc777/superfluid-detector.js +2 -2
- package/dist/erc777/superfluid-detector.js.map +1 -1
- package/dist/eth/fee-proxy-detector.d.ts +6 -6
- package/dist/eth/fee-proxy-detector.d.ts.map +1 -1
- package/dist/eth/fee-proxy-detector.js +17 -10
- package/dist/eth/fee-proxy-detector.js.map +1 -1
- package/dist/eth/input-data.d.ts +6 -7
- package/dist/eth/input-data.d.ts.map +1 -1
- package/dist/eth/input-data.js +18 -11
- package/dist/eth/input-data.js.map +1 -1
- package/dist/fee-reference-based-detector.d.ts +2 -1
- package/dist/fee-reference-based-detector.d.ts.map +1 -1
- package/dist/fee-reference-based-detector.js +2 -2
- package/dist/fee-reference-based-detector.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/near/near-detector.d.ts +3 -4
- package/dist/near/near-detector.d.ts.map +1 -1
- package/dist/near/near-detector.js +2 -2
- package/dist/near/near-detector.js.map +1 -1
- package/dist/near/retrievers/near-conversion-info-retriever.d.ts +1 -1
- package/dist/near/retrievers/near-conversion-info-retriever.d.ts.map +1 -1
- package/dist/near/retrievers/near-info-retriever.d.ts +0 -1
- package/dist/near/retrievers/near-info-retriever.d.ts.map +1 -1
- package/dist/near/retrievers/near-info-retriever.js +3 -4
- package/dist/near/retrievers/near-info-retriever.js.map +1 -1
- package/dist/payment-network-factory.d.ts +4 -8
- package/dist/payment-network-factory.d.ts.map +1 -1
- package/dist/payment-network-factory.js +15 -1
- package/dist/payment-network-factory.js.map +1 -1
- package/dist/reference-based-detector.d.ts +4 -1
- package/dist/reference-based-detector.d.ts.map +1 -1
- package/dist/reference-based-detector.js +3 -1
- package/dist/reference-based-detector.js.map +1 -1
- package/dist/thegraph/__mocks__/client.d.ts +16 -0
- package/dist/thegraph/__mocks__/client.d.ts.map +1 -0
- package/dist/thegraph/__mocks__/client.js +15 -0
- package/dist/thegraph/__mocks__/client.js.map +1 -0
- package/dist/thegraph/client.d.ts +36 -0
- package/dist/thegraph/client.d.ts.map +1 -0
- package/dist/thegraph/client.js +12 -0
- package/dist/thegraph/client.js.map +1 -0
- package/dist/thegraph/generated/graphql.d.ts +12 -50
- package/dist/thegraph/generated/graphql.d.ts.map +1 -1
- package/dist/thegraph/generated/graphql.js +67 -152
- package/dist/thegraph/generated/graphql.js.map +1 -1
- package/dist/thegraph/index.d.ts +2 -15
- package/dist/thegraph/index.d.ts.map +1 -1
- package/dist/thegraph/index.js +3 -27
- package/dist/thegraph/index.js.map +1 -1
- package/dist/thegraph/info-retriever.d.ts +30 -0
- package/dist/thegraph/info-retriever.d.ts.map +1 -0
- package/dist/thegraph/info-retriever.js +89 -0
- package/dist/thegraph/info-retriever.js.map +1 -0
- package/dist/types.d.ts +18 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -1
- package/dist/utils.js.map +1 -1
- package/package.json +9 -7
- package/dist/any/retrievers/thegraph.d.ts +0 -38
- package/dist/any/retrievers/thegraph.d.ts.map +0 -1
- package/dist/any/retrievers/thegraph.js +0 -91
- package/dist/any/retrievers/thegraph.js.map +0 -1
- package/dist/erc20/thegraph-info-retriever.d.ts +0 -26
- package/dist/erc20/thegraph-info-retriever.d.ts.map +0 -1
- package/dist/erc20/thegraph-info-retriever.js +0 -77
- package/dist/erc20/thegraph-info-retriever.js.map +0 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExtensionTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
2
2
|
import { FeeReferenceBasedDetector } from '../fee-reference-based-detector';
|
|
3
|
+
import { PaymentNetworkOptions, ReferenceBasedDetectorOptions } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Handle payment networks with ETH fee proxy extension
|
|
5
6
|
*/
|
|
6
7
|
export declare class EthFeeProxyPaymentDetector extends FeeReferenceBasedDetector<ExtensionTypes.PnFeeReferenceBased.IFeeReferenceBased, PaymentTypes.IETHFeePaymentEventParameters> {
|
|
8
|
+
private readonly getSubgraphClient;
|
|
7
9
|
/**
|
|
8
10
|
* @param extension The advanced logic payment network extensions
|
|
9
11
|
*/
|
|
10
|
-
constructor({ advancedLogic }:
|
|
11
|
-
advancedLogic: AdvancedLogicTypes.IAdvancedLogic;
|
|
12
|
-
});
|
|
12
|
+
constructor({ advancedLogic, currencyManager, getSubgraphClient, }: ReferenceBasedDetectorOptions & Pick<PaymentNetworkOptions, 'getSubgraphClient'>);
|
|
13
13
|
/**
|
|
14
14
|
* Extracts payment events of an address matching an address and a payment reference
|
|
15
15
|
*
|
|
16
16
|
* @param eventName Indicate if it is an address for payment or refund
|
|
17
|
-
* @param
|
|
17
|
+
* @param toAddress Address to check
|
|
18
18
|
* @param paymentReference The reference to identify the payment
|
|
19
19
|
* @param _requestCurrency The request currency
|
|
20
20
|
* @param paymentChain the name of the payment (block)chain
|
|
21
21
|
* @param paymentNetwork the payment network
|
|
22
22
|
* @returns The balance
|
|
23
23
|
*/
|
|
24
|
-
protected extractEvents(eventName: PaymentTypes.EVENTS_NAMES,
|
|
24
|
+
protected extractEvents(eventName: PaymentTypes.EVENTS_NAMES, toAddress: string | undefined, paymentReference: string, _requestCurrency: RequestLogicTypes.ICurrency, paymentChain: string, paymentNetwork: ExtensionTypes.PnFeeReferenceBased.IFeeReferenceBased extends ExtensionTypes.IExtension<infer X> ? ExtensionTypes.IState<X> : never): Promise<PaymentTypes.AllNetworkEvents<PaymentTypes.IETHPaymentEventParameters>>;
|
|
25
25
|
static getDeploymentInformation: import("../utils").GetDeploymentInformation<false>;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=fee-proxy-detector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-proxy-detector.d.ts","sourceRoot":"","sources":["../../src/eth/fee-proxy-detector.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"fee-proxy-detector.d.ts","sourceRoot":"","sources":["../../src/eth/fee-proxy-detector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAG5E,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAYhF;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,yBAAyB,CACvE,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EACrD,YAAY,CAAC,6BAA6B,CAC3C;IACC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6C;IAC/E;;OAEG;gBACgB,EACjB,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,EAAE,6BAA6B,GAAG,IAAI,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;IASnF;;;;;;;;;;OAUG;cACa,aAAa,CAC3B,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,iBAAiB,CAAC,SAAS,EAC7C,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,SAAS,cAAc,CAAC,UAAU,CACrG,MAAM,CAAC,CACR,GACG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,GACxB,KAAK,GACR,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;IAyClF,OAAc,wBAAwB,qDAGpC;CACH"}
|
|
@@ -6,7 +6,6 @@ const SmartContracts = require("@requestnetwork/smart-contracts");
|
|
|
6
6
|
const types_1 = require("@requestnetwork/types");
|
|
7
7
|
const proxy_info_retriever_1 = require("./proxy-info-retriever");
|
|
8
8
|
const fee_reference_based_detector_1 = require("../fee-reference-based-detector");
|
|
9
|
-
const thegraph_info_retriever_1 = require("../erc20/thegraph-info-retriever");
|
|
10
9
|
const utils_1 = require("../utils");
|
|
11
10
|
const thegraph_1 = require("../thegraph");
|
|
12
11
|
const PROXY_CONTRACT_ADDRESS_MAP = {
|
|
@@ -20,34 +19,42 @@ class EthFeeProxyPaymentDetector extends fee_reference_based_detector_1.FeeRefer
|
|
|
20
19
|
/**
|
|
21
20
|
* @param extension The advanced logic payment network extensions
|
|
22
21
|
*/
|
|
23
|
-
constructor({ advancedLogic }) {
|
|
24
|
-
super(types_1.PaymentTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT, advancedLogic.extensions.feeProxyContractEth);
|
|
22
|
+
constructor({ advancedLogic, currencyManager, getSubgraphClient, }) {
|
|
23
|
+
super(types_1.PaymentTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT, advancedLogic.extensions.feeProxyContractEth, currencyManager);
|
|
24
|
+
this.getSubgraphClient = getSubgraphClient;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Extracts payment events of an address matching an address and a payment reference
|
|
28
28
|
*
|
|
29
29
|
* @param eventName Indicate if it is an address for payment or refund
|
|
30
|
-
* @param
|
|
30
|
+
* @param toAddress Address to check
|
|
31
31
|
* @param paymentReference The reference to identify the payment
|
|
32
32
|
* @param _requestCurrency The request currency
|
|
33
33
|
* @param paymentChain the name of the payment (block)chain
|
|
34
34
|
* @param paymentNetwork the payment network
|
|
35
35
|
* @returns The balance
|
|
36
36
|
*/
|
|
37
|
-
extractEvents(eventName,
|
|
37
|
+
extractEvents(eventName, toAddress, paymentReference, _requestCurrency, paymentChain, paymentNetwork) {
|
|
38
38
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
39
|
-
if (!
|
|
39
|
+
if (!toAddress) {
|
|
40
40
|
return {
|
|
41
41
|
paymentEvents: [],
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
const proxyContractArtifact = EthFeeProxyPaymentDetector.getDeploymentInformation(paymentChain, paymentNetwork.version);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const subgraphClient = this.getSubgraphClient(paymentChain);
|
|
46
|
+
if (subgraphClient) {
|
|
47
|
+
const graphInfoRetriever = new thegraph_1.TheGraphInfoRetriever(subgraphClient, this.currencyManager);
|
|
48
|
+
return graphInfoRetriever.getTransferEvents({
|
|
49
|
+
paymentReference,
|
|
50
|
+
contractAddress: proxyContractArtifact.address,
|
|
51
|
+
toAddress,
|
|
52
|
+
eventName,
|
|
53
|
+
paymentChain,
|
|
54
|
+
});
|
|
48
55
|
}
|
|
49
56
|
else {
|
|
50
|
-
const proxyInfoRetriever = new proxy_info_retriever_1.EthProxyInfoRetriever(paymentReference, proxyContractArtifact.address, proxyContractArtifact.creationBlockNumber,
|
|
57
|
+
const proxyInfoRetriever = new proxy_info_retriever_1.EthProxyInfoRetriever(paymentReference, proxyContractArtifact.address, proxyContractArtifact.creationBlockNumber, toAddress, eventName, paymentChain);
|
|
51
58
|
const paymentEvents = yield proxyInfoRetriever.getTransferEvents();
|
|
52
59
|
return {
|
|
53
60
|
paymentEvents,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-proxy-detector.js","sourceRoot":"","sources":["../../src/eth/fee-proxy-detector.ts"],"names":[],"mappings":";;;;AAAA,kEAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"fee-proxy-detector.js","sourceRoot":"","sources":["../../src/eth/fee-proxy-detector.ts"],"names":[],"mappings":";;;;AAAA,kEAAkE;AAClE,iDAAwF;AAExF,iEAA+D;AAC/D,kFAA4E;AAC5E,oCAAwD;AACxD,0CAAoD;AAQpD,MAAM,0BAA0B,GAA0B;IACxD,CAAC,OAAO,CAAC,EAAE,OAAO;IAClB,CAAC,OAAO,CAAC,EAAE,OAAO;CACnB,CAAC;AAEF;;GAEG;AACH,MAAa,0BAA2B,SAAQ,wDAG/C;IAEC;;OAEG;IACH,YAAmB,EACjB,aAAa,EACb,eAAe,EACf,iBAAiB,GACgE;QACjF,KAAK,CACH,oBAAY,CAAC,kBAAkB,CAAC,sBAAsB,EACtD,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAC5C,eAAe,CAChB,CAAC;QACF,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;OAUG;IACa,aAAa,CAC3B,SAAoC,EACpC,SAA6B,EAC7B,gBAAwB,EACxB,gBAA6C,EAC7C,YAAoB,EACpB,cAIS;;YAET,IAAI,CAAC,SAAS,EAAE;gBACd,OAAO;oBACL,aAAa,EAAE,EAAE;iBAClB,CAAC;aACH;YAED,MAAM,qBAAqB,GAAG,0BAA0B,CAAC,wBAAwB,CAC/E,YAAY,EACZ,cAAc,CAAC,OAAO,CACvB,CAAC;YACF,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;YAC5D,IAAI,cAAc,EAAE;gBAClB,MAAM,kBAAkB,GAAG,IAAI,gCAAqB,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBAE3F,OAAO,kBAAkB,CAAC,iBAAiB,CAAC;oBAC1C,gBAAgB;oBAChB,eAAe,EAAE,qBAAqB,CAAC,OAAO;oBAC9C,SAAS;oBACT,SAAS;oBACT,YAAY;iBACb,CAAC,CAAC;aACJ;iBAAM;gBACL,MAAM,kBAAkB,GAAG,IAAI,4CAAqB,CAClD,gBAAgB,EAChB,qBAAqB,CAAC,OAAO,EAC7B,qBAAqB,CAAC,mBAAmB,EACzC,SAAS,EACT,SAAS,EACT,YAAY,CACb,CAAC;gBACF,MAAM,aAAa,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,EAAE,CAAC;gBACnE,OAAO;oBACL,aAAa;iBACd,CAAC;aACH;QACH,CAAC;KAAA;;AA/EH,gEAwFC;AAPC;;GAEG;AACW,mDAAwB,GAAG,IAAA,oCAA4B,EACnE,cAAc,CAAC,wBAAwB,EACvC,0BAA0B,CAC3B,CAAC"}
|
package/dist/eth/input-data.d.ts
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExtensionTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
2
2
|
import { ReferenceBasedDetector } from '../reference-based-detector';
|
|
3
|
+
import { PaymentNetworkOptions, ReferenceBasedDetectorOptions } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Handle payment networks with ETH input data extension
|
|
5
6
|
*/
|
|
6
7
|
export declare class EthInputDataPaymentDetector extends ReferenceBasedDetector<ExtensionTypes.PnReferenceBased.IReferenceBased, PaymentTypes.IETHPaymentEventParameters> {
|
|
7
8
|
private explorerApiKeys;
|
|
9
|
+
private readonly getSubgraphClient;
|
|
8
10
|
/**
|
|
9
11
|
* @param extension The advanced logic payment network extensions
|
|
10
12
|
*/
|
|
11
|
-
constructor({ advancedLogic, explorerApiKeys, }:
|
|
12
|
-
advancedLogic: AdvancedLogicTypes.IAdvancedLogic;
|
|
13
|
-
explorerApiKeys?: Record<string, string>;
|
|
14
|
-
});
|
|
13
|
+
constructor({ advancedLogic, currencyManager, explorerApiKeys, getSubgraphClient, }: ReferenceBasedDetectorOptions & Pick<PaymentNetworkOptions, 'explorerApiKeys' | 'getSubgraphClient'>);
|
|
15
14
|
/**
|
|
16
15
|
* Extracts payment events of an address matching an address and a payment reference
|
|
17
16
|
*
|
|
18
|
-
* @param
|
|
17
|
+
* @param toAddress Address to check
|
|
19
18
|
* @param eventName Indicate if it is an address for payment or refund
|
|
20
19
|
* @param requestCurrency The request currency
|
|
21
20
|
* @param paymentReference The reference to identify the payment
|
|
22
21
|
* @param paymentNetwork the payment network
|
|
23
22
|
* @returns The balance
|
|
24
23
|
*/
|
|
25
|
-
protected extractEvents(eventName: PaymentTypes.EVENTS_NAMES,
|
|
24
|
+
protected extractEvents(eventName: PaymentTypes.EVENTS_NAMES, toAddress: string | undefined, paymentReference: string, _requestCurrency: RequestLogicTypes.ICurrency, paymentChain: string, paymentNetwork: ExtensionTypes.IState<ExtensionTypes.PnReferenceBased.ICreationParameters>): Promise<PaymentTypes.AllNetworkEvents<PaymentTypes.IETHPaymentEventParameters | PaymentTypes.IETHFeePaymentEventParameters>>;
|
|
26
25
|
static getDeploymentInformation: import("../utils").GetDeploymentInformation<true>;
|
|
27
26
|
}
|
|
28
27
|
//# sourceMappingURL=input-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-data.d.ts","sourceRoot":"","sources":["../../src/eth/input-data.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"input-data.d.ts","sourceRoot":"","sources":["../../src/eth/input-data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAchF;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,sBAAsB,CACrE,cAAc,CAAC,gBAAgB,CAAC,eAAe,EAC/C,YAAY,CAAC,0BAA0B,CACxC;IACC,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6C;IAE/E;;OAEG;gBACgB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,EAAE,6BAA6B,GAC9B,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;IAUtE;;;;;;;;;OASG;cACa,aAAa,CAC3B,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,iBAAiB,CAAC,SAAS,EAC7C,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,GACzF,OAAO,CACR,YAAY,CAAC,gBAAgB,CAC3B,YAAY,CAAC,0BAA0B,GAAG,YAAY,CAAC,6BAA6B,CACrF,CACF;IA2DD,OAAc,wBAAwB,oDAIpC;CACH"}
|
package/dist/eth/input-data.js
CHANGED
|
@@ -9,7 +9,6 @@ const proxy_info_retriever_1 = require("./proxy-info-retriever");
|
|
|
9
9
|
const reference_based_detector_1 = require("../reference-based-detector");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const thegraph_1 = require("../thegraph");
|
|
12
|
-
const thegraph_info_retriever_1 = require("../erc20/thegraph-info-retriever");
|
|
13
12
|
// the versions 0.1.0 and 0.2.0 have the same contracts
|
|
14
13
|
const PROXY_CONTRACT_ADDRESS_MAP = {
|
|
15
14
|
['0.1.0']: '0.1.0',
|
|
@@ -23,39 +22,47 @@ class EthInputDataPaymentDetector extends reference_based_detector_1.ReferenceBa
|
|
|
23
22
|
/**
|
|
24
23
|
* @param extension The advanced logic payment network extensions
|
|
25
24
|
*/
|
|
26
|
-
constructor({ advancedLogic, explorerApiKeys, }) {
|
|
27
|
-
super(types_1.PaymentTypes.PAYMENT_NETWORK_ID.ETH_INPUT_DATA, advancedLogic.extensions.ethereumInputData);
|
|
25
|
+
constructor({ advancedLogic, currencyManager, explorerApiKeys, getSubgraphClient, }) {
|
|
26
|
+
super(types_1.PaymentTypes.PAYMENT_NETWORK_ID.ETH_INPUT_DATA, advancedLogic.extensions.ethereumInputData, currencyManager);
|
|
28
27
|
this.explorerApiKeys = explorerApiKeys || {};
|
|
28
|
+
this.getSubgraphClient = getSubgraphClient;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Extracts payment events of an address matching an address and a payment reference
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
33
|
+
* @param toAddress Address to check
|
|
34
34
|
* @param eventName Indicate if it is an address for payment or refund
|
|
35
35
|
* @param requestCurrency The request currency
|
|
36
36
|
* @param paymentReference The reference to identify the payment
|
|
37
37
|
* @param paymentNetwork the payment network
|
|
38
38
|
* @returns The balance
|
|
39
39
|
*/
|
|
40
|
-
extractEvents(eventName,
|
|
40
|
+
extractEvents(eventName, toAddress, paymentReference, _requestCurrency, paymentChain, paymentNetwork) {
|
|
41
41
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
42
|
-
if (!
|
|
42
|
+
if (!toAddress) {
|
|
43
43
|
return {
|
|
44
44
|
paymentEvents: [],
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const infoRetriever = new info_retriever_1.EthInputDataInfoRetriever(
|
|
47
|
+
const infoRetriever = new info_retriever_1.EthInputDataInfoRetriever(toAddress, eventName, paymentChain, paymentReference, this.explorerApiKeys[paymentChain]);
|
|
48
48
|
const events = yield infoRetriever.getTransferEvents();
|
|
49
49
|
const proxyContractArtifact = EthInputDataPaymentDetector.getDeploymentInformation(paymentChain, paymentNetwork.version);
|
|
50
50
|
let allEvents;
|
|
51
51
|
let escrowEvents = [];
|
|
52
52
|
if (proxyContractArtifact) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const subgraphClient = this.getSubgraphClient(paymentChain);
|
|
54
|
+
if (subgraphClient) {
|
|
55
|
+
const graphInfoRetriever = new thegraph_1.TheGraphInfoRetriever(subgraphClient, this.currencyManager);
|
|
56
|
+
allEvents = yield graphInfoRetriever.getTransferEvents({
|
|
57
|
+
paymentReference,
|
|
58
|
+
contractAddress: proxyContractArtifact.address,
|
|
59
|
+
toAddress,
|
|
60
|
+
eventName,
|
|
61
|
+
paymentChain,
|
|
62
|
+
});
|
|
56
63
|
}
|
|
57
64
|
else {
|
|
58
|
-
const ethInfoRetriever = new proxy_info_retriever_1.EthProxyInfoRetriever(paymentReference, proxyContractArtifact.address, proxyContractArtifact.creationBlockNumber,
|
|
65
|
+
const ethInfoRetriever = new proxy_info_retriever_1.EthProxyInfoRetriever(paymentReference, proxyContractArtifact.address, proxyContractArtifact.creationBlockNumber, toAddress, eventName, paymentChain);
|
|
59
66
|
const paymentEvents = yield ethInfoRetriever.getTransferEvents();
|
|
60
67
|
allEvents = {
|
|
61
68
|
paymentEvents,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-data.js","sourceRoot":"","sources":["../../src/eth/input-data.ts"],"names":[],"mappings":";;;;AAAA,kEAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"input-data.js","sourceRoot":"","sources":["../../src/eth/input-data.ts"],"names":[],"m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cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBAC5D,IAAI,cAAc,EAAE;oBAClB,MAAM,kBAAkB,GAAG,IAAI,gCAAqB,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;oBAC3F,SAAS,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,CAAC;wBACrD,gBAAgB;wBAChB,eAAe,EAAE,qBAAqB,CAAC,OAAO;wBAC9C,SAAS;wBACT,SAAS;wBACT,YAAY;qBACb,CAAC,CAAC;iBACJ;qBAAM;oBACL,MAAM,gBAAgB,GAAG,IAAI,4CAAqB,CAChD,gBAAgB,EAChB,qBAAqB,CAAC,OAAO,EAC7B,qBAAqB,CAAC,mBAAmB,EACzC,SAAS,EACT,SAAS,EACT,YAAY,CACb,CAAC;oBACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;oBACjE,SAAS,GAAG;wBACV,aAAa;qBACd,CAAC;iBACH;gBACD,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;gBACxC,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;aACvC;YACD,OAAO;gBACL,aAAa,EAAE,MAAM;gBACrB,YAAY,EAAE,YAAY;aAC3B,CAAC;QACJ,CAAC;KAAA;;AArGH,kEA+GC;AARC;;GAEG;AACW,oDAAwB,GAAG,IAAA,oCAA4B,EACnE,cAAc,CAAC,qBAAqB,EACpC,0BAA0B,EAC1B,IAAI,CACL,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers';
|
|
2
2
|
import { ExtensionTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
3
|
+
import { ICurrencyManager } from '@requestnetwork/currency';
|
|
3
4
|
import { ReferenceBasedDetector } from './reference-based-detector';
|
|
4
5
|
/**
|
|
5
6
|
* Abstract class to extend to get the payment balance of reference based requests
|
|
@@ -12,7 +13,7 @@ export declare abstract class FeeReferenceBasedDetector<TExtension extends Exten
|
|
|
12
13
|
* @param paymentNetworkId Example : PaymentTypes.PAYMENT_NETWORK_ID.ETH_INPUT_DATA
|
|
13
14
|
* @param extension The advanced logic payment network extension, reference based
|
|
14
15
|
*/
|
|
15
|
-
constructor(paymentNetworkId: PaymentTypes.PAYMENT_NETWORK_ID, extension: TExtension);
|
|
16
|
+
constructor(paymentNetworkId: PaymentTypes.PAYMENT_NETWORK_ID, extension: TExtension, currencyManager: ICurrencyManager);
|
|
16
17
|
/**
|
|
17
18
|
* Creates the extensions data for the creation of this extension.
|
|
18
19
|
* Will set a salt if none is already given
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-reference-based-detector.d.ts","sourceRoot":"","sources":["../src/fee-reference-based-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"fee-reference-based-detector.d.ts","sourceRoot":"","sources":["../src/fee-reference-based-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;GAEG;AACH,8BAAsB,yBAAyB,CAC7C,UAAU,SAAS,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EACxE,uBAAuB,SAAS;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAC3E,SAAQ,sBAAsB,CAAC,UAAU,EAAE,uBAAuB,CAAC;IACnE;;;OAGG;gBAGD,gBAAgB,EAAE,YAAY,CAAC,kBAAkB,EACjD,SAAS,EAAE,UAAU,EACrB,eAAe,EAAE,gBAAgB;IAKnC;;;;;;OAMG;IACU,+BAA+B,CAC1C,gCAAgC,EAAE,cAAc,CAAC,mBAAmB,CAAC,mBAAmB,GACvF,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC;IAclC;;;;;OAKG;IACI,wCAAwC,CAC7C,UAAU,EAAE,cAAc,CAAC,mBAAmB,CAAC,iBAAiB,GAC/D,cAAc,CAAC,OAAO;IAOZ,UAAU,CACrB,OAAO,EAAE,iBAAiB,CAAC,QAAQ,GAClC,OAAO,CACR,YAAY,CAAC,kBAAkB,CAC7B,uBAAuB,GAAG,YAAY,CAAC,kCAAkC,CAC1E,CACF;IAYY,aAAa,CACxB,OAAO,EAAE,iBAAiB,CAAC,QAAQ,EACnC,OAAO,EAAE,YAAY,CAAC,kBAAkB,CACtC,uBAAuB,GAAG,YAAY,CAAC,kCAAkC,CAC1E,GACA,OAAO,CACR,YAAY,CAAC,kBAAkB,CAC7B,uBAAuB,GAAG,YAAY,CAAC,kCAAkC,CAC1E,CACF;IAYD,SAAS,CAAC,iBAAiB,CACzB,SAAS,EAAE,YAAY,CAAC,oBAAoB,CAC1C,uBAAuB,GAAG,YAAY,CAAC,kCAAkC,CAC1E,EAAE,EACH,UAAU,EAAE,MAAM,GACjB,SAAS;CAYb"}
|
|
@@ -13,8 +13,8 @@ class FeeReferenceBasedDetector extends reference_based_detector_1.ReferenceBase
|
|
|
13
13
|
* @param paymentNetworkId Example : PaymentTypes.PAYMENT_NETWORK_ID.ETH_INPUT_DATA
|
|
14
14
|
* @param extension The advanced logic payment network extension, reference based
|
|
15
15
|
*/
|
|
16
|
-
constructor(paymentNetworkId, extension) {
|
|
17
|
-
super(paymentNetworkId, extension);
|
|
16
|
+
constructor(paymentNetworkId, extension, currencyManager) {
|
|
17
|
+
super(paymentNetworkId, extension, currencyManager);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Creates the extensions data for the creation of this extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-reference-based-detector.js","sourceRoot":"","sources":["../src/fee-reference-based-detector.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;
|
|
1
|
+
{"version":3,"file":"fee-reference-based-detector.js","sourceRoot":"","sources":["../src/fee-reference-based-detector.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AAGnC,iDAA0C;AAC1C,yEAAoE;AAEpE;;GAEG;AACH,MAAsB,yBAGpB,SAAQ,iDAA2D;IACnE;;;OAGG;IAEH,YACE,gBAAiD,EACjD,SAAqB,EACrB,eAAiC;QAEjC,KAAK,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACU,+BAA+B,CAC1C,gCAAwF;;YAExF,oCAAoC;YACpC,gCAAgC,CAAC,IAAI;gBACnC,gCAAgC,CAAC,IAAI,IAAI,CAAC,MAAM,eAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC,CAAC;YAEvF,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,iBACxC,UAAU,EAAE,gCAAgC,CAAC,UAAU,EACvD,SAAS,EAAE,gCAAgC,CAAC,SAAS,EACrD,cAAc,EAAE,gCAAgC,CAAC,cAAc,EAC/D,aAAa,EAAE,gCAAgC,CAAC,aAAa,IAC1D,gCAAgC,EACnC,CAAC;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACI,wCAAwC,CAC7C,UAAgE;QAEhE,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;YACvC,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,SAAS,EAAE,UAAU,CAAC,SAAS;SAChC,CAAC,CAAC;IACL,CAAC;IAEY,UAAU,CACrB,OAAmC;;;;;YAMnC,MAAM,OAAO,GAAG,MAAM,OAAM,UAAU,YAAC,OAAO,CAAC,CAAC;YAChD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,CAAC;CACF;AA/GD,8DA+GC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaymentNetworkFactory
|
|
1
|
+
import { PaymentNetworkFactory } 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';
|
|
@@ -6,13 +6,14 @@ import * as Erc20PaymentNetwork from './erc20';
|
|
|
6
6
|
import { AnyToERC20PaymentDetector, AnyToEthFeeProxyPaymentDetector } from './any';
|
|
7
7
|
import { EthFeeProxyPaymentDetector, EthInputDataPaymentDetector } from './eth';
|
|
8
8
|
import { initPaymentDetectionApiKeys, setProviderFactory, getDefaultProvider } from './provider';
|
|
9
|
-
import { getTheGraphClient, getTheGraphNearClient
|
|
10
|
-
import { parseLogArgs, padAmountForChainlink, unpadAmountFromChainlink, calculateEscrowState, getPaymentNetworkExtension, getPaymentReference } from './utils';
|
|
9
|
+
import { getTheGraphClient, getTheGraphNearClient } from './thegraph';
|
|
10
|
+
import { parseLogArgs, padAmountForChainlink, unpadAmountFromChainlink, calculateEscrowState, getPaymentNetworkExtension, getPaymentReference, formatAddress } from './utils';
|
|
11
11
|
import { NearNativeTokenPaymentDetector, NearConversionNativeTokenPaymentDetector } from './near';
|
|
12
12
|
import { FeeReferenceBasedDetector } from './fee-reference-based-detector';
|
|
13
13
|
import { SuperFluidPaymentDetector } from './erc777/superfluid-detector';
|
|
14
14
|
import { EscrowERC20InfoRetriever } from './erc20/escrow-info-retriever';
|
|
15
15
|
import { SuperFluidInfoRetriever } from './erc777/superfluid-retriever';
|
|
16
|
+
import { PaymentNetworkOptions } from './types';
|
|
16
17
|
export type { TheGraphClient } from './thegraph';
|
|
17
|
-
export { PaymentNetworkFactory, PaymentNetworkOptions, PaymentReferenceCalculator, BtcPaymentNetwork, DeclarativePaymentDetector, Erc20PaymentNetwork, EthInputDataPaymentDetector, EthFeeProxyPaymentDetector, AnyToERC20PaymentDetector, AnyToEthFeeProxyPaymentDetector, FeeReferenceBasedDetector, SuperFluidPaymentDetector, NearNativeTokenPaymentDetector, NearConversionNativeTokenPaymentDetector, EscrowERC20InfoRetriever, SuperFluidInfoRetriever, setProviderFactory, initPaymentDetectionApiKeys, getDefaultProvider, getTheGraphClient, getTheGraphNearClient,
|
|
18
|
+
export { PaymentNetworkFactory, PaymentNetworkOptions, PaymentReferenceCalculator, BtcPaymentNetwork, DeclarativePaymentDetector, Erc20PaymentNetwork, EthInputDataPaymentDetector, EthFeeProxyPaymentDetector, AnyToERC20PaymentDetector, AnyToEthFeeProxyPaymentDetector, FeeReferenceBasedDetector, SuperFluidPaymentDetector, NearNativeTokenPaymentDetector, NearConversionNativeTokenPaymentDetector, EscrowERC20InfoRetriever, SuperFluidInfoRetriever, setProviderFactory, initPaymentDetectionApiKeys, getDefaultProvider, getTheGraphClient, getTheGraphNearClient, parseLogArgs, padAmountForChainlink, unpadAmountFromChainlink, calculateEscrowState, getPaymentNetworkExtension, getPaymentReference, formatAddress, };
|
|
18
19
|
//# 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,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,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,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|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPaymentReference = exports.getPaymentNetworkExtension = exports.calculateEscrowState = exports.unpadAmountFromChainlink = exports.padAmountForChainlink = exports.parseLogArgs = exports.
|
|
3
|
+
exports.formatAddress = exports.getPaymentReference = exports.getPaymentNetworkExtension = exports.calculateEscrowState = exports.unpadAmountFromChainlink = exports.padAmountForChainlink = exports.parseLogArgs = 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
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");
|
|
@@ -24,7 +24,6 @@ Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: fu
|
|
|
24
24
|
const thegraph_1 = require("./thegraph");
|
|
25
25
|
Object.defineProperty(exports, "getTheGraphClient", { enumerable: true, get: function () { return thegraph_1.getTheGraphClient; } });
|
|
26
26
|
Object.defineProperty(exports, "getTheGraphNearClient", { enumerable: true, get: function () { return thegraph_1.getTheGraphNearClient; } });
|
|
27
|
-
Object.defineProperty(exports, "networkSupportsTheGraph", { enumerable: true, get: function () { return thegraph_1.networkSupportsTheGraph; } });
|
|
28
27
|
const utils_1 = require("./utils");
|
|
29
28
|
Object.defineProperty(exports, "parseLogArgs", { enumerable: true, get: function () { return utils_1.parseLogArgs; } });
|
|
30
29
|
Object.defineProperty(exports, "padAmountForChainlink", { enumerable: true, get: function () { return utils_1.padAmountForChainlink; } });
|
|
@@ -32,6 +31,7 @@ Object.defineProperty(exports, "unpadAmountFromChainlink", { enumerable: true, g
|
|
|
32
31
|
Object.defineProperty(exports, "calculateEscrowState", { enumerable: true, get: function () { return utils_1.calculateEscrowState; } });
|
|
33
32
|
Object.defineProperty(exports, "getPaymentNetworkExtension", { enumerable: true, get: function () { return utils_1.getPaymentNetworkExtension; } });
|
|
34
33
|
Object.defineProperty(exports, "getPaymentReference", { enumerable: true, get: function () { return utils_1.getPaymentReference; } });
|
|
34
|
+
Object.defineProperty(exports, "formatAddress", { enumerable: true, get: function () { return utils_1.formatAddress; } });
|
|
35
35
|
const near_1 = require("./near");
|
|
36
36
|
Object.defineProperty(exports, "NearNativeTokenPaymentDetector", { enumerable: true, get: function () { return near_1.NearNativeTokenPaymentDetector; } });
|
|
37
37
|
Object.defineProperty(exports, "NearConversionNativeTokenPaymentDetector", { enumerable: true, get: function () { return near_1.NearConversionNativeTokenPaymentDetector; } });
|
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,uEAAkE;AA6BhE,sGA7BO,+CAAqB,OA6BP;AA5BvB,iFAAwE;AA8BtE,qCA9BK,sCAA0B,CA8BL;AA5B5B,2CAA2C;AA6BzC,8CAAiB;AA5BnB,+CAA2D;AA6BzD,2GA7BO,wCAA0B,OA6BP;AA5B5B,+CAA+C;AA6B7C,kDAAmB;AA5BrB,+BAAmF;AA+BjF,0GA/BO,+BAAyB,OA+BP;AACzB,gHAhCkC,qCAA+B,OAgClC;AA/BjC,+BAAgF;AA6B9E,2GA7BO,gCAA0B,OA6BP;AAD1B,4GA5BmC,iCAA2B,OA4BnC;AA3B7B,yCAAiG;AAsC/F,4GAtCO,sCAA2B,OAsCP;AAD3B,mGArCoC,6BAAkB,OAqCpC;AAElB,mGAvCwD,6BAAkB,OAuCxD;AAtCpB,yCAAsE;AAuCpE,kGAvCO,4BAAiB,OAuCP;AACjB,sGAxC0B,gCAAqB,OAwC1B;AAvCvB,mCAQiB;AAgCf,6FAvCA,oBAAY,OAuCA;AACZ,sGAvCA,6BAAqB,OAuCA;AACrB,yGAvCA,gCAAwB,OAuCA;AACxB,qGAvCA,4BAAoB,OAuCA;AACpB,2GAvCA,kCAA0B,OAuCA;AAC1B,oGAvCA,2BAAmB,OAuCA;AACnB,8FAvCA,qBAAa,OAuCA;AArCf,iCAAkG;AAsBhG,+GAtBO,qCAA8B,OAsBP;AAC9B,yHAvBuC,+CAAwC,OAuBvC;AAtB1C,iFAA2E;AAmBzE,0GAnBO,wDAAyB,OAmBP;AAlB3B,sEAAyE;AAmBvE,0GAnBO,+CAAyB,OAmBP;AAlB3B,yEAAyE;AAqBvE,yGArBO,gDAAwB,OAqBP;AApB1B,wEAAwE;AAqBtE,wGArBO,8CAAuB,OAqBP"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExtensionTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
2
2
|
import { ReferenceBasedDetector } from '../reference-based-detector';
|
|
3
|
+
import { ReferenceBasedDetectorOptions } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Handle payment detection for NEAR native token payment
|
|
5
6
|
*/
|
|
@@ -7,9 +8,7 @@ export declare class NearNativeTokenPaymentDetector extends ReferenceBasedDetect
|
|
|
7
8
|
/**
|
|
8
9
|
* @param extension The advanced logic payment network extension
|
|
9
10
|
*/
|
|
10
|
-
constructor({ advancedLogic }:
|
|
11
|
-
advancedLogic: AdvancedLogicTypes.IAdvancedLogic;
|
|
12
|
-
});
|
|
11
|
+
constructor({ advancedLogic, currencyManager }: ReferenceBasedDetectorOptions);
|
|
13
12
|
static getContractName: (chainName: string, paymentNetworkVersion?: string) => string;
|
|
14
13
|
/**
|
|
15
14
|
* Extracts the events for an address and a payment reference
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"near-detector.d.ts","sourceRoot":"","sources":["../../src/near/near-detector.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"near-detector.d.ts","sourceRoot":"","sources":["../../src/near/near-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAczD;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,sBAAsB,CACxE,cAAc,CAAC,gBAAgB,CAAC,eAAe,EAC/C,YAAY,CAAC,0BAA0B,CACxC;IACC;;OAEG;gBACgB,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,6BAA6B;IAQpF,OAAc,eAAe,cAAe,MAAM,qCAAoC,MAAM,CAa1F;IAEF;;;;;;;;;OASG;cACa,aAAa,CAC3B,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,iBAAiB,CAAC,SAAS,EAC7C,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,GACzF,OAAO,CAAC,YAAY,CAAC,yBAAyB,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAmBvF,SAAS,CAAC,MAAM,CAAC,iBAAiB,0BAA2B,MAAM,KAAG,MAAM,CAK1E;CACH"}
|
|
@@ -17,8 +17,8 @@ class NearNativeTokenPaymentDetector extends reference_based_detector_1.Referenc
|
|
|
17
17
|
/**
|
|
18
18
|
* @param extension The advanced logic payment network extension
|
|
19
19
|
*/
|
|
20
|
-
constructor({ advancedLogic }) {
|
|
21
|
-
super(types_1.PaymentTypes.PAYMENT_NETWORK_ID.NATIVE_TOKEN, advancedLogic.extensions.nativeToken[0]);
|
|
20
|
+
constructor({ advancedLogic, currencyManager }) {
|
|
21
|
+
super(types_1.PaymentTypes.PAYMENT_NETWORK_ID.NATIVE_TOKEN, advancedLogic.extensions.nativeToken[0], currencyManager);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Extracts the events for an address and a payment reference
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"near-detector.js","sourceRoot":"","sources":["../../src/near/near-detector.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"near-detector.js","sourceRoot":"","sources":["../../src/near/near-detector.ts"],"names":[],"mappings":";;;;AAAA,iDAAwF;AAExF,0EAAqE;AAErE,0EAAqE;AAOrE,uDAAuD;AACvD,MAAM,oBAAoB,GAA0B;IAClD,CAAC,OAAO,CAAC,EAAE,OAAO;IAClB,CAAC,OAAO,CAAC,EAAE,OAAO;CACnB,CAAC;AAEF;;GAEG;AACH,MAAa,8BAA+B,SAAQ,iDAGnD;IACC;;OAEG;IACH,YAAmB,EAAE,aAAa,EAAE,eAAe,EAAiC;QAClF,KAAK,CACH,oBAAY,CAAC,kBAAkB,CAAC,YAAY,EAC5C,aAAa,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EACvC,eAAe,CAChB,CAAC;IACJ,CAAC;IAiBD;;;;;;;;;OASG;IACa,aAAa,CAC3B,SAAoC,EACpC,OAA2B,EAC3B,gBAAwB,EACxB,gBAA6C,EAC7C,YAAoB,EACpB,cAA0F;;YAE1F,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO;oBACL,aAAa,EAAE,E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{ CurrencyDefinition } from '@requestnetwork/currency';
|
|
3
3
|
import { NearInfoRetriever } from './near-info-retriever';
|
|
4
4
|
interface NearSubGraphPaymentEvent extends PaymentTypes.IETHPaymentEventParameters {
|
|
5
5
|
receiptId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"near-conversion-info-retriever.d.ts","sourceRoot":"","sources":["../../../src/near/retrievers/near-conversion-info-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"near-conversion-info-retriever.d.ts","sourceRoot":"","sources":["../../../src/near/retrievers/near-conversion-info-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,UAAU,wBAAyB,SAAQ,YAAY,CAAC,0BAA0B;IAChF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,iBAAiB;IAQ9D,SAAS,CAAC,eAAe,EAAE,kBAAkB;IAC7C,SAAS,CAAC,gBAAgB,EAAE,MAAM;IAClC,SAAS,CAAC,SAAS,EAAE,MAAM;IAC3B,SAAS,CAAC,iBAAiB,EAAE,MAAM;IACnC,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,YAAY;IAC9C,SAAS,CAAC,OAAO,EAAE,MAAM;IACzB,SAAS,CAAC,eAAe,EAAE,MAAM;IAbnC;;;;;OAKG;gBAES,eAAe,EAAE,kBAAkB,EACnC,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,OAAO,EAAE,MAAM,EACf,eAAe,GAAE,MAAU;IAK1B,iBAAiB,IAAI,OAAO,CACvC,YAAY,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,EAAE,CAC9D;CA4BF"}
|
|
@@ -11,7 +11,6 @@ export declare class NearInfoRetriever {
|
|
|
11
11
|
protected toAddress: string;
|
|
12
12
|
protected proxyContractName: string;
|
|
13
13
|
protected eventName: PaymentTypes.EVENTS_NAMES;
|
|
14
|
-
protected network: string;
|
|
15
14
|
protected client: TheGraphClient<'near'>;
|
|
16
15
|
/**
|
|
17
16
|
* @param paymentReference The reference to identify the payment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"near-info-retriever.d.ts","sourceRoot":"","sources":["../../../src/near/retrievers/near-info-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAyB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGvE,UAAU,wBAAyB,SAAQ,YAAY,CAAC,0BAA0B;IAChF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAU1B,SAAS,CAAC,gBAAgB,EAAE,MAAM;IAClC,SAAS,CAAC,SAAS,EAAE,MAAM;IAC3B,SAAS,CAAC,iBAAiB,EAAE,MAAM;IACnC,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"near-info-retriever.d.ts","sourceRoot":"","sources":["../../../src/near/retrievers/near-info-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAyB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGvE,UAAU,wBAAyB,SAAQ,YAAY,CAAC,0BAA0B;IAChF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAU1B,SAAS,CAAC,gBAAgB,EAAE,MAAM;IAClC,SAAS,CAAC,SAAS,EAAE,MAAM;IAC3B,SAAS,CAAC,iBAAiB,EAAE,MAAM;IACnC,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,YAAY;IAZhD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACzC;;;;;;OAMG;gBAES,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,YAAY,CAAC,YAAY,EAC9C,OAAO,EAAE,MAAM;IAYJ,iBAAiB,IAAI,OAAO,CACvC,YAAY,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,EAAE,CAC9D;CAmBF"}
|
|
@@ -19,12 +19,11 @@ class NearInfoRetriever {
|
|
|
19
19
|
this.toAddress = toAddress;
|
|
20
20
|
this.proxyContractName = proxyContractName;
|
|
21
21
|
this.eventName = eventName;
|
|
22
|
-
|
|
23
|
-
if (this.network !== 'aurora' && this.network !== 'aurora-testnet') {
|
|
22
|
+
if (network !== 'aurora' && network !== 'aurora-testnet') {
|
|
24
23
|
throw new Error('Near input data info-retriever only works with Near mainnet and testnet');
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
this.client = (0, thegraph_1.getTheGraphNearClient)(
|
|
25
|
+
network = network.replace('aurora', 'near');
|
|
26
|
+
this.client = (0, thegraph_1.getTheGraphNearClient)(`https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-${network}`);
|
|
28
27
|
}
|
|
29
28
|
getTransferEvents() {
|
|
30
29
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"near-info-retriever.js","sourceRoot":"","sources":["../../../src/near/retrievers/near-info-retriever.ts"],"names":[],"mappings":";;;;AACA,6CAAuE;AAOvE;;GAEG;AACH,MAAa,iBAAiB;IAE5B;;;;;;OAMG;IACH,YACY,gBAAwB,EACxB,SAAiB,EACjB,iBAAyB,EACzB,SAAoC,
|
|
1
|
+
{"version":3,"file":"near-info-retriever.js","sourceRoot":"","sources":["../../../src/near/retrievers/near-info-retriever.ts"],"names":[],"mappings":";;;;AACA,6CAAuE;AAOvE;;GAEG;AACH,MAAa,iBAAiB;IAE5B;;;;;;OAMG;IACH,YACY,gBAAwB,EACxB,SAAiB,EACjB,iBAAyB,EACzB,SAAoC,EAC9C,OAAe;QAJL,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,cAAS,GAAT,SAAS,CAAQ;QACjB,sBAAiB,GAAjB,iBAAiB,CAAQ;QACzB,cAAS,GAAT,SAAS,CAA2B;QAG9C,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,gBAAgB,EAAE;YACxD,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;SAC5F;QAED,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAA,gCAAqB,EACjC,2EAA2E,OAAO,EAAE,CACrF,CAAC;IACJ,CAAC;IAEY,iBAAiB;;YAG5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;gBACjD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,EAAE,EAAE,IAAI,CAAC,SAAS;gBAClB,eAAe,EAAE,IAAI,CAAC,iBAAiB;aACxC,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACnC,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,IAAI,EAAE,IAAI,CAAC,SAAS;gBACpB,UAAU,EAAE;oBACV,KAAK,EAAE,CAAC,CAAC,KAAK;oBACd,aAAa,EAAE,CAAC,CAAC,KAAK;oBACtB,oBAAoB;oBACpB,8BAA8B;oBAC9B,SAAS,EAAE,CAAC,CAAC,SAAS;iBACvB;gBACD,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;aAC/B,CAAC,CAAC,CAAC;QACN,CAAC;KAAA;CACF;AA/CD,8CA+CC"}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { AdvancedLogicTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
2
2
|
import { ICurrencyManager } from '@requestnetwork/currency';
|
|
3
|
-
|
|
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
|
-
};
|
|
3
|
+
import { PaymentNetworkOptions } from './types';
|
|
9
4
|
/** Factory to create the payment network according to the currency and payment network type */
|
|
10
5
|
export declare class PaymentNetworkFactory {
|
|
11
6
|
private readonly advancedLogic;
|
|
12
7
|
private readonly currencyManager;
|
|
13
|
-
private readonly options
|
|
8
|
+
private readonly options;
|
|
14
9
|
/**
|
|
15
10
|
*
|
|
16
11
|
* @param advancedLogic the advanced-logic layer in charge of the extensions
|
|
17
12
|
* @param currencyManager the currency manager handling supported currencies
|
|
18
13
|
* @param options the payment network options
|
|
19
14
|
*/
|
|
20
|
-
constructor(advancedLogic: AdvancedLogicTypes.IAdvancedLogic, currencyManager: ICurrencyManager, options?: PaymentNetworkOptions
|
|
15
|
+
constructor(advancedLogic: AdvancedLogicTypes.IAdvancedLogic, currencyManager: ICurrencyManager, options?: Partial<PaymentNetworkOptions>);
|
|
16
|
+
private buildOptions;
|
|
21
17
|
/**
|
|
22
18
|
* Creates a payment network according to payment network creation parameters
|
|
23
19
|
* It throws if the payment network given is not supported by this library
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAC5D,OAAO,EAGL,qBAAqB,EACtB,MAAM,SAAS,CAAC;AA4DjB,+FAA+F;AAC/F,qBAAa,qBAAqB;IAS9B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IATlC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D;;;;;OAKG;gBAEgB,aAAa,EAAE,kBAAkB,CAAC,cAAc,EAChD,eAAe,EAAE,gBAAgB,EAClD,OAAO,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC;IAK1C,OAAO,CAAC,YAAY;IAepB;;;;;;;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"}
|
|
@@ -15,6 +15,8 @@ const any_to_erc20_proxy_1 = require("./any/any-to-erc20-proxy");
|
|
|
15
15
|
const near_1 = require("./near");
|
|
16
16
|
const any_to_eth_proxy_1 = require("./any/any-to-eth-proxy");
|
|
17
17
|
const utils_1 = require("./utils");
|
|
18
|
+
const thegraph_1 = require("./thegraph");
|
|
19
|
+
const provider_1 = require("./provider");
|
|
18
20
|
const PN_ID = types_1.PaymentTypes.PAYMENT_NETWORK_ID;
|
|
19
21
|
/** Register the payment network by currency and type */
|
|
20
22
|
const supportedPaymentNetwork = {
|
|
@@ -66,7 +68,19 @@ class PaymentNetworkFactory {
|
|
|
66
68
|
constructor(advancedLogic, currencyManager, options) {
|
|
67
69
|
this.advancedLogic = advancedLogic;
|
|
68
70
|
this.currencyManager = currencyManager;
|
|
69
|
-
this.options = options;
|
|
71
|
+
this.options = this.buildOptions(options || {});
|
|
72
|
+
}
|
|
73
|
+
buildOptions(options) {
|
|
74
|
+
const defaultOptions = {
|
|
75
|
+
getSubgraphClient: (network) => {
|
|
76
|
+
return network === 'private'
|
|
77
|
+
? undefined
|
|
78
|
+
: (0, thegraph_1.getTheGraphClient)(`https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-${network}`);
|
|
79
|
+
},
|
|
80
|
+
explorerApiKeys: {},
|
|
81
|
+
getRpcProvider: provider_1.getDefaultProvider,
|
|
82
|
+
};
|
|
83
|
+
return Object.assign(Object.assign({}, defaultOptions), options);
|
|
70
84
|
}
|
|
71
85
|
/**
|
|
72
86
|
* Creates a payment network according to payment network creation parameters
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-network-factory.js","sourceRoot":"","sources":["../src/payment-network-factory.ts"],"names":[],"mappings":";;;AAAA,iDAA4F;
|
|
1
|
+
{"version":3,"file":"payment-network-factory.js","sourceRoot":"","sources":["../src/payment-network-factory.ts"],"names":[],"mappings":";;;AAAA,iDAA4F;AAO5F,uEAA6E;AAC7E,uEAA6E;AAC7E,+CAA2D;AAC3D,yDAAyE;AACzE,mEAA0E;AAC1E,2DAAmE;AACnE,sEAAyE;AACzE,iDAA+D;AAC/D,iEAAsE;AACtE,iEAAqE;AACrE,iCAAkG;AAClG,6DAAyE;AACzE,mCAAqD;AACrD,yCAA+C;AAC/C,yCAAgD;AAEhD,MAAM,KAAK,GAAG,oBAAY,CAAC,kBAAkB,CAAC;AAE9C,wDAAwD;AACxD,MAAM,u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ED,MAAM,gBAAgB,GAAG,EAAE,CAAC,EAAgD,CAAC;QAC7E,OAAO,IAAI,CAAC,oBAAoB,CAC9B,gBAAgB,EAChB,OAAO,CAAC,QAAQ,CAAC,IAAI,EACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CACzB,CAAC;IACJ,CAAC;CACF;AA1FD,sDA0FC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ExtensionTypes, PaymentTypes, RequestLogicTypes } from '@requestnetwork/types';
|
|
2
|
+
import { ICurrencyManager } from '@requestnetwork/currency';
|
|
2
3
|
import { DeclarativePaymentDetectorBase } from './declarative';
|
|
3
4
|
/**
|
|
4
5
|
* Abstract class to extend to get the payment balance of reference based requests
|
|
5
6
|
*/
|
|
6
7
|
export declare abstract class ReferenceBasedDetector<TExtension extends ExtensionTypes.PnReferenceBased.IReferenceBased, TPaymentEventParameters> extends DeclarativePaymentDetectorBase<TExtension, TPaymentEventParameters | PaymentTypes.IDeclarativePaymentEventParameters> {
|
|
8
|
+
protected readonly currencyManager: ICurrencyManager;
|
|
7
9
|
/**
|
|
8
10
|
* @param paymentNetworkId Example : PaymentTypes.PAYMENT_NETWORK_ID.ETH_INPUT_DATA
|
|
9
11
|
* @param extension The advanced logic payment network extension, reference based
|
|
12
|
+
* @param currencyManager The currency manager
|
|
10
13
|
*/
|
|
11
|
-
constructor(paymentNetworkId: PaymentTypes.PAYMENT_NETWORK_ID, extension: TExtension);
|
|
14
|
+
constructor(paymentNetworkId: PaymentTypes.PAYMENT_NETWORK_ID, extension: TExtension, currencyManager: ICurrencyManager);
|
|
12
15
|
/**
|
|
13
16
|
* Creates the extensions data for the creation of this extension.
|
|
14
17
|
* Will set a salt if none is already given
|