Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send epoch number on each request #380

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f6c0956
init patch
Ansonhkg Feb 21, 2024
2d7bbf3
feat: send epoch number on each request
Ansonhkg Feb 21, 2024
271b033
init patch
Ansonhkg Feb 22, 2024
1628810
Feature/lit 2570 js sdk fix build (#387)
Ansonhkg Feb 26, 2024
5464279
remove old v0 errors from js sdk. provide error details to the user …
glitch003 Feb 26, 2024
6e6a12e
feat: cache enabled
Ansonhkg Feb 26, 2024
747c4af
chore: update .gitignore
Ansonhkg Feb 26, 2024
90ea7df
Merge remote-tracking branch 'origin/staging/3.2.2' into staging/3.2.2
Ansonhkg Feb 26, 2024
d2f13cb
chore: enable parallel
Ansonhkg Feb 26, 2024
a8ba384
feat: make capacityTokenId optional (#384)
Ansonhkg Feb 27, 2024
ea0e887
Update yarn.lock to match package.json changes
Ansonhkg Feb 27, 2024
a7b9d65
fix: ReferenceError: crypto is not defined
Ansonhkg Feb 27, 2024
104aa6d
fix: ignore nx cache directory on linting
Ansonhkg Feb 27, 2024
3bd87a6
fix: ignore tools directory on linting
Ansonhkg Feb 27, 2024
318d05f
fix: linting
Ansonhkg Feb 27, 2024
1808b7a
fix: '
Ansonhkg Feb 27, 2024
034abcd
fix: epoch transition logic
Ansonhkg Feb 28, 2024
0a71f26
Merge branch 'staging/3.2.2' into feature/lit-2547-js-sdk-send-epoch-…
Ansonhkg Feb 28, 2024
e5eeffd
chore: add log
Ansonhkg Feb 28, 2024
9d4e045
fix: update the cache
Ansonhkg Feb 28, 2024
75fad46
feat: test
Ansonhkg Feb 28, 2024
ea36923
fix: prettier
Ansonhkg Feb 28, 2024
53bacb9
feat: remove max cache age until implemented on nodes
Ansonhkg Mar 6, 2024
b5396bc
Merge branch 'staging/3.2.6' into feature/lit-2547-js-sdk-send-epoch-…
Ansonhkg Mar 12, 2024
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ apps/html/index.html
apps/nodejs/main.ts
apps/react/src/app/app.tsx

storage.test.db
storage.test.db

.nx
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
/.vscode
/node_modules
/tmp
/packages/*/dist
/packages/*/dist
.nx
tools
64 changes: 31 additions & 33 deletions README.md

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions apps/demo-encrypt-decrypt-react/project.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"name": "demo-encrypt-decrypt-react",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/demo-encrypt-decrypt-react/src",
"projectType": "application",
"targets": {
"serve":{
"executor": "nx:run-commands",
"options": {
"command": "cd apps/demo-encrypt-decrypt-react && yarn start"
}
"name": "demo-encrypt-decrypt-react",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/demo-encrypt-decrypt-react/src",
"projectType": "application",
"targets": {
"serve": {
"executor": "nx:run-commands",
"options": {
"command": "cd apps/demo-encrypt-decrypt-react && yarn start"
}
},
"tags": []
}
}
},
"tags": []
}
Binary file modified apps/demo-pkp-session-sigs-3.0.6/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion apps/demo-pkp-session-sigs-3.0.6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"tailwindcss": "^3",
"typescript": "^5"
}
}
}
Binary file modified apps/demo-pkp-session-sigs/bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions apps/html/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- (DO NOT EDIT!) (HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Thu, 22 Feb 2024 05:05:54 GMT -->
<!-- (DO NOT EDIT!) (HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Sat, 24 Feb 2024 04:18:12 GMT -->
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -62,7 +62,7 @@
</style>
</head>
<body>
(HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Thu, 22 Feb 2024 05:05:54 GMT
(HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Sat, 24 Feb 2024 04:18:12 GMT

<!-- ==================== ALL EXPORTED VANILLA LIBRARIES ==================== -->

Expand Down
27 changes: 13 additions & 14 deletions apps/html/project.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"name": "html",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/html/src",
"projectType": "application",
"targets": {
"serve":{
"executor": "nx:run-commands",
"options": {
"command": "node apps/html/server.js "
}
"name": "html",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/html/src",
"projectType": "application",
"targets": {
"serve": {
"executor": "nx:run-commands",
"options": {
"command": "node apps/html/server.js "
}
},
"tags": []
}
}
},
"tags": []
}
8 changes: 5 additions & 3 deletions apps/nodejs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/node:webpack",
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/nodejs",
"main": "apps/nodejs/main.ts",
"tsConfig": "apps/nodejs/tsconfig.app.json",
"assets": []
"assets": [],
"compiler": "tsc",
"target": "node"
}
},
"serve": {
"executor": "@nrwl/node:node",
"executor": "@nx/js:node",
"options": {
"buildTarget": "nodejs:build"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/react/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/react/babel",
"@nx/react/babel",
{
"runtime": "automatic"
}
Expand Down
11 changes: 4 additions & 7 deletions apps/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/web:webpack",
"executor": "@nx/web:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
Expand All @@ -21,20 +21,17 @@
"scripts": [],
"webpackConfig": "apps/react/webpack.config.js"
},
"configurations": {

}
"configurations": {}
},
"serve": {
"executor": "@nrwl/web:dev-server",
"executor": "@nx/web:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "react:build",
"hmr": true,
"port": 4003
},
"configurations": {
}
"configurations": {}
}
},
"tags": []
Expand Down
2 changes: 1 addition & 1 deletion apps/react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ pre {
`,
}}
/>
(REACT) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-react.mjs Thu, 22 Feb 2024 05:05:54 GMT
(REACT) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-react.mjs Sat, 24 Feb 2024 04:18:12 GMT
<div id="root"></div>
<pre><code id="result"></code></pre>
</>
Expand Down
4 changes: 2 additions & 2 deletions apps/react/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"types": ["node"]
},
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"jest.config.ts",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
6 changes: 6 additions & 0 deletions e2e-nodejs/00-setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { LitNodeClient } from '@lit-protocol/lit-node-client';
import LITCONFIG from '../lit.config.json' assert { type: 'json' };
import { fail } from '../tools/scripts/utils.mjs';
import { LocalStorage } from 'node-localstorage';
import crypto from './polyfills.mjs';

// -- This is to fix CI "ReferenceError: crypto is not defined" error
if (typeof globalThis.crypto === 'undefined') {
globalThis.crypto = crypto;
}

const client = new LitNodeClient({
litNetwork: globalThis.LitCI.network,
Expand Down
32 changes: 32 additions & 0 deletions e2e-nodejs/0_manual-tests/test-epoch-cache.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { LitNodeClient } from '@lit-protocol/lit-node-client';
import crypto from '../polyfills.mjs';

if (typeof globalThis.crypto === 'undefined') {
globalThis.crypto = crypto;
}

globalThis.litConfig = {
debug: true,
};

const DATA_TO_SIGN = new Uint8Array(
await crypto.subtle.digest('SHA-256', new TextEncoder().encode('Hello world'))
);

export async function main() {
// ==================== Test Logic ====================
const litNodeClient = new LitNodeClient({
litNetwork: 'cayenne',
debug: true,
});

await litNodeClient.connect();

// for every second, get new epoch number
setInterval(async () => {
const epochNumber = await litNodeClient.getCurrentEpochNumber();
console.log('epochNumber:', epochNumber);
}, 1000);
}

main();
Loading
Loading