@solard/sdk 0.2.25 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solard/sdk",
3
- "version": "0.2.25",
3
+ "version": "0.2.26",
4
4
  "description": "Public Solard SDK for wallets, trading, history, live market subscriptions and token metadata.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -27,7 +27,7 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@solana/web3.js": "^1.98.4",
30
- "@solard/core": "0.2.25"
30
+ "@solard/core": "0.2.26"
31
31
  },
32
32
  "scripts": {
33
33
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json",
package/src/default.ts CHANGED
@@ -1,5 +1,18 @@
1
+ import {
2
+ getSolUsdPrice,
3
+ subscribeLaunches,
4
+ subscribeMigrations,
5
+ subscribeTrades,
6
+ } from "@solard/core";
1
7
  import { createSolard, type Solard } from "./client.ts";
2
8
 
9
+ type DefaultSolard = Solard & {
10
+ getSolUsdPrice: typeof getSolUsdPrice;
11
+ subscribeLaunches: typeof subscribeLaunches;
12
+ subscribeMigrations: typeof subscribeMigrations;
13
+ subscribeTrades: typeof subscribeTrades;
14
+ };
15
+
3
16
  let instance: Solard | undefined;
4
17
 
5
18
  function client(): Solard {
@@ -7,7 +20,14 @@ function client(): Solard {
7
20
  return instance;
8
21
  }
9
22
 
10
- const slrd = new Proxy({} as Solard, {
23
+ const operations = {
24
+ getSolUsdPrice,
25
+ subscribeLaunches,
26
+ subscribeMigrations,
27
+ subscribeTrades,
28
+ } as const;
29
+
30
+ const slrd = new Proxy({} as DefaultSolard, {
11
31
  get(_target, key) {
12
32
  if (key === "close") {
13
33
  return () => {
@@ -16,6 +36,9 @@ const slrd = new Proxy({} as Solard, {
16
36
  current?.close();
17
37
  };
18
38
  }
39
+ if (typeof key === "string" && key in operations) {
40
+ return operations[key as keyof typeof operations];
41
+ }
19
42
  const current = client();
20
43
  const value = Reflect.get(current as object, key, current);
21
44
  return typeof value === "function" ? value.bind(current) : value;
@@ -138,6 +138,10 @@ describe("sdk membrane", () => {
138
138
  expect(source).toContain('export { default } from "./default.ts"');
139
139
  expect(defaultClient).toContain("instance ??= createSolard()");
140
140
  expect(defaultClient).toContain('if (key === "close")');
141
+ expect(defaultClient).toContain("getSolUsdPrice");
142
+ expect(defaultClient).toContain("subscribeTrades");
143
+ expect(defaultClient).toContain("subscribeLaunches");
144
+ expect(defaultClient).toContain("subscribeMigrations");
141
145
  expect(defaultClient).not.toContain("export default createSolard()");
142
146
  });
143
147