sui-effect 0.1.0
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/AGENTS.md +209 -0
- package/LICENSE +21 -0
- package/LLMS.md +6707 -0
- package/README.md +300 -0
- package/dist/domain/bcs.d.ts +101 -0
- package/dist/domain/bcs.d.ts.map +1 -0
- package/dist/domain/bcs.js +183 -0
- package/dist/domain/bcs.js.map +1 -0
- package/dist/domain/errors.d.ts +595 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +476 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/executed.d.ts +325 -0
- package/dist/domain/executed.d.ts.map +1 -0
- package/dist/domain/executed.js +253 -0
- package/dist/domain/executed.js.map +1 -0
- package/dist/domain/journal-entry.d.ts +468 -0
- package/dist/domain/journal-entry.d.ts.map +1 -0
- package/dist/domain/journal-entry.js +63 -0
- package/dist/domain/journal-entry.js.map +1 -0
- package/dist/domain/schemas.d.ts +950 -0
- package/dist/domain/schemas.d.ts.map +1 -0
- package/dist/domain/schemas.js +571 -0
- package/dist/domain/schemas.js.map +1 -0
- package/dist/domain/sui-schema.d.ts +12 -0
- package/dist/domain/sui-schema.d.ts.map +1 -0
- package/dist/domain/sui-schema.js +12 -0
- package/dist/domain/sui-schema.js.map +1 -0
- package/dist/extension.d.ts +7 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +7 -0
- package/dist/extension.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +18 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +18 -0
- package/dist/internal.js.map +1 -0
- package/dist/journal.d.ts +51 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +18 -0
- package/dist/journal.js.map +1 -0
- package/dist/script.d.ts +7 -0
- package/dist/script.d.ts.map +1 -0
- package/dist/script.js +7 -0
- package/dist/script.js.map +1 -0
- package/dist/services/Journal.d.ts +76 -0
- package/dist/services/Journal.d.ts.map +1 -0
- package/dist/services/Journal.js +70 -0
- package/dist/services/Journal.js.map +1 -0
- package/dist/services/JournalKeyValueStore.d.ts +73 -0
- package/dist/services/JournalKeyValueStore.d.ts.map +1 -0
- package/dist/services/JournalKeyValueStore.js +155 -0
- package/dist/services/JournalKeyValueStore.js.map +1 -0
- package/dist/services/Script.d.ts +210 -0
- package/dist/services/Script.d.ts.map +1 -0
- package/dist/services/Script.js +441 -0
- package/dist/services/Script.js.map +1 -0
- package/dist/services/Signer.d.ts +132 -0
- package/dist/services/Signer.d.ts.map +1 -0
- package/dist/services/Signer.js +158 -0
- package/dist/services/Signer.js.map +1 -0
- package/dist/services/SubmitConfig.d.ts +175 -0
- package/dist/services/SubmitConfig.d.ts.map +1 -0
- package/dist/services/SubmitConfig.js +52 -0
- package/dist/services/SubmitConfig.js.map +1 -0
- package/dist/services/Sui.d.ts +295 -0
- package/dist/services/Sui.d.ts.map +1 -0
- package/dist/services/Sui.js +414 -0
- package/dist/services/Sui.js.map +1 -0
- package/dist/services/SuiCore.d.ts +227 -0
- package/dist/services/SuiCore.d.ts.map +1 -0
- package/dist/services/SuiCore.js +400 -0
- package/dist/services/SuiCore.js.map +1 -0
- package/dist/services/SuiCoreFake.d.ts +278 -0
- package/dist/services/SuiCoreFake.d.ts.map +1 -0
- package/dist/services/SuiCoreFake.js +1003 -0
- package/dist/services/SuiCoreFake.js.map +1 -0
- package/dist/services/SuiExtension.d.ts +208 -0
- package/dist/services/SuiExtension.d.ts.map +1 -0
- package/dist/services/SuiExtension.js +355 -0
- package/dist/services/SuiExtension.js.map +1 -0
- package/dist/services/SuiGraphQL.d.ts +98 -0
- package/dist/services/SuiGraphQL.d.ts.map +1 -0
- package/dist/services/SuiGraphQL.js +118 -0
- package/dist/services/SuiGraphQL.js.map +1 -0
- package/dist/services/Tx.d.ts +687 -0
- package/dist/services/Tx.d.ts.map +1 -0
- package/dist/services/Tx.js +1224 -0
- package/dist/services/Tx.js.map +1 -0
- package/dist/testing.d.ts +88 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +163 -0
- package/dist/testing.js.map +1 -0
- package/dist/tx.d.ts +24 -0
- package/dist/tx.d.ts.map +1 -0
- package/dist/tx.js +24 -0
- package/dist/tx.js.map +1 -0
- package/docs/extensions.md +1685 -0
- package/examples/extension-template/README.md +170 -0
- package/examples/extension-template/package.json +44 -0
- package/examples/extension-template/scripts/check-package.ts +145 -0
- package/examples/extension-template/src/Escrow.ts +445 -0
- package/examples/extension-template/src/Platform.ts +136 -0
- package/examples/extension-template/src/errors.ts +61 -0
- package/examples/extension-template/src/extension.ts +63 -0
- package/examples/extension-template/src/index.ts +34 -0
- package/examples/extension-template/src/schema.ts +158 -0
- package/examples/extension-template/src/upstream.ts +66 -0
- package/examples/extension-template/test/escrow.test.ts +559 -0
- package/examples/extension-template/tsconfig.build.json +26 -0
- package/examples/extension-template/tsconfig.json +35 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuiCoreFake.js","sourceRoot":"","sources":["../../src/services/SuiCoreFake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAErC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEzE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACT,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OA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promise consumers
|
|
5
|
+
* — dapp-kit, third-party TypeScript, anything that has an SDK client and no
|
|
6
|
+
* Effect — reach the same implementation through `client.$extend(...)`, where
|
|
7
|
+
* every Effect member is a method returning a Promise and every Stream member
|
|
8
|
+
* is an `AsyncIterable`.
|
|
9
|
+
*
|
|
10
|
+
* This is the one place in `src/` that runs Effects: the `ManagedRuntime` here
|
|
11
|
+
* is the documented bridge between the Effect world and a Promise caller, and
|
|
12
|
+
* it is built lazily, on the first call rather than at registration, so that
|
|
13
|
+
* `$extend` stays synchronous and free.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
17
|
+
import type { ClientWithCoreApi, SuiClientRegistration } from "@mysten/sui/client";
|
|
18
|
+
import type { Context } from "effect";
|
|
19
|
+
import { Effect, Layer, Stream } from "effect";
|
|
20
|
+
import type { Sui, SuiLayerOptions } from "./Sui.ts";
|
|
21
|
+
import { SuiCore } from "./SuiCore.ts";
|
|
22
|
+
/**
|
|
23
|
+
* The Promise face of a service interface.
|
|
24
|
+
*
|
|
25
|
+
* An `Effect` member becomes a zero-argument method returning a Promise, a
|
|
26
|
+
* function returning an `Effect` keeps its arguments and returns a Promise, a
|
|
27
|
+
* `Stream` member becomes an `AsyncIterable`, a nested plain object of members
|
|
28
|
+
* is mapped the same way (platform SDKs namespace their surface as
|
|
29
|
+
* `client.miso.protocol.*`), and anything else passes through untouched.
|
|
30
|
+
*
|
|
31
|
+
* **A synchronous member stays synchronous**: a recipe builder
|
|
32
|
+
* `(p: Params) => Recipe` is still `(p: Params) => Recipe` here, and a plain
|
|
33
|
+
* value is still that value. The type says so and, once the runtime exists, the
|
|
34
|
+
* runtime agrees — see `warm` and `$ready` on {@link fromService} for the
|
|
35
|
+
* window before it does.
|
|
36
|
+
*
|
|
37
|
+
* **A class instance is a leaf.** The recursion is into plain object literals
|
|
38
|
+
* only, which is what the runtime maps; a `BcsType`, a `Schema.Class` instance,
|
|
39
|
+
* a `Date`, anything with a prototype of its own passes through whole, in the
|
|
40
|
+
* type and at runtime alike. (An interface or class type is not assignable to
|
|
41
|
+
* `Record<string, unknown>`, which is what keeps the two in step.)
|
|
42
|
+
*
|
|
43
|
+
* **A plain-object *value* member is the one place the two faces cannot agree.**
|
|
44
|
+
* `{ packageId: "0x…" }` is indistinguishable from a namespace of members, so
|
|
45
|
+
* the type maps it as a value while the **cold** runtime treats it as a
|
|
46
|
+
* namespace and hands back a placeholder for each key. Reading one throws
|
|
47
|
+
* `ExtensionNotReady` naming the path (`deployment.packageId`) rather than
|
|
48
|
+
* returning something the type says cannot be awaited — so the disagreement is
|
|
49
|
+
* typed and named, not silent — but the cure is `warm` or `$ready()`, not a
|
|
50
|
+
* retry. An extension that is registered lazily should expose such a value
|
|
51
|
+
* through an `Effect` member instead.
|
|
52
|
+
*/
|
|
53
|
+
export type PromiseFace<S> = {
|
|
54
|
+
readonly [K in keyof S]: S[K] extends Stream.Stream<infer A, infer _E, infer _R> ? AsyncIterable<A> : S[K] extends Effect.Effect<infer A, infer _E2, infer _R2> ? () => Promise<A> : S[K] extends (...args: infer Args) => Stream.Stream<infer A, infer _E3, infer _R3> ? (...args: Args) => AsyncIterable<A> : S[K] extends (...args: infer Args) => Effect.Effect<infer A, infer _E4, infer _R4> ? (...args: Args) => Promise<A> : S[K] extends Record<string, unknown> ? PromiseFace<S[K]> : S[K];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* What every registration carries besides the service's own members, under
|
|
58
|
+
* `$`-prefixed names so an extension is free to call a member `ready` or
|
|
59
|
+
* `dispose` itself.
|
|
60
|
+
*/
|
|
61
|
+
export interface ExtensionFace {
|
|
62
|
+
/**
|
|
63
|
+
* Builds the runtime and resolves the service, so every member afterwards is
|
|
64
|
+
* the real thing — synchronous members included.
|
|
65
|
+
*
|
|
66
|
+
* Call it once after `$extend` when the extension has synchronous members
|
|
67
|
+
* (recipe builders, ids, codecs) and the registration is not `warm`. It is
|
|
68
|
+
* idempotent and costs nothing after the first time.
|
|
69
|
+
*/
|
|
70
|
+
readonly $ready: () => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Releases everything the layer acquired and forgets the runtime. Not final:
|
|
73
|
+
* the next call builds a fresh one.
|
|
74
|
+
*/
|
|
75
|
+
readonly $dispose: () => Promise<void>;
|
|
76
|
+
/** The name `$dispose` had first. The same function. */
|
|
77
|
+
readonly dispose: () => Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
/** What `fromService` needs to know beyond the service key itself. */
|
|
80
|
+
export interface SuiExtensionOptions<Self, E, Name extends string = string> {
|
|
81
|
+
/**
|
|
82
|
+
* The property the extension takes on the client: `client.<name>`.
|
|
83
|
+
*
|
|
84
|
+
* It is inferred as a string **literal**, which is what makes
|
|
85
|
+
* `client.escrow` a property rather than an index signature. Widening it to
|
|
86
|
+
* `string` is why the registered member used to arrive as `T | undefined`
|
|
87
|
+
* under `noUncheckedIndexedAccess`.
|
|
88
|
+
*/
|
|
89
|
+
readonly name: Name;
|
|
90
|
+
/**
|
|
91
|
+
* The extension's layer.
|
|
92
|
+
*
|
|
93
|
+
* The bound is `Layer<Self, E, Sui | SuiCore>`: it may require either tier,
|
|
94
|
+
* because this module builds both over the client `$extend` was called on,
|
|
95
|
+
* and **nothing else**. An extension with a dependency of its own — an
|
|
96
|
+
* `HttpClient`, a `SuiGraphQL` — provides it inside this layer
|
|
97
|
+
* (`Layer.provide(SuiGraphQL.layerConfig)`) or in the function that builds
|
|
98
|
+
* the registration. The rule is not "requires `Sui` and nothing else"; it is
|
|
99
|
+
* "requires nothing the consumer's client could have provided".
|
|
100
|
+
*/
|
|
101
|
+
readonly layer: Layer.Layer<Self, E, Sui | SuiCore>;
|
|
102
|
+
/**
|
|
103
|
+
* Options for the `Sui` layer built under the extension's own.
|
|
104
|
+
*
|
|
105
|
+
* `sui.chainId` pins the chain identifier the node must report, overriding
|
|
106
|
+
* the built-in table for `mainnet` and `testnet` and asserting one where
|
|
107
|
+
* there is none — which is how an extension whose deployment names a custom
|
|
108
|
+
* network's `chainIdentifier` refuses to run against a different chain.
|
|
109
|
+
*/
|
|
110
|
+
readonly sui?: SuiLayerOptions;
|
|
111
|
+
/**
|
|
112
|
+
* Build the runtime **inside `register`**, synchronously, instead of on the
|
|
113
|
+
* first call.
|
|
114
|
+
*
|
|
115
|
+
* Give it when the extension has synchronous members — recipe builders, a
|
|
116
|
+
* package id, a codec — that a consumer expects to read the moment it
|
|
117
|
+
* registers. Every member is then the real thing immediately, and
|
|
118
|
+
* `$ready()` has nothing left to do.
|
|
119
|
+
*
|
|
120
|
+
* Two conditions, both enforced:
|
|
121
|
+
*
|
|
122
|
+
* - **The layer must not perform an asynchronous step.** A layer that reads
|
|
123
|
+
* the network, opens a connection or awaits anything cannot be built
|
|
124
|
+
* synchronously and `register` throws. This is the documented contract of
|
|
125
|
+
* `warm`, not an accident: an extension that needs the network at build is
|
|
126
|
+
* registered without it.
|
|
127
|
+
* - **The chain identifier is not read — not at registration, and not
|
|
128
|
+
* later.** `Sui` normally calls `getChainIdentifier` at layer build, which
|
|
129
|
+
* is a round trip. A warm registration takes `warm.chainId` (or
|
|
130
|
+
* `sui.chainId`, or the entry in the built-in table for `mainnet` and
|
|
131
|
+
* `testnet`) as the chain's identifier and asks nothing. **The node is
|
|
132
|
+
* consulted for the first time when the extension itself makes a call**,
|
|
133
|
+
* and that call does not check the identifier either: the pinned id is what
|
|
134
|
+
* `Sui.chainId` reports for the life of the registration. A node on another
|
|
135
|
+
* chain is therefore never detected here — it is detected by the chain,
|
|
136
|
+
* because `Tx.build` stamps that id on the expiration and a validator
|
|
137
|
+
* refuses bytes signed for another chain. Register lazily when the
|
|
138
|
+
* assertion is what you want. On `devnet`, `localnet` or a custom network
|
|
139
|
+
* there is no table entry, so `warm` without a `chainId` throws rather than
|
|
140
|
+
* guess.
|
|
141
|
+
*
|
|
142
|
+
* A **lazy** registration that joins a chain id another registration already
|
|
143
|
+
* pinned still performs its own `getChainIdentifier` assertion — once, shared
|
|
144
|
+
* across every lazy registration on that base — so mixing the two on one
|
|
145
|
+
* client neither loses the check nor duplicates it.
|
|
146
|
+
*/
|
|
147
|
+
readonly warm?: {
|
|
148
|
+
readonly chainId?: string;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Turns an Effect service into a `SuiClientRegistration` a Promise consumer
|
|
153
|
+
* passes to `client.$extend(...)`.
|
|
154
|
+
*
|
|
155
|
+
* `register(client)` does no work by default: the `ManagedRuntime` over
|
|
156
|
+
* `SuiCore.layerFromClient(client)`, a `Sui` for the client's effective chain
|
|
157
|
+
* id and the extension's own layer is built on the first call and shared by
|
|
158
|
+
* every call after it. The `Sui` and `SuiCore` underneath are shared with every
|
|
159
|
+
* other registration on that client that names the same chain id — one
|
|
160
|
+
* transport, one chain identity and one sender-lock map. A rejection carries
|
|
161
|
+
* the original tagged error instance, so a Promise consumer can still switch on
|
|
162
|
+
* `_tag`.
|
|
163
|
+
*
|
|
164
|
+
* `name` is generic in a string literal, so `client.escrow` is a property of
|
|
165
|
+
* the extended client's type and not an index lookup: no cast, and no
|
|
166
|
+
* `| undefined` under `noUncheckedIndexedAccess`.
|
|
167
|
+
*
|
|
168
|
+
* **The window before the runtime exists.** Until then nothing knows what a
|
|
169
|
+
* member *is*, so a member read off the face is a placeholder. An `Effect` or
|
|
170
|
+
* `Stream` member behaves exactly as its type says — the call returns a
|
|
171
|
+
* Promise, the iteration works — because that is what the face promises for
|
|
172
|
+
* them anyway. A **synchronous** member does not: `PromiseFace` types a recipe
|
|
173
|
+
* builder as returning a `Recipe` and a plain value as that value, and a
|
|
174
|
+
* placeholder has neither. So a synchronous member used in that window fails
|
|
175
|
+
* with `ExtensionNotReady` naming itself, rather than quietly handing back a
|
|
176
|
+
* Promise where the type says `Recipe` — which is a bug that only shows up on
|
|
177
|
+
* the *second* call, when the member has become real. Two cures:
|
|
178
|
+
*
|
|
179
|
+
* - `await client.<name>.$ready()` once after `$extend`, which builds the
|
|
180
|
+
* runtime and resolves the service; every member is real from then on;
|
|
181
|
+
* - register with `warm`, which does the same synchronously inside `register`,
|
|
182
|
+
* for a layer that needs no network.
|
|
183
|
+
*
|
|
184
|
+
* Two lifetimes worth knowing:
|
|
185
|
+
*
|
|
186
|
+
* - **`$dispose()` is not final.** It releases everything the layer acquired
|
|
187
|
+
* and forgets the runtime; the next call builds a fresh one. That is what a
|
|
188
|
+
* long-lived page wants (a disposed extension is usable again after a
|
|
189
|
+
* reconnect) and it does mean a `$dispose()` that races an in-flight call can
|
|
190
|
+
* leave the caller's Promise rejected while a new runtime starts behind it.
|
|
191
|
+
* Dispose when the consumer is done, not between calls. `dispose()` is the
|
|
192
|
+
* same function under the name it had first.
|
|
193
|
+
* - **Each `register` is independent.** Registering the same extension on two
|
|
194
|
+
* clients — or twice on one — gives two runtimes, two layer builds and two
|
|
195
|
+
* copies of whatever the layer holds (a cache, a connection). Register once
|
|
196
|
+
* per client and keep the extended client.
|
|
197
|
+
*
|
|
198
|
+
* Never fails, except a `warm` registration, which throws out of `register`
|
|
199
|
+
* when the layer needs an asynchronous step or when the network has no known
|
|
200
|
+
* chain identifier and none was given. Otherwise the layer's own failures
|
|
201
|
+
* surface as rejections of the first call that needs it.
|
|
202
|
+
*/
|
|
203
|
+
export declare const fromService: <Self, Shape, E, const Name extends string>(service: Context.Key<Self, Shape>, options: SuiExtensionOptions<Self, E, Name>) => SuiClientRegistration<ClientWithCoreApi, Name, PromiseFace<Shape> & ExtensionFace>;
|
|
204
|
+
/** The namespace the spec spells: `SuiExtension.fromService(...)`. */
|
|
205
|
+
export declare const SuiExtension: {
|
|
206
|
+
readonly fromService: <Self, Shape, E, const Name extends string>(service: Context.Key<Self, Shape>, options: SuiExtensionOptions<Self, E, Name>) => SuiClientRegistration<ClientWithCoreApi, Name, PromiseFace<Shape> & ExtensionFace>;
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=SuiExtension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AAG,CAAC,IAAI,EAAE,KAAK,CAAC,EACjC,SAAS,mBAAmB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,KAC1C,qBAAqB,CAAC,iBAAiB,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,aAAa,CAyOlF,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,YAAY;2BA/OG,IAAI,EAAE,KAAK,EAAE,CAAC,QAAQ,IAAI,SAAS,MAAM,WAC1D,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,WACxB,mBAAmB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,KAC1C,qBAAqB,CAAC,iBAAiB,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;CA4OjC,CAAA"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { Effect, Layer, ManagedRuntime, Stream } from "effect";
|
|
2
|
+
import { ExtensionNotReady, NetworkMismatch } from "../domain/errors.js";
|
|
3
|
+
import { KNOWN_CHAIN_IDS } from "../domain/schemas.js";
|
|
4
|
+
import { Sui as SuiService } from "./Sui.js";
|
|
5
|
+
import { SuiCore } from "./SuiCore.js";
|
|
6
|
+
/** The names the face adds to every service, which a member cannot shadow. */
|
|
7
|
+
const RESERVED = ["$ready", "$dispose", "dispose"];
|
|
8
|
+
const isEffect = (value) => typeof value === "object" && value !== null && Effect.isEffect(value);
|
|
9
|
+
const isStream = (value) => typeof value === "object" && value !== null && Stream.isStream(value);
|
|
10
|
+
const isPlainObject = (value) => typeof value === "object" && value !== null &&
|
|
11
|
+
(Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
12
|
+
/**
|
|
13
|
+
* Keyed by the client's `core`, not by the client.
|
|
14
|
+
*
|
|
15
|
+
* `client.$extend(a).$extend(b)` hands each `register` a **different** object:
|
|
16
|
+
* the SDK's `$extend` returns a `Proxy` of the client, and the next `$extend`
|
|
17
|
+
* proxies that. Those proxies are not equal as `WeakMap` keys, so keying by the
|
|
18
|
+
* client meant two chained registrations shared nothing. Every one of them
|
|
19
|
+
* reads through to the same `core` object, which is what "the same transport"
|
|
20
|
+
* means here anyway.
|
|
21
|
+
*/
|
|
22
|
+
const SHARED_BASES = new WeakMap();
|
|
23
|
+
const sharedBase = (client, key, build) => {
|
|
24
|
+
const identity = client.core;
|
|
25
|
+
let byKey = SHARED_BASES.get(identity);
|
|
26
|
+
if (byKey === undefined) {
|
|
27
|
+
byKey = new Map();
|
|
28
|
+
SHARED_BASES.set(identity, byKey);
|
|
29
|
+
}
|
|
30
|
+
const existing = byKey.get(key);
|
|
31
|
+
if (existing !== undefined)
|
|
32
|
+
return existing;
|
|
33
|
+
const raw = build();
|
|
34
|
+
// One memo map for this client and this key, shared by every registration:
|
|
35
|
+
// `Layer.effect` memoizes by layer identity, so building `raw` through it
|
|
36
|
+
// hands the second registration the `Sui` the first one built — one chain-id
|
|
37
|
+
// read, and one sender-lock map. The memo map is reference counted by Effect,
|
|
38
|
+
// so the base is released when the last registration that used it is disposed
|
|
39
|
+
// and rebuilt on the next call after that.
|
|
40
|
+
const memoMap = Layer.makeMemoMapUnsafe();
|
|
41
|
+
const entry = {
|
|
42
|
+
memoMap,
|
|
43
|
+
raw,
|
|
44
|
+
shared: Layer.fromBuild((_registrationMemo, scope) => Layer.buildWithMemoMap(raw, memoMap, scope))
|
|
45
|
+
};
|
|
46
|
+
byKey.set(key, entry);
|
|
47
|
+
return entry;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The chain-identifier check a **lazy** registration owes when it joins a base
|
|
51
|
+
* that was pinned rather than read.
|
|
52
|
+
*
|
|
53
|
+
* The shared base for a known chain id is `Sui.layerNoDepsPinned`, because a
|
|
54
|
+
* `warm` registration on that same id has to build it synchronously and cannot
|
|
55
|
+
* await a round trip. A lazy registration promises the opposite — that the node
|
|
56
|
+
* is asked once and a node on another chain fails the build — so it gets this
|
|
57
|
+
* alongside the base. It is one `Layer` value per shared base, built through the
|
|
58
|
+
* base's own memo map, so it runs **once** however many lazy registrations join.
|
|
59
|
+
*
|
|
60
|
+
* Fails with: `NetworkMismatch`, `TransportError`.
|
|
61
|
+
*/
|
|
62
|
+
const assertChainId = (expected) => Layer.effectDiscard(Effect.gen(function* () {
|
|
63
|
+
const core = yield* SuiCore;
|
|
64
|
+
const { chainIdentifier } = yield* core.getChainIdentifier();
|
|
65
|
+
if (chainIdentifier !== expected) {
|
|
66
|
+
return yield* new NetworkMismatch({ expected, actual: chainIdentifier });
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
/** The shared base with {@link assertChainId} attached, memoized on the entry. */
|
|
70
|
+
const assertedBase = (entry, chainId) => {
|
|
71
|
+
if (entry.asserted === undefined) {
|
|
72
|
+
const raw = Layer.merge(entry.raw, assertChainId(chainId).pipe(Layer.provide(entry.raw)));
|
|
73
|
+
entry.asserted = Layer.fromBuild((_registrationMemo, scope) => Layer.buildWithMemoMap(raw, entry.memoMap, scope));
|
|
74
|
+
}
|
|
75
|
+
return entry.asserted;
|
|
76
|
+
};
|
|
77
|
+
const mapMember = (value, bridge) => {
|
|
78
|
+
if (isStream(value))
|
|
79
|
+
return bridge.iterate(value);
|
|
80
|
+
if (isEffect(value))
|
|
81
|
+
return () => bridge.runPromise(value);
|
|
82
|
+
if (typeof value === "function") {
|
|
83
|
+
return (...args) => {
|
|
84
|
+
const result = value(...args);
|
|
85
|
+
if (isStream(result))
|
|
86
|
+
return bridge.iterate(result);
|
|
87
|
+
if (isEffect(result))
|
|
88
|
+
return bridge.runPromise(result);
|
|
89
|
+
return result;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (isPlainObject(value)) {
|
|
93
|
+
const mapped = {};
|
|
94
|
+
for (const [key, member] of Object.entries(value))
|
|
95
|
+
mapped[key] = mapMember(member, bridge);
|
|
96
|
+
return mapped;
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Turns an Effect service into a `SuiClientRegistration` a Promise consumer
|
|
102
|
+
* passes to `client.$extend(...)`.
|
|
103
|
+
*
|
|
104
|
+
* `register(client)` does no work by default: the `ManagedRuntime` over
|
|
105
|
+
* `SuiCore.layerFromClient(client)`, a `Sui` for the client's effective chain
|
|
106
|
+
* id and the extension's own layer is built on the first call and shared by
|
|
107
|
+
* every call after it. The `Sui` and `SuiCore` underneath are shared with every
|
|
108
|
+
* other registration on that client that names the same chain id — one
|
|
109
|
+
* transport, one chain identity and one sender-lock map. A rejection carries
|
|
110
|
+
* the original tagged error instance, so a Promise consumer can still switch on
|
|
111
|
+
* `_tag`.
|
|
112
|
+
*
|
|
113
|
+
* `name` is generic in a string literal, so `client.escrow` is a property of
|
|
114
|
+
* the extended client's type and not an index lookup: no cast, and no
|
|
115
|
+
* `| undefined` under `noUncheckedIndexedAccess`.
|
|
116
|
+
*
|
|
117
|
+
* **The window before the runtime exists.** Until then nothing knows what a
|
|
118
|
+
* member *is*, so a member read off the face is a placeholder. An `Effect` or
|
|
119
|
+
* `Stream` member behaves exactly as its type says — the call returns a
|
|
120
|
+
* Promise, the iteration works — because that is what the face promises for
|
|
121
|
+
* them anyway. A **synchronous** member does not: `PromiseFace` types a recipe
|
|
122
|
+
* builder as returning a `Recipe` and a plain value as that value, and a
|
|
123
|
+
* placeholder has neither. So a synchronous member used in that window fails
|
|
124
|
+
* with `ExtensionNotReady` naming itself, rather than quietly handing back a
|
|
125
|
+
* Promise where the type says `Recipe` — which is a bug that only shows up on
|
|
126
|
+
* the *second* call, when the member has become real. Two cures:
|
|
127
|
+
*
|
|
128
|
+
* - `await client.<name>.$ready()` once after `$extend`, which builds the
|
|
129
|
+
* runtime and resolves the service; every member is real from then on;
|
|
130
|
+
* - register with `warm`, which does the same synchronously inside `register`,
|
|
131
|
+
* for a layer that needs no network.
|
|
132
|
+
*
|
|
133
|
+
* Two lifetimes worth knowing:
|
|
134
|
+
*
|
|
135
|
+
* - **`$dispose()` is not final.** It releases everything the layer acquired
|
|
136
|
+
* and forgets the runtime; the next call builds a fresh one. That is what a
|
|
137
|
+
* long-lived page wants (a disposed extension is usable again after a
|
|
138
|
+
* reconnect) and it does mean a `$dispose()` that races an in-flight call can
|
|
139
|
+
* leave the caller's Promise rejected while a new runtime starts behind it.
|
|
140
|
+
* Dispose when the consumer is done, not between calls. `dispose()` is the
|
|
141
|
+
* same function under the name it had first.
|
|
142
|
+
* - **Each `register` is independent.** Registering the same extension on two
|
|
143
|
+
* clients — or twice on one — gives two runtimes, two layer builds and two
|
|
144
|
+
* copies of whatever the layer holds (a cache, a connection). Register once
|
|
145
|
+
* per client and keep the extended client.
|
|
146
|
+
*
|
|
147
|
+
* Never fails, except a `warm` registration, which throws out of `register`
|
|
148
|
+
* when the layer needs an asynchronous step or when the network has no known
|
|
149
|
+
* chain identifier and none was given. Otherwise the layer's own failures
|
|
150
|
+
* surface as rejections of the first call that needs it.
|
|
151
|
+
*/
|
|
152
|
+
export const fromService = (service, options) => ({
|
|
153
|
+
name: options.name,
|
|
154
|
+
register: (client) => {
|
|
155
|
+
let runtime;
|
|
156
|
+
let instance;
|
|
157
|
+
/**
|
|
158
|
+
* The chain identifier this registration knows before it asks anyone: the
|
|
159
|
+
* one `warm` names, the one `sui` pins, or the built-in entry for the
|
|
160
|
+
* client's network. `undefined` on `devnet`, `localnet` or a custom network
|
|
161
|
+
* with neither, which is the only case where the base is keyed by "read".
|
|
162
|
+
*/
|
|
163
|
+
const knownChainId = options.warm?.chainId ?? options.sui?.chainId ??
|
|
164
|
+
KNOWN_CHAIN_IDS[client.network];
|
|
165
|
+
/**
|
|
166
|
+
* The base every registration on this client and this chain shares.
|
|
167
|
+
*
|
|
168
|
+
* The key is the **effective chain id**, not the registration's own style,
|
|
169
|
+
* so a `warm` registration and a lazy one on the same chain get one `Sui`,
|
|
170
|
+
* one transport and — the reason this matters — one sender-lock map. When
|
|
171
|
+
* the id is known the base is pinned (a `warm` registration must build it
|
|
172
|
+
* synchronously and cannot await a round trip) and a lazy registration adds
|
|
173
|
+
* {@link assertChainId} on top, which asks the node once. Only a network
|
|
174
|
+
* with no known id at all falls back to a base that reads it.
|
|
175
|
+
*/
|
|
176
|
+
const baseEntry = () => sharedBase(client, knownChainId === undefined ? "read" : `chain:${knownChainId}`, () =>
|
|
177
|
+
// `Sui` and `SuiCore` over the very client `$extend` was called on, so
|
|
178
|
+
// the extension and the consumer share one transport, one chain-id
|
|
179
|
+
// check and one sender-lock map.
|
|
180
|
+
(knownChainId === undefined
|
|
181
|
+
? SuiService.layerNoDepsWith(options.sui ?? {})
|
|
182
|
+
: SuiService.layerNoDepsPinned(knownChainId)).pipe(Layer.provideMerge(SuiCore.layerFromClient(client))));
|
|
183
|
+
const baseOf = () => {
|
|
184
|
+
const entry = baseEntry();
|
|
185
|
+
return knownChainId === undefined ? entry.shared : assertedBase(entry, knownChainId);
|
|
186
|
+
};
|
|
187
|
+
const runtimeOf = () => {
|
|
188
|
+
if (runtime === undefined) {
|
|
189
|
+
runtime = ManagedRuntime.make(options.layer.pipe(Layer.provideMerge(baseOf())));
|
|
190
|
+
}
|
|
191
|
+
return runtime;
|
|
192
|
+
};
|
|
193
|
+
const bridge = {
|
|
194
|
+
runPromise: (effect) => runtimeOf().runPromise(effect),
|
|
195
|
+
iterate: (stream) => ({
|
|
196
|
+
async *[Symbol.asyncIterator]() {
|
|
197
|
+
const context = await runtimeOf().context();
|
|
198
|
+
yield* Stream.toAsyncIterableWith(stream, context);
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* The warm path: one synchronous build inside `register`.
|
|
204
|
+
*
|
|
205
|
+
* `ManagedRuntime.runSync` forces the layer and resolves the service in one
|
|
206
|
+
* go; a layer with an asynchronous step throws out of it, which is the
|
|
207
|
+
* documented contract. The chain identifier is taken, never read.
|
|
208
|
+
*/
|
|
209
|
+
const warmUp = (_warm) => {
|
|
210
|
+
if (knownChainId === undefined) {
|
|
211
|
+
throw new Error(`${options.name}: a warm registration on network "${client.network}" needs an explicit ` +
|
|
212
|
+
"chain id (warm: { chainId }), because there is no built-in identifier for it and a " +
|
|
213
|
+
"warm build never asks the node");
|
|
214
|
+
}
|
|
215
|
+
// The **pinned** base, not the asserted one: a warm build is synchronous
|
|
216
|
+
// and `getChainIdentifier` is a round trip. It is the same base object a
|
|
217
|
+
// lazy registration on this chain joins.
|
|
218
|
+
const base = baseEntry().shared;
|
|
219
|
+
const warmRuntime = ManagedRuntime.make(options.layer.pipe(Layer.provideMerge(base)));
|
|
220
|
+
runtime = warmRuntime;
|
|
221
|
+
instance = warmRuntime.runSync(service);
|
|
222
|
+
};
|
|
223
|
+
const resolve = async () => {
|
|
224
|
+
if (instance === undefined) {
|
|
225
|
+
instance = await runtimeOf().runPromise(service);
|
|
226
|
+
}
|
|
227
|
+
return instance;
|
|
228
|
+
};
|
|
229
|
+
const notReady = (member) => new ExtensionNotReady({
|
|
230
|
+
extension: options.name,
|
|
231
|
+
member: member.length === 0 ? "<the service>" : member.join(".")
|
|
232
|
+
});
|
|
233
|
+
const lazy = (path) => {
|
|
234
|
+
const at = async () => {
|
|
235
|
+
const resolved = await resolve();
|
|
236
|
+
let current = resolved;
|
|
237
|
+
for (const key of path)
|
|
238
|
+
current = current[key];
|
|
239
|
+
return current;
|
|
240
|
+
};
|
|
241
|
+
const node = (...args) => {
|
|
242
|
+
const settled = at().then((member) => {
|
|
243
|
+
const mapped = mapMember(member, bridge);
|
|
244
|
+
if (typeof mapped !== "function") {
|
|
245
|
+
// The member was a plain value, and the caller used it as a
|
|
246
|
+
// function because nothing knew what it was yet.
|
|
247
|
+
throw notReady(path);
|
|
248
|
+
}
|
|
249
|
+
const result = mapped(...args);
|
|
250
|
+
// A member that returns an `Effect` or a `Stream` is typed as
|
|
251
|
+
// Promise-returning or as an `AsyncIterable`, so answering with
|
|
252
|
+
// either is the truth. A member that returns anything else is typed
|
|
253
|
+
// as **synchronous**, and a Promise of its value is not the value:
|
|
254
|
+
// say so instead of handing back something the type says cannot be
|
|
255
|
+
// awaited.
|
|
256
|
+
if (result instanceof Promise)
|
|
257
|
+
return result;
|
|
258
|
+
if (typeof result === "object" && result !== null && Symbol.asyncIterator in result) {
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
throw notReady(path);
|
|
262
|
+
});
|
|
263
|
+
// Both faces at once, because until the runtime exists nothing knows
|
|
264
|
+
// which one this member has. `PromiseFace` types an `Effect`-returning
|
|
265
|
+
// method as `Promise` and a `Stream`-returning one as `AsyncIterable`;
|
|
266
|
+
// a bare Promise of an `AsyncIterable` satisfies neither `for await`
|
|
267
|
+
// nor the declared type, which is what a cold Stream call used to hand
|
|
268
|
+
// back. So the returned value is a thenable **and** an async iterable:
|
|
269
|
+
// awaited it is the Promise, iterated it awaits the runtime and then
|
|
270
|
+
// delegates to the real stream.
|
|
271
|
+
return {
|
|
272
|
+
then: (onFulfilled, onRejected) => settled.then(onFulfilled, onRejected),
|
|
273
|
+
catch: (onRejected) => settled.catch(onRejected),
|
|
274
|
+
finally: (onFinally) => settled.finally(onFinally),
|
|
275
|
+
[Symbol.asyncIterator]: async function* () {
|
|
276
|
+
const value = await settled;
|
|
277
|
+
if (typeof value !== "object" || value === null || !(Symbol.asyncIterator in value)) {
|
|
278
|
+
throw notReady(path);
|
|
279
|
+
}
|
|
280
|
+
yield* value;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
// Every synchronous use of a placeholder — a plain value read as a
|
|
285
|
+
// string, a number, a JSON payload — lands on one of these, and each one
|
|
286
|
+
// says the same thing: the runtime does not exist yet.
|
|
287
|
+
const guard = () => {
|
|
288
|
+
throw notReady(path);
|
|
289
|
+
};
|
|
290
|
+
return new Proxy(node, {
|
|
291
|
+
get: (target, key) => {
|
|
292
|
+
if (key === Symbol.asyncIterator) {
|
|
293
|
+
return async function* () {
|
|
294
|
+
const member = await at();
|
|
295
|
+
const mapped = mapMember(member, bridge);
|
|
296
|
+
yield* mapped;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
// Every synchronous use lands on one of these: a coercion, a
|
|
300
|
+
// `JSON.stringify`, or an `await` of what the type says is a value.
|
|
301
|
+
if (key === Symbol.toPrimitive || key === "toJSON" || key === "valueOf" ||
|
|
302
|
+
key === "then") {
|
|
303
|
+
return guard();
|
|
304
|
+
}
|
|
305
|
+
if (typeof key !== "string")
|
|
306
|
+
return Reflect.get(target, key);
|
|
307
|
+
return lazy([...path, key]);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
const ready = async () => {
|
|
312
|
+
await resolve();
|
|
313
|
+
};
|
|
314
|
+
const dispose = async () => {
|
|
315
|
+
if (runtime !== undefined)
|
|
316
|
+
await runtime.dispose();
|
|
317
|
+
runtime = undefined;
|
|
318
|
+
instance = undefined;
|
|
319
|
+
};
|
|
320
|
+
if (options.warm !== undefined)
|
|
321
|
+
warmUp(options.warm);
|
|
322
|
+
const own = (key) => {
|
|
323
|
+
if (key === "$ready")
|
|
324
|
+
return ready;
|
|
325
|
+
if (key === "$dispose" || key === "dispose")
|
|
326
|
+
return dispose;
|
|
327
|
+
return undefined;
|
|
328
|
+
};
|
|
329
|
+
return new Proxy({}, {
|
|
330
|
+
get: (_target, key) => {
|
|
331
|
+
if (typeof key !== "string")
|
|
332
|
+
return undefined;
|
|
333
|
+
const reserved = own(key);
|
|
334
|
+
if (reserved !== undefined)
|
|
335
|
+
return reserved;
|
|
336
|
+
if (instance !== undefined) {
|
|
337
|
+
const member = instance[key];
|
|
338
|
+
return member === undefined ? undefined : mapMember(member, bridge);
|
|
339
|
+
}
|
|
340
|
+
return lazy([key]);
|
|
341
|
+
},
|
|
342
|
+
has: (_target, key) => key === "$ready" || key === "$dispose" || key === "dispose" ||
|
|
343
|
+
(instance !== undefined && typeof key === "string" && key in instance),
|
|
344
|
+
ownKeys: () => instance === undefined
|
|
345
|
+
? [...RESERVED]
|
|
346
|
+
// A `Proxy` refuses duplicate keys, so a service member that happens
|
|
347
|
+
// to be called `dispose` must not be listed twice.
|
|
348
|
+
: [...new Set([...Object.keys(instance), ...RESERVED])],
|
|
349
|
+
getOwnPropertyDescriptor: () => ({ configurable: true, enumerable: true })
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
/** The namespace the spec spells: `SuiExtension.fromService(...)`. */
|
|
354
|
+
export const SuiExtension = { fromService };
|
|
355
|
+
//# sourceMappingURL=SuiExtension.js.map
|