@requestnetwork/payment-detection 0.35.1-next.1795 → 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
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.1796+312ce4a0",
|
|
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.
|
|
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.1796+312ce4a0",
|
|
45
|
+
"@requestnetwork/smart-contracts": "0.28.1-next.1796+312ce4a0",
|
|
46
|
+
"@requestnetwork/types": "0.35.1-next.1796+312ce4a0",
|
|
47
|
+
"@requestnetwork/utils": "0.35.1-next.1796+312ce4a0",
|
|
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.
|
|
64
|
+
"@requestnetwork/advanced-logic": "0.34.1-next.1796+312ce4a0",
|
|
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": "
|
|
75
|
+
"gitHead": "312ce4a0f1826607edc60ccc3c6ca9e8c6bd1643"
|
|
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
|
|
@@ -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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,qBAAqB;IAGhC;;;;;;;;OAQG;IACH,YACU,gBAAwB,EACxB,oBAA4B,EAC5B,oBAAmC,EACnC,SAAiB,EACjB,SAAoC,EACpC,OAAe,EACf,OAA+B;QAN/B,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,yBAAoB,GAApB,oBAAoB,CAAQ;QAC5B,yBAAoB,GAApB,oBAAoB,CAAe;QACnC,cAAS,GAAT,SAAS,CAAQ;QACjB,cAAS,GAAT,SAAS,CAA2B;QACpC,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAwB;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAA,4BAA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