@mysten/sui 2.35.0 → 2.36.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/CHANGELOG.md +13 -0
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/bcs.mjs +4 -2
- package/dist/bcs/bcs.mjs.map +1 -1
- package/dist/bcs/index.d.mts +12 -3
- package/dist/bcs/index.d.mts.map +1 -1
- package/dist/cryptography/publickey.mjs +1 -0
- package/dist/cryptography/publickey.mjs.map +1 -1
- package/dist/cryptography/signature-scheme.d.mts +4 -1
- package/dist/cryptography/signature-scheme.d.mts.map +1 -1
- package/dist/cryptography/signature-scheme.mjs +6 -3
- package/dist/cryptography/signature-scheme.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/cryptography/signature.mjs +2 -1
- package/dist/cryptography/signature.mjs.map +1 -1
- package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
- package/dist/keypairs/mldsa65/index.d.mts +3 -0
- package/dist/keypairs/mldsa65/index.mjs +4 -0
- package/dist/keypairs/mldsa65/keypair.d.mts +67 -0
- package/dist/keypairs/mldsa65/keypair.d.mts.map +1 -0
- package/dist/keypairs/mldsa65/keypair.mjs +91 -0
- package/dist/keypairs/mldsa65/keypair.mjs.map +1 -0
- package/dist/keypairs/mldsa65/publickey.d.mts +37 -0
- package/dist/keypairs/mldsa65/publickey.d.mts.map +1 -0
- package/dist/keypairs/mldsa65/publickey.mjs +64 -0
- package/dist/keypairs/mldsa65/publickey.mjs.map +1 -0
- package/dist/multisig/publickey.d.mts +4 -0
- package/dist/multisig/publickey.d.mts.map +1 -1
- package/dist/multisig/publickey.mjs +7 -6
- package/dist/multisig/publickey.mjs.map +1 -1
- package/dist/transactions/Transaction.d.mts +6 -6
- package/dist/verify/verify.d.mts.map +1 -1
- package/dist/verify/verify.mjs +4 -0
- package/dist/verify/verify.mjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/address-seed.d.mts +6 -0
- package/dist/zklogin/address-seed.d.mts.map +1 -0
- package/dist/zklogin/address-seed.mjs +51 -0
- package/dist/zklogin/address-seed.mjs.map +1 -0
- package/dist/zklogin/address.d.mts.map +1 -1
- package/dist/zklogin/address.mjs +2 -1
- package/dist/zklogin/address.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/index.d.mts +2 -1
- package/dist/zklogin/index.mjs +3 -2
- package/dist/zklogin/nonce.mjs +1 -1
- package/dist/zklogin/utils.d.mts +1 -3
- package/dist/zklogin/utils.d.mts.map +1 -1
- package/dist/zklogin/utils.mjs +1 -46
- package/dist/zklogin/utils.mjs.map +1 -1
- package/docs/cryptography/index.md +7 -6
- package/docs/cryptography/keypairs.md +13 -1
- package/docs/llms-index.md +1 -1
- package/package.json +7 -1
- package/src/bcs/bcs.ts +4 -0
- package/src/cryptography/publickey.ts +1 -0
- package/src/cryptography/signature-scheme.ts +4 -1
- package/src/cryptography/signature.ts +1 -0
- package/src/keypairs/mldsa65/index.ts +5 -0
- package/src/keypairs/mldsa65/keypair.ts +128 -0
- package/src/keypairs/mldsa65/publickey.ts +95 -0
- package/src/multisig/publickey.ts +13 -9
- package/src/verify/verify.ts +4 -0
- package/src/version.ts +1 -1
- package/src/zklogin/address-seed.ts +86 -0
- package/src/zklogin/address.ts +2 -6
- package/src/zklogin/index.ts +1 -2
- package/src/zklogin/utils.ts +0 -83
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @mysten/sui.js
|
|
2
2
|
|
|
3
|
+
## 2.36.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ad42dd8: Add ML-DSA-65 (FIPS 204) support: `MLDSA65Keypair` and `MLDSA65PublicKey` under
|
|
8
|
+
`@mysten/sui/keypairs/mldsa65`, signature scheme flag `0x07`, and ML-DSA-65 members in multisig
|
|
9
|
+
and the verify helpers.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7a9b3e5: Avoid initializing Poseidon when importing keypairs or parsing signatures by separating
|
|
14
|
+
zkLogin public-key encoding helpers from address-seed hashing.
|
|
15
|
+
|
|
3
16
|
## 2.35.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/bcs/bcs.d.mts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { TypeTag as TypeTag$1 } from "./types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_bcs1264 from "@mysten/bcs";
|
|
3
3
|
import { BcsType } from "@mysten/bcs";
|
|
4
4
|
|
|
5
5
|
//#region src/bcs/bcs.d.ts
|
|
6
6
|
declare const TypeTag: BcsType<string, string | TypeTag$1, string>;
|
|
7
|
-
declare function IntentMessage<T extends BcsType<any>>(T: T):
|
|
8
|
-
intent:
|
|
9
|
-
scope:
|
|
7
|
+
declare function IntentMessage<T extends BcsType<any>>(T: T): _mysten_bcs1264.BcsStruct<{
|
|
8
|
+
intent: _mysten_bcs1264.BcsStruct<{
|
|
9
|
+
scope: _mysten_bcs1264.BcsEnum<{
|
|
10
10
|
TransactionData: null;
|
|
11
11
|
TransactionEffects: null;
|
|
12
12
|
CheckpointSummary: null;
|
|
13
13
|
PersonalMessage: null;
|
|
14
14
|
}, "IntentScope">;
|
|
15
|
-
version:
|
|
15
|
+
version: _mysten_bcs1264.BcsEnum<{
|
|
16
16
|
V0: null;
|
|
17
17
|
}, "IntentVersion">;
|
|
18
|
-
appId:
|
|
18
|
+
appId: _mysten_bcs1264.BcsEnum<{
|
|
19
19
|
Sui: null;
|
|
20
20
|
}, "AppId">;
|
|
21
21
|
}, string>;
|
package/dist/bcs/bcs.mjs
CHANGED
|
@@ -230,14 +230,16 @@ const CompressedSignature = bcs.enum("CompressedSignature", {
|
|
|
230
230
|
Secp256k1: bcs.bytes(64),
|
|
231
231
|
Secp256r1: bcs.bytes(64),
|
|
232
232
|
ZkLogin: bcs.byteVector(),
|
|
233
|
-
Passkey: bcs.byteVector()
|
|
233
|
+
Passkey: bcs.byteVector(),
|
|
234
|
+
MLDSA65: bcs.bytes(3309)
|
|
234
235
|
});
|
|
235
236
|
const PublicKey = bcs.enum("PublicKey", {
|
|
236
237
|
ED25519: bcs.bytes(32),
|
|
237
238
|
Secp256k1: bcs.bytes(33),
|
|
238
239
|
Secp256r1: bcs.bytes(33),
|
|
239
240
|
ZkLogin: bcs.byteVector(),
|
|
240
|
-
Passkey: bcs.bytes(33)
|
|
241
|
+
Passkey: bcs.bytes(33),
|
|
242
|
+
MLDSA65: bcs.bytes(1952)
|
|
241
243
|
});
|
|
242
244
|
const MultiSigPkMap = bcs.struct("MultiSigPkMap", {
|
|
243
245
|
pubKey: PublicKey,
|
package/dist/bcs/bcs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcs.mjs","names":[],"sources":["../../src/bcs/bcs.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { BcsType, BcsTypeOptions } from '@mysten/bcs';\nimport { bcs, fromBase58, fromBase64, fromHex, toBase58, toBase64, toHex } from '@mysten/bcs';\n\nimport { isValidSuiAddress, normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';\nimport { TypeTagSerializer } from './type-tag-serializer.js';\nimport type { TypeTag as TypeTagType } from './types.js';\n\nfunction unsafe_u64(options?: BcsTypeOptions<number>) {\n\treturn bcs\n\t\t.u64({\n\t\t\tname: 'unsafe_u64',\n\t\t\t...(options as object),\n\t\t})\n\t\t.transform({\n\t\t\tinput: (val: number | string) => val,\n\t\t\toutput: (val) => Number(val),\n\t\t});\n}\n\nfunction optionEnum<T extends BcsType<any, any>>(type: T) {\n\treturn bcs.enum('Option', {\n\t\tNone: null,\n\t\tSome: type,\n\t});\n}\n\nexport const Address = bcs.bytes(SUI_ADDRESS_LENGTH).transform({\n\tvalidate: (val) => {\n\t\tconst address = typeof val === 'string' ? val : toHex(val);\n\t\tif (!address || !isValidSuiAddress(normalizeSuiAddress(address))) {\n\t\t\tthrow new Error(`Invalid Sui address ${address}`);\n\t\t}\n\t},\n\tinput: (val: string | Uint8Array) =>\n\t\ttypeof val === 'string' ? fromHex(normalizeSuiAddress(val)) : val,\n\toutput: (val) => normalizeSuiAddress(toHex(val)),\n});\n\nexport const ObjectDigest = bcs.byteVector().transform({\n\tname: 'ObjectDigest',\n\tinput: (value: string) => fromBase58(value),\n\toutput: (value) => toBase58(new Uint8Array(value)),\n\tvalidate: (value) => {\n\t\tif (fromBase58(value).length !== 32) {\n\t\t\tthrow new Error('ObjectDigest must be 32 bytes');\n\t\t}\n\t},\n});\n\nexport const SuiObjectRef = bcs.struct('SuiObjectRef', {\n\tobjectId: Address,\n\tversion: bcs.u64(),\n\tdigest: ObjectDigest,\n});\n\nexport const SharedObjectRef = bcs.struct('SharedObjectRef', {\n\tobjectId: Address,\n\tinitialSharedVersion: bcs.u64(),\n\tmutable: bcs.bool(),\n});\n\nexport const ObjectArg = bcs.enum('ObjectArg', {\n\tImmOrOwnedObject: SuiObjectRef,\n\tSharedObject: SharedObjectRef,\n\tReceiving: SuiObjectRef,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const Owner = bcs.enum('Owner', {\n\tAddressOwner: Address,\n\tObjectOwner: Address,\n\tShared: bcs.struct('Shared', {\n\t\tinitialSharedVersion: bcs.u64(),\n\t}),\n\tImmutable: null,\n\tConsensusAddressOwner: bcs.struct('ConsensusAddressOwner', {\n\t\tstartVersion: bcs.u64(),\n\t\towner: Address,\n\t}),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const Reservation = bcs.enum('Reservation', {\n\tMaxAmountU64: bcs.u64(),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const WithdrawalType = bcs.enum('WithdrawalType', {\n\tBalance: bcs.lazy(() => TypeTag),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const WithdrawFrom = bcs.enum('WithdrawFrom', {\n\tSender: null,\n\tSponsor: null,\n\tSenderAllowance: bcs.struct('SenderAllowance', {\n\t\tfunder: Address,\n\t\tallowance: Address,\n\t}),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const FundsWithdrawal = bcs.struct('FundsWithdrawal', {\n\treservation: Reservation,\n\ttypeArg: WithdrawalType,\n\twithdrawFrom: WithdrawFrom,\n});\n\nexport const CallArg = bcs.enum('CallArg', {\n\tPure: bcs.struct('Pure', {\n\t\tbytes: bcs.byteVector().transform({\n\t\t\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\t\t\toutput: (val) => toBase64(new Uint8Array(val)),\n\t\t}),\n\t}),\n\tObject: ObjectArg,\n\tFundsWithdrawal: FundsWithdrawal,\n});\n\nconst InnerTypeTag: BcsType<TypeTagType, TypeTagType> = bcs.enum('TypeTag', {\n\tbool: null,\n\tu8: null,\n\tu64: null,\n\tu128: null,\n\taddress: null,\n\tsigner: null,\n\tvector: bcs.lazy(() => InnerTypeTag),\n\tstruct: bcs.lazy(() => StructTag),\n\tu16: null,\n\tu32: null,\n\tu256: null,\n}) as BcsType<TypeTagType>;\n\nexport const TypeTag = InnerTypeTag.transform({\n\tinput: (typeTag: string | TypeTagType) =>\n\t\ttypeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag, true) : typeTag,\n\toutput: (typeTag: TypeTagType) => TypeTagSerializer.tagToString(typeTag),\n});\n\nexport const Argument = bcs.enum('Argument', {\n\tGasCoin: null,\n\tInput: bcs.u16(),\n\tResult: bcs.u16(),\n\tNestedResult: bcs.tuple([bcs.u16(), bcs.u16()]),\n});\n\nexport const ProgrammableMoveCall = bcs.struct('ProgrammableMoveCall', {\n\tpackage: Address,\n\tmodule: bcs.string(),\n\tfunction: bcs.string(),\n\ttypeArguments: bcs.vector(TypeTag),\n\targuments: bcs.vector(Argument),\n});\n\nexport const Command = bcs.enum('Command', {\n\t/**\n\t * A Move Call - any public Move function can be called via\n\t * this transaction. The results can be used that instant to pass\n\t * into the next transaction.\n\t */\n\tMoveCall: ProgrammableMoveCall,\n\t/**\n\t * Transfer vector of objects to a receiver.\n\t */\n\tTransferObjects: bcs.struct('TransferObjects', {\n\t\tobjects: bcs.vector(Argument),\n\t\taddress: Argument,\n\t}),\n\t// /**\n\t// * Split `amount` from a `coin`.\n\t// */\n\tSplitCoins: bcs.struct('SplitCoins', {\n\t\tcoin: Argument,\n\t\tamounts: bcs.vector(Argument),\n\t}),\n\t// /**\n\t// * Merge Vector of Coins (`sources`) into a `destination`.\n\t// */\n\tMergeCoins: bcs.struct('MergeCoins', {\n\t\tdestination: Argument,\n\t\tsources: bcs.vector(Argument),\n\t}),\n\t// /**\n\t// * Publish a Move module.\n\t// */\n\tPublish: bcs.struct('Publish', {\n\t\tmodules: bcs.vector(\n\t\t\tbcs.byteVector().transform({\n\t\t\t\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\t\t\t\toutput: (val) => toBase64(new Uint8Array(val)),\n\t\t\t}),\n\t\t),\n\t\tdependencies: bcs.vector(Address),\n\t}),\n\t// /**\n\t// * Build a vector of objects using the input arguments.\n\t// * It is impossible to export construct a `vector<T: key>` otherwise,\n\t// * so this call serves a utility function.\n\t// */\n\tMakeMoveVec: bcs.struct('MakeMoveVec', {\n\t\ttype: optionEnum(TypeTag).transform({\n\t\t\tinput: (val: string | null) =>\n\t\t\t\tval === null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tNone: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tSome: val,\n\t\t\t\t\t\t},\n\t\t\toutput: (val) => val.Some ?? null,\n\t\t}),\n\t\telements: bcs.vector(Argument),\n\t}),\n\tUpgrade: bcs.struct('Upgrade', {\n\t\tmodules: bcs.vector(\n\t\t\tbcs.byteVector().transform({\n\t\t\t\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\t\t\t\toutput: (val) => toBase64(new Uint8Array(val)),\n\t\t\t}),\n\t\t),\n\t\tdependencies: bcs.vector(Address),\n\t\tpackage: Address,\n\t\tticket: Argument,\n\t}),\n});\n\nexport const ProgrammableTransaction = bcs.struct('ProgrammableTransaction', {\n\tinputs: bcs.vector(CallArg),\n\tcommands: bcs.vector(Command),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const ValidDuring = bcs.struct('ValidDuring', {\n\tminEpoch: bcs.option(bcs.u64()),\n\tmaxEpoch: bcs.option(bcs.u64()),\n\tminTimestamp: bcs.option(bcs.u64()),\n\tmaxTimestamp: bcs.option(bcs.u64()),\n\tchain: ObjectDigest,\n\tnonce: bcs.u32(),\n});\n\nexport function assertAllowedProposersNotEmpty(proposers: number[]) {\n\tif (proposers.length === 0) {\n\t\tthrow new Error('Allowed proposers must not be empty');\n\t}\n\n\treturn proposers;\n}\n\nexport function assertAllowedProposersStrictlyIncreasing(proposers: number[]) {\n\tassertAllowedProposersNotEmpty(proposers);\n\n\tfor (let i = 1; i < proposers.length; i++) {\n\t\tif (proposers[i] <= proposers[i - 1]) {\n\t\t\tthrow new Error('Allowed proposers must be strictly increasing');\n\t\t}\n\t}\n\n\treturn proposers;\n}\n\n// Upstream only checks sortedness in `validity_check`, on submission, so decoding an unsorted\n// set must succeed. Empty is a deserialization error there, and here.\nconst AllowedProposerIndices = bcs.vector(bcs.u32()).transform({\n\tinput: assertAllowedProposersStrictlyIncreasing,\n\toutput: assertAllowedProposersNotEmpty,\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const AllowedProposers = bcs.struct('AllowedProposers', {\n\tepoch: bcs.u64(),\n\tproposers: AllowedProposerIndices,\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const Validity = bcs.struct('Validity', {\n\tminEpoch: bcs.option(bcs.u64()),\n\tmaxEpoch: bcs.option(bcs.u64()),\n\tminTimestamp: bcs.option(bcs.u64()),\n\tmaxTimestamp: bcs.option(bcs.u64()),\n\tchain: ObjectDigest,\n\tnonce: bcs.u32(),\n\tallowedProposers: bcs.option(AllowedProposers),\n});\n\nexport const TransactionExpiration = bcs.enum('TransactionExpiration', {\n\tNone: null,\n\tEpoch: unsafe_u64(),\n\tValidDuring: ValidDuring,\n\tValidity,\n});\n\nexport const StructTag = bcs.struct('StructTag', {\n\taddress: Address,\n\tmodule: bcs.string(),\n\tname: bcs.string(),\n\ttypeParams: bcs.vector(InnerTypeTag),\n});\n\nexport const GasData = bcs.struct('GasData', {\n\tpayment: bcs.vector(SuiObjectRef),\n\towner: Address,\n\tprice: bcs.u64(),\n\tbudget: bcs.u64(),\n});\n\nexport const IntentScope = bcs.enum('IntentScope', {\n\tTransactionData: null,\n\tTransactionEffects: null,\n\tCheckpointSummary: null,\n\tPersonalMessage: null,\n});\n\nexport const IntentVersion = bcs.enum('IntentVersion', {\n\tV0: null,\n});\n\nexport const AppId = bcs.enum('AppId', {\n\tSui: null,\n});\n\nexport const Intent = bcs.struct('Intent', {\n\tscope: IntentScope,\n\tversion: IntentVersion,\n\tappId: AppId,\n});\n\nexport function IntentMessage<T extends BcsType<any>>(T: T) {\n\treturn bcs.struct(`IntentMessage<${T.name}>`, {\n\t\tintent: Intent,\n\t\tvalue: T,\n\t});\n}\n\nexport const CompressedSignature = bcs.enum('CompressedSignature', {\n\tED25519: bcs.bytes(64),\n\tSecp256k1: bcs.bytes(64),\n\tSecp256r1: bcs.bytes(64),\n\tZkLogin: bcs.byteVector(),\n\tPasskey: bcs.byteVector(),\n});\n\nexport const PublicKey = bcs.enum('PublicKey', {\n\tED25519: bcs.bytes(32),\n\tSecp256k1: bcs.bytes(33),\n\tSecp256r1: bcs.bytes(33),\n\tZkLogin: bcs.byteVector(),\n\tPasskey: bcs.bytes(33),\n});\n\nexport const MultiSigPkMap = bcs.struct('MultiSigPkMap', {\n\tpubKey: PublicKey,\n\tweight: bcs.u8(),\n});\n\nexport const MultiSigPublicKey = bcs.struct('MultiSigPublicKey', {\n\tpk_map: bcs.vector(MultiSigPkMap),\n\tthreshold: bcs.u16(),\n});\n\nexport const MultiSig = bcs.struct('MultiSig', {\n\tsigs: bcs.vector(CompressedSignature),\n\tbitmap: bcs.u16(),\n\tmultisig_pk: MultiSigPublicKey,\n});\n\nexport const base64String = bcs.byteVector().transform({\n\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\toutput: (val) => toBase64(new Uint8Array(val)),\n});\n\nexport const PasskeyAuthenticator = bcs.struct('PasskeyAuthenticator', {\n\tauthenticatorData: bcs.byteVector(),\n\tclientDataJson: bcs.string(),\n\tuserSignature: bcs.byteVector(),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const MoveObjectType = bcs.enum('MoveObjectType', {\n\tOther: StructTag,\n\tGasCoin: null,\n\tStakedSui: null,\n\tCoin: TypeTag,\n\tAccumulatorBalanceWrapper: null,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const TypeOrigin = bcs.struct('TypeOrigin', {\n\tmoduleName: bcs.string(),\n\tdatatypeName: bcs.string(),\n\tpackage: Address,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const UpgradeInfo = bcs.struct('UpgradeInfo', {\n\tupgradedId: Address,\n\tupgradedVersion: bcs.u64(),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const MovePackage = bcs.struct('MovePackage', {\n\tid: Address,\n\tversion: bcs.u64(),\n\tmoduleMap: bcs.map(bcs.string(), bcs.byteVector()),\n\ttypeOriginTable: bcs.vector(TypeOrigin),\n\tlinkageTable: bcs.map(Address, UpgradeInfo),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const MoveObject = bcs.struct('MoveObject', {\n\ttype: MoveObjectType,\n\thasPublicTransfer: bcs.bool(),\n\tversion: bcs.u64(),\n\tcontents: bcs.byteVector(),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const Data = bcs.enum('Data', {\n\tMove: MoveObject,\n\tPackage: MovePackage,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const ObjectInner = bcs.struct('ObjectInner', {\n\tdata: Data,\n\towner: Owner,\n\tpreviousTransaction: ObjectDigest,\n\tstorageRebate: bcs.u64(),\n});\n"],"mappings":";;;;;AAUA,SAAS,WAAW,SAAkC;AACrD,QAAO,IACL,IAAI;EACJ,MAAM;EACN,GAAI;EACJ,CAAC,CACD,UAAU;EACV,QAAQ,QAAyB;EACjC,SAAS,QAAQ,OAAO,IAAI;EAC5B,CAAC;;AAGJ,SAAS,WAAwC,MAAS;AACzD,QAAO,IAAI,KAAK,UAAU;EACzB,MAAM;EACN,MAAM;EACN,CAAC;;AAGH,MAAa,UAAU,IAAI,MAAM,mBAAmB,CAAC,UAAU;CAC9D,WAAW,QAAQ;EAClB,MAAM,UAAU,OAAO,QAAQ,WAAW,MAAM,MAAM,IAAI;AAC1D,MAAI,CAAC,WAAW,CAAC,kBAAkB,oBAAoB,QAAQ,CAAC,CAC/D,OAAM,IAAI,MAAM,uBAAuB,UAAU;;CAGnD,QAAQ,QACP,OAAO,QAAQ,WAAW,QAAQ,oBAAoB,IAAI,CAAC,GAAG;CAC/D,SAAS,QAAQ,oBAAoB,MAAM,IAAI,CAAC;CAChD,CAAC;AAEF,MAAa,eAAe,IAAI,YAAY,CAAC,UAAU;CACtD,MAAM;CACN,QAAQ,UAAkB,WAAW,MAAM;CAC3C,SAAS,UAAU,SAAS,IAAI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OAAO,cAAc;CAClD,YAAY,IAAI,QAAQ;CACxB,cAAc,IAAI,QAAQ;CAC1B,SAAS;CACT,CAAC;AAGF,MAAa,cAAc,IAAI,OAAO,eAAe;CACpD,YAAY;CACZ,iBAAiB,IAAI,KAAK;CAC1B,CAAC;AAGF,MAAa,cAAc,IAAI,OAAO,eAAe;CACpD,IAAI;CACJ,SAAS,IAAI,KAAK;CAClB,WAAW,IAAI,IAAI,IAAI,QAAQ,EAAE,IAAI,YAAY,CAAC;CAClD,iBAAiB,IAAI,OAAO,WAAW;CACvC,cAAc,IAAI,IAAI,SAAS,YAAY;CAC3C,CAAC;AAGF,MAAa,aAAa,IAAI,OAAO,cAAc;CAClD,MAAM;CACN,mBAAmB,IAAI,MAAM;CAC7B,SAAS,IAAI,KAAK;CAClB,UAAU,IAAI,YAAY;CAC1B,CAAC;AAGF,MAAa,OAAO,IAAI,KAAK,QAAQ;CACpC,MAAM;CACN,SAAS;CACT,CAAC;AAGF,MAAa,cAAc,IAAI,OAAO,eAAe;CACpD,MAAM;CACN,OAAO;CACP,qBAAqB;CACrB,eAAe,IAAI,KAAK;CACxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"bcs.mjs","names":[],"sources":["../../src/bcs/bcs.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { BcsType, BcsTypeOptions } from '@mysten/bcs';\nimport { bcs, fromBase58, fromBase64, fromHex, toBase58, toBase64, toHex } from '@mysten/bcs';\n\nimport { isValidSuiAddress, normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';\nimport { TypeTagSerializer } from './type-tag-serializer.js';\nimport type { TypeTag as TypeTagType } from './types.js';\n\nfunction unsafe_u64(options?: BcsTypeOptions<number>) {\n\treturn bcs\n\t\t.u64({\n\t\t\tname: 'unsafe_u64',\n\t\t\t...(options as object),\n\t\t})\n\t\t.transform({\n\t\t\tinput: (val: number | string) => val,\n\t\t\toutput: (val) => Number(val),\n\t\t});\n}\n\nfunction optionEnum<T extends BcsType<any, any>>(type: T) {\n\treturn bcs.enum('Option', {\n\t\tNone: null,\n\t\tSome: type,\n\t});\n}\n\nexport const Address = bcs.bytes(SUI_ADDRESS_LENGTH).transform({\n\tvalidate: (val) => {\n\t\tconst address = typeof val === 'string' ? val : toHex(val);\n\t\tif (!address || !isValidSuiAddress(normalizeSuiAddress(address))) {\n\t\t\tthrow new Error(`Invalid Sui address ${address}`);\n\t\t}\n\t},\n\tinput: (val: string | Uint8Array) =>\n\t\ttypeof val === 'string' ? fromHex(normalizeSuiAddress(val)) : val,\n\toutput: (val) => normalizeSuiAddress(toHex(val)),\n});\n\nexport const ObjectDigest = bcs.byteVector().transform({\n\tname: 'ObjectDigest',\n\tinput: (value: string) => fromBase58(value),\n\toutput: (value) => toBase58(new Uint8Array(value)),\n\tvalidate: (value) => {\n\t\tif (fromBase58(value).length !== 32) {\n\t\t\tthrow new Error('ObjectDigest must be 32 bytes');\n\t\t}\n\t},\n});\n\nexport const SuiObjectRef = bcs.struct('SuiObjectRef', {\n\tobjectId: Address,\n\tversion: bcs.u64(),\n\tdigest: ObjectDigest,\n});\n\nexport const SharedObjectRef = bcs.struct('SharedObjectRef', {\n\tobjectId: Address,\n\tinitialSharedVersion: bcs.u64(),\n\tmutable: bcs.bool(),\n});\n\nexport const ObjectArg = bcs.enum('ObjectArg', {\n\tImmOrOwnedObject: SuiObjectRef,\n\tSharedObject: SharedObjectRef,\n\tReceiving: SuiObjectRef,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const Owner = bcs.enum('Owner', {\n\tAddressOwner: Address,\n\tObjectOwner: Address,\n\tShared: bcs.struct('Shared', {\n\t\tinitialSharedVersion: bcs.u64(),\n\t}),\n\tImmutable: null,\n\tConsensusAddressOwner: bcs.struct('ConsensusAddressOwner', {\n\t\tstartVersion: bcs.u64(),\n\t\towner: Address,\n\t}),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const Reservation = bcs.enum('Reservation', {\n\tMaxAmountU64: bcs.u64(),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const WithdrawalType = bcs.enum('WithdrawalType', {\n\tBalance: bcs.lazy(() => TypeTag),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const WithdrawFrom = bcs.enum('WithdrawFrom', {\n\tSender: null,\n\tSponsor: null,\n\tSenderAllowance: bcs.struct('SenderAllowance', {\n\t\tfunder: Address,\n\t\tallowance: Address,\n\t}),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const FundsWithdrawal = bcs.struct('FundsWithdrawal', {\n\treservation: Reservation,\n\ttypeArg: WithdrawalType,\n\twithdrawFrom: WithdrawFrom,\n});\n\nexport const CallArg = bcs.enum('CallArg', {\n\tPure: bcs.struct('Pure', {\n\t\tbytes: bcs.byteVector().transform({\n\t\t\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\t\t\toutput: (val) => toBase64(new Uint8Array(val)),\n\t\t}),\n\t}),\n\tObject: ObjectArg,\n\tFundsWithdrawal: FundsWithdrawal,\n});\n\nconst InnerTypeTag: BcsType<TypeTagType, TypeTagType> = bcs.enum('TypeTag', {\n\tbool: null,\n\tu8: null,\n\tu64: null,\n\tu128: null,\n\taddress: null,\n\tsigner: null,\n\tvector: bcs.lazy(() => InnerTypeTag),\n\tstruct: bcs.lazy(() => StructTag),\n\tu16: null,\n\tu32: null,\n\tu256: null,\n}) as BcsType<TypeTagType>;\n\nexport const TypeTag = InnerTypeTag.transform({\n\tinput: (typeTag: string | TypeTagType) =>\n\t\ttypeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag, true) : typeTag,\n\toutput: (typeTag: TypeTagType) => TypeTagSerializer.tagToString(typeTag),\n});\n\nexport const Argument = bcs.enum('Argument', {\n\tGasCoin: null,\n\tInput: bcs.u16(),\n\tResult: bcs.u16(),\n\tNestedResult: bcs.tuple([bcs.u16(), bcs.u16()]),\n});\n\nexport const ProgrammableMoveCall = bcs.struct('ProgrammableMoveCall', {\n\tpackage: Address,\n\tmodule: bcs.string(),\n\tfunction: bcs.string(),\n\ttypeArguments: bcs.vector(TypeTag),\n\targuments: bcs.vector(Argument),\n});\n\nexport const Command = bcs.enum('Command', {\n\t/**\n\t * A Move Call - any public Move function can be called via\n\t * this transaction. The results can be used that instant to pass\n\t * into the next transaction.\n\t */\n\tMoveCall: ProgrammableMoveCall,\n\t/**\n\t * Transfer vector of objects to a receiver.\n\t */\n\tTransferObjects: bcs.struct('TransferObjects', {\n\t\tobjects: bcs.vector(Argument),\n\t\taddress: Argument,\n\t}),\n\t// /**\n\t// * Split `amount` from a `coin`.\n\t// */\n\tSplitCoins: bcs.struct('SplitCoins', {\n\t\tcoin: Argument,\n\t\tamounts: bcs.vector(Argument),\n\t}),\n\t// /**\n\t// * Merge Vector of Coins (`sources`) into a `destination`.\n\t// */\n\tMergeCoins: bcs.struct('MergeCoins', {\n\t\tdestination: Argument,\n\t\tsources: bcs.vector(Argument),\n\t}),\n\t// /**\n\t// * Publish a Move module.\n\t// */\n\tPublish: bcs.struct('Publish', {\n\t\tmodules: bcs.vector(\n\t\t\tbcs.byteVector().transform({\n\t\t\t\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\t\t\t\toutput: (val) => toBase64(new Uint8Array(val)),\n\t\t\t}),\n\t\t),\n\t\tdependencies: bcs.vector(Address),\n\t}),\n\t// /**\n\t// * Build a vector of objects using the input arguments.\n\t// * It is impossible to export construct a `vector<T: key>` otherwise,\n\t// * so this call serves a utility function.\n\t// */\n\tMakeMoveVec: bcs.struct('MakeMoveVec', {\n\t\ttype: optionEnum(TypeTag).transform({\n\t\t\tinput: (val: string | null) =>\n\t\t\t\tval === null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tNone: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tSome: val,\n\t\t\t\t\t\t},\n\t\t\toutput: (val) => val.Some ?? null,\n\t\t}),\n\t\telements: bcs.vector(Argument),\n\t}),\n\tUpgrade: bcs.struct('Upgrade', {\n\t\tmodules: bcs.vector(\n\t\t\tbcs.byteVector().transform({\n\t\t\t\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\t\t\t\toutput: (val) => toBase64(new Uint8Array(val)),\n\t\t\t}),\n\t\t),\n\t\tdependencies: bcs.vector(Address),\n\t\tpackage: Address,\n\t\tticket: Argument,\n\t}),\n});\n\nexport const ProgrammableTransaction = bcs.struct('ProgrammableTransaction', {\n\tinputs: bcs.vector(CallArg),\n\tcommands: bcs.vector(Command),\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const ValidDuring = bcs.struct('ValidDuring', {\n\tminEpoch: bcs.option(bcs.u64()),\n\tmaxEpoch: bcs.option(bcs.u64()),\n\tminTimestamp: bcs.option(bcs.u64()),\n\tmaxTimestamp: bcs.option(bcs.u64()),\n\tchain: ObjectDigest,\n\tnonce: bcs.u32(),\n});\n\nexport function assertAllowedProposersNotEmpty(proposers: number[]) {\n\tif (proposers.length === 0) {\n\t\tthrow new Error('Allowed proposers must not be empty');\n\t}\n\n\treturn proposers;\n}\n\nexport function assertAllowedProposersStrictlyIncreasing(proposers: number[]) {\n\tassertAllowedProposersNotEmpty(proposers);\n\n\tfor (let i = 1; i < proposers.length; i++) {\n\t\tif (proposers[i] <= proposers[i - 1]) {\n\t\t\tthrow new Error('Allowed proposers must be strictly increasing');\n\t\t}\n\t}\n\n\treturn proposers;\n}\n\n// Upstream only checks sortedness in `validity_check`, on submission, so decoding an unsorted\n// set must succeed. Empty is a deserialization error there, and here.\nconst AllowedProposerIndices = bcs.vector(bcs.u32()).transform({\n\tinput: assertAllowedProposersStrictlyIncreasing,\n\toutput: assertAllowedProposersNotEmpty,\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const AllowedProposers = bcs.struct('AllowedProposers', {\n\tepoch: bcs.u64(),\n\tproposers: AllowedProposerIndices,\n});\n\n// Rust: crates/sui-types/src/transaction.rs\nexport const Validity = bcs.struct('Validity', {\n\tminEpoch: bcs.option(bcs.u64()),\n\tmaxEpoch: bcs.option(bcs.u64()),\n\tminTimestamp: bcs.option(bcs.u64()),\n\tmaxTimestamp: bcs.option(bcs.u64()),\n\tchain: ObjectDigest,\n\tnonce: bcs.u32(),\n\tallowedProposers: bcs.option(AllowedProposers),\n});\n\nexport const TransactionExpiration = bcs.enum('TransactionExpiration', {\n\tNone: null,\n\tEpoch: unsafe_u64(),\n\tValidDuring: ValidDuring,\n\tValidity,\n});\n\nexport const StructTag = bcs.struct('StructTag', {\n\taddress: Address,\n\tmodule: bcs.string(),\n\tname: bcs.string(),\n\ttypeParams: bcs.vector(InnerTypeTag),\n});\n\nexport const GasData = bcs.struct('GasData', {\n\tpayment: bcs.vector(SuiObjectRef),\n\towner: Address,\n\tprice: bcs.u64(),\n\tbudget: bcs.u64(),\n});\n\nexport const IntentScope = bcs.enum('IntentScope', {\n\tTransactionData: null,\n\tTransactionEffects: null,\n\tCheckpointSummary: null,\n\tPersonalMessage: null,\n});\n\nexport const IntentVersion = bcs.enum('IntentVersion', {\n\tV0: null,\n});\n\nexport const AppId = bcs.enum('AppId', {\n\tSui: null,\n});\n\nexport const Intent = bcs.struct('Intent', {\n\tscope: IntentScope,\n\tversion: IntentVersion,\n\tappId: AppId,\n});\n\nexport function IntentMessage<T extends BcsType<any>>(T: T) {\n\treturn bcs.struct(`IntentMessage<${T.name}>`, {\n\t\tintent: Intent,\n\t\tvalue: T,\n\t});\n}\n\nexport const CompressedSignature = bcs.enum('CompressedSignature', {\n\tED25519: bcs.bytes(64),\n\tSecp256k1: bcs.bytes(64),\n\tSecp256r1: bcs.bytes(64),\n\tZkLogin: bcs.byteVector(),\n\tPasskey: bcs.byteVector(),\n\tMLDSA65: bcs.bytes(3309),\n});\n\n// Variant order must match Sui's `PublicKey` enum, which validators hash to\n// derive a multisig address.\nexport const PublicKey = bcs.enum('PublicKey', {\n\tED25519: bcs.bytes(32),\n\tSecp256k1: bcs.bytes(33),\n\tSecp256r1: bcs.bytes(33),\n\tZkLogin: bcs.byteVector(),\n\tPasskey: bcs.bytes(33),\n\tMLDSA65: bcs.bytes(1952),\n});\n\nexport const MultiSigPkMap = bcs.struct('MultiSigPkMap', {\n\tpubKey: PublicKey,\n\tweight: bcs.u8(),\n});\n\nexport const MultiSigPublicKey = bcs.struct('MultiSigPublicKey', {\n\tpk_map: bcs.vector(MultiSigPkMap),\n\tthreshold: bcs.u16(),\n});\n\nexport const MultiSig = bcs.struct('MultiSig', {\n\tsigs: bcs.vector(CompressedSignature),\n\tbitmap: bcs.u16(),\n\tmultisig_pk: MultiSigPublicKey,\n});\n\nexport const base64String = bcs.byteVector().transform({\n\tinput: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),\n\toutput: (val) => toBase64(new Uint8Array(val)),\n});\n\nexport const PasskeyAuthenticator = bcs.struct('PasskeyAuthenticator', {\n\tauthenticatorData: bcs.byteVector(),\n\tclientDataJson: bcs.string(),\n\tuserSignature: bcs.byteVector(),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const MoveObjectType = bcs.enum('MoveObjectType', {\n\tOther: StructTag,\n\tGasCoin: null,\n\tStakedSui: null,\n\tCoin: TypeTag,\n\tAccumulatorBalanceWrapper: null,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const TypeOrigin = bcs.struct('TypeOrigin', {\n\tmoduleName: bcs.string(),\n\tdatatypeName: bcs.string(),\n\tpackage: Address,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const UpgradeInfo = bcs.struct('UpgradeInfo', {\n\tupgradedId: Address,\n\tupgradedVersion: bcs.u64(),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const MovePackage = bcs.struct('MovePackage', {\n\tid: Address,\n\tversion: bcs.u64(),\n\tmoduleMap: bcs.map(bcs.string(), bcs.byteVector()),\n\ttypeOriginTable: bcs.vector(TypeOrigin),\n\tlinkageTable: bcs.map(Address, UpgradeInfo),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const MoveObject = bcs.struct('MoveObject', {\n\ttype: MoveObjectType,\n\thasPublicTransfer: bcs.bool(),\n\tversion: bcs.u64(),\n\tcontents: bcs.byteVector(),\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const Data = bcs.enum('Data', {\n\tMove: MoveObject,\n\tPackage: MovePackage,\n});\n\n// Rust: crates/sui-types/src/object.rs\nexport const ObjectInner = bcs.struct('ObjectInner', {\n\tdata: Data,\n\towner: Owner,\n\tpreviousTransaction: ObjectDigest,\n\tstorageRebate: bcs.u64(),\n});\n"],"mappings":";;;;;AAUA,SAAS,WAAW,SAAkC;AACrD,QAAO,IACL,IAAI;EACJ,MAAM;EACN,GAAI;EACJ,CAAC,CACD,UAAU;EACV,QAAQ,QAAyB;EACjC,SAAS,QAAQ,OAAO,IAAI;EAC5B,CAAC;;AAGJ,SAAS,WAAwC,MAAS;AACzD,QAAO,IAAI,KAAK,UAAU;EACzB,MAAM;EACN,MAAM;EACN,CAAC;;AAGH,MAAa,UAAU,IAAI,MAAM,mBAAmB,CAAC,UAAU;CAC9D,WAAW,QAAQ;EAClB,MAAM,UAAU,OAAO,QAAQ,WAAW,MAAM,MAAM,IAAI;AAC1D,MAAI,CAAC,WAAW,CAAC,kBAAkB,oBAAoB,QAAQ,CAAC,CAC/D,OAAM,IAAI,MAAM,uBAAuB,UAAU;;CAGnD,QAAQ,QACP,OAAO,QAAQ,WAAW,QAAQ,oBAAoB,IAAI,CAAC,GAAG;CAC/D,SAAS,QAAQ,oBAAoB,MAAM,IAAI,CAAC;CAChD,CAAC;AAEF,MAAa,eAAe,IAAI,YAAY,CAAC,UAAU;CACtD,MAAM;CACN,QAAQ,UAAkB,WAAW,MAAM;CAC3C,SAAS,UAAU,SAAS,IAAI,WAAW,MAAM,CAAC;CAClD,WAAW,UAAU;AACpB,MAAI,WAAW,MAAM,CAAC,WAAW,GAChC,OAAM,IAAI,MAAM,gCAAg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cAAc,IAAI,QAAQ;CAC1B,SAAS;CACT,CAAC;AAGF,MAAa,cAAc,IAAI,OAAO,eAAe;CACpD,YAAY;CACZ,iBAAiB,IAAI,KAAK;CAC1B,CAAC;AAGF,MAAa,cAAc,IAAI,OAAO,eAAe;CACpD,IAAI;CACJ,SAAS,IAAI,KAAK;CAClB,WAAW,IAAI,IAAI,IAAI,QAAQ,EAAE,IAAI,YAAY,CAAC;CAClD,iBAAiB,IAAI,OAAO,WAAW;CACvC,cAAc,IAAI,IAAI,SAAS,YAAY;CAC3C,CAAC;AAGF,MAAa,aAAa,IAAI,OAAO,cAAc;CAClD,MAAM;CACN,mBAAmB,IAAI,MAAM;CAC7B,SAAS,IAAI,KAAK;CAClB,UAAU,IAAI,YAAY;CAC1B,CAAC;AAGF,MAAa,OAAO,IAAI,KAAK,QAAQ;CACpC,MAAM;CACN,SAAS;CACT,CAAC;AAGF,MAAa,cAAc,IAAI,OAAO,eAAe;CACpD,MAAM;CACN,OAAO;CACP,qBAAqB;CACrB,eAAe,IAAI,KAAK;CACxB,CAAC"}
|
package/dist/bcs/index.d.mts
CHANGED
|
@@ -195,6 +195,7 @@ declare const suiBcs: {
|
|
|
195
195
|
Secp256r1: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[64]">;
|
|
196
196
|
ZkLogin: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
197
197
|
Passkey: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
198
|
+
MLDSA65: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[3309]">;
|
|
198
199
|
}, "CompressedSignature">;
|
|
199
200
|
Data: _mysten_bcs0.BcsEnum<{
|
|
200
201
|
Move: _mysten_bcs0.BcsStruct<{
|
|
@@ -343,12 +344,14 @@ declare const suiBcs: {
|
|
|
343
344
|
Secp256r1: Uint8Array<ArrayBufferLike>;
|
|
344
345
|
ZkLogin: Uint8Array<ArrayBufferLike>;
|
|
345
346
|
Passkey: Uint8Array<ArrayBufferLike>;
|
|
346
|
-
|
|
347
|
+
MLDSA65: Uint8Array<ArrayBufferLike>;
|
|
348
|
+
}, "ED25519" | "Secp256k1" | "Secp256r1" | "ZkLogin" | "Passkey" | "MLDSA65">[], Iterable<_mysten_bcs0.EnumInputShape<{
|
|
347
349
|
ED25519: Iterable<number>;
|
|
348
350
|
Secp256k1: Iterable<number>;
|
|
349
351
|
Secp256r1: Iterable<number>;
|
|
350
352
|
ZkLogin: Iterable<number>;
|
|
351
353
|
Passkey: Iterable<number>;
|
|
354
|
+
MLDSA65: Iterable<number>;
|
|
352
355
|
}>> & {
|
|
353
356
|
length: number;
|
|
354
357
|
}, string>;
|
|
@@ -361,7 +364,8 @@ declare const suiBcs: {
|
|
|
361
364
|
Secp256r1: Uint8Array<ArrayBufferLike>;
|
|
362
365
|
ZkLogin: Uint8Array<ArrayBufferLike>;
|
|
363
366
|
Passkey: Uint8Array<ArrayBufferLike>;
|
|
364
|
-
|
|
367
|
+
MLDSA65: Uint8Array<ArrayBufferLike>;
|
|
368
|
+
}, "ED25519" | "Secp256k1" | "Secp256r1" | "ZkLogin" | "Passkey" | "MLDSA65">;
|
|
365
369
|
weight: number;
|
|
366
370
|
}[], Iterable<{
|
|
367
371
|
pubKey: _mysten_bcs0.EnumInputShape<{
|
|
@@ -370,6 +374,7 @@ declare const suiBcs: {
|
|
|
370
374
|
Secp256r1: Iterable<number>;
|
|
371
375
|
ZkLogin: Iterable<number>;
|
|
372
376
|
Passkey: Iterable<number>;
|
|
377
|
+
MLDSA65: Iterable<number>;
|
|
373
378
|
}>;
|
|
374
379
|
weight: number;
|
|
375
380
|
}> & {
|
|
@@ -385,6 +390,7 @@ declare const suiBcs: {
|
|
|
385
390
|
Secp256r1: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[33]">;
|
|
386
391
|
ZkLogin: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
387
392
|
Passkey: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[33]">;
|
|
393
|
+
MLDSA65: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[1952]">;
|
|
388
394
|
}, "PublicKey">;
|
|
389
395
|
weight: _mysten_bcs0.BcsType<number, number, "u8">;
|
|
390
396
|
}, string>;
|
|
@@ -396,7 +402,8 @@ declare const suiBcs: {
|
|
|
396
402
|
Secp256r1: Uint8Array<ArrayBufferLike>;
|
|
397
403
|
ZkLogin: Uint8Array<ArrayBufferLike>;
|
|
398
404
|
Passkey: Uint8Array<ArrayBufferLike>;
|
|
399
|
-
|
|
405
|
+
MLDSA65: Uint8Array<ArrayBufferLike>;
|
|
406
|
+
}, "ED25519" | "Secp256k1" | "Secp256r1" | "ZkLogin" | "Passkey" | "MLDSA65">;
|
|
400
407
|
weight: number;
|
|
401
408
|
}[], Iterable<{
|
|
402
409
|
pubKey: _mysten_bcs0.EnumInputShape<{
|
|
@@ -405,6 +412,7 @@ declare const suiBcs: {
|
|
|
405
412
|
Secp256r1: Iterable<number>;
|
|
406
413
|
ZkLogin: Iterable<number>;
|
|
407
414
|
Passkey: Iterable<number>;
|
|
415
|
+
MLDSA65: Iterable<number>;
|
|
408
416
|
}>;
|
|
409
417
|
weight: number;
|
|
410
418
|
}> & {
|
|
@@ -796,6 +804,7 @@ declare const suiBcs: {
|
|
|
796
804
|
Secp256r1: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[33]">;
|
|
797
805
|
ZkLogin: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "vector<u8>">;
|
|
798
806
|
Passkey: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[33]">;
|
|
807
|
+
MLDSA65: _mysten_bcs0.BcsType<Uint8Array<ArrayBufferLike>, Iterable<number>, "bytes[1952]">;
|
|
799
808
|
}, "PublicKey">;
|
|
800
809
|
SenderSignedData: _mysten_bcs0.BcsType<{
|
|
801
810
|
intentMessage: {
|
package/dist/bcs/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/bcs/index.ts"],"mappings":";;;;;;;;cA6DM,MAAA;MAkDL,YAAA,CAAA,OAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/bcs/index.ts"],"mappings":";;;;;;;;cA6DM,MAAA;MAkDL,YAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAQs0J,YAAA,CAAA,cAAA,2BAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA,YAAA,CAAA,OAAA,mBAAA,GAAA,4BAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA,YAAA,CAAA,OAAA,mBAAA,GAAA,YAAA,IAAA,IAAA,YAAA,CAAA,QAAA,CAAA,CAAA,EAAA,IAAA;kCAAA,YAAA,CAAA,OAAA"}
|
|
@@ -87,6 +87,7 @@ function parseSerializedKeypairSignature(serializedSignature) {
|
|
|
87
87
|
case "ED25519":
|
|
88
88
|
case "Secp256k1":
|
|
89
89
|
case "Secp256r1":
|
|
90
|
+
case "MLDSA65":
|
|
90
91
|
const size = SIGNATURE_SCHEME_TO_SIZE[signatureScheme];
|
|
91
92
|
const signature = bytes.slice(1, bytes.length - size);
|
|
92
93
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publickey.mjs","names":["bcs"],"sources":["../../src/cryptography/publickey.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase64, toBase64 } from '@mysten/bcs';\nimport { blake2b } from '@noble/hashes/blake2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\n\nimport { bcs } from '../bcs/index.js';\nimport { normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';\nimport type { IntentScope } from './intent.js';\nimport { messageWithIntent } from './intent.js';\nimport { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_SIZE } from './signature-scheme.js';\n\n/**\n * Value to be converted into public key.\n */\nexport type PublicKeyInitData = string | Uint8Array | Iterable<number>;\n\nexport function bytesEqual(a: Uint8Array, b: Uint8Array) {\n\tif (a === b) return true;\n\n\tif (a.length !== b.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * A public key\n */\nexport abstract class PublicKey {\n\t/**\n\t * Checks if two public keys are equal\n\t */\n\tequals(publicKey: PublicKey) {\n\t\treturn bytesEqual(this.toRawBytes(), publicKey.toRawBytes());\n\t}\n\n\t/**\n\t * Return the base-64 representation of the public key\n\t */\n\ttoBase64() {\n\t\treturn toBase64(this.toRawBytes());\n\t}\n\n\ttoString(): never {\n\t\tthrow new Error(\n\t\t\t'`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.',\n\t\t);\n\t}\n\n\t/**\n\t * Return the Sui representation of the public key encoded in\n\t * base-64. A Sui public key is formed by the concatenation\n\t * of the scheme flag with the raw bytes of the public key\n\t */\n\ttoSuiPublicKey(): string {\n\t\tconst bytes = this.toSuiBytes();\n\t\treturn toBase64(bytes);\n\t}\n\n\tverifyWithIntent(\n\t\tbytes: Uint8Array,\n\t\tsignature: Uint8Array | string,\n\t\tintent: IntentScope,\n\t): Promise<boolean> {\n\t\tconst intentMessage = messageWithIntent(intent, bytes);\n\t\tconst digest = blake2b(intentMessage, { dkLen: 32 });\n\n\t\treturn this.verify(digest, signature);\n\t}\n\n\t/**\n\t * Verifies that the signature is valid for for the provided PersonalMessage\n\t */\n\tverifyPersonalMessage(message: Uint8Array, signature: Uint8Array | string): Promise<boolean> {\n\t\treturn this.verifyWithIntent(\n\t\t\tbcs.byteVector().serialize(message).toBytes(),\n\t\t\tsignature,\n\t\t\t'PersonalMessage',\n\t\t);\n\t}\n\n\t/**\n\t * Verifies that the signature is valid for for the provided Transaction\n\t */\n\tverifyTransaction(transaction: Uint8Array, signature: Uint8Array | string): Promise<boolean> {\n\t\treturn this.verifyWithIntent(transaction, signature, 'TransactionData');\n\t}\n\n\t/**\n\t * Verifies that the public key is associated with the provided address\n\t */\n\tverifyAddress(address: string): boolean {\n\t\treturn this.toSuiAddress() === address;\n\t}\n\n\t/**\n\t * Returns the bytes representation of the public key\n\t * prefixed with the signature scheme flag\n\t */\n\ttoSuiBytes(): Uint8Array<ArrayBuffer> {\n\t\tconst rawBytes = this.toRawBytes();\n\t\tconst suiBytes = new Uint8Array(rawBytes.length + 1);\n\t\tsuiBytes.set([this.flag()]);\n\t\tsuiBytes.set(rawBytes, 1);\n\n\t\treturn suiBytes;\n\t}\n\n\t/**\n\t * Return the Sui address associated with this Ed25519 public key\n\t */\n\ttoSuiAddress(): string {\n\t\t// Each hex char represents half a byte, hence hex address doubles the length\n\t\treturn normalizeSuiAddress(\n\t\t\tbytesToHex(blake2b(this.toSuiBytes(), { dkLen: 32 })).slice(0, SUI_ADDRESS_LENGTH * 2),\n\t\t);\n\t}\n\n\t/**\n\t * Return the byte array representation of the public key\n\t */\n\tabstract toRawBytes(): Uint8Array<ArrayBuffer>;\n\n\t/**\n\t * Return signature scheme flag of the public key\n\t */\n\tabstract flag(): number;\n\n\t/**\n\t * Verifies that the signature is valid for for the provided message\n\t */\n\tabstract verify(data: Uint8Array, signature: Uint8Array | string): Promise<boolean>;\n}\n\nexport function parseSerializedKeypairSignature(serializedSignature: string) {\n\tconst bytes = fromBase64(serializedSignature);\n\n\tconst signatureScheme =\n\t\tSIGNATURE_FLAG_TO_SCHEME[bytes[0] as keyof typeof SIGNATURE_FLAG_TO_SCHEME];\n\n\tswitch (signatureScheme) {\n\t\tcase 'ED25519':\n\t\tcase 'Secp256k1':\n\t\tcase 'Secp256r1':\n\t\t\tconst size =\n\t\t\t\tSIGNATURE_SCHEME_TO_SIZE[signatureScheme as keyof typeof SIGNATURE_SCHEME_TO_SIZE];\n\t\t\tconst signature = bytes.slice(1, bytes.length - size);\n\t\t\tconst publicKey = bytes.slice(1 + signature.length);\n\n\t\t\treturn {\n\t\t\t\tserializedSignature,\n\t\t\t\tsignatureScheme,\n\t\t\t\tsignature,\n\t\t\t\tpublicKey,\n\t\t\t\tbytes,\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new Error('Unsupported signature scheme');\n\t}\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgB,WAAW,GAAe,GAAe;AACxD,KAAI,MAAM,EAAG,QAAO;AAEpB,KAAI,EAAE,WAAW,EAAE,OAClB,QAAO;AAGR,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC7B,KAAI,EAAE,OAAO,EAAE,GACd,QAAO;AAGT,QAAO;;;;;AAMR,IAAsB,YAAtB,MAAgC;;;;CAI/B,OAAO,WAAsB;AAC5B,SAAO,WAAW,KAAK,YAAY,EAAE,UAAU,YAAY,CAAC;;;;;CAM7D,WAAW;AACV,SAAO,SAAS,KAAK,YAAY,CAAC;;CAGnC,WAAkB;AACjB,QAAM,IAAI,MACT,4FACA;;;;;;;CAQF,iBAAyB;AAExB,SAAO,SADO,KAAK,YAAY,CACT;;CAGvB,iBACC,OACA,WACA,QACmB;EAEnB,MAAM,SAAS,QADO,kBAAkB,QAAQ,MAAM,EAChB,EAAE,OAAO,IAAI,CAAC;AAEpD,SAAO,KAAK,OAAO,QAAQ,UAAU;;;;;CAMtC,sBAAsB,SAAqB,WAAkD;AAC5F,SAAO,KAAK,iBACXA,OAAI,YAAY,CAAC,UAAU,QAAQ,CAAC,SAAS,EAC7C,WACA,kBACA;;;;;CAMF,kBAAkB,aAAyB,WAAkD;AAC5F,SAAO,KAAK,iBAAiB,aAAa,WAAW,kBAAkB;;;;;CAMxE,cAAc,SAA0B;AACvC,SAAO,KAAK,cAAc,KAAK;;;;;;CAOhC,aAAsC;EACrC,MAAM,WAAW,KAAK,YAAY;EAClC,MAAM,WAAW,IAAI,WAAW,SAAS,SAAS,EAAE;AACpD,WAAS,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC;AAC3B,WAAS,IAAI,UAAU,EAAE;AAEzB,SAAO;;;;;CAMR,eAAuB;AAEtB,SAAO,oBACN,WAAW,QAAQ,KAAK,YAAY,EAAE,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,qBAAqB,EAAE,CACtF;;;AAmBH,SAAgB,gCAAgC,qBAA6B;CAC5E,MAAM,QAAQ,WAAW,oBAAoB;CAE7C,MAAM,kBACL,yBAAyB,MAAM;AAEhC,SAAQ,iBAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK;GACJ,MAAM,OACL,yBAAyB;GAC1B,MAAM,YAAY,MAAM,MAAM,GAAG,MAAM,SAAS,KAAK;AAGrD,UAAO;IACN;IACA;IACA;IACA,WANiB,MAAM,MAAM,IAAI,UAAU,OAAO;IAOlD;IACA;EACF,QACC,OAAM,IAAI,MAAM,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"publickey.mjs","names":["bcs"],"sources":["../../src/cryptography/publickey.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase64, toBase64 } from '@mysten/bcs';\nimport { blake2b } from '@noble/hashes/blake2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\n\nimport { bcs } from '../bcs/index.js';\nimport { normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';\nimport type { IntentScope } from './intent.js';\nimport { messageWithIntent } from './intent.js';\nimport { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_SIZE } from './signature-scheme.js';\n\n/**\n * Value to be converted into public key.\n */\nexport type PublicKeyInitData = string | Uint8Array | Iterable<number>;\n\nexport function bytesEqual(a: Uint8Array, b: Uint8Array) {\n\tif (a === b) return true;\n\n\tif (a.length !== b.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * A public key\n */\nexport abstract class PublicKey {\n\t/**\n\t * Checks if two public keys are equal\n\t */\n\tequals(publicKey: PublicKey) {\n\t\treturn bytesEqual(this.toRawBytes(), publicKey.toRawBytes());\n\t}\n\n\t/**\n\t * Return the base-64 representation of the public key\n\t */\n\ttoBase64() {\n\t\treturn toBase64(this.toRawBytes());\n\t}\n\n\ttoString(): never {\n\t\tthrow new Error(\n\t\t\t'`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.',\n\t\t);\n\t}\n\n\t/**\n\t * Return the Sui representation of the public key encoded in\n\t * base-64. A Sui public key is formed by the concatenation\n\t * of the scheme flag with the raw bytes of the public key\n\t */\n\ttoSuiPublicKey(): string {\n\t\tconst bytes = this.toSuiBytes();\n\t\treturn toBase64(bytes);\n\t}\n\n\tverifyWithIntent(\n\t\tbytes: Uint8Array,\n\t\tsignature: Uint8Array | string,\n\t\tintent: IntentScope,\n\t): Promise<boolean> {\n\t\tconst intentMessage = messageWithIntent(intent, bytes);\n\t\tconst digest = blake2b(intentMessage, { dkLen: 32 });\n\n\t\treturn this.verify(digest, signature);\n\t}\n\n\t/**\n\t * Verifies that the signature is valid for for the provided PersonalMessage\n\t */\n\tverifyPersonalMessage(message: Uint8Array, signature: Uint8Array | string): Promise<boolean> {\n\t\treturn this.verifyWithIntent(\n\t\t\tbcs.byteVector().serialize(message).toBytes(),\n\t\t\tsignature,\n\t\t\t'PersonalMessage',\n\t\t);\n\t}\n\n\t/**\n\t * Verifies that the signature is valid for for the provided Transaction\n\t */\n\tverifyTransaction(transaction: Uint8Array, signature: Uint8Array | string): Promise<boolean> {\n\t\treturn this.verifyWithIntent(transaction, signature, 'TransactionData');\n\t}\n\n\t/**\n\t * Verifies that the public key is associated with the provided address\n\t */\n\tverifyAddress(address: string): boolean {\n\t\treturn this.toSuiAddress() === address;\n\t}\n\n\t/**\n\t * Returns the bytes representation of the public key\n\t * prefixed with the signature scheme flag\n\t */\n\ttoSuiBytes(): Uint8Array<ArrayBuffer> {\n\t\tconst rawBytes = this.toRawBytes();\n\t\tconst suiBytes = new Uint8Array(rawBytes.length + 1);\n\t\tsuiBytes.set([this.flag()]);\n\t\tsuiBytes.set(rawBytes, 1);\n\n\t\treturn suiBytes;\n\t}\n\n\t/**\n\t * Return the Sui address associated with this Ed25519 public key\n\t */\n\ttoSuiAddress(): string {\n\t\t// Each hex char represents half a byte, hence hex address doubles the length\n\t\treturn normalizeSuiAddress(\n\t\t\tbytesToHex(blake2b(this.toSuiBytes(), { dkLen: 32 })).slice(0, SUI_ADDRESS_LENGTH * 2),\n\t\t);\n\t}\n\n\t/**\n\t * Return the byte array representation of the public key\n\t */\n\tabstract toRawBytes(): Uint8Array<ArrayBuffer>;\n\n\t/**\n\t * Return signature scheme flag of the public key\n\t */\n\tabstract flag(): number;\n\n\t/**\n\t * Verifies that the signature is valid for for the provided message\n\t */\n\tabstract verify(data: Uint8Array, signature: Uint8Array | string): Promise<boolean>;\n}\n\nexport function parseSerializedKeypairSignature(serializedSignature: string) {\n\tconst bytes = fromBase64(serializedSignature);\n\n\tconst signatureScheme =\n\t\tSIGNATURE_FLAG_TO_SCHEME[bytes[0] as keyof typeof SIGNATURE_FLAG_TO_SCHEME];\n\n\tswitch (signatureScheme) {\n\t\tcase 'ED25519':\n\t\tcase 'Secp256k1':\n\t\tcase 'Secp256r1':\n\t\tcase 'MLDSA65':\n\t\t\tconst size =\n\t\t\t\tSIGNATURE_SCHEME_TO_SIZE[signatureScheme as keyof typeof SIGNATURE_SCHEME_TO_SIZE];\n\t\t\tconst signature = bytes.slice(1, bytes.length - size);\n\t\t\tconst publicKey = bytes.slice(1 + signature.length);\n\n\t\t\treturn {\n\t\t\t\tserializedSignature,\n\t\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R,eAAuB;AAEtB,SAAO,oBACN,WAAW,QAAQ,KAAK,YAAY,EAAE,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,qBAAqB,EAAE,CACtF;;;AAmBH,SAAgB,gCAAgC,qBAA6B;CAC5E,MAAM,QAAQ,WAAW,oBAAoB;CAE7C,MAAM,kBACL,yBAAyB,MAAM;AAEhC,SAAQ,iBAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;GACJ,MAAM,OACL,yBAAyB;GAC1B,MAAM,YAAY,MAAM,MAAM,GAAG,MAAM,SAAS,KAAK;AAGrD,UAAO;IACN;IACA;IACA;IACA,WANiB,MAAM,MAAM,IAAI,UAAU,OAAO;IAOlD;IACA;EACF,QACC,OAAM,IAAI,MAAM,+BAA+B"}
|
|
@@ -6,12 +6,14 @@ declare const SIGNATURE_SCHEME_TO_FLAG: {
|
|
|
6
6
|
readonly MultiSig: 3;
|
|
7
7
|
readonly ZkLogin: 5;
|
|
8
8
|
readonly Passkey: 6;
|
|
9
|
+
readonly MLDSA65: 7;
|
|
9
10
|
};
|
|
10
11
|
declare const SIGNATURE_SCHEME_TO_SIZE: {
|
|
11
12
|
ED25519: number;
|
|
12
13
|
Secp256k1: number;
|
|
13
14
|
Secp256r1: number;
|
|
14
15
|
Passkey: number;
|
|
16
|
+
MLDSA65: number;
|
|
15
17
|
};
|
|
16
18
|
declare const SIGNATURE_FLAG_TO_SCHEME: {
|
|
17
19
|
readonly 0: "ED25519";
|
|
@@ -20,8 +22,9 @@ declare const SIGNATURE_FLAG_TO_SCHEME: {
|
|
|
20
22
|
readonly 3: "MultiSig";
|
|
21
23
|
readonly 5: "ZkLogin";
|
|
22
24
|
readonly 6: "Passkey";
|
|
25
|
+
readonly 7: "MLDSA65";
|
|
23
26
|
};
|
|
24
|
-
type SignatureScheme = 'ED25519' | 'Secp256k1' | 'Secp256r1' | 'MultiSig' | 'ZkLogin' | 'Passkey';
|
|
27
|
+
type SignatureScheme = 'ED25519' | 'Secp256k1' | 'Secp256r1' | 'MultiSig' | 'ZkLogin' | 'Passkey' | 'MLDSA65';
|
|
25
28
|
type SignatureFlag = keyof typeof SIGNATURE_FLAG_TO_SCHEME;
|
|
26
29
|
//#endregion
|
|
27
30
|
export { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_FLAG, SIGNATURE_SCHEME_TO_SIZE, SignatureFlag, SignatureScheme };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature-scheme.d.mts","names":[],"sources":["../../src/cryptography/signature-scheme.ts"],"mappings":";cAGa,wBAAA;EAAA
|
|
1
|
+
{"version":3,"file":"signature-scheme.d.mts","names":[],"sources":["../../src/cryptography/signature-scheme.ts"],"mappings":";cAGa,wBAAA;EAAA;;;;;;;;cAUA,wBAAA;;;;;;;cAQA,wBAAA;EAAA;;;;;;;;KAUD,eAAA;AAAA,KAGA,aAAA,gBAA6B,wBAAA"}
|
|
@@ -5,13 +5,15 @@ const SIGNATURE_SCHEME_TO_FLAG = {
|
|
|
5
5
|
Secp256r1: 2,
|
|
6
6
|
MultiSig: 3,
|
|
7
7
|
ZkLogin: 5,
|
|
8
|
-
Passkey: 6
|
|
8
|
+
Passkey: 6,
|
|
9
|
+
MLDSA65: 7
|
|
9
10
|
};
|
|
10
11
|
const SIGNATURE_SCHEME_TO_SIZE = {
|
|
11
12
|
ED25519: 32,
|
|
12
13
|
Secp256k1: 33,
|
|
13
14
|
Secp256r1: 33,
|
|
14
|
-
Passkey: 33
|
|
15
|
+
Passkey: 33,
|
|
16
|
+
MLDSA65: 1952
|
|
15
17
|
};
|
|
16
18
|
const SIGNATURE_FLAG_TO_SCHEME = {
|
|
17
19
|
0: "ED25519",
|
|
@@ -19,7 +21,8 @@ const SIGNATURE_FLAG_TO_SCHEME = {
|
|
|
19
21
|
2: "Secp256r1",
|
|
20
22
|
3: "MultiSig",
|
|
21
23
|
5: "ZkLogin",
|
|
22
|
-
6: "Passkey"
|
|
24
|
+
6: "Passkey",
|
|
25
|
+
7: "MLDSA65"
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature-scheme.mjs","names":[],"sources":["../../src/cryptography/signature-scheme.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport const SIGNATURE_SCHEME_TO_FLAG = {\n\tED25519: 0x00,\n\tSecp256k1: 0x01,\n\tSecp256r1: 0x02,\n\tMultiSig: 0x03,\n\tZkLogin: 0x05,\n\tPasskey: 0x06,\n} as const;\n\nexport const SIGNATURE_SCHEME_TO_SIZE = {\n\tED25519: 32,\n\tSecp256k1: 33,\n\tSecp256r1: 33,\n\tPasskey: 33,\n};\n\nexport const SIGNATURE_FLAG_TO_SCHEME = {\n\t0x00: 'ED25519',\n\t0x01: 'Secp256k1',\n\t0x02: 'Secp256r1',\n\t0x03: 'MultiSig',\n\t0x05: 'ZkLogin',\n\t0x06: 'Passkey',\n} as const;\n\nexport type SignatureScheme =\n\t'ED25519' | 'Secp256k1' | 'Secp256r1' | 'MultiSig' | 'ZkLogin' | 'Passkey';\n\nexport type SignatureFlag = keyof typeof SIGNATURE_FLAG_TO_SCHEME;\n"],"mappings":";AAGA,MAAa,2BAA2B;CACvC,SAAS;CACT,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACT,SAAS;CACT;AAED,MAAa,2BAA2B;CACvC,SAAS;CACT,WAAW;CACX,WAAW;CACX,SAAS;CACT;AAED,MAAa,2BAA2B;CACvC,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN"}
|
|
1
|
+
{"version":3,"file":"signature-scheme.mjs","names":[],"sources":["../../src/cryptography/signature-scheme.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport const SIGNATURE_SCHEME_TO_FLAG = {\n\tED25519: 0x00,\n\tSecp256k1: 0x01,\n\tSecp256r1: 0x02,\n\tMultiSig: 0x03,\n\tZkLogin: 0x05,\n\tPasskey: 0x06,\n\tMLDSA65: 0x07,\n} as const;\n\nexport const SIGNATURE_SCHEME_TO_SIZE = {\n\tED25519: 32,\n\tSecp256k1: 33,\n\tSecp256r1: 33,\n\tPasskey: 33,\n\tMLDSA65: 1952,\n};\n\nexport const SIGNATURE_FLAG_TO_SCHEME = {\n\t0x00: 'ED25519',\n\t0x01: 'Secp256k1',\n\t0x02: 'Secp256r1',\n\t0x03: 'MultiSig',\n\t0x05: 'ZkLogin',\n\t0x06: 'Passkey',\n\t0x07: 'MLDSA65',\n} as const;\n\nexport type SignatureScheme =\n\t'ED25519' | 'Secp256k1' | 'Secp256r1' | 'MultiSig' | 'ZkLogin' | 'Passkey' | 'MLDSA65';\n\nexport type SignatureFlag = keyof typeof SIGNATURE_FLAG_TO_SCHEME;\n"],"mappings":";AAGA,MAAa,2BAA2B;CACvC,SAAS;CACT,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACT,SAAS;CACT,SAAS;CACT;AAED,MAAa,2BAA2B;CACvC,SAAS;CACT,WAAW;CACX,WAAW;CACX,SAAS;CACT,SAAS;CACT;AAED,MAAa,2BAA2B;CACvC,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN,GAAM;CACN"}
|
|
@@ -23,6 +23,12 @@ declare function toSerializedSignature({
|
|
|
23
23
|
* Decodes a serialized signature into its constituent components: the signature scheme, the actual signature, and the public key
|
|
24
24
|
*/
|
|
25
25
|
declare function parseSerializedSignature(serializedSignature: string): {
|
|
26
|
+
serializedSignature: string;
|
|
27
|
+
signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1" | "MLDSA65";
|
|
28
|
+
signature: Uint8Array<ArrayBuffer>;
|
|
29
|
+
publicKey: Uint8Array<ArrayBuffer>;
|
|
30
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
31
|
+
} | {
|
|
26
32
|
signatureScheme: "Passkey";
|
|
27
33
|
serializedSignature: string;
|
|
28
34
|
signature: Uint8Array<ArrayBufferLike>;
|
|
@@ -30,12 +36,6 @@ declare function parseSerializedSignature(serializedSignature: string): {
|
|
|
30
36
|
clientDataJson: string;
|
|
31
37
|
userSignature: Uint8Array<ArrayBuffer>;
|
|
32
38
|
publicKey: Uint8Array<ArrayBuffer>;
|
|
33
|
-
} | {
|
|
34
|
-
serializedSignature: string;
|
|
35
|
-
signatureScheme: "ED25519" | "Secp256k1" | "Secp256r1";
|
|
36
|
-
signature: Uint8Array<ArrayBuffer>;
|
|
37
|
-
publicKey: Uint8Array<ArrayBuffer>;
|
|
38
|
-
bytes: Uint8Array<ArrayBuffer>;
|
|
39
39
|
} | {
|
|
40
40
|
serializedSignature: string;
|
|
41
41
|
signatureScheme: "ZkLogin";
|
|
@@ -36,7 +36,8 @@ function parseSerializedSignature(serializedSignature) {
|
|
|
36
36
|
case "ZkLogin": return parseSerializedZkLoginSignature(serializedSignature);
|
|
37
37
|
case "ED25519":
|
|
38
38
|
case "Secp256k1":
|
|
39
|
-
case "Secp256r1":
|
|
39
|
+
case "Secp256r1":
|
|
40
|
+
case "MLDSA65": return parseSerializedKeypairSignature(serializedSignature);
|
|
40
41
|
default: throw new Error("Unsupported signature scheme");
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.mjs","names":["bcs"],"sources":["../../src/cryptography/signature.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase64, toBase64 } from '@mysten/bcs';\n\nimport { bcs } from '../bcs/index.js';\nimport { parseSerializedPasskeySignature } from '../keypairs/passkey/publickey.js';\nimport type { MultiSigStruct } from '../multisig/publickey.js';\nimport { parseSerializedZkLoginSignature } from '../zklogin/publickey.js';\nimport { parseSerializedKeypairSignature } from './publickey.js';\nimport type { PublicKey } from './publickey.js';\nimport type { SignatureScheme } from './signature-scheme.js';\nimport { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_FLAG } from './signature-scheme.js';\n\n/**\n * Pair of signature and corresponding public key\n */\nexport type SerializeSignatureInput = {\n\tsignatureScheme: SignatureScheme;\n\t/** Base64-encoded signature */\n\tsignature: Uint8Array;\n\t/** Base64-encoded public key */\n\tpublicKey?: PublicKey;\n};\n\n/**\n * Takes in a signature, its associated signing scheme and a public key, then serializes this data\n */\nexport function toSerializedSignature({\n\tsignature,\n\tsignatureScheme,\n\tpublicKey,\n}: SerializeSignatureInput): string {\n\tif (!publicKey) {\n\t\tthrow new Error('`publicKey` is required');\n\t}\n\n\tconst pubKeyBytes = publicKey.toRawBytes();\n\tconst serializedSignature = new Uint8Array(1 + signature.length + pubKeyBytes.length);\n\tserializedSignature.set([SIGNATURE_SCHEME_TO_FLAG[signatureScheme]]);\n\tserializedSignature.set(signature, 1);\n\tserializedSignature.set(pubKeyBytes, 1 + signature.length);\n\treturn toBase64(serializedSignature);\n}\n\n/**\n * Decodes a serialized signature into its constituent components: the signature scheme, the actual signature, and the public key\n */\nexport function parseSerializedSignature(serializedSignature: string) {\n\tconst bytes = fromBase64(serializedSignature);\n\n\tconst signatureScheme =\n\t\tSIGNATURE_FLAG_TO_SCHEME[bytes[0] as keyof typeof SIGNATURE_FLAG_TO_SCHEME];\n\n\tswitch (signatureScheme) {\n\t\tcase 'Passkey':\n\t\t\treturn parseSerializedPasskeySignature(serializedSignature);\n\t\tcase 'MultiSig':\n\t\t\tconst multisig: MultiSigStruct = bcs.MultiSig.parse(bytes.slice(1));\n\t\t\treturn {\n\t\t\t\tserializedSignature,\n\t\t\t\tsignatureScheme,\n\t\t\t\tmultisig,\n\t\t\t\tbytes,\n\t\t\t\tsignature: undefined,\n\t\t\t};\n\t\tcase 'ZkLogin':\n\t\t\treturn parseSerializedZkLoginSignature(serializedSignature);\n\t\tcase 'ED25519':\n\t\tcase 'Secp256k1':\n\t\tcase 'Secp256r1':\n\t\t\treturn parseSerializedKeypairSignature(serializedSignature);\n\t\tdefault:\n\t\t\tthrow new Error('Unsupported signature scheme');\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,sBAAsB,EACrC,WACA,iBACA,aACmC;AACnC,KAAI,CAAC,UACJ,OAAM,IAAI,MAAM,0BAA0B;CAG3C,MAAM,cAAc,UAAU,YAAY;CAC1C,MAAM,sBAAsB,IAAI,WAAW,IAAI,UAAU,SAAS,YAAY,OAAO;AACrF,qBAAoB,IAAI,CAAC,yBAAyB,iBAAiB,CAAC;AACpE,qBAAoB,IAAI,WAAW,EAAE;AACrC,qBAAoB,IAAI,aAAa,IAAI,UAAU,OAAO;AAC1D,QAAO,SAAS,oBAAoB;;;;;AAMrC,SAAgB,yBAAyB,qBAA6B;CACrE,MAAM,QAAQ,WAAW,oBAAoB;CAE7C,MAAM,kBACL,yBAAyB,MAAM;AAEhC,SAAQ,iBAAR;EACC,KAAK,UACJ,QAAO,gCAAgC,oBAAoB;EAC5D,KAAK,WAEJ,QAAO;GACN;GACA;GACA,UAJgCA,OAAI,SAAS,MAAM,MAAM,MAAM,EAAE,CAAC;GAKlE;GACA,WAAW;GACX;EACF,KAAK,UACJ,QAAO,gCAAgC,oBAAoB;EAC5D,KAAK;EACL,KAAK;EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"signature.mjs","names":["bcs"],"sources":["../../src/cryptography/signature.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fromBase64, toBase64 } from '@mysten/bcs';\n\nimport { bcs } from '../bcs/index.js';\nimport { parseSerializedPasskeySignature } from '../keypairs/passkey/publickey.js';\nimport type { MultiSigStruct } from '../multisig/publickey.js';\nimport { parseSerializedZkLoginSignature } from '../zklogin/publickey.js';\nimport { parseSerializedKeypairSignature } from './publickey.js';\nimport type { PublicKey } from './publickey.js';\nimport type { SignatureScheme } from './signature-scheme.js';\nimport { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_FLAG } from './signature-scheme.js';\n\n/**\n * Pair of signature and corresponding public key\n */\nexport type SerializeSignatureInput = {\n\tsignatureScheme: SignatureScheme;\n\t/** Base64-encoded signature */\n\tsignature: Uint8Array;\n\t/** Base64-encoded public key */\n\tpublicKey?: PublicKey;\n};\n\n/**\n * Takes in a signature, its associated signing scheme and a public key, then serializes this data\n */\nexport function toSerializedSignature({\n\tsignature,\n\tsignatureScheme,\n\tpublicKey,\n}: SerializeSignatureInput): string {\n\tif (!publicKey) {\n\t\tthrow new Error('`publicKey` is required');\n\t}\n\n\tconst pubKeyBytes = publicKey.toRawBytes();\n\tconst serializedSignature = new Uint8Array(1 + signature.length + pubKeyBytes.length);\n\tserializedSignature.set([SIGNATURE_SCHEME_TO_FLAG[signatureScheme]]);\n\tserializedSignature.set(signature, 1);\n\tserializedSignature.set(pubKeyBytes, 1 + signature.length);\n\treturn toBase64(serializedSignature);\n}\n\n/**\n * Decodes a serialized signature into its constituent components: the signature scheme, the actual signature, and the public key\n */\nexport function parseSerializedSignature(serializedSignature: string) {\n\tconst bytes = fromBase64(serializedSignature);\n\n\tconst signatureScheme =\n\t\tSIGNATURE_FLAG_TO_SCHEME[bytes[0] as keyof typeof SIGNATURE_FLAG_TO_SCHEME];\n\n\tswitch (signatureScheme) {\n\t\tcase 'Passkey':\n\t\t\treturn parseSerializedPasskeySignature(serializedSignature);\n\t\tcase 'MultiSig':\n\t\t\tconst multisig: MultiSigStruct = bcs.MultiSig.parse(bytes.slice(1));\n\t\t\treturn {\n\t\t\t\tserializedSignature,\n\t\t\t\tsignatureScheme,\n\t\t\t\tmultisig,\n\t\t\t\tbytes,\n\t\t\t\tsignature: undefined,\n\t\t\t};\n\t\tcase 'ZkLogin':\n\t\t\treturn parseSerializedZkLoginSignature(serializedSignature);\n\t\tcase 'ED25519':\n\t\tcase 'Secp256k1':\n\t\tcase 'Secp256r1':\n\t\tcase 'MLDSA65':\n\t\t\treturn parseSerializedKeypairSignature(serializedSignature);\n\t\tdefault:\n\t\t\tthrow new Error('Unsupported signature scheme');\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,sBAAsB,EACrC,WACA,iBACA,aACmC;AACnC,KAAI,CAAC,UACJ,OAAM,IAAI,MAAM,0BAA0B;CAG3C,MAAM,cAAc,UAAU,YAAY;CAC1C,MAAM,sBAAsB,IAAI,WAAW,IAAI,UAAU,SAAS,YAAY,OAAO;AACrF,qBAAoB,IAAI,CAAC,yBAAyB,iBAAiB,CAAC;AACpE,qBAAoB,IAAI,WAAW,EAAE;AACrC,qBAAoB,IAAI,aAAa,IAAI,UAAU,OAAO;AAC1D,QAAO,SAAS,oBAAoB;;;;;AAMrC,SAAgB,yBAAyB,qBAA6B;CACrE,MAAM,QAAQ,WAAW,oBAAoB;CAE7C,MAAM,kBACL,yBAAyB,MAAM;AAEhC,SAAQ,iBAAR;EACC,KAAK,UACJ,QAAO,gCAAgC,oBAAoB;EAC5D,KAAK,WAEJ,QAAO;GACN;GACA;GACA,UAJgCA,OAAI,SAAS,MAAM,MAAM,MAAM,EAAE,CAAC;GAKlE;GACA,WAAW;GACX;EACF,KAAK,UACJ,QAAO,gCAAgC,oBAAoB;EAC5D,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,UACJ,QAAO,gCAAgC,oBAAoB;EAC5D,QACC,OAAM,IAAI,MAAM,+BAA+B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AdvanceCheckpointRequest, AdvanceCheckpointResponse, AdvanceClockRequest, AdvanceClockResponse, GetStatusRequest, GetStatusResponse } from "./forking_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime0 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc0 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/forking/v1alpha/forking_service.client.d.ts
|
|
@@ -37,9 +37,9 @@ interface IForkingServiceClient {
|
|
|
37
37
|
declare class ForkingServiceClient implements IForkingServiceClient, ServiceInfo {
|
|
38
38
|
private readonly _transport;
|
|
39
39
|
typeName: string;
|
|
40
|
-
methods:
|
|
40
|
+
methods: _protobuf_ts_runtime_rpc0.MethodInfo<any, any>[];
|
|
41
41
|
options: {
|
|
42
|
-
[extensionName: string]:
|
|
42
|
+
[extensionName: string]: _protobuf_ts_runtime0.JsonValue;
|
|
43
43
|
};
|
|
44
44
|
constructor(_transport: RpcTransport);
|
|
45
45
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BatchGetObjectsRequest, BatchGetObjectsResponse, BatchGetTransactionsRequest, BatchGetTransactionsResponse, GetCheckpointRequest, GetCheckpointResponse, GetEpochRequest, GetEpochResponse, GetObjectRequest, GetObjectResponse, GetServiceInfoRequest, GetServiceInfoResponse, GetTransactionRequest, GetTransactionResponse, ListCheckpointsRequest, ListCheckpointsResponse, ListEventsRequest, ListEventsResponse, ListTransactionsRequest, ListTransactionsResponse } from "./ledger_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime1 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc1 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServerStreamingCall, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts
|
|
@@ -73,9 +73,9 @@ interface ILedgerServiceClient {
|
|
|
73
73
|
declare class LedgerServiceClient implements ILedgerServiceClient, ServiceInfo {
|
|
74
74
|
private readonly _transport;
|
|
75
75
|
typeName: string;
|
|
76
|
-
methods:
|
|
76
|
+
methods: _protobuf_ts_runtime_rpc1.MethodInfo<any, any>[];
|
|
77
77
|
options: {
|
|
78
|
-
[extensionName: string]:
|
|
78
|
+
[extensionName: string]: _protobuf_ts_runtime1.JsonValue;
|
|
79
79
|
};
|
|
80
80
|
constructor(_transport: RpcTransport);
|
|
81
81
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetDatatypeRequest, GetDatatypeResponse, GetFunctionRequest, GetFunctionResponse, GetPackageRequest, GetPackageResponse, ListPackageVersionsRequest, ListPackageVersionsResponse } from "./move_package_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime2 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc2 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts
|
|
@@ -31,9 +31,9 @@ interface IMovePackageServiceClient {
|
|
|
31
31
|
declare class MovePackageServiceClient implements IMovePackageServiceClient, ServiceInfo {
|
|
32
32
|
private readonly _transport;
|
|
33
33
|
typeName: string;
|
|
34
|
-
methods:
|
|
34
|
+
methods: _protobuf_ts_runtime_rpc2.MethodInfo<any, any>[];
|
|
35
35
|
options: {
|
|
36
|
-
[extensionName: string]:
|
|
36
|
+
[extensionName: string]: _protobuf_ts_runtime2.JsonValue;
|
|
37
37
|
};
|
|
38
38
|
constructor(_transport: RpcTransport);
|
|
39
39
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LookupNameRequest, LookupNameResponse, ReverseLookupNameRequest, ReverseLookupNameResponse } from "./name_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime5 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc5 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/name_service.client.d.ts
|
|
@@ -23,9 +23,9 @@ interface INameServiceClient {
|
|
|
23
23
|
declare class NameServiceClient implements INameServiceClient, ServiceInfo {
|
|
24
24
|
private readonly _transport;
|
|
25
25
|
typeName: string;
|
|
26
|
-
methods:
|
|
26
|
+
methods: _protobuf_ts_runtime_rpc5.MethodInfo<any, any>[];
|
|
27
27
|
options: {
|
|
28
|
-
[extensionName: string]:
|
|
28
|
+
[extensionName: string]: _protobuf_ts_runtime5.JsonValue;
|
|
29
29
|
};
|
|
30
30
|
constructor(_transport: RpcTransport);
|
|
31
31
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VerifySignatureRequest, VerifySignatureResponse } from "./signature_verification_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime6 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc6 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts
|
|
@@ -21,9 +21,9 @@ interface ISignatureVerificationServiceClient {
|
|
|
21
21
|
declare class SignatureVerificationServiceClient implements ISignatureVerificationServiceClient, ServiceInfo {
|
|
22
22
|
private readonly _transport;
|
|
23
23
|
typeName: string;
|
|
24
|
-
methods:
|
|
24
|
+
methods: _protobuf_ts_runtime_rpc6.MethodInfo<any, any>[];
|
|
25
25
|
options: {
|
|
26
|
-
[extensionName: string]:
|
|
26
|
+
[extensionName: string]: _protobuf_ts_runtime6.JsonValue;
|
|
27
27
|
};
|
|
28
28
|
constructor(_transport: RpcTransport);
|
|
29
29
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetBalanceRequest, GetBalanceResponse, GetCoinInfoRequest, GetCoinInfoResponse, ListBalancesRequest, ListBalancesResponse, ListDynamicFieldsRequest, ListDynamicFieldsResponse, ListOwnedObjectsRequest, ListOwnedObjectsResponse } from "./state_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime4 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc4 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/state_service.client.d.ts
|
|
@@ -35,9 +35,9 @@ interface IStateServiceClient {
|
|
|
35
35
|
declare class StateServiceClient implements IStateServiceClient, ServiceInfo {
|
|
36
36
|
private readonly _transport;
|
|
37
37
|
typeName: string;
|
|
38
|
-
methods:
|
|
38
|
+
methods: _protobuf_ts_runtime_rpc4.MethodInfo<any, any>[];
|
|
39
39
|
options: {
|
|
40
|
-
[extensionName: string]:
|
|
40
|
+
[extensionName: string]: _protobuf_ts_runtime4.JsonValue;
|
|
41
41
|
};
|
|
42
42
|
constructor(_transport: RpcTransport);
|
|
43
43
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SubscribeCheckpointsRequest, SubscribeCheckpointsResponse, SubscribeEventsRequest, SubscribeEventsResponse, SubscribeTransactionsRequest, SubscribeTransactionsResponse } from "./subscription_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime3 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc3 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServerStreamingCall, ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts
|
|
@@ -100,9 +100,9 @@ interface ISubscriptionServiceClient {
|
|
|
100
100
|
declare class SubscriptionServiceClient implements ISubscriptionServiceClient, ServiceInfo {
|
|
101
101
|
private readonly _transport;
|
|
102
102
|
typeName: string;
|
|
103
|
-
methods:
|
|
103
|
+
methods: _protobuf_ts_runtime_rpc3.MethodInfo<any, any>[];
|
|
104
104
|
options: {
|
|
105
|
-
[extensionName: string]:
|
|
105
|
+
[extensionName: string]: _protobuf_ts_runtime3.JsonValue;
|
|
106
106
|
};
|
|
107
107
|
constructor(_transport: RpcTransport);
|
|
108
108
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecuteTransactionRequest, ExecuteTransactionResponse, SimulateTransactionRequest, SimulateTransactionResponse } from "./transaction_execution_service.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _protobuf_ts_runtime0 from "@protobuf-ts/runtime";
|
|
3
|
+
import * as _protobuf_ts_runtime_rpc0 from "@protobuf-ts/runtime-rpc";
|
|
4
4
|
import { RpcOptions, RpcTransport, ServiceInfo, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
5
5
|
|
|
6
6
|
//#region src/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts
|
|
@@ -23,9 +23,9 @@ interface ITransactionExecutionServiceClient {
|
|
|
23
23
|
declare class TransactionExecutionServiceClient implements ITransactionExecutionServiceClient, ServiceInfo {
|
|
24
24
|
private readonly _transport;
|
|
25
25
|
typeName: string;
|
|
26
|
-
methods:
|
|
26
|
+
methods: _protobuf_ts_runtime_rpc0.MethodInfo<any, any>[];
|
|
27
27
|
options: {
|
|
28
|
-
[extensionName: string]:
|
|
28
|
+
[extensionName: string]: _protobuf_ts_runtime0.JsonValue;
|
|
29
29
|
};
|
|
30
30
|
constructor(_transport: RpcTransport);
|
|
31
31
|
/**
|