@mysten/walrus 1.1.0 → 1.1.1
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/CHANGELOG.md +6 -0
- package/dist/client.d.mts +6 -10
- package/dist/client.d.mts.map +1 -1
- package/dist/constants.d.mts.map +1 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/contracts/walrus/blob.d.mts.map +1 -1
- package/dist/contracts/walrus/storage_node.d.mts.map +1 -1
- package/dist/error.d.mts.map +1 -1
- package/dist/files/blob.d.mts.map +1 -1
- package/dist/files/file.d.mts.map +1 -1
- package/dist/files/readers/blob.d.mts.map +1 -1
- package/dist/files/readers/quilt-file.d.mts +0 -1
- package/dist/files/readers/quilt-file.d.mts.map +1 -1
- package/dist/files/readers/quilt.d.mts.map +1 -1
- package/dist/storage-node/client.d.mts.map +1 -1
- package/dist/storage-node/error.d.mts.map +1 -1
- package/dist/storage-node/types.d.mts.map +1 -1
- package/dist/storage-node/utils.d.mts.map +1 -1
- package/dist/types.d.mts +4 -9
- package/dist/types.d.mts.map +1 -1
- package/dist/upload-relay/client.d.mts.map +1 -1
- package/dist/utils/bcs.d.mts +1 -2
- package/dist/utils/bcs.d.mts.map +1 -1
- package/dist/utils/quilts.d.mts +0 -1
- package/dist/utils/quilts.d.mts.map +1 -1
- package/docs/index.md +130 -137
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
package/dist/client.d.mts
CHANGED
|
@@ -232,8 +232,7 @@ declare class WalrusClient {
|
|
|
232
232
|
epochs,
|
|
233
233
|
owner
|
|
234
234
|
}: StorageWithSizeOptions & {
|
|
235
|
-
transaction?: Transaction;
|
|
236
|
-
/** Address the storage resource should be transferred to */
|
|
235
|
+
transaction?: Transaction; /** Address the storage resource should be transferred to */
|
|
237
236
|
owner: string;
|
|
238
237
|
}): Transaction;
|
|
239
238
|
/**
|
|
@@ -309,8 +308,7 @@ declare class WalrusClient {
|
|
|
309
308
|
transaction,
|
|
310
309
|
...options
|
|
311
310
|
}: RegisterBlobOptions & {
|
|
312
|
-
transaction?: Transaction;
|
|
313
|
-
/** Address the blob should be transferred to */
|
|
311
|
+
transaction?: Transaction; /** Address the blob should be transferred to */
|
|
314
312
|
owner: string;
|
|
315
313
|
}): Transaction;
|
|
316
314
|
/**
|
|
@@ -326,8 +324,7 @@ declare class WalrusClient {
|
|
|
326
324
|
...options
|
|
327
325
|
}: RegisterBlobOptions & {
|
|
328
326
|
transaction?: Transaction;
|
|
329
|
-
signer: Signer;
|
|
330
|
-
/** Address the blob should be transferred to */
|
|
327
|
+
signer: Signer; /** Address the blob should be transferred to */
|
|
331
328
|
owner?: string;
|
|
332
329
|
}): Promise<{
|
|
333
330
|
blob: (typeof Blob)['$inferType'];
|
|
@@ -412,8 +409,7 @@ declare class WalrusClient {
|
|
|
412
409
|
blobObjectId,
|
|
413
410
|
transaction
|
|
414
411
|
}: DeleteBlobOptions & {
|
|
415
|
-
transaction?: Transaction;
|
|
416
|
-
/** Address the storage resource should be returned to */
|
|
412
|
+
transaction?: Transaction; /** Address the storage resource should be returned to */
|
|
417
413
|
owner: string;
|
|
418
414
|
}): Transaction;
|
|
419
415
|
/**
|
|
@@ -765,7 +761,7 @@ declare class WalrusClient {
|
|
|
765
761
|
patchId: string;
|
|
766
762
|
endIndex: number;
|
|
767
763
|
identifier: string;
|
|
768
|
-
tags:
|
|
764
|
+
tags: Map<string, string> | Record<string, string>;
|
|
769
765
|
startIndex: number;
|
|
770
766
|
}[];
|
|
771
767
|
};
|
|
@@ -800,7 +796,7 @@ declare class WalrusClient {
|
|
|
800
796
|
patches: ({
|
|
801
797
|
endIndex: number;
|
|
802
798
|
identifier: string;
|
|
803
|
-
tags:
|
|
799
|
+
tags: Map<string, string> | Record<string, string>;
|
|
804
800
|
} & {
|
|
805
801
|
startIndex: number;
|
|
806
802
|
})[];
|
package/dist/client.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|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,WAAA,CAAA;IACL;EAAA;IAEA,KAAA;MACC,QAAA,EAAU,UAAA;MACV,UAAA;MACA,IAAA,GAAO,MAAA;IAAA;EAAA,IAER,OAAA;;;;;;;;;;;;EAhgCA;;;;;;;;EAylCD,KAAA,CAAA;EAmBM,OAAA,CAAA;IAAU;EAAA;IAAY,MAAA;EAAA,IAAgB,OAAA,CAAA,UAAA;EAWtC,QAAA,CAAA;IAAW;EAAA;IAAS,GAAA;EAAA,IAAe,OAAA,CAAA,UAAA;EA+CnC,UAAA,CAAA;IAAa,KAAA;IAAO,MAAA;IAAQ,MAAA;IAAA,GAAW;EAAA,GAAW,iBAAA,GAAiB,OAAA;;;wBAl4D3B,IAAA;EAAA;EA2vB/B;;;;;;;;;;;;;;;EAqqCf,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,cAAA;EAphChD;;;;;;;;;;;;;;;;;;;;;;;;;;EAkjCA,aAAA,CAAc,OAAA,EAAS,oBAAA,GAAuB,aAAA;AAAA"}
|
package/dist/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"
|
|
1
|
+
{"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"mappings":";;;cAMa,6BAAA;;;;;cAWA,6BAAA;EAGkB,cAAA;EAAA,aAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/contracts/utils/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/contracts/utils/index.ts"],"mappings":";;;;;UAkBiB,UAAA,iBACA,IAAA,CAAK,cAAA,CAAe,aAAA,2BAC3B,cAAA,CAAe,gBAAA,CAAiB,OAAA;EACzC,MAAA,EAAQ,iBAAA;AAAA;AAAA,UAGQ,cAAA,iBACA,IAAA,CAAK,cAAA,CAAe,aAAA,2BAC3B,cAAA,CAAe,iBAAA,CAAkB,OAAA;EAC1C,MAAA,EAAQ,iBAAA;AAAA;AAAA,cAwII,UAAA,WACF,MAAA,SAAe,OAAA,oDAEhB,SAAA,CAAU,CAAA,EAAG,IAAA;EAChB,GAAA,iBAAoB,IAAA,CAAK,cAAA,CAAe,aAAA,2BAAA,CAAA;IAC7C,QAAA;IAAA,GACG;EAAA,GACD,UAAA,CAAW,OAAA,IAAW,OAAA,CACxB,cAAA,CAAe,MAAA,CAAO,OAAA;IAAY,OAAA;IAAe,IAAA;EAAA;IAChD,IAAA,EAAM,SAAA,CAAU,CAAA;EAAA;EAWZ,OAAA,iBAAwB,IAAA,CAAK,cAAA,CAAe,aAAA,2BAAA,CAAA;IACjD,MAAA;IAAA,GACG;EAAA,GACD,cAAA,CAAe,OAAA,IAAW,OAAA,CAC5B,KAAA,CACC,cAAA,CAAe,MAAA,CAAO,OAAA;IAAY,OAAA;IAAe,IAAA;EAAA;IAChD,IAAA,EAAM,SAAA,CAAU,CAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["val"],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["val"],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\ttype BcsType,\n\ttype TypeTag,\n\tTypeTagSerializer,\n\tBcsStruct,\n\tBcsEnum,\n\tBcsTuple,\n} from '@mysten/sui/bcs';\nimport { normalizeSuiAddress } from '@mysten/sui/utils';\nimport { type TransactionArgument, isArgument } from '@mysten/sui/transactions';\nimport { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';\n\nconst MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');\nconst SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');\n\nexport type RawTransactionArgument<T> = T | TransactionArgument;\n\nexport interface GetOptions<\n\tInclude extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {},\n> extends SuiClientTypes.GetObjectOptions<Include> {\n\tclient: ClientWithCoreApi;\n}\n\nexport interface GetManyOptions<\n\tInclude extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {},\n> extends SuiClientTypes.GetObjectsOptions<Include> {\n\tclient: ClientWithCoreApi;\n}\n\nexport function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {\n\tconst parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;\n\n\tif ('u8' in parsedTag) {\n\t\treturn bcs.U8;\n\t} else if ('u16' in parsedTag) {\n\t\treturn bcs.U16;\n\t} else if ('u32' in parsedTag) {\n\t\treturn bcs.U32;\n\t} else if ('u64' in parsedTag) {\n\t\treturn bcs.U64;\n\t} else if ('u128' in parsedTag) {\n\t\treturn bcs.U128;\n\t} else if ('u256' in parsedTag) {\n\t\treturn bcs.U256;\n\t} else if ('address' in parsedTag) {\n\t\treturn bcs.Address;\n\t} else if ('bool' in parsedTag) {\n\t\treturn bcs.Bool;\n\t} else if ('vector' in parsedTag) {\n\t\tconst type = getPureBcsSchema(parsedTag.vector);\n\t\treturn type ? bcs.vector(type) : null;\n\t} else if ('struct' in parsedTag) {\n\t\tconst structTag = parsedTag.struct;\n\t\tconst pkg = normalizeSuiAddress(structTag.address);\n\n\t\tif (pkg === MOVE_STDLIB_ADDRESS) {\n\t\t\tif (\n\t\t\t\t(structTag.module === 'ascii' || structTag.module === 'string') &&\n\t\t\t\tstructTag.name === 'String'\n\t\t\t) {\n\t\t\t\treturn bcs.String;\n\t\t\t}\n\n\t\t\tif (structTag.module === 'option' && structTag.name === 'Option') {\n\t\t\t\tconst type = getPureBcsSchema(structTag.typeParams[0]);\n\t\t\t\treturn type ? bcs.option(type) : null;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tpkg === SUI_FRAMEWORK_ADDRESS &&\n\t\t\tstructTag.module === 'object' &&\n\t\t\t(structTag.name === 'ID' || structTag.name === 'UID')\n\t\t) {\n\t\t\treturn bcs.Address;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function normalizeMoveArguments(\n\targs: unknown[] | object,\n\targTypes: readonly (string | null)[],\n\tparameterNames?: string[],\n) {\n\tconst argLen = Array.isArray(args) ? args.length : Object.keys(args).length;\n\tif (parameterNames && argLen !== parameterNames.length) {\n\t\tthrow new Error(\n\t\t\t`Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,\n\t\t);\n\t}\n\n\tconst normalizedArgs: TransactionArgument[] = [];\n\n\tlet index = 0;\n\tfor (const [i, argType] of argTypes.entries()) {\n\t\tif (argType === '0x2::clock::Clock') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.clock());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::random::Random') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.random());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::deny_list::DenyList') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.denyList());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x3::sui_system::SuiSystemState') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.system());\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet arg;\n\t\tif (Array.isArray(args)) {\n\t\t\tif (index >= args.length) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\targ = args[index];\n\t\t} else {\n\t\t\tif (!parameterNames) {\n\t\t\t\tthrow new Error(`Expected arguments to be passed as an array`);\n\t\t\t}\n\t\t\tconst name = parameterNames[index];\n\t\t\targ = args[name as keyof typeof args];\n\n\t\t\tif (arg === undefined) {\n\t\t\t\tthrow new Error(`Parameter ${name} is required`);\n\t\t\t}\n\t\t}\n\n\t\tindex += 1;\n\n\t\tif (typeof arg === 'function' || isArgument(arg)) {\n\t\t\tnormalizedArgs.push(arg as TransactionArgument);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst type = argTypes[i];\n\t\tconst bcsType = type === null ? null : getPureBcsSchema(type);\n\n\t\tif (bcsType) {\n\t\t\tconst bytes = bcsType.serialize(arg as never);\n\t\t\tnormalizedArgs.push((tx) => tx.pure(bytes));\n\t\t\tcontinue;\n\t\t} else if (typeof arg === 'string') {\n\t\t\tnormalizedArgs.push((tx) => tx.object(arg));\n\t\t\tcontinue;\n\t\t}\n\n\t\tthrow new Error(`Invalid argument ${stringify(arg)} for type ${type}`);\n\t}\n\n\treturn normalizedArgs;\n}\n\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\n\tasync get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tobjectId,\n\t\t...options\n\t}: GetOptions<Include>): Promise<\n\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t}\n\t> {\n\t\tconst [res] = await this.getMany<Include>({\n\t\t\t...options,\n\t\t\tobjectIds: [objectId],\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tasync getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tclient,\n\t\t...options\n\t}: GetManyOptions<Include>): Promise<\n\t\tArray<\n\t\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t\t}\n\t\t>\n\t> {\n\t\tconst response = (await client.core.getObjects({\n\t\t\t...options,\n\t\t\tinclude: {\n\t\t\t\t...options.include,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t})) as SuiClientTypes.GetObjectsResponse<Include & { content: true }>;\n\n\t\treturn response.objects.map((obj) => {\n\t\t\tif (obj instanceof Error) {\n\t\t\t\tthrow obj;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...obj,\n\t\t\t\tjson: this.parse(obj.content),\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport class MoveEnum<\n\tT extends Record<string, BcsType<any> | null>,\n\tconst Name extends string,\n> extends BcsEnum<T, Name> {}\n\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (val: unknown) => val);\n\t}\n\tif (typeof val === 'bigint') {\n\t\treturn val.toString();\n\t}\n\n\treturn val;\n}\n"],"mappings":";;;;;AAaA,MAAM,sBAAsB,oBAAoB,MAAM;AACtD,MAAM,wBAAwB,oBAAoB,MAAM;AAgBxD,SAAgB,iBAAiB,SAAgD;CAChF,MAAM,YAAY,OAAO,YAAY,WAAW,kBAAkB,aAAa,QAAQ,GAAG;AAE1F,KAAI,QAAQ,UACX,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,aAAa,UACvB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,YAAY,WAAW;EACjC,MAAM,OAAO,iBAAiB,UAAU,OAAO;AAC/C,SAAO,OAAO,IAAI,OAAO,KAAK,GAAG;YACvB,YAAY,WAAW;EACjC,MAAM,YAAY,UAAU;EAC5B,MAAM,MAAM,oBAAoB,UAAU,QAAQ;AAElD,MAAI,QAAQ,qBAAqB;AAChC,QACE,UAAU,WAAW,WAAW,UAAU,WAAW,aACtD,UAAU,SAAS,SAEnB,QAAO,IAAI;AAGZ,OAAI,UAAU,WAAW,YAAY,UAAU,SAAS,UAAU;IACjE,MAAM,OAAO,iBAAiB,UAAU,WAAW,GAAG;AACtD,WAAO,OAAO,IAAI,OAAO,KAAK,GAAG;;;AAInC,MACC,QAAQ,yBACR,UAAU,WAAW,aACpB,UAAU,SAAS,QAAQ,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a;AAC7C,kBAAe,MAAM,OAAO,GAAG,KAAK,MAAM,CAAC;AAC3C;aACU,OAAO,QAAQ,UAAU;AACnC,kBAAe,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC;AAC3C;;AAGD,QAAM,IAAI,MAAM,oBAAoB,UAAU,IAAI,CAAC,YAAY,OAAO;;AAGvE,QAAO;;AAGR,IAAa,aAAb,cAGU,UAAmB;CAC5B,MAAM,IAAiF,EACtF,UACA,GAAG,WAKF;EACD,MAAM,CAAC,OAAO,MAAM,KAAK,QAAiB;GACzC,GAAG;GACH,WAAW,CAAC,SAAS;GACrB,CAAC;AAEF,SAAO;;CAGR,MAAM,QAAqF,EAC1F,QACA,GAAG,WAOF;AASD,UARkB,MAAM,OAAO,KAAK,WAAW;GAC9C,GAAG;GACH,SAAS;IACR,GAAG,QAAQ;IACX,SAAS;IACT;GACD,CAAC,EAEc,QAAQ,KAAK,QAAQ;AACpC,OAAI,eAAe,MAClB,OAAM;AAGP,UAAO;IACN,GAAG;IACH,MAAM,KAAK,MAAM,IAAI,QAAQ;IAC7B;IACA;;;AAIJ,IAAa,WAAb,cAGU,QAAiB;AAE3B,IAAa,YAAb,cAGU,SAAkB;AAE5B,SAAS,UAAU,KAAc;AAChC,KAAI,OAAO,QAAQ,SAClB,QAAO,KAAK,UAAU,MAAM,UAAiBA,MAAI;AAElD,KAAI,OAAO,QAAQ,SAClB,QAAO,IAAI,UAAU;AAGtB,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.d.mts","names":[],"sources":["../../../src/contracts/walrus/blob.ts"],"
|
|
1
|
+
{"version":3,"file":"blob.d.mts","names":[],"sources":["../../../src/contracts/walrus/blob.ts"],"mappings":";;;;;cAQa,IAAA,EAAI,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage_node.d.mts","names":[],"sources":["../../../src/contracts/walrus/storage_node.ts"],"
|
|
1
|
+
{"version":3,"file":"storage_node.d.mts","names":[],"sources":["../../../src/contracts/walrus/storage_node.ts"],"mappings":";;;;;cAUa,eAAA,EAAe,UAAA;QAW1B,iBAAA,CAAA,OAAA"}
|
package/dist/error.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.mts","names":[],"sources":["../src/error.ts"],"
|
|
1
|
+
{"version":3,"file":"error.d.mts","names":[],"sources":["../src/error.ts"],"mappings":";cAGa,iBAAA,SAA0B,KAAA;AAAA,cAE1B,0BAAA,SAAmC,iBAAA;;cAGnC,yBAAA,SAAkC,iBAAA;;cAGlC,iCAAA,SAA0C,iBAAA;;cAG1C,2BAAA,SAAoC,0BAAA;;cAGpC,6BAAA,SAAsC,0BAAA;AANnD;AAAA,cASa,+BAAA,SAAwC,0BAAA;;cAGxC,uBAAA,SAAgC,0BAAA;;cAGhC,qBAAA,SAA8B,0BAAA;;cAG9B,qBAAA,SAA8B,iBAAA;;cAG9B,gBAAA,SAAyB,KAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.d.mts","names":[],"sources":["../../src/files/blob.ts"],"
|
|
1
|
+
{"version":3,"file":"blob.d.mts","names":[],"sources":["../../src/files/blob.ts"],"mappings":";;;;;cAQa,UAAA;EAAA;;IAKE,MAAA;IAAQ;EAAA;IAAY,MAAA,EAAQ,UAAA;IAAY,MAAA,EAAQ,YAAA;EAAA;EAM9D,MAAA,CAAA,GAAM,UAAA;EAIA,MAAA,CAAA,GAAU,OAAA;EAKV,KAAA,CACL,OAAA;IACC,GAAA;IACA,IAAA;MAAA,CAAU,OAAA;IAAA;IACV,WAAA;EAAA,IACK,OAAA,CAAA,UAAA;EAqCD,MAAA,CAAA,GAAM,OAAA;EAKN,WAAA,CAAA,GAAW,OAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.mts","names":[],"sources":["../../src/files/file.ts"],"
|
|
1
|
+
{"version":3,"file":"file.d.mts","names":[],"sources":["../../src/files/file.ts"],"mappings":";UAKiB,UAAA;EAChB,aAAA,IAAiB,OAAA;EACjB,OAAA,IAAW,OAAA,CAAQ,MAAA;EACnB,QAAA,IAAY,OAAA,CAAQ,UAAA;AAAA;AAAA,cAGR,UAAA;EAAA;SAGL,IAAA,CAAK,OAAA;IACX,QAAA,EAAU,UAAA,GAAa,IAAA;IACvB,UAAA;IACA,IAAA,GAAO,MAAA;EAAA,IACP,UAAA;;IAMa;EAAA;IAAY,MAAA,EAAQ,UAAA;EAAA;EAIlC,aAAA,CAAA,GAAa,OAAA;EAGb,OAAA,CAAA,GAAO,OAAA,CAAA,MAAA;EAIP,KAAA,CAAA,GAAK,OAAA,CAAA,UAAA,CAAA,eAAA;EAIC,IAAA,CAAA,GAAI,OAAA;EAMJ,IAAA,CAAA,GAAI,OAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.d.mts","names":[],"sources":["../../../src/files/readers/blob.ts"],"
|
|
1
|
+
{"version":3,"file":"blob.d.mts","names":[],"sources":["../../../src/files/readers/blob.ts"],"mappings":";;;;;;UASiB,iBAAA;EAChB,MAAA,EAAQ,YAAA;EACR,MAAA;EACA,SAAA;AAAA;AAAA,cAGY,UAAA,YAAsB,UAAA;EAAA;EAClC,MAAA;EAMA,yBAAA;;IAGc,MAAA;IAAQ,MAAA;IAAQ;EAAA,GAAa,iBAAA;EAMrC,aAAA,CAAA,GAAa,OAAA;EAIb,OAAA,CAAA,GAAO,OAAA;EAIb,cAAA,CAAA,GAAc,WAAA;EAIR,QAAA,CAAA,GAAQ,OAAA,CAAA,UAAA,CAAA,eAAA;EAad,WAAA,CAAA;;;;uBAbc,aAAA,CAAA,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBR,aAAA,CAAA,GAAa,OAAA;EA4Bb,aAAA,CAAA,GAAa,OAAA;EAWb,UAAA,CAAA,GAAU,OAAA;EAMV,kBAAA,CAAA;IAAqB,WAAA;IAAa;EAAA;IAAY,WAAA;IAAqB,MAAA,GAAS,WAAA;EAAA,IAAa,OAAA,CAAA,UAAA,CAAA,eAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quilt-file.d.mts","names":[],"sources":["../../../src/files/readers/quilt-file.ts"],"
|
|
1
|
+
{"version":3,"file":"quilt-file.d.mts","names":[],"sources":["../../../src/files/readers/quilt-file.ts"],"mappings":";;;;cAca,eAAA,YAA2B,UAAA;EAAA;;IAOtC,KAAA;IACA,WAAA;IACA,UAAA;IACA;EAAA;IAEA,KAAA,EAAO,WAAA;IACP,WAAA;IACA,UAAA;IACA,IAAA,GAAO,MAAA;EAAA;EAQF,QAAA,CAAA,GAAY,OAAA,CAAQ,UAAA;EAOpB,aAAA,CAAA,GAAa,OAAA;EAWb,OAAA,CAAA,GAAO,OAAA,CAAA,MAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quilt.d.mts","names":[],"sources":["../../../src/files/readers/quilt.ts"],"
|
|
1
|
+
{"version":3,"file":"quilt.d.mts","names":[],"sources":["../../../src/files/readers/quilt.ts"],"mappings":";;;;UAiBiB,kBAAA;EAChB,IAAA,EAAM,UAAA;AAAA;AAAA,cAGM,WAAA;EAAA;;IAIE;EAAA,GAAQ,kBAAA;EAkHhB,aAAA,CAAc,WAAA,WAAmB,OAAA;;;;;;EA0CjC,QAAA,CAAS,WAAA,WAAmB,OAAA;;;;;EAYlC,gBAAA,CAAiB,EAAA,WAAU,eAAA;EAYrB,SAAA,CAAA,GAAS,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/storage-node/client.ts"],"
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/storage-node/client.ts"],"mappings":";;;;KA+BY,KAAA,IAAS,GAAA,EAAK,WAAA,EAAa,IAAA,GAAO,WAAA,KAAgB,OAAA,CAAQ,QAAA;AAAA,KAE1D,wBAAA;EAFA;;;;;;;EAUX,KAAA,GAAQ,KAAA;EAV4D;;;;EAgBpE,OAAA;EAhB6D;;;EAqB7D,OAAA,IAAW,KAAA,EAAO,KAAA;AAAA;AAAA,KAGP,cAAA;EACX,OAAA;EACA,OAAA;EACA,OAAA,GAAU,UAAA,QAAkB,YAAA;AAAA,IACzB,IAAA,CAAK,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.mts","names":[],"sources":["../../src/storage-node/error.ts"],"
|
|
1
|
+
{"version":3,"file":"error.d.mts","names":[],"sources":["../../src/storage-node/error.ts"],"mappings":";cAGa,gBAAA,SAAyB,KAAA;AAAA,cAEzB,mBAAA,0HAGH,gBAAA;EAAA;EAL4B;EAAA,SAO5B,MAAA,EAAQ,OAAA;EALL;EAAA,SAQH,KAAA,EAAO,MAAA;cAEJ,MAAA,EAAQ,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,OAAA;EAAA,OAwBrC,QAAA,CACN,MAAA,sBACA,aAAA,sBACA,OAAA,uBACE,mBAAA;AAAA;AAAA,cA6CS,cAAA,SAAuB,mBAAA;;IACrB;EAAA;IAAa,OAAA;EAAA;AAAA;AAAA,cAKf,eAAA,SAAwB,mBAAA;;IACtB;EAAA;IAAa,OAAA;EAAA;AAAA;AAAA,cAKf,sBAAA,SAA+B,mBAAA;;IAC7B;EAAA;IAAa,OAAA;EAAA;AAAA;AAAA,cAKf,eAAA,SAAwB,mBAAA;EAAA,OAC7B,QAAA,CACN,MAAA,OACA,aAAA,sBACA,OAAA,uBACE,mBAAA;AAAA;AAAA,cAkBS,sBAAA,SAA+B,mBAAA;cAC/B,KAAA,sBAA2B,OAAA;AAAA;AAAA,cAK3B,mBAAA,SAA4B,mBAAA;AAAA,cAE5B,qBAAA,SAA8B,mBAAA;AAAA,cAE9B,aAAA,SAAsB,mBAAA;AAAA,cAEtB,aAAA,SAAsB,mBAAA;AAAA,cAEtB,wBAAA,SAAiC,mBAAA;AAAA,cAEjC,cAAA,SAAuB,mBAAA;AAAA,cAEvB,uBAAA,SAAgC,mBAAA;AAAA,cAEhC,mBAAA,SAA4B,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/storage-node/types.ts"],"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/storage-node/types.ts"],"mappings":";;;KAOY,UAAA;AAAA,KAEA,UAAA,UAAoB,UAAA,CAAW,UAAA;AAAA,KAE/B,UAAA,GAAa,UAAA,GAAa,WAAA,GAAc,cAAA,GAAiB,IAAA;AAAA,KAEzD,mBAAA;EACX,iBAAA;EACA,SAAA;AAAA;AAAA,KASW,UAAA;EACP,IAAA;AAAA;EACC,IAAA;AAAA,IAAoB,iBAAA;EACpB,IAAA;AAAA,IAAsB,mBAAA;EACtB,IAAA;AAAA,IAAsB,mBAAA;AAAA,KAehB,iBAAA;EACX,OAAA;IACC,KAAA,EAAO,WAAA;EAAA;AAAA;AAAA,KAIG,mBAAA;EACX,SAAA;IACC,eAAA,EAAiB,eAAA;IACjB,QAAA;IACA,WAAA;IACA,WAAA,EAAa,WAAA;IACb,qBAAA;EAAA;AAAA;AAAA,KAIU,mBAAA;EACX,SAAA;IACC,eAAA,EAAiB,eAAA;IACjB,qBAAA;EAAA;AAAA;AAAA,KAIU,eAAA;EACX,qBAAA;EACA,yBAAA;AAAA;AAAA,KAGW,WAAA;EACX,QAAA;EACA,QAAA;AAAA;AAAA,KASW,6BAAA;EACX,MAAA;EACA,QAAA,EAAU,UAAA,UAAoB,YAAA,CAAa,WAAA;AAAA;AAAA,KAGhC,yBAAA;EACX,OAAA;IACC,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,KASU,iBAAA,GAAoB,UAAA;AAAA,KAEpB,uBAAA;EACX,MAAA;EACA,MAAA,EAAQ,UAAA,UAAoB,UAAA,CAAW,WAAA;EACvC,UAAA,EAAY,UAAA;EACZ,eAAA;AAAA;AAAA,KAEW,mBAAA;EACX,OAAA;IACC,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,KA+BU,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/storage-node/utils.ts"],"
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/storage-node/utils.ts"],"mappings":";KAGY,WAAA,GAAc,MAAA,0CAAgD,WAAA;AAAA,iBAE1D,YAAA,CAAA,GAAgB,OAAA,GAAU,WAAA,kBAA6B,OAAA"}
|
package/dist/types.d.mts
CHANGED
|
@@ -10,7 +10,6 @@ import { ClientWithCoreApi } from "@mysten/sui/client";
|
|
|
10
10
|
import { Signer } from "@mysten/sui/cryptography";
|
|
11
11
|
|
|
12
12
|
//#region src/types.d.ts
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* Configuration for the Walrus package on sui
|
|
16
15
|
*
|
|
@@ -137,8 +136,7 @@ interface GetSecondarySliverOptions extends WalrusClientRequestOptions {
|
|
|
137
136
|
type GetVerifiedBlobStatusOptions = ReadBlobOptions;
|
|
138
137
|
type ComputeBlobMetadataOptions = {
|
|
139
138
|
bytes: Uint8Array;
|
|
140
|
-
numShards?: number;
|
|
141
|
-
/** Provide a nonce from a prior encode to ensure deterministic resume. If omitted, a random nonce is generated. */
|
|
139
|
+
numShards?: number; /** Provide a nonce from a prior encode to ensure deterministic resume. If omitted, a random nonce is generated. */
|
|
142
140
|
nonce?: Uint8Array;
|
|
143
141
|
};
|
|
144
142
|
interface SliversForNode {
|
|
@@ -302,16 +300,13 @@ interface DeleteBlobOptions {
|
|
|
302
300
|
blobObjectId: string;
|
|
303
301
|
}
|
|
304
302
|
type ExtendBlobOptions = {
|
|
305
|
-
blobObjectId: string;
|
|
306
|
-
/** optionally specify a WAL coin pay for the registration. This will consume WAL from the signer by default. */
|
|
303
|
+
blobObjectId: string; /** optionally specify a WAL coin pay for the registration. This will consume WAL from the signer by default. */
|
|
307
304
|
walCoin?: TransactionObjectArgument;
|
|
308
305
|
} & ({
|
|
309
|
-
/** The number of epochs the blob should be stored for. */
|
|
310
|
-
epochs: number;
|
|
306
|
+
/** The number of epochs the blob should be stored for. */epochs: number;
|
|
311
307
|
endEpoch?: never;
|
|
312
308
|
} | {
|
|
313
|
-
/** The new end epoch for the storage period of the blob. */
|
|
314
|
-
endEpoch: number;
|
|
309
|
+
/** The new end epoch for the storage period of the blob. */endEpoch: number;
|
|
315
310
|
epochs?: never;
|
|
316
311
|
});
|
|
317
312
|
type WriteBlobAttributesOptions = {
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;AAyBA;;;UAAiB,mBAAA;EAEhB;EAAA,cAAA;EAGA;EADA,aAAA;EACA,WAAA;AAAA;AAAA,KAGI,4BAAA;EAEF,OAAA;EACA,aAAA,GAAgB,mBAAA;AAAA;EAGhB,OAAA;EACA,aAAA,EAAe,mBAAA;AAAA;AAAA,KAGN,WAAA;EAET,KAAA;AAAA;EAGA,MAAA;IACC,IAAA;IACA,aAAA;EAAA;AAAA;AAAA,KAIQ,oBAAA;EACX,OAAA;EACA,GAAA;EACA,IAAA,EAAM,WAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,wBAAA;EAC1C,OAAA,UAEG,oBAAA;IAEA,GAAA;EAAA;AAAA;AAAA,UAIM,sBAAA;EACT,wBAAA,GAA2B,wBAAA;EAC3B,OAAA;EACA,WAAA,GAAc,iBAAA;AAAA;;AAZf;;;;KAoBY,kBAAA,GAAqB,sBAAA,GAChC,4BAAA;EACC,SAAA,EAAW,iBAAA;AAAA;AAAA,KAGD,aAAA,oBAAiC,sBAAA;EAC5C,aAAA,GAAgB,mBAAA;EAChB,IAAA,GAAO,IAAA;AAAA;AAA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@@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/upload-relay/client.ts"],"
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/upload-relay/client.ts"],"mappings":";;;KAcY,KAAA,IAAS,GAAA,EAAK,WAAA,EAAa,IAAA,GAAO,WAAA,KAAgB,OAAA,CAAQ,QAAA;AAAA,KAE1D,wBAAA;EACX,IAAA;;;;;;;;EAQA,KAAA,GAAQ,KAAA;EAXY;;;;EAiBpB,OAAA;EAjB6E;;AAE9E;EAoBC,OAAA,IAAW,KAAA,EAAO,KAAA;AAAA"}
|
package/dist/utils/bcs.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import * as _mysten_sui_bcs0 from "@mysten/sui/bcs";
|
|
|
3
3
|
import { BcsType } from "@mysten/sui/bcs";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/bcs.d.ts
|
|
6
|
-
|
|
7
6
|
declare const BlobMetadata: _mysten_sui_bcs0.BcsEnum<{
|
|
8
7
|
V1: _mysten_sui_bcs0.BcsStruct<{
|
|
9
8
|
encoding_type: BcsType<_mysten_bcs5.EnumOutputShapeWithKeys<{
|
|
@@ -45,7 +44,7 @@ declare const QuiltPatchV1: _mysten_sui_bcs0.BcsStruct<{
|
|
|
45
44
|
identifier: BcsType<string, string, "string">;
|
|
46
45
|
tags: BcsType<{
|
|
47
46
|
[k: string]: string;
|
|
48
|
-
},
|
|
47
|
+
}, Map<string, string> | Record<string, string>, "Map<string, string>">;
|
|
49
48
|
}, string>;
|
|
50
49
|
//#endregion
|
|
51
50
|
export { BlobMetadata, QuiltPatchV1, blobIdFromInt, blobIdToInt };
|
package/dist/utils/bcs.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/utils/bcs.ts"],"
|
|
1
|
+
{"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/utils/bcs.ts"],"mappings":";;;;;cAyCa,YAAA,mBAAY,OAAA;;2BAEvB,YAAA,CAAA,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOc,aAAA,CAAc,MAAA;AAAA,iBAcd,WAAA,CAAY,MAAA;AAAA,cA4Ff,YAAA,mBAAY,SAAA"}
|
package/dist/utils/quilts.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quilts.d.mts","names":[],"sources":["../../src/utils/quilts.ts"],"
|
|
1
|
+
{"version":3,"file":"quilts.d.mts","names":[],"sources":["../../src/utils/quilts.ts"],"mappings":";;;;UA8HiB,kBAAA;EAChB,KAAA;IACC,QAAA,EAAU,UAAA;IACV,UAAA;IACA,IAAA,GAAO,MAAA;EAAA;EAER,SAAA;EACA,YAAA,GAAe,YAAA;AAAA;AAAA,iBAGA,WAAA,CAAA;EAAc,KAAA;EAAO,SAAA;EAAW;AAAA,GAAgB,kBAAA;;;qBASvC,YAAA,CAAa,WAAA;MAAgB,UAAA;IAAA;EAAA;AAAA"}
|
package/docs/index.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
> Store and retrieve blobs on Walrus decentralized storage
|
|
4
4
|
|
|
5
|
+
The Walrus TypeScript SDK works directly with Walrus storage nodes or with the Walrus upload relay.
|
|
6
|
+
When you use the Walrus SDK without an upload relay, reading and writing Walrus blobs requires many
|
|
7
|
+
requests (approximately 2200 to write a blob and approximately 335 to read a blob). The upload relay
|
|
8
|
+
reduces the number of requests needed to write a blob, but reads through the Walrus SDK still
|
|
9
|
+
require many requests. For many applications, using publishers and aggregators is recommended, but
|
|
10
|
+
the TypeScript SDK is useful when building applications where the application needs to directly
|
|
11
|
+
interact with Walrus, or when users need to pay for their own storage directly.
|
|
12
|
+
|
|
13
|
+
The Walrus SDK exposes high-level methods for reading and writing blobs, as well as lower-level
|
|
14
|
+
methods for the individual steps in the process. You can use the lower-level methods to implement
|
|
15
|
+
more complex flows when you want more control over optimization.
|
|
16
|
+
|
|
5
17
|
## Installation
|
|
6
18
|
|
|
7
19
|
```bash npm2yarn
|
|
@@ -10,8 +22,8 @@ npm install --save @mysten/walrus @mysten/sui
|
|
|
10
22
|
|
|
11
23
|
## Setup
|
|
12
24
|
|
|
13
|
-
To use the
|
|
14
|
-
|
|
25
|
+
To use the Walrus SDK, you need to create a client from the TypeScript SDK and extend it with the
|
|
26
|
+
Walrus SDK.
|
|
15
27
|
|
|
16
28
|
```ts
|
|
17
29
|
const client = new SuiGrpcClient({
|
|
@@ -20,9 +32,9 @@ const client = new SuiGrpcClient({
|
|
|
20
32
|
}).$extend(walrus());
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
The
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
The Walrus SDK includes all the relevant package and object IDs needed for connecting to Testnet.
|
|
36
|
+
You can also manually configure the Walrus SDK to use a different set of IDs, allowing you to
|
|
37
|
+
connect to a different network or updated deployment of the Walrus contracts.
|
|
26
38
|
|
|
27
39
|
```ts
|
|
28
40
|
const client = new SuiGrpcClient({
|
|
@@ -38,7 +50,7 @@ const client = new SuiGrpcClient({
|
|
|
38
50
|
);
|
|
39
51
|
```
|
|
40
52
|
|
|
41
|
-
|
|
53
|
+
Some environments require you to customize how data is fetched:
|
|
42
54
|
|
|
43
55
|
```ts
|
|
44
56
|
const client = new SuiGrpcClient({
|
|
@@ -57,37 +69,22 @@ const client = new SuiGrpcClient({
|
|
|
57
69
|
);
|
|
58
70
|
```
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
any other desired behavior.
|
|
62
|
-
|
|
63
|
-
## SDK Overview
|
|
64
|
-
|
|
65
|
-
The Walrus TS SDK is designed to work directly with walrus storage nodes, or with the walrus upload
|
|
66
|
-
relay. When using the walrus SDK without an upload relay, it is important to understand that reading
|
|
67
|
-
and writing walrus blobs requires a lot of requests (~2200 to write a blob, ~335 to read a blob).
|
|
68
|
-
The upload relay will reduce the number of requests needed to write a blob, but reads through the
|
|
69
|
-
walrus SDK will still require a lot of requests. For many applications, using publishers and
|
|
70
|
-
aggregators is recommended, but the TS SDK can be useful when building applications where the
|
|
71
|
-
application needs to directly interact with walrus or users need to pay for their own storage
|
|
72
|
-
directly.
|
|
73
|
-
|
|
74
|
-
The walrus sdk exposes high level methods for reading and writing blobs, as well as lower level
|
|
75
|
-
methods for the individual steps in the process that can be used to implement more complex flows
|
|
76
|
-
when you want more control to implement more optimized implementations.
|
|
72
|
+
You can use this approach to implement a fetch function with custom timeouts, rate limits, retry
|
|
73
|
+
logic, or any other desired behavior.
|
|
77
74
|
|
|
78
|
-
##
|
|
75
|
+
## `WalrusFile` API
|
|
79
76
|
|
|
80
|
-
The `WalrusFile` API provides a higher
|
|
81
|
-
about how data is stored in
|
|
82
|
-
|
|
77
|
+
The `WalrusFile` API provides a higher-level abstraction so that applications do not need to worry
|
|
78
|
+
about how data is stored in Walrus. It handles data stored directly in blobs and data stored in
|
|
79
|
+
quilts, but might expand to cover other storage patterns in the future.
|
|
83
80
|
|
|
84
81
|
### Reading files
|
|
85
82
|
|
|
86
|
-
To read files,
|
|
87
|
-
|
|
83
|
+
To read files, use the `getFiles` method. This method accepts both blob IDs and quilt IDs, and
|
|
84
|
+
returns a `WalrusFile`.
|
|
88
85
|
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
Read files in batches when possible, which allows the client to be more efficient when loading
|
|
87
|
+
multiple files from the same quilt.
|
|
91
88
|
|
|
92
89
|
```ts
|
|
93
90
|
const [file1, file2] = await client.walrus.getFiles({ ids: [anyBlobId, orQuiltId] });
|
|
@@ -104,17 +101,16 @@ const text = await file1.text();
|
|
|
104
101
|
const json = await file2.json();
|
|
105
102
|
```
|
|
106
103
|
|
|
107
|
-
A `WalrusFile`
|
|
108
|
-
quilt.
|
|
104
|
+
A `WalrusFile` might also have `identifier` and `tags` properties if the file was stored in a quilt.
|
|
109
105
|
|
|
110
106
|
```ts
|
|
111
107
|
const identifier: string | null = await file1.getIdentifier();
|
|
112
108
|
const tags: Record<string, string> = await file1.getTags();
|
|
113
109
|
```
|
|
114
110
|
|
|
115
|
-
|
|
111
|
+
#### `WalrusBlob`
|
|
116
112
|
|
|
117
|
-
You can also get a `WalrusBlob` instead of a `WalrusFile` if you have the blobId
|
|
113
|
+
You can also get a `WalrusBlob` instead of a `WalrusFile` if you have the `blobId`:
|
|
118
114
|
|
|
119
115
|
```ts
|
|
120
116
|
const blob = await client.walrus.getBlob({ blobId });
|
|
@@ -135,8 +131,8 @@ const filesById = await blob.files({ ids: [quiltID] });
|
|
|
135
131
|
|
|
136
132
|
### Writing files
|
|
137
133
|
|
|
138
|
-
You can also construct a `WalrusFile` from a `Uint8Array`, `Blob`, or a `string
|
|
139
|
-
|
|
134
|
+
You can also construct a `WalrusFile` from a `Uint8Array`, `Blob`, or a `string`, which you can then
|
|
135
|
+
store on Walrus:
|
|
140
136
|
|
|
141
137
|
```ts
|
|
142
138
|
const file1 = WalrusFile.from({
|
|
@@ -156,15 +152,15 @@ const file3 = WalrusFile.from({
|
|
|
156
152
|
});
|
|
157
153
|
```
|
|
158
154
|
|
|
159
|
-
|
|
155
|
+
After you have your files, use the `writeFiles` method to write them to Walrus.
|
|
160
156
|
|
|
161
|
-
Along with the files, you
|
|
162
|
-
transaction
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
Along with the files, you also need to provide a `Signer` instance that signs and pays for the
|
|
158
|
+
transaction and storage fees. The signer's address needs sufficient SUI to cover the transactions
|
|
159
|
+
that register the blob and certify its availability after upload. The signer must own sufficient WAL
|
|
160
|
+
to pay to store the blob for the specified number of epochs, as well as the write fee for writing
|
|
161
|
+
the blob.
|
|
166
162
|
|
|
167
|
-
The exact costs
|
|
163
|
+
The exact costs depend on the size of the blobs, as well as the current gas and storage prices.
|
|
168
164
|
|
|
169
165
|
```ts
|
|
170
166
|
const results: {
|
|
@@ -179,32 +175,32 @@ const results: {
|
|
|
179
175
|
});
|
|
180
176
|
```
|
|
181
177
|
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
The provided files are all written into a single quilt. Future versions of the SDK might optimize
|
|
179
|
+
how files are stored to be more efficient by splitting files into multiple quilts.
|
|
184
180
|
|
|
185
181
|
The current quilt encoding is less efficient for single files, so writing multiple files together is
|
|
186
182
|
recommended when possible. Writing raw blobs directly is also possible using the `writeBlob` API
|
|
187
|
-
|
|
183
|
+
described below.
|
|
188
184
|
|
|
189
|
-
|
|
185
|
+
#### Writing files in browser environments
|
|
190
186
|
|
|
191
|
-
When the transactions to upload a blob are signed by a wallet in a browser, some wallets
|
|
192
|
-
|
|
193
|
-
interaction,
|
|
187
|
+
When the transactions to upload a blob are signed by a wallet in a browser, some wallets use popups
|
|
188
|
+
to prompt you for a signature. If the popups are not opened in direct response to a user
|
|
189
|
+
interaction, the browser might block them.
|
|
194
190
|
|
|
195
|
-
To avoid this,
|
|
196
|
-
|
|
191
|
+
To avoid this, execute the transactions that register and certify the blob in separate event
|
|
192
|
+
handlers by creating separate buttons for each step.
|
|
197
193
|
|
|
198
194
|
The `client.writeFilesFlow` method returns an object with a set of methods that break the write flow
|
|
199
195
|
into several smaller steps:
|
|
200
196
|
|
|
201
|
-
1. `encode
|
|
202
|
-
2. `register
|
|
203
|
-
3. `upload
|
|
204
|
-
4. `certify
|
|
205
|
-
5. `listFiles
|
|
197
|
+
1. `encode`: Encodes the files and generates a `blobId`.
|
|
198
|
+
2. `register`: Returns a transaction that registers the blob onchain.
|
|
199
|
+
3. `upload`: Uploads the data to storage nodes.
|
|
200
|
+
4. `certify`: Returns a transaction that certifies the blob onchain.
|
|
201
|
+
5. `listFiles`: Returns a list of the created files.
|
|
206
202
|
|
|
207
|
-
|
|
203
|
+
The following simplified example shows the core API usage with separate user interactions:
|
|
208
204
|
|
|
209
205
|
```tsx
|
|
210
206
|
// Step 1: Create and encode the flow (can be done immediately when file is selected)
|
|
@@ -260,9 +256,8 @@ interactions, allowing wallet popups to work properly without being blocked by t
|
|
|
260
256
|
|
|
261
257
|
### Running the full flow
|
|
262
258
|
|
|
263
|
-
If you
|
|
264
|
-
pipeline as an async iterator.
|
|
265
|
-
recovery:
|
|
259
|
+
If you do not need separate user interactions for each step, use `run()` to execute the full
|
|
260
|
+
pipeline as an async iterator.
|
|
266
261
|
|
|
267
262
|
```ts
|
|
268
263
|
const flow = client.walrus.writeBlobFlow({ blob });
|
|
@@ -283,10 +278,11 @@ const up = await flow.upload({ digest: reg.txDigest });
|
|
|
283
278
|
const cert = await flow.executeCertify({ signer });
|
|
284
279
|
```
|
|
285
280
|
|
|
286
|
-
|
|
281
|
+
#### Resuming uploads
|
|
287
282
|
|
|
288
|
-
|
|
289
|
-
|
|
283
|
+
Each step executed by `run()` produces a `WriteBlobStep` that you can persist for crash recovery. To
|
|
284
|
+
resume an upload after a crash, pass a saved `WriteBlobStep` as `resume`. The flow skips completed
|
|
285
|
+
steps, validates the `blobId`, and only uploads slivers that are not already stored:
|
|
290
286
|
|
|
291
287
|
```ts
|
|
292
288
|
const saved = await db.load(fileId);
|
|
@@ -297,13 +293,12 @@ for await (const step of flow.run({ signer, epochs: 3, deletable: true })) {
|
|
|
297
293
|
}
|
|
298
294
|
```
|
|
299
295
|
|
|
300
|
-
##
|
|
296
|
+
## Using an upload relay
|
|
301
297
|
|
|
302
|
-
Writing blobs directly from a client requires
|
|
303
|
-
|
|
304
|
-
complexity for the client.
|
|
298
|
+
Writing blobs directly from a client requires many requests to write data to all the storage nodes.
|
|
299
|
+
An upload relay offloads the work of these writes to a server, reducing complexity for the client.
|
|
305
300
|
|
|
306
|
-
To use an upload relay,
|
|
301
|
+
To use an upload relay, add the `uploadRelay` option when adding the Walrus extension:
|
|
307
302
|
|
|
308
303
|
```ts
|
|
309
304
|
const client = new SuiGrpcClient({
|
|
@@ -321,18 +316,18 @@ const client = new SuiGrpcClient({
|
|
|
321
316
|
);
|
|
322
317
|
```
|
|
323
318
|
|
|
324
|
-
The `host` option is required
|
|
325
|
-
require a tip to
|
|
326
|
-
|
|
327
|
-
|
|
319
|
+
The `host` option is required and indicates the URL for your upload relay. Upload relays might
|
|
320
|
+
require a tip to cover the cost of writing the blob. You can configure a maximum tip (paid in MIST)
|
|
321
|
+
and the `WalrusClient` automatically determines the required tip for your upload relay. You can also
|
|
322
|
+
manually configure the tip as shown below.
|
|
328
323
|
|
|
329
|
-
|
|
330
|
-
`https://upload-relay.testnet.walrus.space/v1/tip-config`)
|
|
331
|
-
|
|
324
|
+
Find the tip required by an upload relay using the `tip-config` endpoint (for example,
|
|
325
|
+
`https://upload-relay.testnet.walrus.space/v1/tip-config`). The tip is either a `const` or a
|
|
326
|
+
`linear` type.
|
|
332
327
|
|
|
333
328
|
### `const` tip
|
|
334
329
|
|
|
335
|
-
A `const`
|
|
330
|
+
A `const` tip sends a fixed amount for each blob written to the upload relay.
|
|
336
331
|
|
|
337
332
|
```ts
|
|
338
333
|
const client = new SuiGrpcClient({
|
|
@@ -355,8 +350,8 @@ const client = new SuiGrpcClient({
|
|
|
355
350
|
|
|
356
351
|
### `linear` tip
|
|
357
352
|
|
|
358
|
-
A `linear` tip
|
|
359
|
-
|
|
353
|
+
A `linear` tip sends a fixed amount for each blob written to the upload relay, plus a multiplier
|
|
354
|
+
based on the size of the blob.
|
|
360
355
|
|
|
361
356
|
```ts
|
|
362
357
|
const client = new SuiGrpcClient({
|
|
@@ -382,22 +377,22 @@ const client = new SuiGrpcClient({
|
|
|
382
377
|
|
|
383
378
|
## Interacting with blobs directly
|
|
384
379
|
|
|
385
|
-
|
|
386
|
-
|
|
380
|
+
If you do not want to use the `WalrusFile` abstractions, use the `readBlob` and `writeBlob` APIs
|
|
381
|
+
directly.
|
|
387
382
|
|
|
388
383
|
### Reading blobs
|
|
389
384
|
|
|
390
|
-
The `readBlob` method
|
|
385
|
+
The `readBlob` method reads a blob given the `blobId` and returns a `Uint8Array` containing the blob
|
|
391
386
|
content:
|
|
392
387
|
|
|
393
388
|
```ts
|
|
394
389
|
const blob = await client.walrus.readBlob({ blobId });
|
|
395
390
|
```
|
|
396
391
|
|
|
397
|
-
### Writing
|
|
392
|
+
### Writing blobs
|
|
398
393
|
|
|
399
|
-
The writeBlob method
|
|
400
|
-
|
|
394
|
+
The `writeBlob` method writes a blob (as a `Uint8Array`) to Walrus. You need to specify how long the
|
|
395
|
+
blob should be stored for and whether the blob should be deletable.
|
|
401
396
|
|
|
402
397
|
```ts
|
|
403
398
|
const file = new TextEncoder().encode('Hello from the TS SDK!!!\n');
|
|
@@ -423,26 +418,14 @@ const { blobId } = await client.walrus.writeBlob({
|
|
|
423
418
|
});
|
|
424
419
|
```
|
|
425
420
|
|
|
426
|
-
## Full API
|
|
427
|
-
|
|
428
|
-
For a complete overview of the available methods on the `WalrusClient` you can reference type
|
|
429
|
-
[TypeDocs](/typedoc/classes/_mysten_walrus.WalrusClient.html)
|
|
430
|
-
|
|
431
|
-
## Examples
|
|
432
|
-
|
|
433
|
-
There are a number of simple
|
|
434
|
-
[examples you can reference](https://github.com/MystenLabs/ts-sdks/tree/main/packages/walrus/examples)
|
|
435
|
-
in the `ts-sdks` repo that show things like building simple aggregators and publishers with the
|
|
436
|
-
walrus SDK
|
|
437
|
-
|
|
438
421
|
## Error handling
|
|
439
422
|
|
|
440
423
|
The SDK exports all the error classes for different types of errors that can be thrown. Walrus is a
|
|
441
|
-
fault-tolerant distributed system
|
|
442
|
-
changes
|
|
443
|
-
|
|
424
|
+
fault-tolerant distributed system where many types of errors can be recovered from. During epoch
|
|
425
|
+
changes, the data cached in the `WalrusClient` can become invalid. Errors that result from this
|
|
426
|
+
situation extend the `RetryableWalrusClientError` class.
|
|
444
427
|
|
|
445
|
-
You can check for these errors
|
|
428
|
+
You can check for these errors and reset the client before retrying:
|
|
446
429
|
|
|
447
430
|
```ts
|
|
448
431
|
if (error instanceof RetryableWalrusClientError) {
|
|
@@ -452,25 +435,25 @@ if (error instanceof RetryableWalrusClientError) {
|
|
|
452
435
|
}
|
|
453
436
|
```
|
|
454
437
|
|
|
455
|
-
`RetryableWalrusClientError` are not guaranteed to succeed after resetting the client and
|
|
456
|
-
but this pattern
|
|
438
|
+
`RetryableWalrusClientError` errors are not guaranteed to succeed after resetting the client and
|
|
439
|
+
retrying, but this pattern handles some edge cases.
|
|
457
440
|
|
|
458
|
-
High
|
|
459
|
-
|
|
441
|
+
High-level methods like `readBlob` already handle various error cases and automatically retry when
|
|
442
|
+
encountering these errors, as well as handling cases where only a subset of nodes need to respond
|
|
460
443
|
successfully to read or publish a blob.
|
|
461
444
|
|
|
462
|
-
When using the lower
|
|
463
|
-
|
|
464
|
-
|
|
445
|
+
When using the lower-level methods to build your own read or publish flows, understand the number of
|
|
446
|
+
shards and slivers that need to be successfully written or read for your operation to succeed.
|
|
447
|
+
Gracefully handle cases where some nodes might be in a bad state.
|
|
465
448
|
|
|
466
449
|
### Network errors
|
|
467
450
|
|
|
468
|
-
Walrus
|
|
469
|
-
|
|
470
|
-
challenging
|
|
451
|
+
Walrus handles some nodes being down, and the SDK only throws errors when it cannot read from or
|
|
452
|
+
write to enough storage nodes. When troubleshooting problems, figuring out what went wrong can be
|
|
453
|
+
challenging because you do not see all the individual network errors.
|
|
471
454
|
|
|
472
|
-
|
|
473
|
-
|
|
455
|
+
Pass an `onError` option in the `storageNodeClientOptions` to get the individual errors from failed
|
|
456
|
+
requests:
|
|
474
457
|
|
|
475
458
|
```ts
|
|
476
459
|
const client = new SuiGrpcClient({
|
|
@@ -487,16 +470,14 @@ const client = new SuiGrpcClient({
|
|
|
487
470
|
|
|
488
471
|
## Configuring network requests
|
|
489
472
|
|
|
490
|
-
Reading and writing blobs directly from storage nodes requires
|
|
491
|
-
|
|
492
|
-
|
|
473
|
+
Reading and writing blobs directly from storage nodes requires many requests. The Walrus SDK issues
|
|
474
|
+
all requests needed to complete these operations, but does not handle all the complexities a robust
|
|
475
|
+
aggregator or publisher might encounter.
|
|
493
476
|
|
|
494
|
-
By default, all requests
|
|
495
|
-
in.
|
|
477
|
+
By default, all requests use the global `fetch` for whatever runtime the SDK runs in.
|
|
496
478
|
|
|
497
|
-
This
|
|
498
|
-
|
|
499
|
-
`fetch` method:
|
|
479
|
+
This does not impose any limitations on concurrency, and is subject to default timeouts and behavior
|
|
480
|
+
defined by your runtime. To customize how requests are made, provide a custom `fetch` method:
|
|
500
481
|
|
|
501
482
|
```ts
|
|
502
483
|
const client = new SuiGrpcClient({
|
|
@@ -520,15 +501,15 @@ const client = new SuiGrpcClient({
|
|
|
520
501
|
);
|
|
521
502
|
```
|
|
522
503
|
|
|
523
|
-
## Loading the
|
|
504
|
+
## Loading the WASM module in Vite or client-side apps
|
|
524
505
|
|
|
525
|
-
The
|
|
526
|
-
some bundlers this
|
|
506
|
+
The Walrus SDK requires WASM bindings to encode and decode blobs. When running in Node.js or Bun,
|
|
507
|
+
and with some bundlers, this works without any additional configuration.
|
|
527
508
|
|
|
528
|
-
In some cases you
|
|
509
|
+
In some cases, you might need to manually specify where the SDK loads the WASM bindings from.
|
|
529
510
|
|
|
530
|
-
In
|
|
531
|
-
|
|
511
|
+
In Vite, get the URL for the WASM bindings by importing the WASM file with a `?url` suffix, then
|
|
512
|
+
pass it into the Walrus client:
|
|
532
513
|
|
|
533
514
|
```ts
|
|
534
515
|
const client = new SuiGrpcClient({
|
|
@@ -541,8 +522,8 @@ const client = new SuiGrpcClient({
|
|
|
541
522
|
);
|
|
542
523
|
```
|
|
543
524
|
|
|
544
|
-
If you are unable to get a
|
|
545
|
-
the
|
|
525
|
+
If you are unable to get a URL for the WASM file in your bundler or build system, you can self-host
|
|
526
|
+
the WASM bindings or load them from a CDN:
|
|
546
527
|
|
|
547
528
|
```ts
|
|
548
529
|
const client = new SuiGrpcClient({
|
|
@@ -555,8 +536,8 @@ const client = new SuiGrpcClient({
|
|
|
555
536
|
);
|
|
556
537
|
```
|
|
557
538
|
|
|
558
|
-
In
|
|
559
|
-
|
|
539
|
+
In Next.js, when using Walrus in API routes, you might need to tell Next.js to skip bundling for the
|
|
540
|
+
Walrus packages:
|
|
560
541
|
|
|
561
542
|
```ts
|
|
562
543
|
// next.config.ts
|
|
@@ -565,9 +546,21 @@ const nextConfig: NextConfig = {
|
|
|
565
546
|
};
|
|
566
547
|
```
|
|
567
548
|
|
|
568
|
-
## Known fetch limitations
|
|
549
|
+
## Known fetch limitations
|
|
550
|
+
|
|
551
|
+
- Some nodes can be slow to respond. When running in Node.js, the default `connectTimeout` is 10
|
|
552
|
+
seconds and can cause request timeouts.
|
|
553
|
+
- In Bun, the `abort` signal stops requests from responding, but the requests still wait for
|
|
554
|
+
completion before their promises reject.
|
|
555
|
+
|
|
556
|
+
## Full API
|
|
557
|
+
|
|
558
|
+
For a complete overview of the available methods on the `WalrusClient`, reference the
|
|
559
|
+
[TypeDocs](/typedoc/classes/_mysten_walrus.WalrusClient.html).
|
|
569
560
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
561
|
+
## Examples
|
|
562
|
+
|
|
563
|
+
There are a number of
|
|
564
|
+
[examples you can reference](https://github.com/MystenLabs/ts-sdks/tree/main/packages/walrus/examples)
|
|
565
|
+
in the `ts-sdks` repository that show things like building aggregators and publishers with the
|
|
566
|
+
Walrus SDK.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten/walrus",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Walrus SDK",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"react-dom": "^19.2.3",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
43
|
"undici": "^7.24.4",
|
|
44
|
-
"vite": "^
|
|
44
|
+
"vite": "^8.0.5",
|
|
45
45
|
"vitest": "^4.0.17",
|
|
46
|
-
"@mysten/codegen": "^0.8.
|
|
46
|
+
"@mysten/codegen": "^0.8.4",
|
|
47
|
+
"@mysten/dapp-kit-core": "^1.3.0",
|
|
47
48
|
"@mysten/dapp-kit-react": "^2.0.1",
|
|
48
|
-
"@mysten/
|
|
49
|
-
"@mysten/sui": "^2.9.1"
|
|
49
|
+
"@mysten/sui": "^2.15.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"dataloader": "^2.2.3",
|
|
53
|
-
"@mysten/utils": "^0.3.1",
|
|
54
53
|
"@mysten/bcs": "^2.0.3",
|
|
54
|
+
"@mysten/utils": "^0.3.1",
|
|
55
55
|
"@mysten/walrus-wasm": "^0.2.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@mysten/sui": "^2.
|
|
58
|
+
"@mysten/sui": "^2.15.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|