Skip to content

Commit

Permalink
fix: release (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigopavezi authored Dec 2, 2024
1 parent c392e4c commit c287045
Show file tree
Hide file tree
Showing 37 changed files with 129 additions and 151 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"lerna": "6.6.2",
"lint-staged": "10.5.4",
"npm-package-json-lint": "5.1.0",
"prettier": "3.0.3",
"prettier": "2.8.8",
"prettier-plugin-solidity": "1.0.0-beta.19",
"typescript": "5.1.3"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/advanced-logic/src/extensions/content-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const CURRENT_VERSION = '0.1.0';
* Implementation of the content data extension
*/
export default class ContentDataExtension<
TCreationParameters extends
ExtensionTypes.ContentData.ICreationParameters = ExtensionTypes.ContentData.ICreationParameters,
TCreationParameters extends ExtensionTypes.ContentData.ICreationParameters = ExtensionTypes.ContentData.ICreationParameters,
> extends AbstractExtension<TCreationParameters> {
public constructor() {
super(ExtensionTypes.TYPE.CONTENT_DATA, ExtensionTypes.ID.CONTENT_DATA, CURRENT_VERSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import DeclarativePaymentNetwork from './declarative';
* This module is called by the address based payment networks to avoid code redundancy
*/
export default abstract class AddressBasedPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnAddressBased.ICreationParameters = ExtensionTypes.PnAddressBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnAddressBased.ICreationParameters = ExtensionTypes.PnAddressBased.ICreationParameters,
> extends DeclarativePaymentNetwork<TCreationParameters> {
protected constructor(
protected currencyManager: CurrencyTypes.ICurrencyManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const CURRENT_VERSION = '0.1.0';
* Core of the declarative payment network
*/
export default class DeclarativePaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnAnyDeclarative.ICreationParameters = ExtensionTypes.PnAnyDeclarative.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnAnyDeclarative.ICreationParameters = ExtensionTypes.PnAnyDeclarative.ICreationParameters,
> extends AbstractExtension<TCreationParameters> {
public constructor(
public readonly extensionId: ExtensionTypes.PAYMENT_NETWORK_ID = ExtensionTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const NEAR_CURRENT_VERSION = 'NEAR-0.1.0';
* Implementation of the payment network to pay in ERC20, including third-party fees payment, based on a reference provided to a proxy contract.
*/
export default class Erc20FeeProxyPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
> extends FeeReferenceBasedPaymentNetwork<TCreationParameters> {
/**
* @param network is only relevant for non-EVM chains (Near and Near testnet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const CURRENT_VERSION = '0.1.0';
* Implementation of the payment network to pay in ERC20 based on a reference provided to a proxy contract.
*/
export default class Erc20ProxyPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnReferenceBased.ICreationParameters = ExtensionTypes.PnReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnReferenceBased.ICreationParameters = ExtensionTypes.PnReferenceBased.ICreationParameters,
> extends ReferenceBasedPaymentNetwork<TCreationParameters> {
public constructor(currencyManager: CurrencyTypes.ICurrencyManager) {
super(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const CURRENT_VERSION = '0.2.0';
* Implementation of the payment network to pay in ERC20 based on a transferable receivable contract.
*/
export default class Erc20TransferableReceivablePaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
> extends FeeReferenceBasedPaymentNetwork<TCreationParameters> {
public constructor(
currencyManager: CurrencyTypes.ICurrencyManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const CURRENT_VERSION = '0.1.0';
* Implementation of the payment network to pay in ERC777, including third-party fees payment, based on a reference provided to a proxy contract.
*/
export default class Erc777StreamPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnStreamReferenceBased.ICreationParameters = ExtensionTypes.PnStreamReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnStreamReferenceBased.ICreationParameters = ExtensionTypes.PnStreamReferenceBased.ICreationParameters,
> extends ReferenceBasedPaymentNetwork<TCreationParameters> {
public constructor(currencyManager: CurrencyTypes.ICurrencyManager) {
super(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const CURRENT_VERSION = '0.2.0';
* Implementation of the payment network to pay in Ethereum, including third-party fees payment, based on a reference provided to a proxy contract.
*/
export default class EthereumFeeProxyPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
> extends FeeReferenceBasedPaymentNetwork<TCreationParameters> {
public constructor(
currencyManager: CurrencyTypes.ICurrencyManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { areEqualIdentities, deepCopy, isValidAmount } from '@requestnetwork/uti
* This module is called by the fee reference based (ethereum & erc20) payment networks to avoid code redundancy
*/
export abstract class FeeReferenceBasedPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnFeeReferenceBased.ICreationParameters = ExtensionTypes.PnFeeReferenceBased.ICreationParameters,
> extends ReferenceBasedPaymentNetwork<TCreationParameters> {
protected constructor(
currencyManager: CurrencyTypes.ICurrencyManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import DeclarativePaymentNetwork from './declarative';
const CURRENT_VERSION = '0.1.0';

export default class MetaPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnMeta.ICreationParameters = ExtensionTypes.PnMeta.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnMeta.ICreationParameters = ExtensionTypes.PnMeta.ICreationParameters,
> extends DeclarativePaymentNetwork<TCreationParameters> {
public constructor(
protected currencyManager: CurrencyTypes.ICurrencyManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const eightHexRegex = /[0-9a-f]{16,}/;
* This module is called by the reference based payment networks to avoid code redundancy
*/
export default abstract class ReferenceBasedPaymentNetwork<
TCreationParameters extends
ExtensionTypes.PnReferenceBased.ICreationParameters = ExtensionTypes.PnReferenceBased.ICreationParameters,
TCreationParameters extends ExtensionTypes.PnReferenceBased.ICreationParameters = ExtensionTypes.PnReferenceBased.ICreationParameters,
> extends AddressBasedPaymentNetwork<TCreationParameters> {
/**
* Creates the extensionsData to create the payment detection extension
Expand Down
28 changes: 11 additions & 17 deletions packages/data-access/src/data-read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,17 @@ export class DataAccessRead implements DataAccessTypes.IDataRead {
const filteredTxs = transactions.filter((tx) => channels.includes(tx.channelId));
return {
meta: {
storageMeta: filteredTxs.reduce(
(acc, tx) => {
acc[tx.channelId] = [this.toStorageMeta(tx, result.blockNumber, this.network)];
return acc;
},
{} as Record<string, StorageTypes.IEntryMetadata[]>,
),
transactionsStorageLocation: filteredTxs.reduce(
(prev, curr) => {
if (!prev[curr.channelId]) {
prev[curr.channelId] = [];
}
prev[curr.channelId].push(curr.hash);
return prev;
},
{} as Record<string, string[]>,
),
storageMeta: filteredTxs.reduce((acc, tx) => {
acc[tx.channelId] = [this.toStorageMeta(tx, result.blockNumber, this.network)];
return acc;
}, {} as Record<string, StorageTypes.IEntryMetadata[]>),
transactionsStorageLocation: filteredTxs.reduce((prev, curr) => {
if (!prev[curr.channelId]) {
prev[curr.channelId] = [];
}
prev[curr.channelId].push(curr.hash);
return prev;
}, {} as Record<string, string[]>),
pagination:
page && pageSize
? {
Expand Down
5 changes: 1 addition & 4 deletions packages/payment-detection/src/balance-error.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { PaymentTypes, ExtensionTypes } from '@requestnetwork/types';

export class BalanceError extends Error {
constructor(
message: string,
public readonly code: PaymentTypes.BALANCE_ERROR_CODE,
) {
constructor(message: string, public readonly code: PaymentTypes.BALANCE_ERROR_CODE) {
super(message);
}
}
Expand Down
16 changes: 7 additions & 9 deletions packages/payment-detection/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,27 @@ export interface IEventRetriever<

/** Object interface to list the payment network module by id */
export type IPaymentNetworkModuleByType<
TPaymentEventParameters extends
PaymentTypes.GenericEventParameters = PaymentTypes.GenericEventParameters,
TPaymentEventParameters extends PaymentTypes.GenericEventParameters = PaymentTypes.GenericEventParameters,
> = Partial<
Record<
ExtensionTypes.PAYMENT_NETWORK_ID,
new (
...pnParams: any
) => PaymentDetectorBase<ExtensionTypes.IExtension, TPaymentEventParameters>
new (...pnParams: any) => PaymentDetectorBase<
ExtensionTypes.IExtension,
TPaymentEventParameters
>
>
>;

/** Object interface to list the payment network module by network */
export interface ISupportedPaymentNetworkByNetwork<
TPaymentEventParameters extends
PaymentTypes.GenericEventParameters = PaymentTypes.GenericEventParameters,
TPaymentEventParameters extends PaymentTypes.GenericEventParameters = PaymentTypes.GenericEventParameters,
> {
[network: string]: IPaymentNetworkModuleByType<TPaymentEventParameters>;
}

/** Object interface to list the payment network id and its module by currency */
export interface ISupportedPaymentNetworkByCurrency<
TPaymentEventParameters extends
PaymentTypes.GenericEventParameters = PaymentTypes.GenericEventParameters,
TPaymentEventParameters extends PaymentTypes.GenericEventParameters = PaymentTypes.GenericEventParameters,
> {
[currency: string]: ISupportedPaymentNetworkByNetwork<TPaymentEventParameters>;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/payment-detection/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,6 @@ export const transformNonNull = <T extends Record<string, unknown>, TKey extends
({
[key as TKey]:
val[key] !== undefined && val[key] !== null ? transform(val[key], key) : undefined,
}) as {
} as {
[P in TKey]: TOut;
};
});
2 changes: 1 addition & 1 deletion packages/payment-processor/test/payment/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export const currencyManager = new CurrencyManager([
decimals: 18,
symbol: 'ERC20_' + i,
type: RequestLogicTypes.CURRENCY.ERC20,
}) as CurrencyTypes.CurrencyDefinition,
} as CurrencyTypes.CurrencyDefinition),
),
]);
10 changes: 6 additions & 4 deletions packages/request-client.js/src/api/request-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ export default class RequestNetwork {
parameters: Types.ICreateRequestParameters,
options?: Types.ICreateRequestOptions,
): Promise<Request> {
const { requestParameters, topics, paymentNetwork } =
await this.prepareRequestParameters(parameters);
const { requestParameters, topics, paymentNetwork } = await this.prepareRequestParameters(
parameters,
);

const requestLogicCreateResult = await this.requestLogic.createRequest(
requestParameters,
Expand Down Expand Up @@ -165,8 +166,9 @@ export default class RequestNetwork {
encryptionParams: EncryptionTypes.IEncryptionParameters[],
options?: Types.ICreateRequestOptions,
): Promise<Request> {
const { requestParameters, topics, paymentNetwork } =
await this.prepareRequestParameters(parameters);
const { requestParameters, topics, paymentNetwork } = await this.prepareRequestParameters(
parameters,
);

const requestLogicCreateResult = await this.requestLogic.createEncryptedRequest(
requestParameters,
Expand Down
2 changes: 1 addition & 1 deletion packages/request-client.js/test/index-encryption.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<title>@requestnetwork/request-client.js Test Page</title>
Expand Down
2 changes: 1 addition & 1 deletion packages/request-client.js/test/index-metamask.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<title>@requestnetwork/request-client.js Test Page</title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<title>@requestnetwork/request-client.js Test Page</title>
Expand Down
2 changes: 1 addition & 1 deletion packages/request-client.js/test/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<title>@requestnetwork/request-client.js Test Page</title>
Expand Down
2 changes: 1 addition & 1 deletion packages/request-logic/specs/example/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function foo(): Promise<void> {
({
[aliceRaw.identity.value as string]: sign(data, aliceRaw.signatureParams),
[bobRaw.identity.value as string]: sign(data, bobRaw.signatureParams),
})[identity.value],
}[identity.value]),
supportedIdentityTypes: [IdentityTypes.TYPE.ETHEREUM_ADDRESS],
supportedMethods: [SignatureTypes.METHOD.ECDSA],
};
Expand Down
42 changes: 20 additions & 22 deletions packages/request-logic/src/request-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,26 +511,23 @@ export default class RequestLogic implements RequestLogicTypes.IRequestLogic {
// second parameter is null, because the first action must be a creation (no state expected)
const confirmedRequestState = transactions
.filter((action) => action.state === TransactionTypes.TransactionState.CONFIRMED)
.reduce(
(requestState, actionConfirmed) => {
try {
return RequestLogicCore.applyActionToRequest(
requestState,
actionConfirmed.action,
actionConfirmed.timestamp,
this.advancedLogic,
);
} catch (e) {
// if an error occurs while applying we ignore the action
ignoredTransactionsByApplication.push({
reason: e.message,
transaction: actionConfirmed,
});
return requestState;
}
},
null as RequestLogicTypes.IRequest | null,
);
.reduce((requestState, actionConfirmed) => {
try {
return RequestLogicCore.applyActionToRequest(
requestState,
actionConfirmed.action,
actionConfirmed.timestamp,
this.advancedLogic,
);
} catch (e) {
// if an error occurs while applying we ignore the action
ignoredTransactionsByApplication.push({
reason: e.message,
transaction: actionConfirmed,
});
return requestState;
}
}, null as RequestLogicTypes.IRequest | null);

const pendingRequestState = transactions
.filter((action) => action.state === TransactionTypes.TransactionState.PENDING)
Expand Down Expand Up @@ -677,8 +674,9 @@ export default class RequestLogic implements RequestLogicTypes.IRequestLogic {
requestId: RequestLogicTypes.RequestId,
action: RequestLogicTypes.IAction,
): Promise<void> {
const { confirmedRequestState, pendingRequestState } =
await this.computeRequestFromRequestId(requestId);
const { confirmedRequestState, pendingRequestState } = await this.computeRequestFromRequestId(
requestId,
);

try {
// Check if the action doesn't fail with the request state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export const fakeSignatureProvider: SignatureProviderTypes.ISignatureProvider =
[payeeRaw.address as string]: sign(data, payeeRaw.signatureParams),
[payerRaw.address as string]: sign(data, payerRaw.signatureParams),
[otherIdRaw.address as string]: sign(data, otherIdRaw.signatureParams),
})[identity.value],
}[identity.value]),
supportedIdentityTypes: [IdentityTypes.TYPE.ETHEREUM_ADDRESS],
supportedMethods: [SignatureTypes.METHOD.ECDSA],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export default class ConfirmedTransactionStore {
public async getConfirmedTransaction(
transactionHash: string,
): Promise<DataAccessTypes.IReturnPersistTransactionRaw | undefined> {
const { transactions, blockNumber } =
await this.subgraphClient.getTransactionsByDataHash(transactionHash);
const { transactions, blockNumber } = await this.subgraphClient.getTransactionsByDataHash(
transactionHash,
);
if (transactions.length === 0) {
return;
}
Expand Down
5 changes: 1 addition & 4 deletions packages/request-node/src/request/getChannelsByTopic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { Request, Response } from 'express';
import { StatusCodes } from 'http-status-codes';

export default class GetChannelHandler {
constructor(
private logger: LogTypes.ILogger,
private dataAccess: DataAccessTypes.IDataRead,
) {
constructor(private logger: LogTypes.ILogger, private dataAccess: DataAccessTypes.IDataRead) {
this.handler = this.handler.bind(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { StatusCodes } from 'http-status-codes';
import ConfirmedTransactionStore from './confirmedTransactionStore';

export default class GetConfirmedTransactionHandler {
constructor(
private logger: LogTypes.ILogger,
private store: ConfirmedTransactionStore,
) {
constructor(private logger: LogTypes.ILogger, private store: ConfirmedTransactionStore) {
this.handler = this.handler.bind(this);
}

Expand Down
5 changes: 1 addition & 4 deletions packages/request-node/src/request/getStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ const packageJson = require('../../package.json');
* @param dataAccess data access layer
*/
export default class GetStatusHandler {
constructor(
private logger: LogTypes.ILogger,
private dataAccess: DataAccessTypes.IDataAccess,
) {
constructor(private logger: LogTypes.ILogger, private dataAccess: DataAccessTypes.IDataAccess) {
this.handler = this.handler.bind(this);
}
async handler(clientRequest: Request, serverResponse: Response): Promise<void> {
Expand Down
Loading

0 comments on commit c287045

Please sign in to comment.