Skip to content

Commit

Permalink
chore(merge): merge remote-tracking branch 'origin' into Frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddesh7 committed Apr 5, 2024
2 parents 57b9750 + 7f034ff commit 3bfcec0
Show file tree
Hide file tree
Showing 39 changed files with 219 additions and 212 deletions.
31 changes: 9 additions & 22 deletions packages/reactnative/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@pushprotocol/react-native-sdk",
"version": "0.1.0",
"description": "test",
"version": "1.1.1",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/index.d.ts",
Expand Down Expand Up @@ -44,26 +43,26 @@
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"build": "bob build",
"prepare": "bob build",
"release": "release-it",
"bootstrap": "yarn install",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
"postinstall": "node_modules/.bin/rn-nodeify --install crypto,assert,url,stream,events,http,https,os,url,net,fs --hack && npx patch-package"
"postinstall": "cd $INIT_CWD && npx patch-package --patch-dir ./node_modules/@pushprotocol/react-native-sdk/patches"
},
"keywords": [
"react-native",
"ios",
"android"
],
"repository": "https://github.com/ethereum-push-notification-service/push-sdk",
"repository": "https://github.com/push-protocol/push-sdk",
"author": "Push Protocol <[email protected]> (https://www.push.org)",
"license": "MIT",
"bugs": {
"url": "https://github.com/ethereum-push-notification-service/push-sdk/issues"
"url": "https://github.com/push-protocol/push-sdk/issues"
},
"homepage": "https://github.com/ethereum-push-notification-service/push-sdk#readme",
"homepage": "https://github.com/push-protocol/push-sdk#readme",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"dependencies": {
"@pushprotocol/restapi": "1.6.3",
Expand All @@ -75,6 +74,7 @@
"ethers": "^5.7.1",
"events": "^3.3.0",
"https-browserify": "^0.0.1",
"patch-package": "^8.0.0",
"process": "^0.11.10",
"react-native-crypto": "^2.2.0",
"react-native-fast-openpgp": "2.7.0",
Expand All @@ -94,10 +94,8 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.0.2",
"@evilmartians/lefthook": "^1.2.2",
"@react-native-community/eslint-config": "^3.0.2",
"@release-it/conventional-changelog": "^5.0.0",
"@types/jest": "^28.1.2",
"@types/react": "~18.2.25",
"@types/react-native": "0.72.6",
Expand All @@ -107,7 +105,6 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.1",
"patch-package": "^7.0.0",
"pod-install": "^0.1.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.0.5",
Expand All @@ -134,11 +131,6 @@
"<rootDir>/lib/"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"release-it": {
"git": {
"commitMessage": "chore: release ${version}",
Expand All @@ -148,12 +140,7 @@
"publish": true
},
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular"
}
"release": false
}
},
"eslintConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/restapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"viem": "^1.20.3"
},
"scripts": {
"test": "TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' mocha -r ts-node/register 'tests/**/*.test.ts' --timeout 1200000 --require tests/root.ts --serial"
"test": "TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' DOTENV_CONFIG_PATH='./tests/.env' mocha -r ts-node/register -r dotenv/config 'tests/**/*.test.ts' --timeout 1200000 --require tests/root.ts --serial"
},
"devDependencies": {
"@types/chai": "^4.3.4",
Expand All @@ -43,4 +43,4 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.2"
}
}
}
13 changes: 8 additions & 5 deletions packages/restapi/tests/lib/alias/arbitrum.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import * as path from 'path';
import * as dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
import { ethers } from 'ethers';
import { PushAPI } from '../../../src';
import { ENV } from '../../../src/lib/constants';
Expand All @@ -10,6 +7,12 @@ describe('ARBITRUM ALIAS functionality', () => {
let userBob: PushAPI;
let account: string;
let account2: string;

// accessing env dynamically using process.env
type EnvStrings = keyof typeof ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = ENV[envMode];

before(async () => {
const provider = new ethers.providers.JsonRpcProvider(
'https://sepolia-rollup.arbitrum.io/rpc'
Expand All @@ -20,12 +23,12 @@ describe('ARBITRUM ALIAS functionality', () => {
);
account = signer.address;
userAlice = await PushAPI.initialize(signer, {
env: ENV.DEV,
env: _env,
});

const signer2 = new ethers.Wallet(ethers.Wallet.createRandom().privateKey);
account2 = signer2.address;
userBob = await PushAPI.initialize(signer2, { env: ENV.DEV });
userBob = await PushAPI.initialize(signer2, { env: _env });
});

it.skip('Should be able to create channel', async () => {
Expand Down
13 changes: 8 additions & 5 deletions packages/restapi/tests/lib/alias/berachain.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import * as path from 'path';
import * as dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
import { ethers } from 'ethers';
import { PushAPI } from '../../../src';
import { ENV } from '../../../src/lib/constants';
Expand All @@ -10,6 +7,12 @@ describe('BERACHAIN ALIAS functionality', () => {
let userBob: PushAPI;
let account: string;
let account2: string;

// accessing env dynamically using process.env
type EnvStrings = keyof typeof ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = ENV[envMode];

before(async () => {
const provider = new ethers.providers.JsonRpcProvider(
'https://artio.rpc.berachain.com' // berachain artio Provider
Expand All @@ -20,12 +23,12 @@ describe('BERACHAIN ALIAS functionality', () => {
);
account = signer.address;
userAlice = await PushAPI.initialize(signer, {
env: ENV.DEV,
env: _env,
});

const signer2 = new ethers.Wallet(ethers.Wallet.createRandom().privateKey);
account2 = signer2.address;
userBob = await PushAPI.initialize(signer2, { env: ENV.DEV });
userBob = await PushAPI.initialize(signer2, { env: _env });
});

it.skip('Should be able to create channel', async () => {
Expand Down
13 changes: 8 additions & 5 deletions packages/restapi/tests/lib/alias/optimism.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import * as path from 'path';
import * as dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
import { ethers } from 'ethers';
import { PushAPI } from '../../../src';
import { ENV } from '../../../src/lib/constants';
Expand All @@ -10,6 +7,12 @@ describe('OPTIMISM ALIAS functionality', () => {
let userBob: PushAPI;
let account: string;
let account2: string;

// accessing env dynamically using process.env
type EnvStrings = keyof typeof ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = ENV[envMode];

before(async () => {
const provider = new ethers.providers.JsonRpcProvider(
'https://sepolia.optimism.io'
Expand All @@ -20,12 +23,12 @@ describe('OPTIMISM ALIAS functionality', () => {
);
account = signer.address;
userAlice = await PushAPI.initialize(signer, {
env: ENV.DEV,
env: _env,
});

const signer2 = new ethers.Wallet(ethers.Wallet.createRandom().privateKey);
account2 = signer2.address;
userBob = await PushAPI.initialize(signer2, { env: ENV.DEV });
userBob = await PushAPI.initialize(signer2, { env: _env });
});

it.skip('Should be able to create channel', async () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/restapi/tests/lib/benchmark/chatMessage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { ethers } from 'ethers';
import Constants from '../../../src/lib/constants';
import { PushAPI } from '../../../src/lib/pushapi/PushAPI';

const _env = Constants.ENV.PROD;
// accessing env dynamically using process.env
type EnvStrings = keyof typeof Constants.ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = Constants.ENV[envMode];

/**
* THIS TEST GROUP IS FOR BENCHMARKING CHAT PERFORMANCE
Expand Down
5 changes: 4 additions & 1 deletion packages/restapi/tests/lib/benchmark/privateGroup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import Constants from '../../../src/lib/constants';
import { PushAPI } from '../../../src/lib/pushapi/PushAPI';
import { users } from './data/did';

const _env = Constants.ENV.LOCAL;
// accessing env dynamically using process.env
type EnvStrings = keyof typeof Constants.ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = Constants.ENV[envMode];

/**
* THIS TEST GROUP IS FOR BENCHMARKING PUBLIC GROUP
Expand Down
5 changes: 4 additions & 1 deletion packages/restapi/tests/lib/benchmark/publicGroup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import Constants from '../../../src/lib/constants';
import { PushAPI } from '../../../src/lib/pushapi/PushAPI';
import { users } from './data/did';

const _env = Constants.ENV.LOCAL;
// accessing env dynamically using process.env
type EnvStrings = keyof typeof Constants.ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = Constants.ENV[envMode];

/**
* THIS TEST GROUP IS FOR BENCHMARKING PUBLIC GROUP
Expand Down
27 changes: 11 additions & 16 deletions packages/restapi/tests/lib/channel/getChannelNotifications.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import * as path from 'path';
import * as dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
import * as PUSH_CHANNELS from '../../../src/lib/channels';
import { expect } from 'chai';
import { ethers } from 'ethers';
import { ENV } from '../../../src/lib/constants';

describe('PUSH_CHANNELS.sendNotification functionality', () => {
let signer1: any;
let account1: string;
let signer2: any;
let account2: string;
enum ENV {
PROD = 'prod',
STAGING = 'staging',
DEV = 'dev',
/**
* **This is for local development only**
*/
LOCAL = 'local',
}

// accessing env dynamically using process.env
type EnvStrings = keyof typeof ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = ENV[envMode];

beforeEach(async () => {
signer1 = new ethers.Wallet(
'0xb9d00f786e1d024cfed08f696a775217ff75501f4aacef5ec0795fc4a2eb9df1'
Expand All @@ -33,22 +28,22 @@ describe('PUSH_CHANNELS.sendNotification functionality', () => {
it('Should fetch notifications of a channel', async () => {
const res = await PUSH_CHANNELS.getChannelNotifications({
channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',
env: ENV.DEV,
env: _env,
});
console.log(res);
});
it('Should should fetch notifications of a channel based on filter', async () => {
const res = await PUSH_CHANNELS.getChannelNotifications({
channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',
env: ENV.DEV,
env: _env,
filter: 1,
});
console.log(res);
});
it('Should should fetch notifications of a channel based on filter and in standard format', async () => {
const res = await PUSH_CHANNELS.getChannelNotifications({
channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',
env: ENV.DEV,
env: _env,
filter: 1,
raw: false,
});
Expand All @@ -57,7 +52,7 @@ describe('PUSH_CHANNELS.sendNotification functionality', () => {
it('Should should fetch notifications of a channel based on filter and in standard format', async () => {
const res = await PUSH_CHANNELS.getChannelNotifications({
channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',
env: ENV.DEV,
env: _env,
filter: 1,
raw: false,
page: 1,
Expand Down
20 changes: 7 additions & 13 deletions packages/restapi/tests/lib/channel/sendNotification.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as path from 'path';
import * as dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
import * as PUSH_PAYLOAD from '../../../src/lib/payloads';
import { expect } from 'chai';
import { ethers } from 'ethers';
import { ENV } from '../../../src/lib/constants';

describe('PUSH_PAYLOAD.sendNotification functionality', () => {
let signer1: any;
Expand Down Expand Up @@ -36,17 +34,13 @@ describe('PUSH_PAYLOAD.sendNotification functionality', () => {
SUBSET = 4,
}

enum ENV {
PROD = 'prod',
STAGING = 'staging',
DEV = 'dev',
/**
* **This is for local development only**
*/
LOCAL = 'local',
}
// accessing env dynamically using process.env
type EnvStrings = keyof typeof ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = ENV[envMode];

const res = await PUSH_PAYLOAD.sendNotification({
env: ENV.DEV,
env: _env,
signer: signer1,
type: NOTIFICATION_TYPE.BROADCAST,
identityType: IDENTITY_TYPE.DIRECT_PAYLOAD,
Expand Down
12 changes: 7 additions & 5 deletions packages/restapi/tests/lib/channel/subscribeV2.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import * as path from 'path';
import * as dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname, '../../.env') });
import * as PUSH_CHANNEL from '../../../src/lib/channels/';
import { expect } from 'chai';
import { ethers } from 'ethers';
Expand All @@ -12,6 +9,11 @@ describe('PUSH_CHANNEL.subscribeV2 functionality', () => {
let signer2: any;
let account2: string;

// accessing env dynamically using process.env
type EnvStrings = keyof typeof CONSTANTS.ENV;
const envMode = process.env.ENV as EnvStrings;
const _env = CONSTANTS.ENV[envMode];

beforeEach(async () => {
const WALLET1 = ethers.Wallet.createRandom();
signer1 = new ethers.Wallet(WALLET1.privateKey);
Expand All @@ -27,7 +29,7 @@ describe('PUSH_CHANNEL.subscribeV2 functionality', () => {
signer: signer1,
channelAddress: 'eip155:11155111:0xD8634C39BBFd4033c0d3289C4515275102423681',
userAddress: `eip155:11155111:${account1}`,
env: CONSTANTS.ENV.STAGING,
env: _env,
});
expect(res.status).to.be.equal(204);
});
Expand All @@ -37,7 +39,7 @@ describe('PUSH_CHANNEL.subscribeV2 functionality', () => {
signer: signer1,
channelAddress: 'eip155:11155111:0xD8634C39BBFd4033c0d3289C4515275102423681',
userAddress: `eip155:11155111:${account1}`,
env: CONSTANTS.ENV.STAGING,
env: _env,
});
// console.log(res)
expect(res.status).to.be.equal(204);
Expand Down
Loading

0 comments on commit 3bfcec0

Please sign in to comment.