Skip to content

Commit

Permalink
Merge branch 'master' into pn-any-to-erc20-request-client
Browse files Browse the repository at this point in the history
  • Loading branch information
vrolland committed Mar 8, 2021
2 parents 9afd126 + 9f4f131 commit 6942ee7
Show file tree
Hide file tree
Showing 50 changed files with 470 additions and 159 deletions.
12 changes: 12 additions & 0 deletions packages/advanced-logic/CHANGELOG.md
Expand Up @@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.29.0](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/advanced-logic@0.27.0...@requestnetwork/advanced-logic@0.29.0) (2021-03-03)


### Features

* payment network any to erc20 in advanced logic ([#414](https://github.com/RequestNetwork/requestNetwork/issues/414)) ([45f09f9](https://github.com/RequestNetwork/requestNetwork/commit/45f09f9ee5693378722559d414b07e887fb3c63c))
* payment network any to erc20 smartcontracts ([#408](https://github.com/RequestNetwork/requestNetwork/issues/408)) ([a2f30a8](https://github.com/RequestNetwork/requestNetwork/commit/a2f30a84689eaea0994e72944c417718c7aad20e))





# [0.28.0](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/advanced-logic@0.27.0...@requestnetwork/advanced-logic@0.28.0) (2021-02-22)


Expand Down
6 changes: 3 additions & 3 deletions packages/advanced-logic/package.json
@@ -1,6 +1,6 @@
{
"name": "@requestnetwork/advanced-logic",
"version": "0.28.0",
"version": "0.29.0",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -39,8 +39,8 @@
"test:watch": "yarn test --watch"
},
"dependencies": {
"@requestnetwork/types": "0.29.3",
"@requestnetwork/utils": "0.29.0",
"@requestnetwork/types": "0.30.0",
"@requestnetwork/utils": "0.30.0",
"@types/node": "14.14.16",
"lodash": "4.17.20",
"wallet-address-validator": "0.2.4"
Expand Down
12 changes: 12 additions & 0 deletions packages/currency/CHANGELOG.md
Expand Up @@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 0.3.0 (2021-03-03)


### Features

* add mph and ausdc tokens to supported tokens ([#423](https://github.com/RequestNetwork/requestNetwork/issues/423)) ([6f8afec](https://github.com/RequestNetwork/requestNetwork/commit/6f8afec5bc5fbbd8b33280808bff47d07e5377f0))
* payment network any to erc20 smartcontracts ([#408](https://github.com/RequestNetwork/requestNetwork/issues/408)) ([a2f30a8](https://github.com/RequestNetwork/requestNetwork/commit/a2f30a84689eaea0994e72944c417718c7aad20e))





# 0.2.0 (2021-02-22)


Expand Down
6 changes: 3 additions & 3 deletions packages/currency/package.json
@@ -1,6 +1,6 @@
{
"name": "@requestnetwork/currency",
"version": "0.2.0",
"version": "0.3.0",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -42,8 +42,8 @@
},
"dependencies": {
"@metamask/contract-metadata": "1.23.0",
"@requestnetwork/types": "0.29.3",
"@requestnetwork/utils": "0.29.0",
"@requestnetwork/types": "0.30.0",
"@requestnetwork/utils": "0.30.0",
"node-dijkstra": "2.5.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/currency/src/erc20/index.ts
Expand Up @@ -31,7 +31,7 @@ export function getErc20Decimals(currency: RequestLogicTypes.ICurrency): number
// Get the decimals from one of the supported ERC20 networks
if (supportedNetworksDetails.hasOwnProperty(network)) {
erc20Token = Object.values(supportedNetworksDetails[network]).find(
({ address }) => address === currency.value,
({ address }) => address.toLowerCase() === currency.value.toLowerCase(),
);
}

Expand Down Expand Up @@ -59,7 +59,7 @@ export function getErc20Symbol(currency: RequestLogicTypes.ICurrency): string |
// Find ERC20 symbol in one of the other supported ERC20 networks
if (supportedNetworks.hasOwnProperty(network)) {
const entry = [...supportedNetworks[network].entries()].find(
([, obj]) => currency.value === obj.value,
([, obj]) => currency.value.toLowerCase() === obj.value.toLowerCase(),
);
return entry ? entry[0] : null;
}
Expand Down
18 changes: 18 additions & 0 deletions packages/currency/src/erc20/networks/mainnet.ts
Expand Up @@ -29,6 +29,24 @@ const extraERC20Tokens = {
decimals: 2,
address: '0x433d86336dB759855A66cCAbe4338313a8A7fc77',
},
// MPH
'0x8888801af4d980682e47f1a9036e589479e835c5': {
name: 'MPH',
erc20: true,
logo: 'mph.svg',
symbol: 'MPH',
decimals: 18,
address: '0x8888801af4d980682e47f1a9036e589479e835c5',
},
// Aave USDC
'0x9bA00D6856a4eDF4665BcA2C2309936572473B7E': {
name: 'aUSDC',
erc20: true,
logo: 'ausdc.svg',
symbol: 'aUSDC',
decimals: 6,
address: '0x9bA00D6856a4eDF4665BcA2C2309936572473B7E',
},
};
/* eslint-enable spellcheck/spell-checker */

Expand Down
103 changes: 88 additions & 15 deletions packages/currency/test/currency/erc20.test.ts
@@ -1,23 +1,25 @@
import { RequestLogicTypes } from '@requestnetwork/types';
import {
getErc20Symbol,
} from '../../src/erc20';
import { getErc20Decimals, getErc20Symbol } from '../../src/erc20';

describe('erc20', () => {
describe('getErc20Symbol', () => {
it('get the symbol for SAI currency', () => {
expect(getErc20Symbol({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', // SAI
})).toEqual('SAI');
expect(
getErc20Symbol({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', // SAI
}),
).toEqual('SAI');
});
it('get the symbol for CTBK currency', () => {
expect(getErc20Symbol({
network: 'rinkeby',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x995d6a8c21f24be1dd04e105dd0d83758343e258',
})).toEqual('CTBK');
expect(
getErc20Symbol({
network: 'rinkeby',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x995d6a8c21f24be1dd04e105dd0d83758343e258',
}),
).toEqual('CTBK');
});
it('get the symbol for CUSD currency (Celo network)', () => {
expect(
Expand All @@ -28,9 +30,39 @@ describe('erc20', () => {
}),
).toEqual('CUSD');
});
it('cannot get the symbol for not ERC20 type', () => {

it('can get the symbol for different address case', () => {
// upper case
expect(
() => getErc20Symbol({
getErc20Symbol({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0X8888801AF4D980682E47F1A9036E589479E835C5', // MPH
}),
).toEqual('MPH');

// lower case
expect(
getErc20Symbol({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x8888801af4d980682e47f1a9036e589479e835c5', // MPH
}),
).toEqual('MPH');

// checksum
expect(
getErc20Symbol({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x8888801aF4d980682e47f1A9036e589479e835C5', // MPH
}),
).toEqual('MPH');
});

it('cannot get the symbol for not ERC20 type', () => {
expect(() =>
getErc20Symbol({
type: RequestLogicTypes.CURRENCY.ETH,
value: '0x765DE816845861e75A25fCA122bb6898B8B1282a',
}),
Expand All @@ -44,6 +76,7 @@ describe('erc20', () => {
}),
).toEqual(null);
});

it('cannot get the symbol for unknown network', () => {
expect(
getErc20Symbol({
Expand All @@ -54,4 +87,44 @@ describe('erc20', () => {
).toEqual(null);
});
});
describe('getErc20Decimals', () => {
it('can get the decimals for SAI', () => {
expect(
getErc20Decimals({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', // SAI
}),
).toEqual(18);
});

it('can get the symbol for different address case', () => {
// upper case
expect(
getErc20Decimals({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0X8888801AF4D980682E47F1A9036E589479E835C5', // MPH
}),
).toEqual(18);

// lower case
expect(
getErc20Decimals({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x8888801af4d980682e47f1a9036e589479e835c5', // MPH
}),
).toEqual(18);

// checksum
expect(
getErc20Decimals({
network: 'mainnet',
type: RequestLogicTypes.CURRENCY.ERC20,
value: '0x8888801aF4d980682e47f1A9036e589479e835C5', // MPH
}),
).toEqual(18);
});
});
});
8 changes: 8 additions & 0 deletions packages/data-access/CHANGELOG.md
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.23.4](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/data-access@0.23.0...@requestnetwork/data-access@0.23.4) (2021-03-03)

**Note:** Version bump only for package @requestnetwork/data-access





## [0.23.3](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/data-access@0.23.0...@requestnetwork/data-access@0.23.3) (2021-02-22)

**Note:** Version bump only for package @requestnetwork/data-access
Expand Down
8 changes: 4 additions & 4 deletions packages/data-access/package.json
@@ -1,6 +1,6 @@
{
"name": "@requestnetwork/data-access",
"version": "0.23.3",
"version": "0.23.4",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -39,9 +39,9 @@
"test:watch": "yarn test --watch"
},
"dependencies": {
"@requestnetwork/multi-format": "0.15.3",
"@requestnetwork/types": "0.29.3",
"@requestnetwork/utils": "0.29.0",
"@requestnetwork/multi-format": "0.15.4",
"@requestnetwork/types": "0.30.0",
"@requestnetwork/utils": "0.30.0",
"bluebird": "3.7.2",
"keyv": "4.0.3"
},
Expand Down
11 changes: 11 additions & 0 deletions packages/data-format/CHANGELOG.md
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.8.4](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/data-format@0.8.0...@requestnetwork/data-format@0.8.4) (2021-03-03)


### Bug Fixes

* enable tree-shaking on data-format ([#411](https://github.com/RequestNetwork/requestNetwork/issues/411)) ([c6e34ed](https://github.com/RequestNetwork/requestNetwork/commit/c6e34edc74417456fdec91a280a6a5905babffaf))





## [0.8.3](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/data-format@0.8.0...@requestnetwork/data-format@0.8.3) (2021-02-22)


Expand Down
2 changes: 1 addition & 1 deletion packages/data-format/package.json
@@ -1,6 +1,6 @@
{
"name": "@requestnetwork/data-format",
"version": "0.8.3",
"version": "0.8.4",
"publishConfig": {
"access": "public"
},
Expand Down
11 changes: 11 additions & 0 deletions packages/docs/CHANGELOG.md
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.5.0](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/docs@0.1.16...@requestnetwork/docs@0.5.0) (2021-03-03)


### Features

* update token list ([#384](https://github.com/RequestNetwork/requestNetwork/issues/384)) ([4913626](https://github.com/RequestNetwork/requestNetwork/commit/4913626c74458e17c27b1b21e2a7f4937fe2e841))





# [0.4.0](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/docs@0.1.16...@requestnetwork/docs@0.4.0) (2021-02-22)


Expand Down
10 changes: 5 additions & 5 deletions packages/docs/package.json
@@ -1,6 +1,6 @@
{
"name": "@requestnetwork/docs",
"version": "0.4.0",
"version": "0.5.0",
"private": true,
"description": "Request products technical documentation.",
"keywords": [
Expand Down Expand Up @@ -37,10 +37,10 @@
"@docusaurus/theme-live-codeblock": "2.0.0-alpha.64",
"@docusaurus/utils": "2.0.0-alpha.64",
"@metamask/contract-metadata": "1.23.0",
"@requestnetwork/payment-processor": "0.31.0",
"@requestnetwork/request-client.js": "0.33.0",
"@requestnetwork/smart-contracts": "0.22.0",
"@requestnetwork/types": "0.29.3",
"@requestnetwork/payment-processor": "0.32.0",
"@requestnetwork/request-client.js": "0.34.0",
"@requestnetwork/smart-contracts": "0.23.0",
"@requestnetwork/types": "0.30.0",
"bn.js": "5.1.3",
"classnames": "2.2.6",
"core-js": "3.6.5",
Expand Down
8 changes: 8 additions & 0 deletions packages/epk-decryption/CHANGELOG.md
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.3.28](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/epk-decryption@0.3.24...@requestnetwork/epk-decryption@0.3.28) (2021-03-03)

**Note:** Version bump only for package @requestnetwork/epk-decryption





## [0.3.27](https://github.com/RequestNetwork/requestNetwork/compare/@requestnetwork/epk-decryption@0.3.24...@requestnetwork/epk-decryption@0.3.27) (2021-02-22)

**Note:** Version bump only for package @requestnetwork/epk-decryption
Expand Down
8 changes: 4 additions & 4 deletions packages/epk-decryption/package.json
@@ -1,6 +1,6 @@
{
"name": "@requestnetwork/epk-decryption",
"version": "0.3.27",
"version": "0.3.28",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -41,9 +41,9 @@
"test:watch": "yarn test --watch"
},
"dependencies": {
"@requestnetwork/multi-format": "0.15.3",
"@requestnetwork/types": "0.29.3",
"@requestnetwork/utils": "0.29.0"
"@requestnetwork/multi-format": "0.15.4",
"@requestnetwork/types": "0.30.0",
"@requestnetwork/utils": "0.30.0"
},
"devDependencies": {
"@types/jest": "26.0.13",
Expand Down

0 comments on commit 6942ee7

Please sign in to comment.