Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { createMockErc20FeeRequest } from '../utils';

const erc20FeeProxy = new Erc20PaymentNetwork.ERC20FeeProxyPaymentDetector({
// FIXME: the mocked advanced logic is address based
advancedLogic: mockAdvancedLogic,
currencyManager: CurrencyManager.getDefault(),
getSubgraphClient: jest.fn(),
Expand Down
4 changes: 2 additions & 2 deletions packages/payment-detection/src/btc/address-based.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PaymentDetectorBase } from '../payment-detector-base';
*/
export abstract class BtcAddressBasedDetector extends PaymentDetectorBase<
ExtensionTypes.PnAddressBased.IAddressBased<ExtensionTypes.PnAddressBased.ICreationParameters>,
PaymentTypes.IBTCPaymentEventParameters
PaymentTypes.GenericEventParameters
> {
/**
* @param extension The advanced logic payment network extensions
Expand Down Expand Up @@ -74,7 +74,7 @@ export abstract class BtcAddressBasedDetector extends PaymentDetectorBase<
*/
protected async getEvents(
request: RequestLogicTypes.IRequest,
): Promise<PaymentTypes.AllNetworkEvents<PaymentTypes.IBTCPaymentEventParameters>> {
): Promise<PaymentTypes.AllNetworkEvents<PaymentTypes.GenericEventParameters>> {
const { paymentAddress, refundAddress } = this.getPaymentExtension(request).values;

this.checkRequiredParameter(paymentAddress, 'paymentAddress');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import ContentDataExtension from '../../src/api/content-data-extension';
import * as TestData from './data-for-content-data-extension';
import { IAdvancedLogicExtensions } from '@requestnetwork/types/src/advanced-logic-types';

const mockAdvancedLogic: AdvancedLogicTypes.IAdvancedLogic = {
const mockAdvancedLogic = {
applyActionToExtensions: jest.fn(),
getNativeTokenExtensionForNetwork: jest.fn(),
getAnyToNativeTokenExtensionForNetwork: jest.fn(),
extensions: {
contentData: { createCreationAction: jest.fn() },
} as any as IAdvancedLogicExtensions,
};
} as any as AdvancedLogicTypes.IAdvancedLogic;

let contentDataExtension: ContentDataExtension;

Expand Down
2 changes: 1 addition & 1 deletion packages/request-client.js/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const requestParameters: RequestLogicTypes.ICreateParameters = {

const mockBTCProvider = {
getAddressBalanceWithEvents: (): Promise<
PaymentTypes.IBalanceWithEvents<PaymentTypes.IBTCPaymentEventParameters>
PaymentTypes.IBalanceWithEvents<PaymentTypes.GenericEventParameters>
> => {
return Promise.resolve({
balance: '666743',
Expand Down
6 changes: 2 additions & 4 deletions packages/request-logic/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ const fakeMetaTransactionManager = {
};
let fakeTransactionManager: TransactionTypes.ITransactionManager;

const fakeAdvancedLogicBase: AdvancedLogicTypes.IAdvancedLogic = {
getAnyToNativeTokenExtensionForNetwork: jest.fn(),
getNativeTokenExtensionForNetwork: jest.fn(),
const fakeAdvancedLogicBase = {
applyActionToExtensions: jest.fn(),
extensions: {} as AdvancedLogicTypes.IAdvancedLogicExtensions,
};
} as any as AdvancedLogicTypes.IAdvancedLogic;

/* eslint-disable @typescript-eslint/no-unused-expressions */
describe('index', () => {
Expand Down
6 changes: 2 additions & 4 deletions packages/request-logic/test/unit/requestLogicCore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ import * as TestData from './utils/test-data-generator';

import RequestLogicCore from '../../src/requestLogicCore';

const fakeAdvancedLogic: AdvancedLogicTypes.IAdvancedLogic = {
getAnyToNativeTokenExtensionForNetwork: jest.fn(),
getNativeTokenExtensionForNetwork: jest.fn(),
const fakeAdvancedLogic = {
applyActionToExtensions: (
extensionStates: RequestLogicTypes.IExtensionStates,
): RequestLogicTypes.IExtensionStates => extensionStates,
extensions: {} as AdvancedLogicTypes.IAdvancedLogicExtensions,
};
} as any as AdvancedLogicTypes.IAdvancedLogic;

/* eslint-disable @typescript-eslint/no-unused-expressions */
describe('requestLogicCore', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/transaction-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm install @requestnetwork/transaction-manager
In order to decrypt encrypted transactions, you must provide a decryption provider.
You can see the specification of decryption provider [here](./specs/decryption-provider.md).

An example of implementation of a decryption provider is available in the package: [epk-decryption](../../epk-decryption)
An example of implementation of a decryption provider is available in the package: [epk-decryption](../epk-decryption/)

```javascript
import EthereumPrivateKeyDecryptionProvider from '@requestnetwork/epk-decryption';
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/extension-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export {
};

/** Extension interface is extended by the extensions implementation */
export interface IExtension<T = any> {
export interface IExtension<TCreationParameters = any> {
extensionType: TYPE;
extensionId: ID;
currentVersion: string;
applyActionToExtension: (
extensionsState: RequestLogic.IExtensionStates,
extensionAction: IAction<T>,
extensionAction: IAction<TCreationParameters>,
requestState: RequestLogic.IRequest,
actionSigner: Identity.IIdentity,
timestamp: number,
Expand Down
13 changes: 4 additions & 9 deletions packages/types/src/payment-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export type ERC777BalanceWithEvents = IBalanceWithEvents<IERC777PaymentEventPara
* ERC20 networks and events
*/

/** Parameters for events of ERC20 payments */
/** Parameters detectable payment events */
export interface GenericEventParameters {
block?: number;
txHash?: string;
Expand Down Expand Up @@ -274,18 +274,13 @@ export interface IBitcoinDetectionProvider {
bitcoinNetworkId: number,
address: string,
eventName: EVENTS_NAMES,
) => Promise<IBalanceWithEvents<IBTCPaymentEventParameters>>;
) => Promise<IBalanceWithEvents<GenericEventParameters>>;
}

/** Parameters for events of BTC payments */
export interface IBTCPaymentEventParameters {
block?: number;
txHash?: string;
}
/** BTC Payment Network Event */
export type BTCPaymentNetworkEvent = IPaymentNetworkEvent<IBTCPaymentEventParameters>;
export type BTCPaymentNetworkEvent = IPaymentNetworkEvent<GenericEventParameters>;
/** BTC BalanceWithEvents */
export type BTCBalanceWithEvents = IBalanceWithEvents<IBTCPaymentEventParameters>;
export type BTCBalanceWithEvents = IBalanceWithEvents<GenericEventParameters>;

/** Parameters for escrow events from EscrowERC20 contract state changes */
export interface IEscrowEventParameters extends Required<GenericEventParameters> {
Expand Down