@mysten/walrus 1.0.3 → 1.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/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { MAINNET_WALRUS_PACKAGE_CONFIG, TESTNET_WALRUS_PACKAGE_CONFIG, statusLifecycleRank } from "./constants.mjs";
1
+ import { MAINNET_WALRUS_PACKAGE_CONFIG, SLIVER_STATUS_CHECK_THRESHOLD, TESTNET_WALRUS_PACKAGE_CONFIG, statusLifecycleRank } from "./constants.mjs";
2
2
  import { Storage } from "./contracts/walrus/storage_resource.mjs";
3
3
  import { Blob, addMetadata, insertOrUpdateMetadataPair, removeMetadataPair } from "./contracts/walrus/blob.mjs";
4
4
  import { Metadata, _new } from "./contracts/walrus/metadata.mjs";
@@ -8,7 +8,7 @@ import { Staking } from "./contracts/walrus/staking.mjs";
8
8
  import { SystemStateInnerV1 } from "./contracts/walrus/system_state_inner.mjs";
9
9
  import { System, certifyBlob, deleteBlob, extendBlob, registerBlob, reserveSpace } from "./contracts/walrus/system.mjs";
10
10
  import { BehindCurrentEpochError, BlobBlockedError, BlobNotCertifiedError, InconsistentBlobError, NoBlobMetadataReceivedError, NoBlobStatusReceivedError, NoVerifiedBlobStatusReceivedError, NotEnoughBlobConfirmationsError, NotEnoughSliversReceivedError, RetryableWalrusClientError, WalrusClientError } from "./error.mjs";
11
- import { IntentType, StorageConfirmation, blobIdToInt } from "./utils/bcs.mjs";
11
+ import { IntentType, StorageConfirmation, blobIdToInt, parseCertificateFromBase64 } from "./utils/bcs.mjs";
12
12
  import { BlobNotRegisteredError, LegallyUnavailableError, NotFoundError, UserAbortError } from "./storage-node/error.mjs";
13
13
  import { StorageNodeClient } from "./storage-node/client.mjs";
14
14
  import { encodedBlobLength, getShardIndicesByNodeId, getSourceSymbols, isAboveValidity, isQuorum, signersToBitmap, sliverPairIndexFromSecondarySliverIndex, storageUnitsFromSize, toPairIndex, toShardIndex } from "./utils/index.mjs";
@@ -23,6 +23,8 @@ import { BlobReader } from "./files/readers/blob.mjs";
23
23
  import { WalrusFile } from "./files/file.mjs";
24
24
  import { WalrusBlob } from "./files/blob.mjs";
25
25
  import { retry } from "./utils/retry.mjs";
26
+ import { createWriteBlobFlow } from "./flows/write-blob.mjs";
27
+ import { createWriteFilesFlow } from "./flows/write-files.mjs";
26
28
  import { bcs } from "@mysten/bcs";
27
29
  import { Transaction, coinWithBalance } from "@mysten/sui/transactions";
28
30
  import { normalizeStructTag, parseStructTag } from "@mysten/sui/utils";
@@ -155,13 +157,13 @@ var WalrusClient = class {
155
157
  if (bindings.computeMetadata(systemState.committee.n_shards, blobBytes).blobId !== blobId) throw new InconsistentBlobError("The specified blob was encoded incorrectly.");
156
158
  return blobBytes;
157
159
  }
158
- async computeBlobMetadata({ bytes, numShards }) {
160
+ async computeBlobMetadata({ bytes, numShards, nonce: providedNonce }) {
159
161
  let shardCount;
160
162
  if (typeof numShards === "number") shardCount = numShards;
161
163
  else shardCount = (await this.systemState()).committee.n_shards;
162
164
  const { blobId, rootHash, unencodedLength, encodingType } = (await this.#wasmBindings()).computeMetadata(shardCount, bytes);
163
165
  let sha256Hash;
164
- const nonce = crypto.getRandomValues(new Uint8Array(32));
166
+ const nonce = providedNonce ?? crypto.getRandomValues(new Uint8Array(32));
165
167
  return {
166
168
  rootHash,
167
169
  blobId,
@@ -679,7 +681,7 @@ var WalrusClient = class {
679
681
  certifyBlob({ blobId, blobObjectId, confirmations, certificate, deletable }) {
680
682
  return async (tx) => {
681
683
  const systemState = await this.systemState();
682
- const combinedSignature = certificate ?? await this.certificateFromConfirmations({
684
+ const combinedSignature = (typeof certificate === "string" ? parseCertificateFromBase64(certificate) : certificate) ?? await this.certificateFromConfirmations({
683
685
  confirmations,
684
686
  blobId,
685
687
  deletable,
@@ -986,6 +988,43 @@ var WalrusClient = class {
986
988
  }))?.success?.data?.signed ?? null;
987
989
  }
988
990
  /**
991
+ * Get storage confirmations from all active committee nodes for a blob.
992
+ *
993
+ * @example
994
+ * ```ts
995
+ * const confirmations = await client.getStorageConfirmations({
996
+ * blobId: savedState.blobId,
997
+ * deletable: true,
998
+ * objectId: savedState.blobObjectId,
999
+ * });
1000
+ * const tx = client.certifyBlobTransaction({ blobId, blobObjectId, confirmations, deletable: true });
1001
+ * ```
1002
+ */
1003
+ async getStorageConfirmations({ blobId, deletable, objectId, signal }) {
1004
+ const committee = await this.#getActiveCommittee();
1005
+ return Promise.all(committee.nodes.map((_, nodeIndex) => this.getStorageConfirmationFromNode({
1006
+ nodeIndex,
1007
+ blobId,
1008
+ ...deletable ? {
1009
+ deletable: true,
1010
+ objectId
1011
+ } : { deletable: false },
1012
+ signal
1013
+ }).catch(() => null)));
1014
+ }
1015
+ /**
1016
+ * Load a parsed Blob object from chain by its Sui object ID.
1017
+ *
1018
+ * @example
1019
+ * ```ts
1020
+ * const blobObject = await client.getBlobObject('0x...');
1021
+ * console.log(blobObject.id, blobObject.blob_id);
1022
+ * ```
1023
+ */
1024
+ async getBlobObject(blobObjectId) {
1025
+ return this.#objectLoader.load(blobObjectId, Blob);
1026
+ }
1027
+ /**
989
1028
  * Encode a blob into slivers for each node
990
1029
  *
991
1030
  * @example
@@ -1123,13 +1162,28 @@ var WalrusClient = class {
1123
1162
  * ```
1124
1163
  */
1125
1164
  async writeEncodedBlobToNode({ nodeIndex, blobId, metadata, slivers, signal, ...options }) {
1126
- await this.writeMetadataToNode({
1165
+ const node = (await this.#getActiveCommittee()).nodes[nodeIndex];
1166
+ let metaDataExists = false;
1167
+ try {
1168
+ const metadataStatus = await this.#storageNodeClient.getMetadataStatus({ blobId }, {
1169
+ nodeUrl: node.networkUrl,
1170
+ signal
1171
+ });
1172
+ if (metadataStatus === "Stored" || metadataStatus === "Buffered") metaDataExists = true;
1173
+ } catch {}
1174
+ if (!metaDataExists) await this.writeMetadataToNode({
1127
1175
  nodeIndex,
1128
1176
  blobId,
1129
1177
  metadata,
1130
1178
  signal
1131
1179
  });
1132
- await this.writeSliversToNode({
1180
+ if (!metaDataExists) await this.writeSliversToNode({
1181
+ blobId,
1182
+ slivers,
1183
+ signal,
1184
+ nodeIndex
1185
+ });
1186
+ else await this.#writeSliversWithStatusCheck({
1133
1187
  blobId,
1134
1188
  slivers,
1135
1189
  signal,
@@ -1141,6 +1195,41 @@ var WalrusClient = class {
1141
1195
  ...options
1142
1196
  });
1143
1197
  }
1198
+ async #writeSliversWithStatusCheck({ blobId, slivers, signal, nodeIndex }) {
1199
+ const node = (await this.#getActiveCommittee()).nodes[nodeIndex];
1200
+ const controller = new AbortController();
1201
+ const combinedSignal = signal ? AbortSignal.any([controller.signal, signal]) : controller.signal;
1202
+ const sliverWrites = [...slivers.primary.map((s) => ({
1203
+ ...s,
1204
+ sliverType: "primary"
1205
+ })), ...slivers.secondary.map((s) => ({
1206
+ ...s,
1207
+ sliverType: "secondary"
1208
+ }))].map(async ({ sliverPairIndex, sliver, sliverType }) => {
1209
+ if (sliver.byteLength >= SLIVER_STATUS_CHECK_THRESHOLD) try {
1210
+ const status = await this.#storageNodeClient.getSliverStatus({
1211
+ blobId,
1212
+ sliverPairIndex,
1213
+ sliverType
1214
+ }, {
1215
+ nodeUrl: node.networkUrl,
1216
+ signal: combinedSignal
1217
+ });
1218
+ if (status === "Stored" || status === "Buffered") return;
1219
+ } catch {}
1220
+ return this.writeSliver({
1221
+ blobId,
1222
+ sliverPairIndex,
1223
+ sliverType,
1224
+ sliver,
1225
+ signal: combinedSignal
1226
+ });
1227
+ });
1228
+ await Promise.all(sliverWrites).catch((error) => {
1229
+ controller.abort(error);
1230
+ throw error;
1231
+ });
1232
+ }
1144
1233
  /**
1145
1234
  * Write a blob to all storage nodes
1146
1235
  *
@@ -1149,84 +1238,24 @@ var WalrusClient = class {
1149
1238
  * const { blobId, blobObject } = await client.writeBlob({ blob, deletable, epochs, signer });
1150
1239
  * ```
1151
1240
  */
1152
- async writeBlob({ blob, deletable, epochs, signer, signal, owner, attributes }) {
1153
- if (!this.#uploadRelayConfig) {
1154
- const encoded = await this.encodeBlob(blob);
1155
- const blobId = encoded.blobId;
1156
- const { sliversByNode, metadata, rootHash } = encoded;
1157
- const blobObjectId = (await this.executeRegisterBlobTransaction({
1158
- signer,
1159
- size: blob.length,
1160
- epochs,
1161
- blobId,
1162
- rootHash,
1163
- deletable,
1164
- owner: owner ?? signer.toSuiAddress(),
1165
- attributes
1166
- })).blob.id;
1167
- const confirmations = await this.writeEncodedBlobToNodes({
1168
- blobId,
1169
- metadata,
1170
- sliversByNode,
1171
- deletable,
1172
- objectId: blobObjectId,
1173
- signal
1174
- });
1175
- await this.executeCertifyBlobTransaction({
1176
- signer,
1177
- blobId,
1178
- blobObjectId,
1179
- confirmations,
1180
- deletable
1181
- });
1182
- return {
1183
- blobId,
1184
- blobObject: await this.#objectLoader.load(blobObjectId, Blob)
1185
- };
1186
- } else {
1187
- const metadata = await this.computeBlobMetadata({ bytes: blob });
1188
- const blobId = metadata.blobId;
1189
- const transaction = new Transaction();
1190
- transaction.add(this.sendUploadRelayTip({
1191
- size: blob.length,
1192
- blobDigest: metadata.blobDigest,
1193
- nonce: metadata.nonce
1194
- }));
1195
- const registerResult = await this.executeRegisterBlobTransaction({
1196
- signer,
1197
- transaction,
1198
- size: blob.length,
1199
- epochs,
1200
- blobId: metadata.blobId,
1201
- rootHash: metadata.rootHash,
1202
- deletable,
1203
- owner: owner ?? signer.toSuiAddress(),
1204
- attributes
1205
- });
1206
- await this.#suiClient.core.waitForTransaction({ digest: registerResult.digest });
1207
- const certificate = (await this.writeBlobToUploadRelay({
1208
- blobId,
1209
- blob,
1210
- nonce: metadata.nonce,
1211
- txDigest: registerResult.digest,
1212
- signal,
1213
- deletable,
1214
- blobObjectId: registerResult.blob.id,
1215
- encodingType: metadata.metadata.encodingType
1216
- })).certificate;
1217
- const blobObjectId = registerResult.blob.id;
1218
- await this.executeCertifyBlobTransaction({
1219
- signer,
1220
- blobId,
1221
- blobObjectId,
1222
- certificate,
1223
- deletable
1224
- });
1225
- return {
1226
- blobId,
1227
- blobObject: await this.#objectLoader.load(blobObjectId, Blob)
1228
- };
1229
- }
1241
+ async writeBlob({ blob, deletable, epochs, signer, owner, attributes, onStep, resume, signal }) {
1242
+ const flow = this.writeBlobFlow({
1243
+ blob,
1244
+ resume
1245
+ });
1246
+ for await (const step of flow.run({
1247
+ signer,
1248
+ epochs,
1249
+ deletable,
1250
+ owner: owner ?? signer.toSuiAddress(),
1251
+ attributes,
1252
+ signal
1253
+ })) await onStep?.(step);
1254
+ const result = await flow.getBlob();
1255
+ return {
1256
+ blobId: result.blobId,
1257
+ blobObject: result.blobObject
1258
+ };
1230
1259
  }
1231
1260
  async writeQuilt({ blobs, ...options }) {
1232
1261
  const encoded = await this.encodeQuilt({ blobs });
@@ -1370,270 +1399,73 @@ var WalrusClient = class {
1370
1399
  }) });
1371
1400
  });
1372
1401
  }
1373
- async writeFiles({ files, ...options }) {
1374
- const { blobId, index, blobObject } = await this.writeQuilt({
1375
- ...options,
1376
- blobs: await Promise.all(files.map(async (file, i) => ({
1377
- contents: await file.bytes(),
1378
- identifier: await file.getIdentifier() ?? `file-${i}`,
1379
- tags: await file.getTags() ?? {}
1380
- })))
1402
+ async writeFiles({ files, onStep, resume, ...options }) {
1403
+ const flow = this.writeFilesFlow({
1404
+ files,
1405
+ resume
1381
1406
  });
1382
- return index.patches.map((patch) => ({
1383
- id: patch.patchId,
1384
- blobId,
1385
- blobObject
1386
- }));
1407
+ for await (const step of flow.run({
1408
+ signer: options.signer,
1409
+ epochs: options.epochs,
1410
+ deletable: options.deletable,
1411
+ owner: options.owner ?? options.signer.toSuiAddress(),
1412
+ attributes: options.attributes
1413
+ })) await onStep?.(step);
1414
+ return flow.listFiles();
1387
1415
  }
1388
- writeFilesFlow({ files }) {
1389
- const encode = async () => {
1390
- const { quilt, index } = await this.encodeQuilt({ blobs: await Promise.all(files.map(async (file, i) => ({
1391
- contents: await file.bytes(),
1392
- identifier: await file.getIdentifier() ?? `file-${i}`,
1393
- tags: await file.getTags() ?? {}
1394
- }))) });
1395
- return {
1396
- metadata: this.#uploadRelayClient ? await this.computeBlobMetadata({ bytes: quilt }) : await this.encodeBlob(quilt),
1397
- size: quilt.length,
1398
- data: this.#uploadRelayClient ? quilt : void 0,
1399
- index
1400
- };
1401
- };
1402
- const register = ({ data, metadata, index, size }, { epochs, deletable, owner, attributes }) => {
1403
- const transaction = new Transaction();
1404
- transaction.setSenderIfNotSet(owner);
1405
- if (this.#uploadRelayClient) {
1406
- const meta = metadata;
1407
- transaction.add(this.sendUploadRelayTip({
1408
- size,
1409
- blobDigest: meta.blobDigest,
1410
- nonce: meta.nonce
1411
- }));
1412
- }
1413
- transaction.transferObjects([this.registerBlob({
1414
- size,
1415
- epochs,
1416
- blobId: metadata.blobId,
1417
- rootHash: metadata.rootHash,
1418
- deletable,
1419
- attributes: {
1420
- _walrusBlobType: "quilt",
1421
- ...attributes
1422
- }
1423
- })], owner);
1424
- return {
1425
- registerTransaction: transaction,
1426
- index,
1427
- data,
1428
- metadata,
1429
- deletable
1430
- };
1431
- };
1432
- const upload = async ({ index, data, metadata, deletable }, { digest }) => {
1433
- const blobObject = await this.#getCreatedBlob(digest);
1434
- if (this.#uploadRelayClient) {
1435
- const meta$1 = metadata;
1436
- return {
1437
- index,
1438
- blobObject,
1439
- metadata,
1440
- deletable,
1441
- certificate: (await this.writeBlobToUploadRelay({
1442
- blobId: metadata.blobId,
1443
- blob: data,
1444
- nonce: meta$1.nonce,
1445
- txDigest: digest,
1446
- blobObjectId: blobObject.id,
1447
- deletable,
1448
- encodingType: meta$1.metadata.encodingType
1449
- })).certificate
1450
- };
1451
- }
1452
- const meta = metadata;
1453
- return {
1454
- index,
1455
- blobObject,
1456
- metadata,
1457
- deletable,
1458
- confirmations: await this.writeEncodedBlobToNodes({
1459
- blobId: metadata.blobId,
1460
- objectId: blobObject.id,
1461
- metadata: meta.metadata,
1462
- sliversByNode: meta.sliversByNode,
1463
- deletable
1464
- })
1465
- };
1466
- };
1467
- const certify = ({ index, metadata, confirmations, certificate, blobObject, deletable }) => {
1468
- return {
1469
- index,
1470
- blobObject,
1471
- metadata,
1472
- transaction: confirmations ? this.certifyBlobTransaction({
1473
- blobId: metadata.blobId,
1474
- blobObjectId: blobObject.id,
1475
- confirmations,
1476
- deletable
1477
- }) : this.certifyBlobTransaction({
1478
- certificate,
1479
- blobId: metadata.blobId,
1480
- blobObjectId: blobObject.id,
1481
- deletable
1482
- })
1483
- };
1484
- };
1485
- async function listFiles({ index, blobObject, metadata }) {
1486
- return index.patches.map((patch) => ({
1487
- id: encodeQuiltPatchId({
1488
- quiltId: metadata.blobId,
1489
- patchId: {
1490
- version: 1,
1491
- startIndex: patch.startIndex,
1492
- endIndex: patch.endIndex
1493
- }
1494
- }),
1495
- blobId: metadata.blobId,
1496
- blobObject
1497
- }));
1498
- }
1499
- const stepResults = {};
1500
- function getResults(step, current) {
1501
- if (!stepResults[step]) throw new Error(`${step} must be executed before calling ${current}`);
1502
- return stepResults[step];
1503
- }
1504
- return {
1505
- encode: async () => {
1506
- if (!stepResults.encode) stepResults.encode = await encode();
1507
- },
1508
- register: (options) => {
1509
- stepResults.register = register(getResults("encode", "register"), options);
1510
- return stepResults.register.registerTransaction;
1511
- },
1512
- upload: async (options) => {
1513
- stepResults.upload = await upload(getResults("register", "upload"), options);
1514
- },
1515
- certify: () => {
1516
- stepResults.certify = certify(getResults("upload", "certify"));
1517
- return stepResults.certify.transaction;
1518
- },
1519
- listFiles: async () => {
1520
- return listFiles(getResults("certify", "listFiles"));
1521
- }
1522
- };
1416
+ /**
1417
+ * Create a step-by-step files upload flow with resume support.
1418
+ *
1419
+ * Encodes files into a quilt blob and delegates to `writeBlobFlow()` internally.
1420
+ * Supports the same resume, step methods, and `run()` async iterator as `writeBlobFlow()`.
1421
+ *
1422
+ * @example
1423
+ * ```ts
1424
+ * const flow = client.writeFilesFlow({ files });
1425
+ * for await (const step of flow.run({ signer, epochs: 3, deletable: true })) {
1426
+ * await db.save(fileId, step);
1427
+ * }
1428
+ * const fileRefs = await flow.listFiles();
1429
+ * ```
1430
+ */
1431
+ writeFilesFlow(options) {
1432
+ return createWriteFilesFlow(this, options);
1523
1433
  }
1524
- writeBlobFlow({ blob }) {
1525
- const encode = async () => {
1526
- return {
1527
- metadata: this.#uploadRelayClient ? await this.computeBlobMetadata({ bytes: blob }) : await this.encodeBlob(blob),
1528
- size: blob.length,
1529
- data: this.#uploadRelayClient ? blob : void 0
1530
- };
1531
- };
1532
- const register = ({ data, metadata, size }, { epochs, deletable, owner, attributes }) => {
1533
- const transaction = new Transaction();
1534
- transaction.setSenderIfNotSet(owner);
1535
- if (this.#uploadRelayClient) {
1536
- const meta = metadata;
1537
- transaction.add(this.sendUploadRelayTip({
1538
- size,
1539
- blobDigest: meta.blobDigest,
1540
- nonce: meta.nonce
1541
- }));
1542
- }
1543
- transaction.transferObjects([this.registerBlob({
1544
- size,
1545
- epochs,
1546
- blobId: metadata.blobId,
1547
- rootHash: metadata.rootHash,
1548
- deletable,
1549
- attributes
1550
- })], owner);
1551
- return {
1552
- registerTransaction: transaction,
1553
- data,
1554
- metadata,
1555
- deletable
1556
- };
1557
- };
1558
- const upload = async ({ data, metadata, deletable }, { digest }) => {
1559
- const blobObject = await this.#getCreatedBlob(digest);
1560
- if (this.#uploadRelayClient) {
1561
- const meta$1 = metadata;
1562
- return {
1563
- blobObject,
1564
- metadata,
1565
- deletable,
1566
- certificate: (await this.writeBlobToUploadRelay({
1567
- blobId: metadata.blobId,
1568
- blob: data,
1569
- nonce: meta$1.nonce,
1570
- txDigest: digest,
1571
- blobObjectId: blobObject.id,
1572
- deletable,
1573
- encodingType: meta$1.metadata.encodingType
1574
- })).certificate
1575
- };
1576
- }
1577
- const meta = metadata;
1578
- return {
1579
- blobObject,
1580
- metadata,
1581
- deletable,
1582
- confirmations: await this.writeEncodedBlobToNodes({
1583
- blobId: metadata.blobId,
1584
- objectId: blobObject.id,
1585
- metadata: meta.metadata,
1586
- sliversByNode: meta.sliversByNode,
1587
- deletable
1588
- })
1589
- };
1590
- };
1591
- const certify = ({ metadata, confirmations, certificate, blobObject, deletable }) => {
1592
- return {
1593
- blobObject,
1594
- metadata,
1595
- transaction: confirmations ? this.certifyBlobTransaction({
1596
- blobId: metadata.blobId,
1597
- blobObjectId: blobObject.id,
1598
- confirmations,
1599
- deletable
1600
- }) : this.certifyBlobTransaction({
1601
- certificate,
1602
- blobId: metadata.blobId,
1603
- blobObjectId: blobObject.id,
1604
- deletable
1605
- })
1606
- };
1607
- };
1608
- async function getBlob({ blobObject, metadata }) {
1609
- return {
1610
- blobId: metadata.blobId,
1611
- blobObject
1612
- };
1613
- }
1614
- const stepResults = {};
1615
- function getResults(step, current) {
1616
- if (!stepResults[step]) throw new Error(`${step} must be executed before calling ${current}`);
1617
- return stepResults[step];
1618
- }
1434
+ /**
1435
+ * Create a step-by-step blob upload flow with resume support.
1436
+ *
1437
+ * Returns an object with individual step methods (`encode`, `register`, `upload`, `certify`)
1438
+ * for manual control, convenience methods (`executeRegister`, `executeCertify`) that handle
1439
+ * signing, and a `run()` async iterator that executes the full pipeline.
1440
+ *
1441
+ * Each step returns a `WriteBlobStep` result that can be persisted and passed as `resume`
1442
+ * to recover from crashes.
1443
+ *
1444
+ * @example
1445
+ * ```ts
1446
+ * // Async iterator with checkpoints:
1447
+ * const flow = client.writeBlobFlow({ blob });
1448
+ * for await (const step of flow.run({ signer, epochs: 3, deletable: true })) {
1449
+ * await db.save(fileId, step);
1450
+ * }
1451
+ *
1452
+ * // Resume from saved state:
1453
+ * const saved = await db.load(fileId);
1454
+ * const flow = client.writeBlobFlow({ blob, resume: saved });
1455
+ * for await (const step of flow.run({ signer, epochs: 3, deletable: true })) {
1456
+ * await db.save(fileId, step);
1457
+ * }
1458
+ * ```
1459
+ */
1460
+ writeBlobFlow(options) {
1461
+ return createWriteBlobFlow(this, this.#flowContext(), options);
1462
+ }
1463
+ #flowContext() {
1619
1464
  return {
1620
- encode: async () => {
1621
- if (!stepResults.encode) stepResults.encode = await encode();
1622
- },
1623
- register: (options) => {
1624
- stepResults.register = register(getResults("encode", "register"), options);
1625
- return stepResults.register.registerTransaction;
1626
- },
1627
- upload: async (options) => {
1628
- stepResults.upload = await upload(getResults("register", "upload"), options);
1629
- },
1630
- certify: () => {
1631
- stepResults.certify = certify(getResults("upload", "certify"));
1632
- return stepResults.certify.transaction;
1633
- },
1634
- getBlob: async () => {
1635
- return getBlob(getResults("certify", "getBlob"));
1636
- }
1465
+ hasUploadRelay: () => !!this.#uploadRelayClient,
1466
+ executeTransaction: (transaction, signer, action) => this.#executeTransaction(transaction, signer, action),
1467
+ getCreatedBlob: (digest) => this.#getCreatedBlob(digest),
1468
+ loadBlobObject: (objectId) => this.#objectLoader.load(objectId, Blob)
1637
1469
  };
1638
1470
  }
1639
1471
  };