@solard/sdk 0.2.23 → 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.23",
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.23"
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;
@@ -32,6 +32,7 @@ describe("sdk membrane", () => {
32
32
  "createSolard",
33
33
  "fetchTokenMetadata",
34
34
  "formatRaw",
35
+ "getSolUsdPrice",
35
36
  "publicTokenMetadataUrl",
36
37
  "subscribeLaunches",
37
38
  "subscribeMigrations",
@@ -50,6 +51,7 @@ describe("sdk membrane", () => {
50
51
  "CumulativeDistributionState",
51
52
  "CumulativeEntitlement",
52
53
  "FetchTokenMetadataOptions",
54
+ "GetSolUsdPriceOptions",
53
55
  "HumanAmount",
54
56
  "LaunchEvent",
55
57
  "LaunchSubscription",
@@ -61,6 +63,8 @@ describe("sdk membrane", () => {
61
63
  "MarketHistory",
62
64
  "MarketHistoryOptions",
63
65
  "MarketPrice",
66
+ "SolUsdPrice",
67
+ "SolUsdSource",
64
68
  "MergedReplayEventStream",
65
69
  "QuoteAsset",
66
70
  "ReplayCoverage",
@@ -75,6 +79,7 @@ describe("sdk membrane", () => {
75
79
  "SenderId",
76
80
  "SimulationResult",
77
81
  "TradeEvent",
82
+ "TradeMarket",
78
83
  "TradeSide",
79
84
  "TradeSubscription",
80
85
  "TradeVenue",
@@ -133,6 +138,10 @@ describe("sdk membrane", () => {
133
138
  expect(source).toContain('export { default } from "./default.ts"');
134
139
  expect(defaultClient).toContain("instance ??= createSolard()");
135
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");
136
145
  expect(defaultClient).not.toContain("export default createSolard()");
137
146
  });
138
147
 
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ export type {
54
54
 
55
55
  export {
56
56
  fetchTokenMetadata,
57
+ getSolUsdPrice,
57
58
  publicTokenMetadataUrl,
58
59
  subscribeLaunches,
59
60
  subscribeMigrations,
@@ -67,7 +68,11 @@ export type {
67
68
  MigrationEvent,
68
69
  MigrationSubscription,
69
70
  MigrationVenue,
71
+ GetSolUsdPriceOptions,
72
+ SolUsdPrice,
73
+ SolUsdSource,
70
74
  TradeEvent,
75
+ TradeMarket,
71
76
  TradeSide,
72
77
  TradeSubscription,
73
78
  TradeVenue,