Skip to content

Commit bde0c09

Browse files
committed
feat: change subgraph url
1 parent c9dde69 commit bde0c09

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/config/index.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,27 @@ function getLiNearSDKConfig(): LiNearSDKConfig {
2323
}
2424

2525
/**
26-
* custom configauation for LiNear SDK
26+
* custom configuration for LiNear SDK
2727
* @param config custom config
2828
*/
2929
function setLiNearSDKConfig(config: LiNearSDKConfig) {
3030
SDK_CUSTOM_CONFIG = config;
3131
}
3232

33-
export { changeSDKEnvironment, getLiNearSDKConfig, setLiNearSDKConfig };
33+
/**
34+
* change subgraph URL
35+
*/
36+
function changeSubgraphUrl(apiUrl: string) {
37+
const config = getLiNearSDKConfig();
38+
setLiNearSDKConfig({
39+
...config,
40+
apiUrl,
41+
});
42+
}
43+
44+
export {
45+
changeSDKEnvironment,
46+
getLiNearSDKConfig,
47+
setLiNearSDKConfig,
48+
changeSubgraphUrl,
49+
};

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// env
2-
export { changeSDKEnvironment, setLiNearSDKConfig } from './config';
2+
export {
3+
changeSDKEnvironment,
4+
setLiNearSDKConfig,
5+
getLiNearSDKConfig,
6+
changeSubgraphUrl,
7+
} from './config';
38

49
export { SDK_ENV, LiNearSDKConfig } from './config/type';
510

test/apy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SECOND } from './../src/consts';
2-
import { getStakingApy, changeSDKEnvironment, SDK_ENV } from '../src';
2+
import { getStakingApy, changeSDKEnvironment, SDK_ENV, setLiNearSDKConfig, getLiNearSDKConfig } from '../src';
33

44
jest.setTimeout(20 * SECOND);
55

0 commit comments

Comments
 (0)