@mysten/sui
Version:
Sui TypeScript API
1 lines • 14.3 kB
Source Map (JSON)
{"version":3,"file":"effects.mjs","names":[],"sources":["../../src/bcs/effects.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bcs } from '@mysten/bcs';\n\nimport { Address, ObjectDigest, Owner, SuiObjectRef, TypeTag } from './bcs.js';\n\n// Rust: crates/sui-types/src/execution_status.rs (PackageUpgradeError enum)\nconst PackageUpgradeError = bcs.enum('PackageUpgradeError', {\n\tUnableToFetchPackage: bcs.struct('UnableToFetchPackage', { packageId: Address }),\n\tNotAPackage: bcs.struct('NotAPackage', { objectId: Address }),\n\tIncompatibleUpgrade: null,\n\tDigestDoesNotMatch: bcs.struct('DigestDoesNotMatch', { digest: bcs.byteVector() }),\n\tUnknownUpgradePolicy: bcs.struct('UnknownUpgradePolicy', { policy: bcs.u8() }),\n\tPackageIDDoesNotMatch: bcs.struct('PackageIDDoesNotMatch', {\n\t\tpackageId: Address,\n\t\tticketId: Address,\n\t}),\n});\n\n// Rust: move-core-types/src/language_storage.rs\nconst ModuleId = bcs.struct('ModuleId', {\n\taddress: Address,\n\tname: bcs.string(),\n});\n// Rust: crates/sui-types/src/execution_status.rs\nconst MoveLocation = bcs.struct('MoveLocation', {\n\tmodule: ModuleId,\n\tfunction: bcs.u16(),\n\tinstruction: bcs.u16(),\n\tfunctionName: bcs.option(bcs.string()),\n});\n\n// Rust: crates/sui-types/src/execution_status.rs\nconst CommandArgumentError = bcs.enum('CommandArgumentError', {\n\tTypeMismatch: null,\n\tInvalidBCSBytes: null,\n\tInvalidUsageOfPureArg: null,\n\tInvalidArgumentToPrivateEntryFunction: null,\n\tIndexOutOfBounds: bcs.struct('IndexOutOfBounds', { idx: bcs.u16() }),\n\tSecondaryIndexOutOfBounds: bcs.struct('SecondaryIndexOutOfBounds', {\n\t\tresultIdx: bcs.u16(),\n\t\tsecondaryIdx: bcs.u16(),\n\t}),\n\tInvalidResultArity: bcs.struct('InvalidResultArity', { resultIdx: bcs.u16() }),\n\tInvalidGasCoinUsage: null,\n\tInvalidValueUsage: null,\n\tInvalidObjectByValue: null,\n\tInvalidObjectByMutRef: null,\n\tSharedObjectOperationNotAllowed: null,\n\tInvalidArgumentArity: null,\n\tInvalidTransferObject: null,\n\tInvalidMakeMoveVecNonObjectArgument: null,\n\tArgumentWithoutValue: null,\n\tCannotMoveBorrowedValue: null,\n\tCannotWriteToExtendedReference: null,\n\tInvalidReferenceArgument: null,\n});\n\n// Rust: crates/sui-types/src/execution_status.rs\nconst TypeArgumentError = bcs.enum('TypeArgumentError', {\n\tTypeNotFound: null,\n\tConstraintNotSatisfied: null,\n});\n\n// Rust: crates/sui-types/src/execution_status.rs\nconst ExecutionFailureStatus = bcs.enum('ExecutionFailureStatus', {\n\tInsufficientGas: null,\n\tInvalidGasObject: null,\n\tInvariantViolation: null,\n\tFeatureNotYetSupported: null,\n\tMoveObjectTooBig: bcs.struct('MoveObjectTooBig', {\n\t\tobjectSize: bcs.u64(),\n\t\tmaxObjectSize: bcs.u64(),\n\t}),\n\tMovePackageTooBig: bcs.struct('MovePackageTooBig', {\n\t\tobjectSize: bcs.u64(),\n\t\tmaxObjectSize: bcs.u64(),\n\t}),\n\tCircularObjectOwnership: bcs.struct('CircularObjectOwnership', { object: Address }),\n\tInsufficientCoinBalance: null,\n\tCoinBalanceOverflow: null,\n\tPublishErrorNonZeroAddress: null,\n\tSuiMoveVerificationError: null,\n\tMovePrimitiveRuntimeError: bcs.option(MoveLocation),\n\tMoveAbort: bcs.tuple([MoveLocation, bcs.u64()]),\n\tVMVerificationOrDeserializationError: null,\n\tVMInvariantViolation: null,\n\tFunctionNotFound: null,\n\tArityMismatch: null,\n\tTypeArityMismatch: null,\n\tNonEntryFunctionInvoked: null,\n\tCommandArgumentError: bcs.struct('CommandArgumentError', {\n\t\targIdx: bcs.u16(),\n\t\tkind: CommandArgumentError,\n\t}),\n\tTypeArgumentError: bcs.struct('TypeArgumentError', {\n\t\targumentIdx: bcs.u16(),\n\t\tkind: TypeArgumentError,\n\t}),\n\tUnusedValueWithoutDrop: bcs.struct('UnusedValueWithoutDrop', {\n\t\tresultIdx: bcs.u16(),\n\t\tsecondaryIdx: bcs.u16(),\n\t}),\n\tInvalidPublicFunctionReturnType: bcs.struct('InvalidPublicFunctionReturnType', {\n\t\tidx: bcs.u16(),\n\t}),\n\tInvalidTransferObject: null,\n\tEffectsTooLarge: bcs.struct('EffectsTooLarge', { currentSize: bcs.u64(), maxSize: bcs.u64() }),\n\tPublishUpgradeMissingDependency: null,\n\tPublishUpgradeDependencyDowngrade: null,\n\tPackageUpgradeError: bcs.struct('PackageUpgradeError', { upgradeError: PackageUpgradeError }),\n\tWrittenObjectsTooLarge: bcs.struct('WrittenObjectsTooLarge', {\n\t\tcurrentSize: bcs.u64(),\n\t\tmaxSize: bcs.u64(),\n\t}),\n\tCertificateDenied: null,\n\tSuiMoveVerificationTimedout: null,\n\tSharedObjectOperationNotAllowed: null,\n\tInputObjectDeleted: null,\n\tExecutionCancelledDueToSharedObjectCongestion: bcs.struct(\n\t\t'ExecutionCancelledDueToSharedObjectCongestion',\n\t\t{\n\t\t\tcongested_objects: bcs.vector(Address),\n\t\t},\n\t),\n\tAddressDeniedForCoin: bcs.struct('AddressDeniedForCoin', {\n\t\taddress: Address,\n\t\tcoinType: bcs.string(),\n\t}),\n\tCoinTypeGlobalPause: bcs.struct('CoinTypeGlobalPause', { coinType: bcs.string() }),\n\tExecutionCancelledDueToRandomnessUnavailable: null,\n\tMoveVectorElemTooBig: bcs.struct('MoveVectorElemTooBig', {\n\t\tvalueSize: bcs.u64(),\n\t\tmaxScaledSize: bcs.u64(),\n\t}),\n\tMoveRawValueTooBig: bcs.struct('MoveRawValueTooBig', {\n\t\tvalueSize: bcs.u64(),\n\t\tmaxScaledSize: bcs.u64(),\n\t}),\n\tInvalidLinkage: null,\n\tInsufficientBalanceForWithdraw: null,\n\tNonExclusiveWriteInputObjectModified: bcs.struct('NonExclusiveWriteInputObjectModified', {\n\t\tid: Address,\n\t}),\n});\n\n// Rust: crates/sui-types/src/execution_status.rs\nexport const ExecutionStatus = bcs.enum('ExecutionStatus', {\n\tSuccess: null,\n\tFailure: bcs.struct('Failure', {\n\t\terror: ExecutionFailureStatus,\n\t\tcommand: bcs.option(bcs.u64()),\n\t}),\n});\n\n// Rust: crates/sui-types/src/gas.rs\nconst GasCostSummary = bcs.struct('GasCostSummary', {\n\tcomputationCost: bcs.u64(),\n\tstorageCost: bcs.u64(),\n\tstorageRebate: bcs.u64(),\n\tnonRefundableStorageFee: bcs.u64(),\n});\n\n// Rust: crates/sui-types/src/effects/effects_v1.rs\nconst TransactionEffectsV1 = bcs.struct('TransactionEffectsV1', {\n\tstatus: ExecutionStatus,\n\texecutedEpoch: bcs.u64(),\n\tgasUsed: GasCostSummary,\n\tmodifiedAtVersions: bcs.vector(bcs.tuple([Address, bcs.u64()])),\n\tsharedObjects: bcs.vector(SuiObjectRef),\n\ttransactionDigest: ObjectDigest,\n\tcreated: bcs.vector(bcs.tuple([SuiObjectRef, Owner])),\n\tmutated: bcs.vector(bcs.tuple([SuiObjectRef, Owner])),\n\tunwrapped: bcs.vector(bcs.tuple([SuiObjectRef, Owner])),\n\tdeleted: bcs.vector(SuiObjectRef),\n\tunwrappedThenDeleted: bcs.vector(SuiObjectRef),\n\twrapped: bcs.vector(SuiObjectRef),\n\tgasObject: bcs.tuple([SuiObjectRef, Owner]),\n\teventsDigest: bcs.option(ObjectDigest),\n\tdependencies: bcs.vector(ObjectDigest),\n});\n\n// Rust: crates/sui-types/src/base_types.rs\nconst VersionDigest = bcs.tuple([bcs.u64(), ObjectDigest]);\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst ObjectIn = bcs.enum('ObjectIn', {\n\tNotExist: null,\n\tExist: bcs.tuple([VersionDigest, Owner]),\n});\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst AccumulatorAddress = bcs.struct('AccumulatorAddress', {\n\taddress: Address,\n\t// TODO: ask why this is the name\n\tty: TypeTag,\n});\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst AccumulatorOperation = bcs.enum('AccumulatorOperation', {\n\tMerge: null,\n\tSplit: null,\n});\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst AccumulatorValue = bcs.enum('AccumulatorValue', {\n\tInteger: bcs.u64(),\n\tIntegerTuple: bcs.tuple([bcs.u64(), bcs.u64()]),\n\t// NonEmpty<(u64, Digest)> in Rust - vector must have at least one element\n\tEventDigest: bcs.vector(bcs.tuple([bcs.u64(), ObjectDigest])),\n});\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst AccumulatorWriteV1 = bcs.struct('AccumulatorWriteV1', {\n\taddress: AccumulatorAddress,\n\toperation: AccumulatorOperation,\n\tvalue: AccumulatorValue,\n});\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst ObjectOut = bcs.enum('ObjectOut', {\n\tNotExist: null,\n\tObjectWrite: bcs.tuple([ObjectDigest, Owner]),\n\tPackageWrite: VersionDigest,\n\tAccumulatorWriteV1: AccumulatorWriteV1,\n});\n\n// Rust: crates/sui-types/src/effects/mod.rs\nconst IDOperation = bcs.enum('IDOperation', {\n\tNone: null,\n\tCreated: null,\n\tDeleted: null,\n});\n\n// Rust: crates/sui-types/src/effects/object_change.rs\nconst EffectsObjectChange = bcs.struct('EffectsObjectChange', {\n\tinputState: ObjectIn,\n\toutputState: ObjectOut,\n\tidOperation: IDOperation,\n});\n\n// Rust: crates/sui-types/src/effects/effects_v2.rs\nconst UnchangedConsensusKind = bcs.enum('UnchangedConsensusKind', {\n\tReadOnlyRoot: VersionDigest,\n\tMutateConsensusStreamEnded: bcs.u64(),\n\tReadConsensusStreamEnded: bcs.u64(),\n\tCancelled: bcs.u64(),\n\tPerEpochConfig: null,\n});\n\n// Rust: crates/sui-types/src/effects/effects_v2.rs\nconst TransactionEffectsV2 = bcs.struct('TransactionEffectsV2', {\n\tstatus: ExecutionStatus,\n\texecutedEpoch: bcs.u64(),\n\tgasUsed: GasCostSummary,\n\ttransactionDigest: ObjectDigest,\n\tgasObjectIndex: bcs.option(bcs.u32()),\n\teventsDigest: bcs.option(ObjectDigest),\n\tdependencies: bcs.vector(ObjectDigest),\n\tlamportVersion: bcs.u64(),\n\tchangedObjects: bcs.vector(bcs.tuple([Address, EffectsObjectChange])),\n\tunchangedConsensusObjects: bcs.vector(bcs.tuple([Address, UnchangedConsensusKind])),\n\tauxDataDigest: bcs.option(ObjectDigest),\n});\n\n// Rust: crates/sui-types/src/effects/mod.rs\nexport const TransactionEffects = bcs.enum('TransactionEffects', {\n\tV1: TransactionEffectsV1,\n\tV2: TransactionEffectsV2,\n});\n"],"mappings":";;;;AAQA,MAAM,sBAAsB,IAAI,KAAK,uBAAuB;CAC3D,sBAAsB,IAAI,OAAO,wBAAwB,EAAE,WAAW,SAAS,CAAC;CAChF,aAAa,IAAI,OAAO,eAAe,EAAE,UAAU,SAAS,CAAC;CAC7D,qBAAqB;CACrB,oBAAoB,IAAI,OAAO,sBAAsB,EAAE,QAAQ,IAAI,YAAY,EAAE,CAAC;CAClF,sBAAsB,IAAI,OAAO,wBAAwB,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC;CAC9E,uBAAuB,IAAI,OAAO,yBAAyB;EAC1D,WAAW;EACX,UAAU;EACV,CAAC;CACF,CAAC;AAGF,MAAM,WAAW,IAAI,OAAO,YAAY;CACvC,SAAS;CACT,MAAM,IAAI,QAAQ;CAClB,CAAC;AAEF,MAAM,eAAe,IAAI,OAAO,gBAAgB;CAC/C,QAAQ;CACR,UAAU,IAAI,KAAK;CACnB,aAAa,IAAI,KAAK;CACtB,cAAc,IAAI,OAAO,IAAI,QAAQ,CAAC;CACtC,CAAC;AAGF,MAAM,uBAAuB,IAAI,KAAK,wBAAwB;CAC7D,cAAc;CACd,iBAAiB;CACjB,uBAAuB;CACvB,uCAAuC;CACvC,kBAAkB,IAAI,OAAO,oBAAoB,EAAE,KAAK,I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