-
Notifications
You must be signed in to change notification settings - Fork 87
Feat/naga shiva #989
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
Open
Ansonhkg
wants to merge
8
commits into
naga
Choose a base branch
from
feat/naga-shiva
base: naga
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+657
−372
Open
Feat/naga shiva #989
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d12339d
feat: add exports
Ansonhkg 3ab3ad6
feat(e2e): register payment delegation ticket suite in index export
Ansonhkg 0f1baec
refactor(WIP): making shiva work
Ansonhkg cbfc8cb
refactor: standardize response property names in TestNetResponse
Ansonhkg 3c27611
feat(lit-client, networks): handle edge cases
Ansonhkg 8110939
refactor(lit-client): centralise retry reasons as const
Ansonhkg f39927d
fmt
Ansonhkg 115c194
refactor(executeWithHandshake): simplify retry logic and remove redun…
Ansonhkg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
packages/e2e/src/helper/ShivaClient/helpers/createEpochSnapshot.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| type EpochInfo = { | ||
| epochLength: number; | ||
| number: number; | ||
| endTime: number; | ||
| retries: number; | ||
| timeout: number; | ||
| }; | ||
|
|
||
| type EpochState = { | ||
| currentNumber: number; | ||
| startTime: number; | ||
| }; | ||
|
|
||
| type NetworkPrice = { | ||
| url: string; | ||
| prices: Array<number | bigint>; | ||
| }; | ||
|
|
||
| type PriceFeedInfo = { | ||
| epochId: number; | ||
| minNodeCount: number; | ||
| networkPrices: NetworkPrice[]; | ||
| }; | ||
|
|
||
| type LatestConnectionInfo = { | ||
| epochInfo: EpochInfo; | ||
| epochState: EpochState; | ||
| minNodeCount: number; | ||
| bootstrapUrls: string[]; | ||
| priceFeedInfo: PriceFeedInfo; | ||
| }; | ||
|
|
||
| type ServerKeyDetails = { | ||
| serverPublicKey: string; | ||
| subnetPublicKey: string; | ||
| networkPublicKey: string; | ||
| networkPublicKeySet: string; | ||
| clientSdkVersion: string; | ||
| hdRootPubkeys: string[]; | ||
| attestation?: string | null; | ||
| latestBlockhash: string; | ||
| nodeIdentityKey: string; | ||
| nodeVersion: string; | ||
| epoch: number; | ||
| }; | ||
|
|
||
| type CoreNodeConfig = { | ||
| subnetPubKey: string; | ||
| networkPubKey: string; | ||
| networkPubKeySet: string; | ||
| hdRootPubkeys: string[]; | ||
| latestBlockhash: string; | ||
| }; | ||
|
|
||
| type HandshakeResult = { | ||
| serverKeys: Record<string, ServerKeyDetails>; | ||
| connectedNodes: Record<string, unknown> | Set<string>; | ||
| coreNodeConfig: CoreNodeConfig | null; | ||
| threshold: number; | ||
| }; | ||
|
|
||
| type EpochSnapshotSource = { | ||
| latestConnectionInfo?: LatestConnectionInfo | null; | ||
| handshakeResult?: HandshakeResult | null; | ||
| }; | ||
|
|
||
| export type EpochSnapshot = EpochSnapshotSource; | ||
|
|
||
| export const createEpochSnapshot = async ( | ||
| litClient: Awaited< | ||
| ReturnType<typeof import('@lit-protocol/lit-client').createLitClient> | ||
| > | ||
| ): Promise<EpochSnapshot> => { | ||
| const ctx = await litClient.getContext(); | ||
|
|
||
| const snapshot = { | ||
| latestConnectionInfo: ctx?.latestConnectionInfo, | ||
| handshakeResult: ctx?.handshakeResult, | ||
| }; | ||
|
|
||
| return snapshot; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,20 @@ | ||
| // re-export | ||
| export { init } from './init'; | ||
| export * from './helper/auth-contexts'; | ||
| export * from './helper/tests'; | ||
| export * from './helper/NetworkManager'; | ||
| export * from './helper/tests'; | ||
| export { init } from './init'; | ||
|
|
||
| export { printAligned } from './helper/utils'; | ||
| export { getOrCreatePkp } from './helper/pkp-utils'; | ||
| export { createShivaClient } from './helper/shiva-client'; | ||
| export { printAligned } from './helper/utils'; | ||
| export type { AuthContext } from './types'; | ||
|
|
||
| // re-export new helpers that should be used to refactor the `init.ts` proces | ||
| // see packages/e2e/src/tickets/delegation.suite.ts for usage examples | ||
| export { createEnvVars } from './helper/createEnvVars'; | ||
| export { createTestAccount } from './helper/createTestAccount'; | ||
| export { createTestEnv } from './helper/createTestEnv'; | ||
| export type { CreateTestAccountResult } from './helper/createTestAccount'; | ||
| export { registerPaymentDelegationTicketSuite } from './tickets/delegation.suite'; | ||
|
|
||
| // -- Shiva | ||
| export { createShivaClient } from './helper/ShivaClient/createShivaClient'; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'proces' to 'process'.