@requestnetwork/payment-detection 0.35.1-next.1795 → 0.35.1-next.1797

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.
Files changed (93) hide show
  1. package/dist/any/any-to-erc20-proxy.d.ts +5 -7
  2. package/dist/any/any-to-erc20-proxy.d.ts.map +1 -1
  3. package/dist/any/any-to-erc20-proxy.js +19 -8
  4. package/dist/any/any-to-erc20-proxy.js.map +1 -1
  5. package/dist/any/any-to-eth-proxy.d.ts +6 -11
  6. package/dist/any/any-to-eth-proxy.d.ts.map +1 -1
  7. package/dist/any/any-to-eth-proxy.js +22 -15
  8. package/dist/any/any-to-eth-proxy.js.map +1 -1
  9. package/dist/any-to-any-detector.d.ts +0 -1
  10. package/dist/any-to-any-detector.d.ts.map +1 -1
  11. package/dist/any-to-any-detector.js +1 -2
  12. package/dist/any-to-any-detector.js.map +1 -1
  13. package/dist/erc20/fee-proxy-contract.d.ts +6 -8
  14. package/dist/erc20/fee-proxy-contract.d.ts.map +1 -1
  15. package/dist/erc20/fee-proxy-contract.js +19 -13
  16. package/dist/erc20/fee-proxy-contract.js.map +1 -1
  17. package/dist/erc20/proxy-contract.d.ts +5 -5
  18. package/dist/erc20/proxy-contract.d.ts.map +1 -1
  19. package/dist/erc20/proxy-contract.js +16 -9
  20. package/dist/erc20/proxy-contract.js.map +1 -1
  21. package/dist/erc777/superfluid-detector.d.ts +3 -4
  22. package/dist/erc777/superfluid-detector.d.ts.map +1 -1
  23. package/dist/erc777/superfluid-detector.js +2 -2
  24. package/dist/erc777/superfluid-detector.js.map +1 -1
  25. package/dist/eth/fee-proxy-detector.d.ts +6 -6
  26. package/dist/eth/fee-proxy-detector.d.ts.map +1 -1
  27. package/dist/eth/fee-proxy-detector.js +17 -10
  28. package/dist/eth/fee-proxy-detector.js.map +1 -1
  29. package/dist/eth/input-data.d.ts +6 -7
  30. package/dist/eth/input-data.d.ts.map +1 -1
  31. package/dist/eth/input-data.js +18 -11
  32. package/dist/eth/input-data.js.map +1 -1
  33. package/dist/fee-reference-based-detector.d.ts +2 -1
  34. package/dist/fee-reference-based-detector.d.ts.map +1 -1
  35. package/dist/fee-reference-based-detector.js +2 -2
  36. package/dist/fee-reference-based-detector.js.map +1 -1
  37. package/dist/index.d.ts +5 -4
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +2 -2
  40. package/dist/index.js.map +1 -1
  41. package/dist/near/near-detector.d.ts +3 -4
  42. package/dist/near/near-detector.d.ts.map +1 -1
  43. package/dist/near/near-detector.js +2 -2
  44. package/dist/near/near-detector.js.map +1 -1
  45. package/dist/near/retrievers/near-conversion-info-retriever.d.ts +1 -1
  46. package/dist/near/retrievers/near-conversion-info-retriever.d.ts.map +1 -1
  47. package/dist/near/retrievers/near-info-retriever.d.ts +0 -1
  48. package/dist/near/retrievers/near-info-retriever.d.ts.map +1 -1
  49. package/dist/near/retrievers/near-info-retriever.js +3 -4
  50. package/dist/near/retrievers/near-info-retriever.js.map +1 -1
  51. package/dist/payment-network-factory.d.ts +4 -8
  52. package/dist/payment-network-factory.d.ts.map +1 -1
  53. package/dist/payment-network-factory.js +15 -1
  54. package/dist/payment-network-factory.js.map +1 -1
  55. package/dist/reference-based-detector.d.ts +4 -1
  56. package/dist/reference-based-detector.d.ts.map +1 -1
  57. package/dist/reference-based-detector.js +3 -1
  58. package/dist/reference-based-detector.js.map +1 -1
  59. package/dist/thegraph/__mocks__/client.d.ts +16 -0
  60. package/dist/thegraph/__mocks__/client.d.ts.map +1 -0
  61. package/dist/thegraph/__mocks__/client.js +15 -0
  62. package/dist/thegraph/__mocks__/client.js.map +1 -0
  63. package/dist/thegraph/client.d.ts +36 -0
  64. package/dist/thegraph/client.d.ts.map +1 -0
  65. package/dist/thegraph/client.js +12 -0
  66. package/dist/thegraph/client.js.map +1 -0
  67. package/dist/thegraph/generated/graphql.d.ts +12 -50
  68. package/dist/thegraph/generated/graphql.d.ts.map +1 -1
  69. package/dist/thegraph/generated/graphql.js +67 -152
  70. package/dist/thegraph/generated/graphql.js.map +1 -1
  71. package/dist/thegraph/index.d.ts +2 -15
  72. package/dist/thegraph/index.d.ts.map +1 -1
  73. package/dist/thegraph/index.js +3 -27
  74. package/dist/thegraph/index.js.map +1 -1
  75. package/dist/thegraph/info-retriever.d.ts +30 -0
  76. package/dist/thegraph/info-retriever.d.ts.map +1 -0
  77. package/dist/thegraph/info-retriever.js +89 -0
  78. package/dist/thegraph/info-retriever.js.map +1 -0
  79. package/dist/types.d.ts +18 -1
  80. package/dist/types.d.ts.map +1 -1
  81. package/dist/utils.d.ts +5 -0
  82. package/dist/utils.d.ts.map +1 -1
  83. package/dist/utils.js +17 -1
  84. package/dist/utils.js.map +1 -1
  85. package/package.json +9 -7
  86. package/dist/any/retrievers/thegraph.d.ts +0 -38
  87. package/dist/any/retrievers/thegraph.d.ts.map +0 -1
  88. package/dist/any/retrievers/thegraph.js +0 -91
  89. package/dist/any/retrievers/thegraph.js.map +0 -1
  90. package/dist/erc20/thegraph-info-retriever.d.ts +0 -26
  91. package/dist/erc20/thegraph-info-retriever.d.ts.map +0 -1
  92. package/dist/erc20/thegraph-info-retriever.js +0 -77
  93. package/dist/erc20/thegraph-info-retriever.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@requestnetwork/payment-detection",
3
- "version": "0.35.1-next.1795+39c20554",
3
+ "version": "0.35.1-next.1797+a2641795",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,15 +41,16 @@
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.1795+39c20554",
45
- "@requestnetwork/smart-contracts": "0.28.1-next.1795+39c20554",
46
- "@requestnetwork/types": "0.35.1-next.1795+39c20554",
47
- "@requestnetwork/utils": "0.35.1-next.1795+39c20554",
44
+ "@requestnetwork/currency": "0.8.1-next.1797+a2641795",
45
+ "@requestnetwork/smart-contracts": "0.28.1-next.1797+a2641795",
46
+ "@requestnetwork/types": "0.35.1-next.1797+a2641795",
47
+ "@requestnetwork/utils": "0.35.1-next.1797+a2641795",
48
48
  "axios": "0.27.2",
49
49
  "ethers": "5.5.1",
50
50
  "graphql": "15.5.1",
51
51
  "graphql-request": "3.4.0",
52
52
  "graphql-tag": "2.12.4",
53
+ "lodash": "4.17.21",
53
54
  "satoshi-bitcoin": "1.0.4",
54
55
  "tslib": "2.3.1"
55
56
  },
@@ -60,8 +61,9 @@
60
61
  "@graphql-codegen/typescript-graphql-request": "3.2.1",
61
62
  "@graphql-codegen/typescript-operations": "1.18.0",
62
63
  "@graphql-codegen/typescript-resolvers": "1.19.2",
63
- "@requestnetwork/advanced-logic": "0.34.1-next.1795+39c20554",
64
+ "@requestnetwork/advanced-logic": "0.34.1-next.1797+a2641795",
64
65
  "@types/jest": "26.0.13",
66
+ "@types/lodash": "4.14.161",
65
67
  "jest": "26.4.2",
66
68
  "nyc": "15.1.0",
67
69
  "shx": "0.3.2",
@@ -70,5 +72,5 @@
70
72
  "ts-node": "9.0.0",
71
73
  "typescript": "4.4.4"
72
74
  },
73
- "gitHead": "39c20554ff3ba72646dbd56bfcc92c7e4b2a9863"
75
+ "gitHead": "a2641795b680b69652cad1e79a9dd597e817b873"
74
76
  }
@@ -1,38 +0,0 @@
1
- import { CurrencyDefinition } from '@requestnetwork/currency';
2
- import { PaymentTypes } from '@requestnetwork/types';
3
- import { IPaymentRetriever } from '../../types';
4
- /**
5
- * Retrieves a list of payment events from a payment reference, a destination address, a token address and a proxy contract
6
- */
7
- export declare class TheGraphConversionRetriever implements IPaymentRetriever<PaymentTypes.ERC20PaymentNetworkEvent> {
8
- private requestCurrency;
9
- private paymentReference;
10
- private contractAddress;
11
- private toAddress;
12
- private eventName;
13
- private network;
14
- private acceptedTokens?;
15
- private maxRateTimespan;
16
- private client;
17
- /**
18
- * @param requestCurrency The request currency
19
- * @param paymentReference The reference to identify the payment
20
- * @param contractAddress The address of the proxy contract
21
- * @param toAddress Address of the balance we want to check
22
- * @param eventName Indicate if it is an address for payment or refund
23
- * @param network The Ethereum network to use
24
- * @param acceptedTokens The list of ERC20 tokens addresses accepted for payments and refunds
25
- * @param maxRateTimespan The the maximum span between the time the rate was fetched and the payment
26
- */
27
- constructor(requestCurrency: CurrencyDefinition, paymentReference: string, contractAddress: string, toAddress: string, eventName: PaymentTypes.EVENTS_NAMES, network: string, acceptedTokens?: string[] | undefined, maxRateTimespan?: number);
28
- /**
29
- * Retrieves transfer events from the payment proxy and conversion proxy.
30
- * Logs from both proxies are matched by transaction hash, as both proxies should
31
- * be called in one transaction.
32
- *
33
- * The conversion proxy's logs are used to compute the amounts in request currency (typically fiat).
34
- * The payment proxy's logs are used the same way as for a pn-fee-proxy request.
35
- */
36
- getTransferEvents(): Promise<PaymentTypes.ERC20PaymentNetworkEvent[]>;
37
- }
38
- //# sourceMappingURL=thegraph.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thegraph.d.ts","sourceRoot":"","sources":["../../../src/any/retrievers/thegraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD;;GAEG;AACH,qBAAa,2BACX,YAAW,iBAAiB,CAAC,YAAY,CAAC,wBAAwB,CAAC;IAejE,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,eAAe;IApBzB,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;;;;;;;OASG;gBAEO,eAAe,EAAE,kBAAkB,EACnC,gBAAgB,EAAE,MAAM,EACxB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,sBAAU,EACzB,eAAe,GAAE,MAAU;IAOrC;;;;;;;OAOG;IACU,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,wBAAwB,EAAE,CAAC;CA8CnF"}
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TheGraphConversionRetriever = void 0;
4
- const tslib_1 = require("tslib");
5
- const ethers_1 = require("ethers");
6
- const thegraph_1 = require("../../thegraph");
7
- const utils_1 = require("../../utils");
8
- /**
9
- * Retrieves a list of payment events from a payment reference, a destination address, a token address and a proxy contract
10
- */
11
- class TheGraphConversionRetriever {
12
- /**
13
- * @param requestCurrency The request currency
14
- * @param paymentReference The reference to identify the payment
15
- * @param contractAddress The address of the proxy contract
16
- * @param toAddress Address of the balance we want to check
17
- * @param eventName Indicate if it is an address for payment or refund
18
- * @param network The Ethereum network to use
19
- * @param acceptedTokens The list of ERC20 tokens addresses accepted for payments and refunds
20
- * @param maxRateTimespan The the maximum span between the time the rate was fetched and the payment
21
- */
22
- constructor(requestCurrency, paymentReference, contractAddress, toAddress, eventName, network, acceptedTokens, maxRateTimespan = 0) {
23
- this.requestCurrency = requestCurrency;
24
- this.paymentReference = paymentReference;
25
- this.contractAddress = contractAddress;
26
- this.toAddress = toAddress;
27
- this.eventName = eventName;
28
- this.network = network;
29
- this.acceptedTokens = acceptedTokens;
30
- this.maxRateTimespan = maxRateTimespan;
31
- this.client = (0, thegraph_1.getTheGraphClient)(this.network);
32
- this.acceptedTokens = acceptedTokens === null || acceptedTokens === void 0 ? void 0 : acceptedTokens.map((token) => token.toLowerCase());
33
- }
34
- /**
35
- * Retrieves transfer events from the payment proxy and conversion proxy.
36
- * Logs from both proxies are matched by transaction hash, as both proxies should
37
- * be called in one transaction.
38
- *
39
- * The conversion proxy's logs are used to compute the amounts in request currency (typically fiat).
40
- * The payment proxy's logs are used the same way as for a pn-fee-proxy request.
41
- */
42
- getTransferEvents() {
43
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
44
- const variables = {
45
- contractAddress: this.contractAddress,
46
- reference: ethers_1.utils.keccak256(`0x${this.paymentReference}`),
47
- to: this.toAddress,
48
- maxRateTimespan: this.maxRateTimespan,
49
- };
50
- // Parses, filters and creates the events from the logs with the payment reference
51
- const events = yield this.client.GetConversionPayments(variables);
52
- // Creates the balance events
53
- return events.payments
54
- .filter((payment) => {
55
- var _a;
56
- if (this.acceptedTokens && this.acceptedTokens.length > 0) {
57
- return this.acceptedTokens.includes((_a = payment.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase());
58
- }
59
- return !payment.tokenAddress;
60
- })
61
- .map((payment) => {
62
- var _a;
63
- const requestCurrency = this.requestCurrency;
64
- const { amount, feeAmount } = payment;
65
- const amountWithRightDecimal = (0, utils_1.unpadAmountFromChainlink)(amount, requestCurrency);
66
- const feeAmountWithRightDecimal = (0, utils_1.unpadAmountFromChainlink)(feeAmount, requestCurrency);
67
- return {
68
- amount: amountWithRightDecimal.toString(),
69
- name: this.eventName,
70
- parameters: {
71
- block: payment.block,
72
- feeAddress: payment.feeAddress ? ethers_1.utils.getAddress(payment.feeAddress) : undefined,
73
- feeAmount: feeAmountWithRightDecimal.toString(),
74
- feeAmountInCrypto: payment.feeAmountInCrypto || undefined,
75
- amountInCrypto: payment.amountInCrypto,
76
- tokenAddress: payment.tokenAddress ? ethers_1.utils.getAddress(payment.tokenAddress) : undefined,
77
- to: this.toAddress,
78
- txHash: payment.txHash,
79
- maxRateTimespan: (_a = payment.maxRateTimespan) === null || _a === void 0 ? void 0 : _a.toString(),
80
- from: payment.from,
81
- gasUsed: payment.gasUsed,
82
- gasPrice: payment.gasPrice,
83
- },
84
- timestamp: payment.timestamp,
85
- };
86
- });
87
- });
88
- }
89
- }
90
- exports.TheGraphConversionRetriever = TheGraphConversionRetriever;
91
- //# sourceMappingURL=thegraph.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thegraph.js","sourceRoot":"","sources":["../../../src/any/retrievers/thegraph.ts"],"names":[],"mappings":";;;;AAEA,mCAA+B;AAE/B,6CAAmE;AACnE,uCAAuD;AAEvD;;GAEG;AACH,MAAa,2BAA2B;IAKtC;;;;;;;;;OASG;IACH,YACU,eAAmC,EACnC,gBAAwB,EACxB,eAAuB,EACvB,SAAiB,EACjB,SAAoC,EACpC,OAAe,EACf,cAAyB,EACzB,kBAA0B,CAAC;QAP3B,oBAAe,GAAf,eAAe,CAAoB;QACnC,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,oBAAe,GAAf,eAAe,CAAQ;QACvB,cAAS,GAAT,SAAS,CAAQ;QACjB,cAAS,GAAT,SAAS,CAA2B;QACpC,YAAO,GAAP,OAAO,CAAQ;QACf,mBAAc,GAAd,cAAc,CAAW;QACzB,oBAAe,GAAf,eAAe,CAAY;QAEnC,IAAI,CAAC,MAAM,GAAG,IAAA,4BAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,cAAc,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;OAOG;IACU,iBAAiB;;YAC5B,MAAM,SAAS,GAAG;gBAChB,eAAe,EAAE,IAAI,CAAC,eAAe;gBACrC,SAAS,EAAE,cAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxD,EAAE,EAAE,IAAI,CAAC,SAAS;gBAClB,eAAe,EAAE,IAAI,CAAC,eAAe;aACtC,CAAC;YAEF,kFAAkF;YAClF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM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CAAC,CAAC,SAAS;wBACvF,EAAE,EAAE,IAAI,CAAC,SAAS;wBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,eAAe,EAAE,MAAA,OAAO,CAAC,eAAe,0CAAE,QAAQ,EAAE;wBACpD,IAAI,EAAE,OAAO,CAAC,IAAI;wBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;wBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;qBAC3B;oBACD,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC7B,CAAC;YACJ,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACF;AApFD,kEAoFC"}
@@ -1,26 +0,0 @@
1
- import { PaymentTypes } from '@requestnetwork/types';
2
- import { TheGraphClientOptions } from '../thegraph';
3
- export declare class TheGraphInfoRetriever {
4
- private paymentReference;
5
- private proxyContractAddress;
6
- private tokenContractAddress;
7
- private toAddress;
8
- private eventName;
9
- private network;
10
- private options?;
11
- private client;
12
- /**
13
- * @param paymentReference The reference to identify the payment
14
- * @param proxyContractAddress The address of the proxy contract
15
- * @param tokenContractAddress The address of the ERC20 contract
16
- * @param toAddress Address of the balance we want to check
17
- * @param eventName Indicate if it is an address for payment or refund
18
- * @param network The Ethereum network to use
19
- * @param options Extra options to GraphQL client
20
- */
21
- constructor(paymentReference: string, proxyContractAddress: string, tokenContractAddress: string | null, toAddress: string, eventName: PaymentTypes.EVENTS_NAMES, network: string, options?: TheGraphClientOptions | undefined);
22
- private getGraphVariables;
23
- getTransferEvents(): Promise<PaymentTypes.AllNetworkEvents<PaymentTypes.IERC20FeePaymentEventParameters>>;
24
- }
25
- export default TheGraphInfoRetriever;
26
- //# sourceMappingURL=thegraph-info-retriever.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thegraph-info-retriever.d.ts","sourceRoot":"","sources":["../../src/erc20/thegraph-info-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAqC,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAUvF,qBAAa,qBAAqB;IAa9B,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO,CAAC;IAlBlB,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;;;;;;OAQG;gBAEO,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,EACnC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,mCAAuB;IAKzC,OAAO,CAAC,iBAAiB;IASZ,iBAAiB,IAAI,OAAO,CACvC,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAC5E;CAqCF;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TheGraphInfoRetriever = void 0;
4
- const tslib_1 = require("tslib");
5
- const types_1 = require("@requestnetwork/types");
6
- const ethers_1 = require("ethers");
7
- const thegraph_1 = require("../thegraph");
8
- class TheGraphInfoRetriever {
9
- /**
10
- * @param paymentReference The reference to identify the payment
11
- * @param proxyContractAddress The address of the proxy contract
12
- * @param tokenContractAddress The address of the ERC20 contract
13
- * @param toAddress Address of the balance we want to check
14
- * @param eventName Indicate if it is an address for payment or refund
15
- * @param network The Ethereum network to use
16
- * @param options Extra options to GraphQL client
17
- */
18
- constructor(paymentReference, proxyContractAddress, tokenContractAddress, toAddress, eventName, network, options) {
19
- this.paymentReference = paymentReference;
20
- this.proxyContractAddress = proxyContractAddress;
21
- this.tokenContractAddress = tokenContractAddress;
22
- this.toAddress = toAddress;
23
- this.eventName = eventName;
24
- this.network = network;
25
- this.options = options;
26
- this.client = (0, thegraph_1.getTheGraphClient)(this.network, this.options);
27
- }
28
- getGraphVariables() {
29
- return {
30
- contractAddress: this.proxyContractAddress,
31
- reference: ethers_1.utils.keccak256(`0x${this.paymentReference}`),
32
- to: this.toAddress,
33
- tokenAddress: this.tokenContractAddress,
34
- };
35
- }
36
- getTransferEvents() {
37
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
38
- const variables = this.getGraphVariables();
39
- const paymentsAndEscrows = yield this.client.GetPaymentsAndEscrowState(variables);
40
- const paymentEvents = paymentsAndEscrows.payments.map((p) => ({
41
- amount: p.amount,
42
- name: this.eventName,
43
- parameters: {
44
- to: this.toAddress,
45
- txHash: p.txHash,
46
- block: p.block,
47
- feeAddress: p.feeAddress ? ethers_1.utils.getAddress(p.feeAddress) : undefined,
48
- feeAmount: p.feeAmount || undefined,
49
- from: p.from,
50
- gasUsed: p.gasUsed,
51
- gasPrice: p.gasPrice,
52
- },
53
- timestamp: p.timestamp,
54
- }));
55
- const escrowEvents = paymentsAndEscrows.escrowEvents.map((p) => ({
56
- name: types_1.PaymentTypes.EVENTS_NAMES.ESCROW,
57
- parameters: {
58
- to: this.toAddress,
59
- from: p.from,
60
- txHash: p.txHash,
61
- block: p.block,
62
- eventName: p.eventName,
63
- gasUsed: p.gasUsed,
64
- gasPrice: p.gasPrice,
65
- },
66
- timestamp: p.timestamp,
67
- }));
68
- return {
69
- paymentEvents: paymentEvents,
70
- escrowEvents: escrowEvents,
71
- };
72
- });
73
- }
74
- }
75
- exports.TheGraphInfoRetriever = TheGraphInfoRetriever;
76
- exports.default = TheGraphInfoRetriever;
77
- //# sourceMappingURL=thegraph-info-retriever.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thegraph-info-retriever.js","sourceRoot":"","sources":["../../src/erc20/thegraph-info-retriever.ts"],"names":[],"mappings":";;;;AAAA,iDAAqD;AACrD,mCAA+B;AAC/B,0CAAuF;AAUvF,MAAa,qB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