@zhoujun_aptos/octopus-ts-sdk-min 0.23.0 → 0.24.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.
@@ -1,6 +1,5 @@
1
1
  import * as AptosSDK from '@aptos-labs/ts-sdk';
2
2
  import { Deserializer, Serializer, Aptos, AccountAddress, Ed25519PublicKey, Ed25519Signature, AccountPublicKey, Signature as Signature$1, PublicKey as PublicKey$1, AptosConfig } from '@aptos-labs/ts-sdk';
3
- import * as SolanaSDK from '@solana/web3.js';
4
3
  import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
5
4
 
6
5
  declare class Element {
@@ -768,7 +767,7 @@ declare class ContractID$1 {
768
767
  programId: PublicKey;
769
768
  constructor({ knownChainName, programId }: {
770
769
  knownChainName: string;
771
- programId: PublicKey;
770
+ programId: string;
772
771
  });
773
772
  static deserialize(deserializer: Deserializer): ContractID$1;
774
773
  static fromBytes(bytes: Uint8Array): ContractID$1;
@@ -826,7 +825,7 @@ declare class ContractID {
826
825
  }): ContractID;
827
826
  static newSolana({ knownChainName, programId }: {
828
827
  knownChainName: string;
829
- programId: SolanaSDK.PublicKey;
828
+ programId: string;
830
829
  }): ContractID;
831
830
  static dummy(): ContractID;
832
831
  static deserialize(deserializer: Deserializer): ContractID;
@@ -905,7 +904,7 @@ declare class ProofOfPermission {
905
904
  fullMessage: string;
906
905
  }): ProofOfPermission;
907
906
  static createSolana({ txn }: {
908
- txn: SolanaSDK.Transaction | SolanaSDK.VersionedTransaction;
907
+ txn: Uint8Array;
909
908
  }): ProofOfPermission;
910
909
  static deserialize(deserializer: Deserializer): ProofOfPermission;
911
910
  static fromBytes(bytes: Uint8Array): ProofOfPermission;
@@ -2651,7 +2651,6 @@ __export(threshold_ibe_exports, {
2651
2651
  });
2652
2652
  import { Deserializer as Deserializer13, Serializer as Serializer14 } from "@aptos-labs/ts-sdk";
2653
2653
  import { bytesToHex as bytesToHex13, hexToBytes as hexToBytes8 } from "@noble/hashes/utils";
2654
- import * as SolanaSDK from "@solana/web3.js";
2655
2654
 
2656
2655
  // src/threshold-ibe/aptos.ts
2657
2656
  import { AccountAddress as AccountAddress2, AccountPublicKey, AnyPublicKey, AnySignature, Aptos as Aptos2, AptosConfig as AptosConfig2, Deserializer as Deserializer11, Ed25519PublicKey, Ed25519Signature, FederatedKeylessPublicKey, KeylessPublicKey, KeylessSignature, MultiEd25519PublicKey, MultiEd25519Signature, MultiKey, MultiKeySignature, Network as Network3, Serializer as Serializer12 } from "@aptos-labs/ts-sdk";
@@ -2969,12 +2968,12 @@ var ContractID2 = class _ContractID {
2969
2968
  programId;
2970
2969
  constructor({ knownChainName, programId }) {
2971
2970
  this.knownChainName = knownChainName;
2972
- this.programId = programId;
2971
+ this.programId = new PublicKey2(programId);
2973
2972
  }
2974
2973
  static deserialize(deserializer) {
2975
2974
  const knownChainName = deserializer.deserializeStr();
2976
2975
  const programId = new PublicKey2(deserializer.deserializeBytes());
2977
- return new _ContractID({ knownChainName, programId });
2976
+ return new _ContractID({ knownChainName, programId: programId.toBase58() });
2978
2977
  }
2979
2978
  static fromBytes(bytes) {
2980
2979
  const deserializer = new Deserializer12(bytes);
@@ -3162,6 +3161,7 @@ async function assertTransactionSimulationPasses(txn, chainName) {
3162
3161
  }
3163
3162
 
3164
3163
  // src/threshold-ibe/index.ts
3164
+ import { Transaction as Transaction2, VersionedTransaction as VersionedTransaction2 } from "@solana/web3.js";
3165
3165
  var Committee = class _Committee {
3166
3166
  workerEndpoints;
3167
3167
  threshold;
@@ -3444,8 +3444,13 @@ var ProofOfPermission3 = class _ProofOfPermission {
3444
3444
  return new _ProofOfPermission(_ProofOfPermission.SCHEME_APTOS, new ProofOfPermission({ userAddr, publicKey, signature, fullMessage }));
3445
3445
  }
3446
3446
  static createSolana({ txn }) {
3447
- const solanaProof = txn instanceof SolanaSDK.VersionedTransaction ? ProofOfPermission2.newVersioned(txn) : ProofOfPermission2.newUnversioned(txn);
3448
- return new _ProofOfPermission(_ProofOfPermission.SCHEME_SOLANA, solanaProof);
3447
+ try {
3448
+ const versioned = VersionedTransaction2.deserialize(txn);
3449
+ return new _ProofOfPermission(_ProofOfPermission.SCHEME_SOLANA, ProofOfPermission2.newVersioned(versioned));
3450
+ } catch {
3451
+ const legacy = Transaction2.from(Buffer.from(txn));
3452
+ return new _ProofOfPermission(_ProofOfPermission.SCHEME_SOLANA, ProofOfPermission2.newUnversioned(legacy));
3453
+ }
3449
3454
  }
3450
3455
  static deserialize(deserializer) {
3451
3456
  const scheme = deserializer.deserializeU8();
@@ -4109,7 +4114,7 @@ __export(solana_exports, {
4109
4114
  });
4110
4115
  import { Deserializer as Deserializer17, Serializer as Serializer18 } from "@aptos-labs/ts-sdk";
4111
4116
  import { bytesToHex as bytesToHex17, hexToBytes as hexToBytes12 } from "@noble/hashes/utils";
4112
- import { PublicKey as PublicKey3, Transaction as Transaction2, VersionedTransaction as VersionedTransaction3 } from "@solana/web3.js";
4117
+ import { PublicKey as PublicKey3, Transaction as Transaction3, VersionedTransaction as VersionedTransaction3 } from "@solana/web3.js";
4113
4118
  var SCHEME_V0 = 0;
4114
4119
  var ContractID5 = class _ContractID {
4115
4120
  scheme;
@@ -4208,7 +4213,7 @@ var ProofOfPermission5 = class _ProofOfPermission {
4208
4213
  const inner = VersionedTransaction3.deserialize(bytes);
4209
4214
  return new _ProofOfPermission(POP_SCHEME__VERSIONED_TXN, inner);
4210
4215
  } else if (scheme == POP_SCHEME__UNVERSIONED_TXN) {
4211
- const inner = Transaction2.from(Buffer.from(bytes));
4216
+ const inner = Transaction3.from(Buffer.from(bytes));
4212
4217
  return new _ProofOfPermission(POP_SCHEME__UNVERSIONED_TXN, inner);
4213
4218
  } else {
4214
4219
  throw new Error(`Unknown scheme: ${scheme}`);