Skip to content

Commit

Permalink
Fixed release failed issue (#24)
Browse files Browse the repository at this point in the history
* Fixed release failed issue
* Changed project-key as compulsory
* Changed graphqlEndpoint as optional
* Set graphqlEndpoint from networkConfig
  • Loading branch information
kaushalrajbacancy authored Aug 29, 2023
1 parent b32597d commit 51d8d82
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ node_modules
dist
coverage
__snapshots__
src/sdk/contracts/**/*.ts
src/sdk/contracts/**/*.ts
src/sdk/base/HttpRpcClient.ts
src/sdk/state/state.service.ts
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etherspot/prime-sdk",
"version": "1.1.7",
"version": "1.1.8",
"description": "Etherspot Prime (Account Abstraction) SDK",
"keywords": [
"ether",
Expand Down Expand Up @@ -75,6 +75,6 @@
"dotenv": "16.0.3",
"npm": "9.6.4",
"ts-node": "8.10.2",
"typescript": "3.9.3"
"typescript": "4.5.2"
}
}
11 changes: 11 additions & 0 deletions src/sdk/common/rxjs/object.subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ export class ObjectSubject<T extends {}, K extends keyof T = keyof T> extends Be
}
}

nextData(value: T): void {
if (!value) {
super.next('' as any);
} else if (
!this.value || //
!deepCompare(this.prepareForCompare(this.value), this.prepareForCompare(value))
) {
super.next(this.prepareForNext(value));
}
}

prepareForNext(value: T): T {
return value;
}
Expand Down
9 changes: 4 additions & 5 deletions src/sdk/data/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { BigNumber } from 'ethers';
import { CrossChainServiceProvider, LiFiBridge } from './constants';

export class DataService extends Service {
readonly currentProject$ = new ObjectSubject<string>(null);
readonly currentProject$ = new ObjectSubject<string>('');

constructor(currentProject: string = null) {
constructor(currentProject = '') {
super();
this.switchCurrentProject(currentProject);
}
Expand All @@ -19,8 +19,7 @@ export class DataService extends Service {

get headers(): { [key: string]: any } {
let result: { [key: string]: any } = {};

if (this.currentProject) {
if (this.currentProject || this.currentProject === '') {
const key = this.currentProject;

result = {
Expand All @@ -32,7 +31,7 @@ export class DataService extends Service {
}

switchCurrentProject(currentProject: string): string {
this.currentProject$.next(currentProject);
this.currentProject$.nextData(currentProject);

return this.currentProject;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export interface SdkOptions {
bundlerRpcUrl?: string;
rpcProviderUrl?: string;
graphqlEndpoint?: string;
projectKey? : string;
projectKey: string;
paymasterApi?: PaymasterApi;
}
2 changes: 1 addition & 1 deletion src/sdk/network/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export interface NetworkConfig {
use: boolean;
url: string;
};
graphqlEndpoint: string;
graphqlEndpoint?: string;
};
2 changes: 0 additions & 2 deletions src/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export class PrimeSdk {
const networkConfig = getNetworkConfig(chainId);
optionsLike.bundlerRpcUrl = networkConfig.bundler;
if (optionsLike.bundlerRpcUrl == '') throw new Exception('No bundler Rpc provided');

optionsLike.graphqlEndpoint = networkConfig.graphqlEndpoint;
if (optionsLike.graphqlEndpoint == '') throw new Exception('No graphql endpoint provided');
}


Expand Down

0 comments on commit 51d8d82

Please sign in to comment.