@burningflames/inj-exchange-sdk 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +49 -11
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -6,13 +6,21 @@ the SDK hands you the bytes.
6
6
 
7
7
  ## Why this exists
8
8
 
9
- `@injectivelabs/sdk-ts` talks to the chain and the indexer over **gRPC-web**. In a
10
- browser that is the only option; in a backend it is the wrong one — gRPC-web needs
11
- a proxy hop in front of the node, and it is meaningfully slower than the native
12
- protocol for the number of calls a trading service makes.
13
-
14
- This SDK speaks native gRPC over `@grpc/grpc-js` to the same endpoints, so a
15
- backend calls the chain and the indexer directly with no proxy in the path.
9
+ `@injectivelabs/sdk-ts` reaches the chain and the indexer over **gRPC-web**. That is
10
+ the right choice in a browser and a detour in a backend: every call crosses an
11
+ Envoy hop in front of the node, and the client carries a wallet-and-cosmos platform
12
+ this service never touches — 68 packages, 181 MB installed, 705 ms to import.
13
+
14
+ This SDK speaks native gRPC over `@grpc/grpc-js` to the same endpoints, so nothing
15
+ sits between the backend and the node. It installs 35 packages, 105 MB, and imports
16
+ in 67 ms.
17
+
18
+ The hop is not the bottleneck. Measured against the public endpoints, p50 is within
19
+ 5% and throughput at 64 calls in flight is within 3%, because a call spends its time
20
+ inside the endpoint rather than in the proxy. What native gRPC does buy is the tail:
21
+ on an orderbook read gRPC-web reached 871 ms at p95 where native stayed at 259 ms.
22
+ It also lets the client point at a node's own port 9090 with no proxy to stand up,
23
+ which is the lever that matters.
16
24
 
17
25
  ## Scope
18
26
 
@@ -53,12 +61,41 @@ declarations for each.
53
61
  ## Install
54
62
 
55
63
  ```sh
56
- bun add @burningflames/inj-exchange-sdk # or: npm i @burningflames/inj-exchange-sdk
64
+ bun add @burningflames/inj-exchange-sdk
65
+ # or: npm i @burningflames/inj-exchange-sdk
66
+ # or: pnpm add / yarn add @burningflames/inj-exchange-sdk
57
67
  ```
58
68
 
59
- From a checkout instead: `bun pm pack` builds and packs the tarball —
60
- `dist/`, `package.json`, `README.md`, `LICENSE` and `NOTICE` — which installs
61
- with `bun add ./burningflames-inj-exchange-sdk-0.1.0.tgz`.
69
+ Everything it needs installs with it — `@grpc/grpc-js`, `@bufbuild/protobuf`,
70
+ `@scure/base`, `eventemitter3` and `viem` — and there are no peer dependencies to
71
+ add yourself. Type declarations ship in the package, so nothing extra is needed
72
+ for TypeScript.
73
+
74
+ It loads as ESM or as CommonJS, from the package root or any of the six entry
75
+ points:
76
+
77
+ ```ts
78
+ import { MsgDeposit } from "@burningflames/inj-exchange-sdk/msgs";
79
+ import { getEip712TypedDataV2 } from "@burningflames/inj-exchange-sdk/utils";
80
+ ```
81
+
82
+ ```js
83
+ const { MsgDeposit } = require("@burningflames/inj-exchange-sdk/msgs");
84
+ const { getEip712TypedDataV2 } = require("@burningflames/inj-exchange-sdk/utils");
85
+ ```
86
+
87
+ `gen/` is not importable: the proto layer reaches you only through these entry
88
+ points, so `@burningflames/inj-exchange-sdk/gen/...` fails with
89
+ `ERR_PACKAGE_PATH_NOT_EXPORTED` by design.
90
+
91
+ From a checkout instead: `bun pm pack` builds and packs the tarball — `dist/`,
92
+ `package.json`, `README.md`, `LICENSE` and `NOTICE` — which installs with
93
+ `bun add ./burningflames-inj-exchange-sdk-0.1.0.tgz`.
94
+
95
+ Bun blocks one postinstall from a dependency, `protobufjs` arriving through
96
+ `@grpc/grpc-js`. It only prints a version-pinning warning when the consumer pins
97
+ `protobufjs` itself, and nothing is built or fetched, so it is safe to leave
98
+ blocked or to allow with `bun pm trust protobufjs`.
62
99
 
63
100
  ## Sending a transaction
64
101
 
@@ -185,6 +222,7 @@ and need a trigger price.
185
222
  bun run check # oxlint, oxfmt --check, tsc --noEmit, bun test
186
223
  bun test # 59 tests: encodings, EIP-712 payload, decimal scaling, pagination
187
224
  bun run build # tsdown → dist/, ESM and CJS with declarations
225
+ bun run check:pack # the file list a publish would carry; refuses an unexpected one
188
226
  bun pm pack # the publishable tarball
189
227
  ```
190
228
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burningflames/inj-exchange-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Trading messages, query clients and EIP-712 transaction building for the Injective exchange module",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -79,10 +79,11 @@
79
79
  "typecheck": "tsc --noEmit",
80
80
  "check": "bun run lint && bun run format:check && bun run typecheck && bun test",
81
81
  "build": "tsdown",
82
- "prepublishOnly": "bun run check && bun run build",
82
+ "prepublishOnly": "bun run check && bun run check:pack",
83
83
  "prepack": "bun run build",
84
84
  "test": "bun test",
85
- "record:fixtures": "bun run scripts/record-encoding-fixtures.ts"
85
+ "record:fixtures": "bun run scripts/record-encoding-fixtures.ts",
86
+ "check:pack": "bun run scripts/check-pack.ts"
86
87
  },
87
88
  "dependencies": {
88
89
  "@bufbuild/protobuf": "^2.13.0",