@sovereign-sdk/web3 0.13.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import * as SovereignClient from '@sovereign-sdk/client';
4
4
  export { SovereignClient };
5
5
  import { RollupSchema as RollupSchema$1, Serializer as Serializer$1 } from '@sovereign-sdk/serializers';
6
6
  import { Signer } from '@sovereign-sdk/signers';
7
- import { TxDetails, UnsignedTransaction, Transaction } from '@sovereign-sdk/types';
7
+ import { TxDetails, UnsignedTransaction, Transaction, TransactionV1 } from '@sovereign-sdk/types';
8
8
 
9
9
  /**
10
10
  * Encodes a public key as a bech32m address with the given human-readable part (hrp).
@@ -419,6 +419,10 @@ declare abstract class Serializer {
419
419
  type SolanaOffchainUnsignedTransaction<RuntimeCall> = UnsignedTransaction<RuntimeCall> & {
420
420
  chain_name: string;
421
421
  };
422
+ type SolanaOffchainUnsignedTransactionV1<RuntimeCall> = SolanaOffchainUnsignedTransaction<RuntimeCall> & {
423
+ multisig_id: string;
424
+ version: number;
425
+ };
422
426
  type SolanaOffchainSimpleMessage = {
423
427
  signed_message: Uint8Array;
424
428
  chain_hash: Uint8Array;
@@ -429,12 +433,37 @@ type SolanaOffchainSpecCompliantMessage = {
429
433
  signed_message_with_preamble: Uint8Array;
430
434
  signature: Uint8Array;
431
435
  };
436
+ type SolanaOffchainSimpleMultisigMessage = {
437
+ /** Wire format: [0x80][JSON payload]. The 0x80 prefix is a parsing discriminator only. */
438
+ wire_bytes: Uint8Array;
439
+ chain_hash: Uint8Array;
440
+ signatures: Array<{
441
+ signature: Uint8Array;
442
+ pub_key: Uint8Array;
443
+ }>;
444
+ unused_pub_keys: Uint8Array[];
445
+ min_signers: number;
446
+ };
447
+ type SolanaOffchainSpecCompliantMultisigMessage = {
448
+ signed_message_with_preamble: Uint8Array;
449
+ signatures: Uint8Array[];
450
+ signer_bitfield: number;
451
+ min_signers: number;
452
+ };
432
453
  type Authenticator = "standard" | "solanaSimple" | "solana" | "solanaAuto";
433
- /**
434
- * Creates a Solana offchain message preamble according to the spec.
435
- * See https://docs.anza.xyz/proposals/off-chain-message-signing#message-preamble
436
- */
437
- declare function createSolanaPreamble(pubkey: Uint8Array, chainHash: Uint8Array, messageLength: number): Uint8Array;
454
+ type SolanaMultisigAuthenticator = "solanaSimple" | "solana";
455
+ type SolanaMultisigParams = {
456
+ multisigAddress: Uint8Array;
457
+ multisigPubkeys: Uint8Array[];
458
+ };
459
+ type SolanaMultisigSubmitParams = {
460
+ authenticator: "standard";
461
+ } | ({
462
+ authenticator: SolanaMultisigAuthenticator;
463
+ } & SolanaMultisigParams);
464
+ type SolanaMultisigSignParams = SolanaMultisigSubmitParams & {
465
+ signer: Signer;
466
+ };
438
467
  declare class SolanaSignableRollup<RuntimeCall> {
439
468
  private inner;
440
469
  private solanaEndpoint;
@@ -458,6 +487,10 @@ declare class SolanaSignableRollup<RuntimeCall> {
458
487
  * Submits a Solana spec-compliant message to the rollup.
459
488
  */
460
489
  private submitSolanaSpecMessage;
490
+ /**
491
+ * Submits a Solana spec-compliant multisig message to the rollup.
492
+ */
493
+ private submitSolanaSpecMultisigMessage;
461
494
  /**
462
495
  * Helper to build an unsigned transaction using the standard type builder.
463
496
  */
@@ -466,6 +499,15 @@ declare class SolanaSignableRollup<RuntimeCall> {
466
499
  * Helper to build a transaction result object.
467
500
  */
468
501
  private buildTransactionResult;
502
+ /**
503
+ * Concatenates a Solana preamble with the message bytes it signs.
504
+ */
505
+ private combinePreambleAndMessage;
506
+ /**
507
+ * Validates and canonicalizes the multisig pubkey list.
508
+ * The canonical order is lexicographic by raw pubkey bytes.
509
+ */
510
+ private canonicalizeMultisigPubkeys;
469
511
  /**
470
512
  * Helper to create and serialize a SolanaOffchainUnsignedTransaction to JSON bytes.
471
513
  */
@@ -505,6 +547,46 @@ declare class SolanaSignableRollup<RuntimeCall> {
505
547
  signer: Signer;
506
548
  authenticator: Authenticator;
507
549
  }, options?: SovereignClient__default.RequestOptions): Promise<TransactionResult<Transaction<RuntimeCall>>>;
550
+ /**
551
+ * Creates V1 JSON bytes for a multisig transaction, including multisig_id and version.
552
+ * The resulting JSON is what each signer signs directly (no discriminator prefix).
553
+ */
554
+ private createMultisigJsonBytes;
555
+ /**
556
+ * Creates the preamble+JSON bytes signed by every signer in a spec-compliant multisig flow.
557
+ */
558
+ private createSpecCompliantMultisigSignedMessage;
559
+ /**
560
+ * Signs an unsigned transaction using Solana offchain simple multisig signing.
561
+ */
562
+ private signForSolanaSimpleMultisig;
563
+ /**
564
+ * Signs an unsigned transaction using the spec-compliant multisig preamble.
565
+ */
566
+ private signForSolanaSpecMultisig;
567
+ /**
568
+ * Signs an unsigned transaction for use in a Solana offchain multisig.
569
+ *
570
+ * `authenticator: "standard"` delegates directly to the wrapped standard rollup.
571
+ * `authenticator: "solanaSimple"` signs the V1 JSON payload directly.
572
+ * `authenticator: "solana"` signs the spec-compliant preamble+JSON bytes.
573
+ * Solana multisig authenticators treat `multisigPubkeys` as an unordered set and
574
+ * canonicalize it before signing.
575
+ */
576
+ signTransactionForMultisig(unsignedTx: UnsignedTransaction<RuntimeCall>, params: SolanaMultisigSignParams): Promise<Transaction<RuntimeCall>>;
577
+ /**
578
+ * Builds a spec-compliant multisig envelope from a V1 transaction and ordered multisig pubkeys.
579
+ */
580
+ private buildSpecCompliantMultisigEnvelope;
581
+ /**
582
+ * Submits a multisig transaction using the Solana offchain simple multisig format.
583
+ *
584
+ * Accepts the V1 transaction produced by `MultisigTransaction.asTransaction()`.
585
+ * `authenticator: "standard"` delegates directly to the wrapped standard rollup.
586
+ * Solana authenticators rebuild the appropriate Solana multisig envelope and
587
+ * submit it to the Solana offchain endpoint.
588
+ */
589
+ submitMultisigTransaction(multisigTx: TransactionV1<RuntimeCall>, params: SolanaMultisigSubmitParams): Promise<SovereignClient__default.Sequencer.TxCreateResponse>;
508
590
  /**
509
591
  * Submits a standard transaction.
510
592
  */
@@ -541,6 +623,28 @@ declare class SolanaSignableRollup<RuntimeCall> {
541
623
  * Helper method to serialize a SolanaOffchainSpecCompliantMessage using borsh encoding.
542
624
  */
543
625
  private serializeSolanaSpecMessage;
626
+ /**
627
+ * Serializes a SolanaOffchainSimpleMultisigMessage using borsh encoding.
628
+ * Layout matches the Rust struct:
629
+ * [u32 LE: wire_bytes.len][wire_bytes]
630
+ * [32 bytes: chain_hash]
631
+ * [u32 LE: signatures.len]
632
+ * for each: [64 bytes: signature][32 bytes: pub_key]
633
+ * [u32 LE: unused_pub_keys.len]
634
+ * for each: [32 bytes: pub_key]
635
+ * [u8: min_signers]
636
+ */
637
+ private serializeSolanaMultisigMessage;
638
+ /**
639
+ * Serializes a SolanaOffchainSpecCompliantMultisigMessage using borsh encoding.
640
+ * Layout matches the Rust struct:
641
+ * [u32 LE: signed_message_with_preamble.len][signed_message_with_preamble]
642
+ * [u32 LE: signatures.len]
643
+ * for each: [64 bytes: signature]
644
+ * [u32 LE: signer_bitfield]
645
+ * [u8: min_signers]
646
+ */
647
+ private serializeSolanaSpecMultisigMessage;
544
648
  }
545
649
  declare function createSolanaSignableRollup<RuntimeCall>(rollupConfig?: Partial<RollupConfig<DeepPartial<StandardRollupContext>>>, solanaEndpoint?: string): Promise<SolanaSignableRollup<RuntimeCall>>;
546
650
 
@@ -564,4 +668,4 @@ declare class SchemaError extends SovereignError {
564
668
  constructor(message: string, reason: string, schema: object);
565
669
  }
566
670
 
567
- export { type Authenticator, type BaseTypeSpec, type CallParams, DEFAULT_TX_DETAILS, type Dedup, type EventPayload, InvalidRollupConfigError, Rollup, type RollupConfig, type RollupContext, type RollupTypeSpec, SchemaError, type SignerParams, type SimulateParams, type SolanaOffchainSimpleMessage, type SolanaOffchainSpecCompliantMessage, type SolanaOffchainUnsignedTransaction, SolanaSignableRollup, SovereignError, StandardRollup, type StandardRollupContext, type StandardRollupSpec, type Subscription, type TransactionContext, type TransactionResult, type TypeBuilder, type UnsignedTransactionContext, VersionMismatchError, addressFromPublicKey, createSolanaPreamble, createSolanaSignableRollup, createStandardRollup, standardTypeBuilder };
671
+ export { type Authenticator, type BaseTypeSpec, type CallParams, DEFAULT_TX_DETAILS, type Dedup, type EventPayload, InvalidRollupConfigError, Rollup, type RollupConfig, type RollupContext, type RollupTypeSpec, SchemaError, type SignerParams, type SimulateParams, type SolanaMultisigAuthenticator, type SolanaMultisigSignParams, type SolanaMultisigSubmitParams, type SolanaOffchainSimpleMessage, type SolanaOffchainSimpleMultisigMessage, type SolanaOffchainSpecCompliantMessage, type SolanaOffchainSpecCompliantMultisigMessage, type SolanaOffchainUnsignedTransaction, type SolanaOffchainUnsignedTransactionV1, SolanaSignableRollup, SovereignError, StandardRollup, type StandardRollupContext, type StandardRollupSpec, type Subscription, type TransactionContext, type TransactionResult, type TypeBuilder, type UnsignedTransactionContext, VersionMismatchError, addressFromPublicKey, createSolanaSignableRollup, createStandardRollup, standardTypeBuilder };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as SovereignClient from '@sovereign-sdk/client';
4
4
  export { SovereignClient };
5
5
  import { RollupSchema as RollupSchema$1, Serializer as Serializer$1 } from '@sovereign-sdk/serializers';
6
6
  import { Signer } from '@sovereign-sdk/signers';
7
- import { TxDetails, UnsignedTransaction, Transaction } from '@sovereign-sdk/types';
7
+ import { TxDetails, UnsignedTransaction, Transaction, TransactionV1 } from '@sovereign-sdk/types';
8
8
 
9
9
  /**
10
10
  * Encodes a public key as a bech32m address with the given human-readable part (hrp).
@@ -419,6 +419,10 @@ declare abstract class Serializer {
419
419
  type SolanaOffchainUnsignedTransaction<RuntimeCall> = UnsignedTransaction<RuntimeCall> & {
420
420
  chain_name: string;
421
421
  };
422
+ type SolanaOffchainUnsignedTransactionV1<RuntimeCall> = SolanaOffchainUnsignedTransaction<RuntimeCall> & {
423
+ multisig_id: string;
424
+ version: number;
425
+ };
422
426
  type SolanaOffchainSimpleMessage = {
423
427
  signed_message: Uint8Array;
424
428
  chain_hash: Uint8Array;
@@ -429,12 +433,37 @@ type SolanaOffchainSpecCompliantMessage = {
429
433
  signed_message_with_preamble: Uint8Array;
430
434
  signature: Uint8Array;
431
435
  };
436
+ type SolanaOffchainSimpleMultisigMessage = {
437
+ /** Wire format: [0x80][JSON payload]. The 0x80 prefix is a parsing discriminator only. */
438
+ wire_bytes: Uint8Array;
439
+ chain_hash: Uint8Array;
440
+ signatures: Array<{
441
+ signature: Uint8Array;
442
+ pub_key: Uint8Array;
443
+ }>;
444
+ unused_pub_keys: Uint8Array[];
445
+ min_signers: number;
446
+ };
447
+ type SolanaOffchainSpecCompliantMultisigMessage = {
448
+ signed_message_with_preamble: Uint8Array;
449
+ signatures: Uint8Array[];
450
+ signer_bitfield: number;
451
+ min_signers: number;
452
+ };
432
453
  type Authenticator = "standard" | "solanaSimple" | "solana" | "solanaAuto";
433
- /**
434
- * Creates a Solana offchain message preamble according to the spec.
435
- * See https://docs.anza.xyz/proposals/off-chain-message-signing#message-preamble
436
- */
437
- declare function createSolanaPreamble(pubkey: Uint8Array, chainHash: Uint8Array, messageLength: number): Uint8Array;
454
+ type SolanaMultisigAuthenticator = "solanaSimple" | "solana";
455
+ type SolanaMultisigParams = {
456
+ multisigAddress: Uint8Array;
457
+ multisigPubkeys: Uint8Array[];
458
+ };
459
+ type SolanaMultisigSubmitParams = {
460
+ authenticator: "standard";
461
+ } | ({
462
+ authenticator: SolanaMultisigAuthenticator;
463
+ } & SolanaMultisigParams);
464
+ type SolanaMultisigSignParams = SolanaMultisigSubmitParams & {
465
+ signer: Signer;
466
+ };
438
467
  declare class SolanaSignableRollup<RuntimeCall> {
439
468
  private inner;
440
469
  private solanaEndpoint;
@@ -458,6 +487,10 @@ declare class SolanaSignableRollup<RuntimeCall> {
458
487
  * Submits a Solana spec-compliant message to the rollup.
459
488
  */
460
489
  private submitSolanaSpecMessage;
490
+ /**
491
+ * Submits a Solana spec-compliant multisig message to the rollup.
492
+ */
493
+ private submitSolanaSpecMultisigMessage;
461
494
  /**
462
495
  * Helper to build an unsigned transaction using the standard type builder.
463
496
  */
@@ -466,6 +499,15 @@ declare class SolanaSignableRollup<RuntimeCall> {
466
499
  * Helper to build a transaction result object.
467
500
  */
468
501
  private buildTransactionResult;
502
+ /**
503
+ * Concatenates a Solana preamble with the message bytes it signs.
504
+ */
505
+ private combinePreambleAndMessage;
506
+ /**
507
+ * Validates and canonicalizes the multisig pubkey list.
508
+ * The canonical order is lexicographic by raw pubkey bytes.
509
+ */
510
+ private canonicalizeMultisigPubkeys;
469
511
  /**
470
512
  * Helper to create and serialize a SolanaOffchainUnsignedTransaction to JSON bytes.
471
513
  */
@@ -505,6 +547,46 @@ declare class SolanaSignableRollup<RuntimeCall> {
505
547
  signer: Signer;
506
548
  authenticator: Authenticator;
507
549
  }, options?: SovereignClient__default.RequestOptions): Promise<TransactionResult<Transaction<RuntimeCall>>>;
550
+ /**
551
+ * Creates V1 JSON bytes for a multisig transaction, including multisig_id and version.
552
+ * The resulting JSON is what each signer signs directly (no discriminator prefix).
553
+ */
554
+ private createMultisigJsonBytes;
555
+ /**
556
+ * Creates the preamble+JSON bytes signed by every signer in a spec-compliant multisig flow.
557
+ */
558
+ private createSpecCompliantMultisigSignedMessage;
559
+ /**
560
+ * Signs an unsigned transaction using Solana offchain simple multisig signing.
561
+ */
562
+ private signForSolanaSimpleMultisig;
563
+ /**
564
+ * Signs an unsigned transaction using the spec-compliant multisig preamble.
565
+ */
566
+ private signForSolanaSpecMultisig;
567
+ /**
568
+ * Signs an unsigned transaction for use in a Solana offchain multisig.
569
+ *
570
+ * `authenticator: "standard"` delegates directly to the wrapped standard rollup.
571
+ * `authenticator: "solanaSimple"` signs the V1 JSON payload directly.
572
+ * `authenticator: "solana"` signs the spec-compliant preamble+JSON bytes.
573
+ * Solana multisig authenticators treat `multisigPubkeys` as an unordered set and
574
+ * canonicalize it before signing.
575
+ */
576
+ signTransactionForMultisig(unsignedTx: UnsignedTransaction<RuntimeCall>, params: SolanaMultisigSignParams): Promise<Transaction<RuntimeCall>>;
577
+ /**
578
+ * Builds a spec-compliant multisig envelope from a V1 transaction and ordered multisig pubkeys.
579
+ */
580
+ private buildSpecCompliantMultisigEnvelope;
581
+ /**
582
+ * Submits a multisig transaction using the Solana offchain simple multisig format.
583
+ *
584
+ * Accepts the V1 transaction produced by `MultisigTransaction.asTransaction()`.
585
+ * `authenticator: "standard"` delegates directly to the wrapped standard rollup.
586
+ * Solana authenticators rebuild the appropriate Solana multisig envelope and
587
+ * submit it to the Solana offchain endpoint.
588
+ */
589
+ submitMultisigTransaction(multisigTx: TransactionV1<RuntimeCall>, params: SolanaMultisigSubmitParams): Promise<SovereignClient__default.Sequencer.TxCreateResponse>;
508
590
  /**
509
591
  * Submits a standard transaction.
510
592
  */
@@ -541,6 +623,28 @@ declare class SolanaSignableRollup<RuntimeCall> {
541
623
  * Helper method to serialize a SolanaOffchainSpecCompliantMessage using borsh encoding.
542
624
  */
543
625
  private serializeSolanaSpecMessage;
626
+ /**
627
+ * Serializes a SolanaOffchainSimpleMultisigMessage using borsh encoding.
628
+ * Layout matches the Rust struct:
629
+ * [u32 LE: wire_bytes.len][wire_bytes]
630
+ * [32 bytes: chain_hash]
631
+ * [u32 LE: signatures.len]
632
+ * for each: [64 bytes: signature][32 bytes: pub_key]
633
+ * [u32 LE: unused_pub_keys.len]
634
+ * for each: [32 bytes: pub_key]
635
+ * [u8: min_signers]
636
+ */
637
+ private serializeSolanaMultisigMessage;
638
+ /**
639
+ * Serializes a SolanaOffchainSpecCompliantMultisigMessage using borsh encoding.
640
+ * Layout matches the Rust struct:
641
+ * [u32 LE: signed_message_with_preamble.len][signed_message_with_preamble]
642
+ * [u32 LE: signatures.len]
643
+ * for each: [64 bytes: signature]
644
+ * [u32 LE: signer_bitfield]
645
+ * [u8: min_signers]
646
+ */
647
+ private serializeSolanaSpecMultisigMessage;
544
648
  }
545
649
  declare function createSolanaSignableRollup<RuntimeCall>(rollupConfig?: Partial<RollupConfig<DeepPartial<StandardRollupContext>>>, solanaEndpoint?: string): Promise<SolanaSignableRollup<RuntimeCall>>;
546
650
 
@@ -564,4 +668,4 @@ declare class SchemaError extends SovereignError {
564
668
  constructor(message: string, reason: string, schema: object);
565
669
  }
566
670
 
567
- export { type Authenticator, type BaseTypeSpec, type CallParams, DEFAULT_TX_DETAILS, type Dedup, type EventPayload, InvalidRollupConfigError, Rollup, type RollupConfig, type RollupContext, type RollupTypeSpec, SchemaError, type SignerParams, type SimulateParams, type SolanaOffchainSimpleMessage, type SolanaOffchainSpecCompliantMessage, type SolanaOffchainUnsignedTransaction, SolanaSignableRollup, SovereignError, StandardRollup, type StandardRollupContext, type StandardRollupSpec, type Subscription, type TransactionContext, type TransactionResult, type TypeBuilder, type UnsignedTransactionContext, VersionMismatchError, addressFromPublicKey, createSolanaPreamble, createSolanaSignableRollup, createStandardRollup, standardTypeBuilder };
671
+ export { type Authenticator, type BaseTypeSpec, type CallParams, DEFAULT_TX_DETAILS, type Dedup, type EventPayload, InvalidRollupConfigError, Rollup, type RollupConfig, type RollupContext, type RollupTypeSpec, SchemaError, type SignerParams, type SimulateParams, type SolanaMultisigAuthenticator, type SolanaMultisigSignParams, type SolanaMultisigSubmitParams, type SolanaOffchainSimpleMessage, type SolanaOffchainSimpleMultisigMessage, type SolanaOffchainSpecCompliantMessage, type SolanaOffchainSpecCompliantMultisigMessage, type SolanaOffchainUnsignedTransaction, type SolanaOffchainUnsignedTransactionV1, SolanaSignableRollup, SovereignError, StandardRollup, type StandardRollupContext, type StandardRollupSpec, type Subscription, type TransactionContext, type TransactionResult, type TypeBuilder, type UnsignedTransactionContext, VersionMismatchError, addressFromPublicKey, createSolanaSignableRollup, createStandardRollup, standardTypeBuilder };