@unconfirmed/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 +147 -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,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Sui`: the opinionated tier.
|
|
3
|
+
*
|
|
4
|
+
* Where `SuiCore` mirrors the SDK, `Sui` makes the decisions: fixed include
|
|
5
|
+
* sets, decoded BCS content, `Option` instead of not-found errors where a
|
|
6
|
+
* caller can act on absence, chunked and integrity-checked batch reads, streams
|
|
7
|
+
* for pagination, and one sender lock so gas selection cannot race itself.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { BcsType } from "@mysten/bcs";
|
|
12
|
+
import type { SuiClientTypes } from "@mysten/sui/client";
|
|
13
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
14
|
+
import { Config, Context, DateTime, Effect, Layer, Option, Result, Schema, Stream } from "effect";
|
|
15
|
+
import { BuildError, DecodeError, ExecutionFailed, NetworkMismatch, ObjectDeleted, ObjectNotFound, ObjectUnavailable, SimulationFailed, TransactionNotFound, TransportError } from "../domain/errors.ts";
|
|
16
|
+
import { Executed } from "../domain/executed.ts";
|
|
17
|
+
import { Balance, CoinType, Digest, DynamicField, DynamicFieldEntry, DynamicFieldName, ObjectId, Simulation, StructTag, SuiAddress, type SuiObject } from "../domain/schemas.ts";
|
|
18
|
+
import type { SuiGrpcLayerOptions } from "./SuiCore.ts";
|
|
19
|
+
import { SuiCore } from "./SuiCore.ts";
|
|
20
|
+
/** A synchronous transaction draft. Reads happen before it, so it stays replayable. */
|
|
21
|
+
export type Recipe = (tx: Transaction) => void;
|
|
22
|
+
/** The include set every object read asks for. */
|
|
23
|
+
export declare const OBJECT_INCLUDE: {
|
|
24
|
+
readonly content: true;
|
|
25
|
+
};
|
|
26
|
+
/** The include set every simulation asks for. */
|
|
27
|
+
export declare const SIMULATE_INCLUDE: {
|
|
28
|
+
readonly commandResults: true;
|
|
29
|
+
readonly effects: true;
|
|
30
|
+
readonly events: true;
|
|
31
|
+
readonly balanceChanges: true;
|
|
32
|
+
readonly objectTypes: true;
|
|
33
|
+
};
|
|
34
|
+
/** What can go wrong reading one object with a schema. */
|
|
35
|
+
export type GetObjectError = ObjectNotFound | ObjectDeleted | ObjectUnavailable | DecodeError | TransportError;
|
|
36
|
+
/** What can go wrong decoding one object of a batch read. */
|
|
37
|
+
export type BatchItemError = ObjectNotFound | ObjectDeleted | ObjectUnavailable | DecodeError;
|
|
38
|
+
/** The opinionated tier over `SuiCore`. */
|
|
39
|
+
export interface SuiService {
|
|
40
|
+
/** The network the underlying client was built for. */
|
|
41
|
+
readonly network: SuiClientTypes.Network;
|
|
42
|
+
/**
|
|
43
|
+
* The mechanical tier this `Sui` was built over.
|
|
44
|
+
*
|
|
45
|
+
* `Sui` is the tier application code reads through, but writing a
|
|
46
|
+
* transaction needs `executeTransaction` and the SDK client object behind
|
|
47
|
+
* `use`, neither of which belongs on the opinionated tier. Exposing the core
|
|
48
|
+
* here is what lets every `Tx.*` function declare `R = Sui` and nothing
|
|
49
|
+
* else. Reach for it directly only for a field or method `Sui` does not
|
|
50
|
+
* expose.
|
|
51
|
+
*/
|
|
52
|
+
readonly core: SuiCore["Service"];
|
|
53
|
+
/** The genesis checkpoint digest of the chain, read once at layer build. */
|
|
54
|
+
readonly chainId: string;
|
|
55
|
+
/**
|
|
56
|
+
* The chain's own clock, read from the Clock object `0x6` through the BCS
|
|
57
|
+
* bridge and never cached.
|
|
58
|
+
*
|
|
59
|
+
* Fails with: `TransportError`.
|
|
60
|
+
*/
|
|
61
|
+
readonly chainTime: Effect.Effect<DateTime.Utc, TransportError>;
|
|
62
|
+
/**
|
|
63
|
+
* Reads one object, decoding its BCS content with `opts.schema` when given.
|
|
64
|
+
*
|
|
65
|
+
* The object's type tag is checked before the bytes are parsed: against
|
|
66
|
+
* `opts.expectedType` when given, otherwise against the type
|
|
67
|
+
* `SuiSchema.bcs` recorded on the codec. This member and the two below are
|
|
68
|
+
* written as overloads, not `Effect.fn`, because `Effect.fn` cannot express
|
|
69
|
+
* an overload set; the implementations are `Effect.fn` and carry the span.
|
|
70
|
+
*
|
|
71
|
+
* Fails with: `ObjectNotFound`, `ObjectDeleted`, `ObjectUnavailable`,
|
|
72
|
+
* `DecodeError`, `TransportError`.
|
|
73
|
+
*/
|
|
74
|
+
readonly getObject: {
|
|
75
|
+
<S>(id: ObjectId, opts: {
|
|
76
|
+
readonly schema: Schema.Codec<S, Uint8Array>;
|
|
77
|
+
readonly expectedType?: string;
|
|
78
|
+
}): Effect.Effect<SuiObject<S>, GetObjectError>;
|
|
79
|
+
(id: ObjectId, opts?: {
|
|
80
|
+
readonly schema?: undefined;
|
|
81
|
+
readonly expectedType?: string;
|
|
82
|
+
}): Effect.Effect<SuiObject<Uint8Array>, GetObjectError>;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Like `getObject`, but a missing or deleted object is `None` rather than a
|
|
86
|
+
* failure.
|
|
87
|
+
*
|
|
88
|
+
* Fails with: `ObjectUnavailable`, `DecodeError`, `TransportError`.
|
|
89
|
+
*/
|
|
90
|
+
readonly getObjectOption: {
|
|
91
|
+
<S>(id: ObjectId, opts: {
|
|
92
|
+
readonly schema: Schema.Codec<S, Uint8Array>;
|
|
93
|
+
readonly expectedType?: string;
|
|
94
|
+
}): Effect.Effect<Option.Option<SuiObject<S>>, ObjectUnavailable | DecodeError | TransportError>;
|
|
95
|
+
(id: ObjectId, opts?: {
|
|
96
|
+
readonly schema?: undefined;
|
|
97
|
+
readonly expectedType?: string;
|
|
98
|
+
}): Effect.Effect<Option.Option<SuiObject<Uint8Array>>, ObjectUnavailable | DecodeError | TransportError>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Reads many objects, chunked by 50, checking that the node answered for
|
|
102
|
+
* each requested id exactly once. Ids are normalized and deduplicated before
|
|
103
|
+
* the request, so asking twice for the same object is legal and returns the
|
|
104
|
+
* same `Result` twice. Per-object failures are `Result` values.
|
|
105
|
+
*
|
|
106
|
+
* Fails with: `TransportError`.
|
|
107
|
+
*/
|
|
108
|
+
readonly getObjects: {
|
|
109
|
+
<S>(ids: ReadonlyArray<ObjectId>, opts: {
|
|
110
|
+
readonly schema: Schema.Codec<S, Uint8Array>;
|
|
111
|
+
readonly expectedType?: string;
|
|
112
|
+
}): Effect.Effect<ReadonlyArray<Result.Result<SuiObject<S>, BatchItemError>>, TransportError>;
|
|
113
|
+
(ids: ReadonlyArray<ObjectId>, opts?: {
|
|
114
|
+
readonly schema?: undefined;
|
|
115
|
+
readonly expectedType?: string;
|
|
116
|
+
}): Effect.Effect<ReadonlyArray<Result.Result<SuiObject<Uint8Array>, BatchItemError>>, TransportError>;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* `getObjects` for a caller who wants the first per-item failure to fail the
|
|
120
|
+
* whole read.
|
|
121
|
+
*
|
|
122
|
+
* The soft idiom — filter or default the `Result` array `getObjects` returns
|
|
123
|
+
* — is right when a missing object is ordinary. This is the hard one: every
|
|
124
|
+
* id must be there, and the first that is not is the failure. Order is the
|
|
125
|
+
* order of `ids`.
|
|
126
|
+
*
|
|
127
|
+
* Fails with: `ObjectNotFound`, `ObjectDeleted`, `ObjectUnavailable`,
|
|
128
|
+
* `DecodeError`, `TransportError`.
|
|
129
|
+
*/
|
|
130
|
+
readonly getObjectsOrFail: {
|
|
131
|
+
<S>(ids: ReadonlyArray<ObjectId>, opts: {
|
|
132
|
+
readonly schema: Schema.Codec<S, Uint8Array>;
|
|
133
|
+
readonly expectedType?: string;
|
|
134
|
+
}): Effect.Effect<ReadonlyArray<SuiObject<S>>, BatchItemError | TransportError>;
|
|
135
|
+
(ids: ReadonlyArray<ObjectId>, opts?: {
|
|
136
|
+
readonly schema?: undefined;
|
|
137
|
+
readonly expectedType?: string;
|
|
138
|
+
}): Effect.Effect<ReadonlyArray<SuiObject<Uint8Array>>, BatchItemError | TransportError>;
|
|
139
|
+
};
|
|
140
|
+
/** The balance of one coin type for one owner. Fails with: `TransportError`. */
|
|
141
|
+
readonly getBalance: (owner: SuiAddress, coinType?: CoinType) => Effect.Effect<Balance, TransportError>;
|
|
142
|
+
/**
|
|
143
|
+
* Reads one dynamic field; absence is `None`.
|
|
144
|
+
*
|
|
145
|
+
* Fails with: `TransportError`.
|
|
146
|
+
*/
|
|
147
|
+
readonly getDynamicFieldOption: (parent: ObjectId, name: DynamicFieldName) => Effect.Effect<Option.Option<DynamicField>, TransportError>;
|
|
148
|
+
/**
|
|
149
|
+
* Reads an executed transaction. A historical transaction that failed on
|
|
150
|
+
* chain fails here too, so there is one representation of an on-chain failure.
|
|
151
|
+
*
|
|
152
|
+
* Fails with: `ExecutionFailed`, `TransactionNotFound`, `TransportError`.
|
|
153
|
+
*/
|
|
154
|
+
readonly getTransaction: (digest: Digest) => Effect.Effect<Executed, ExecutionFailed | TransactionNotFound | TransportError>;
|
|
155
|
+
/**
|
|
156
|
+
* Simulates a transaction with the fixed simulate include set.
|
|
157
|
+
*
|
|
158
|
+
* `opts.sender` is set on the transaction when the recipe did not set one.
|
|
159
|
+
* A simulation needs *a* sender: the SDK substitutes the zero address when
|
|
160
|
+
* the transaction carries none, which is what a read-only simulation of a
|
|
161
|
+
* public function wants and is what happens here when `sender` is omitted. A
|
|
162
|
+
* recipe may `tx.setSender(...)` itself, and then it wins. Bytes that are
|
|
163
|
+
* already serialized carry their own sender and `opts.sender` does not apply.
|
|
164
|
+
*
|
|
165
|
+
* Fails with: `SimulationFailed`, `BuildError`, `TransportError`.
|
|
166
|
+
*/
|
|
167
|
+
readonly simulate: (input: Recipe | Transaction | Uint8Array, opts?: {
|
|
168
|
+
readonly sender?: SuiAddress;
|
|
169
|
+
}) => Effect.Effect<Simulation, SimulationFailed | BuildError | TransportError>;
|
|
170
|
+
/**
|
|
171
|
+
* Reads a Move return value without executing: simulates with checks disabled
|
|
172
|
+
* and decodes return value `result` (default 0) of command `command`
|
|
173
|
+
* (default the last command).
|
|
174
|
+
*
|
|
175
|
+
* The codec may be a bare `@mysten/bcs` `BcsType` — `bcs.Address()`,
|
|
176
|
+
* `bcs.vector(bcs.u64())` — because a Move **return value** has no struct tag
|
|
177
|
+
* to check it against. A `SuiSchema.bcs` codec works too, and so does one
|
|
178
|
+
* composed with `Schema.decodeTo(DomainClass, …)`; no type tag is compared
|
|
179
|
+
* either way.
|
|
180
|
+
*
|
|
181
|
+
* `opts.sender` is the address the call is simulated as, defaulting to the
|
|
182
|
+
* zero address the way the SDK does; a recipe that sets its own sender wins.
|
|
183
|
+
*
|
|
184
|
+
* Fails with: `SimulationFailed`, `BuildError`, `DecodeError`, `TransportError`.
|
|
185
|
+
*/
|
|
186
|
+
readonly view: <S, I>(recipe: Recipe, schema: Schema.Codec<S, Uint8Array> | BcsType<S, I>, opts?: {
|
|
187
|
+
readonly command?: number;
|
|
188
|
+
readonly result?: number;
|
|
189
|
+
readonly sender?: SuiAddress;
|
|
190
|
+
}) => Effect.Effect<S, SimulationFailed | BuildError | DecodeError | TransportError>;
|
|
191
|
+
/** Every object an address owns, paginated. Fails with: `TransportError`. */
|
|
192
|
+
readonly streamOwnedObjects: (owner: SuiAddress, opts?: {
|
|
193
|
+
readonly type?: StructTag;
|
|
194
|
+
}) => Stream.Stream<SuiObject<Uint8Array>, TransportError>;
|
|
195
|
+
/**
|
|
196
|
+
* Every dynamic field of a parent, paginated.
|
|
197
|
+
*
|
|
198
|
+
* There is no key filter: the node has none, so a caller filters the stream
|
|
199
|
+
* on `entry.name.type`. Do that with `SuiSchema.matchesType`, not with the
|
|
200
|
+
* SDK's `normalizeStructTag` — a dynamic-field key is legally a primitive
|
|
201
|
+
* (`u64`, `bool`, `address`, `vector<u8>`) and `normalizeStructTag` throws on
|
|
202
|
+
* every one of them, which turns the first such key in a parent's fields into
|
|
203
|
+
* a defect. The value bytes are decoded with `SuiSchema.decode`, passing
|
|
204
|
+
* `actualType: entry.valueType` so the same tag check `Sui.getObject` does
|
|
205
|
+
* runs before a byte is parsed.
|
|
206
|
+
*
|
|
207
|
+
* Fails with: `TransportError`.
|
|
208
|
+
*/
|
|
209
|
+
readonly streamDynamicFields: (parent: ObjectId) => Stream.Stream<DynamicFieldEntry, TransportError>;
|
|
210
|
+
/**
|
|
211
|
+
* Serializes work for one sender, so two transactions from the same address
|
|
212
|
+
* cannot pick the same gas coin. Adds no failures of its own.
|
|
213
|
+
*/
|
|
214
|
+
readonly withSenderLock: (address: SuiAddress) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
215
|
+
}
|
|
216
|
+
/** Options for {@link Sui.layerNoDepsWith}. */
|
|
217
|
+
export interface SuiLayerOptions {
|
|
218
|
+
/**
|
|
219
|
+
* The chain identifier this program expects, as `getChainIdentifier` returns
|
|
220
|
+
* it. When set, a layer over a node on another chain fails to build, and it
|
|
221
|
+
* overrides the {@link KNOWN_CHAIN_IDS} entry for the client's network.
|
|
222
|
+
*
|
|
223
|
+
* Leave it unset for `mainnet` and `testnet`: their chain identifiers are in
|
|
224
|
+
* the table and are asserted by default. `devnet`, `localnet` and any custom
|
|
225
|
+
* network are regenerated, so set this when the program must pin one.
|
|
226
|
+
*/
|
|
227
|
+
readonly chainId?: string;
|
|
228
|
+
}
|
|
229
|
+
declare const Sui_base: Context.ServiceClass<Sui, "@unconfirmed/sui-effect/Sui", SuiService>;
|
|
230
|
+
/**
|
|
231
|
+
* The opinionated tier.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* import { Effect } from "effect"
|
|
236
|
+
* import { Sui } from "@unconfirmed/sui-effect"
|
|
237
|
+
*
|
|
238
|
+
* const time = Effect.gen(function*() {
|
|
239
|
+
* const sui = yield* Sui
|
|
240
|
+
* return yield* sui.chainTime
|
|
241
|
+
* })
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
export declare class Sui extends Sui_base {
|
|
245
|
+
/**
|
|
246
|
+
* Like {@link layerNoDeps}, but refuses to build when the node reports a
|
|
247
|
+
* different chain identifier than `options.chainId`, whatever the network.
|
|
248
|
+
*
|
|
249
|
+
* Fails with: `NetworkMismatch`, `TransportError`.
|
|
250
|
+
*/
|
|
251
|
+
static readonly layerNoDepsWith: (options: SuiLayerOptions) => Layer.Layer<Sui, NetworkMismatch | TransportError, SuiCore>;
|
|
252
|
+
/**
|
|
253
|
+
* `Sui` over whatever `SuiCore` is provided, **without reading the chain
|
|
254
|
+
* identifier**: the one given is taken as the chain's.
|
|
255
|
+
*
|
|
256
|
+
* This exists for one caller: `SuiExtension.fromService` with `warm`, which
|
|
257
|
+
* builds its runtime synchronously inside `register` and therefore cannot
|
|
258
|
+
* await a `getChainIdentifier` round trip. Nothing is asserted, because
|
|
259
|
+
* nothing is asked — a node on another chain is not detected here. What still
|
|
260
|
+
* protects a warm registration is the chain itself: `Tx.build` stamps this id
|
|
261
|
+
* on the transaction's `ValidDuring` expiration, and a validator refuses
|
|
262
|
+
* bytes signed for another chain.
|
|
263
|
+
*
|
|
264
|
+
* Prefer {@link layerNoDeps}, which asks. Never fails.
|
|
265
|
+
*/
|
|
266
|
+
static readonly layerNoDepsPinned: (chainId: string) => Layer.Layer<Sui, never, SuiCore>;
|
|
267
|
+
/**
|
|
268
|
+
* Builds `Sui` over whatever `SuiCore` is provided, reading the chain
|
|
269
|
+
* identifier once.
|
|
270
|
+
*
|
|
271
|
+
* When the client's network is one of the entries in {@link KNOWN_CHAIN_IDS}
|
|
272
|
+
* (`mainnet`, `testnet`) the identifier the node reports must match it, so a
|
|
273
|
+
* program pointed at the wrong node fails at layer build rather than reading
|
|
274
|
+
* the wrong chain. `devnet`, `localnet` and custom networks have no fixed
|
|
275
|
+
* identifier: the observed one is recorded on `Sui.chainId` and nothing is
|
|
276
|
+
* asserted unless {@link layerNoDepsWith} is given a `chainId`.
|
|
277
|
+
*
|
|
278
|
+
* Fails with: `NetworkMismatch`, `TransportError`.
|
|
279
|
+
*/
|
|
280
|
+
static readonly layerNoDeps: Layer.Layer<Sui, NetworkMismatch | TransportError, SuiCore>;
|
|
281
|
+
/**
|
|
282
|
+
* `layerNoDeps` over a gRPC `SuiCore`.
|
|
283
|
+
*
|
|
284
|
+
* Fails with: `NetworkMismatch`, `TransportError`.
|
|
285
|
+
*/
|
|
286
|
+
static readonly layer: (options: SuiGrpcLayerOptions & SuiLayerOptions) => Layer.Layer<Sui, NetworkMismatch | TransportError>;
|
|
287
|
+
/**
|
|
288
|
+
* `layerNoDeps` over `SuiCore.layerConfig`.
|
|
289
|
+
*
|
|
290
|
+
* Fails with: `ConfigError`, `NetworkMismatch`, `TransportError`.
|
|
291
|
+
*/
|
|
292
|
+
static readonly layerConfig: Layer.Layer<Sui, Config.ConfigError | NetworkMismatch | TransportError>;
|
|
293
|
+
}
|
|
294
|
+
export {};
|
|
295
|
+
//# sourceMappingURL=Sui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sui.d.ts","sourceRoot":"","sources":["../../src/services/Sui.ts"],"names":[],"mappings":"AAAA;;;;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