@zhoujun_aptos/octopus-ts-sdk-min 0.22.8 → 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;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -2693,7 +2683,6 @@ __export(threshold_ibe_exports, {
2693
2683
  });
2694
2684
  var import_ts_sdk14 = require("@aptos-labs/ts-sdk");
2695
2685
  var import_utils19 = require("@noble/hashes/utils");
2696
- var SolanaSDK = __toESM(require("@solana/web3.js"));
2697
2686
 
2698
2687
  // src/threshold-ibe/aptos.ts
2699
2688
  var import_ts_sdk12 = require("@aptos-labs/ts-sdk");
@@ -3011,12 +3000,12 @@ var ContractID2 = class _ContractID {
3011
3000
  programId;
3012
3001
  constructor({ knownChainName, programId }) {
3013
3002
  this.knownChainName = knownChainName;
3014
- this.programId = programId;
3003
+ this.programId = new import_web3.PublicKey(programId);
3015
3004
  }
3016
3005
  static deserialize(deserializer) {
3017
3006
  const knownChainName = deserializer.deserializeStr();
3018
3007
  const programId = new import_web3.PublicKey(deserializer.deserializeBytes());
3019
- return new _ContractID({ knownChainName, programId });
3008
+ return new _ContractID({ knownChainName, programId: programId.toBase58() });
3020
3009
  }
3021
3010
  static fromBytes(bytes) {
3022
3011
  const deserializer = new import_ts_sdk13.Deserializer(bytes);
@@ -3204,6 +3193,7 @@ async function assertTransactionSimulationPasses(txn, chainName) {
3204
3193
  }
3205
3194
 
3206
3195
  // src/threshold-ibe/index.ts
3196
+ var import_web32 = require("@solana/web3.js");
3207
3197
  var Committee = class _Committee {
3208
3198
  workerEndpoints;
3209
3199
  threshold;
@@ -3486,8 +3476,13 @@ var ProofOfPermission3 = class _ProofOfPermission {
3486
3476
  return new _ProofOfPermission(_ProofOfPermission.SCHEME_APTOS, new ProofOfPermission({ userAddr, publicKey, signature, fullMessage }));
3487
3477
  }
3488
3478
  static createSolana({ txn }) {
3489
- const solanaProof = txn instanceof SolanaSDK.VersionedTransaction ? ProofOfPermission2.newVersioned(txn) : ProofOfPermission2.newUnversioned(txn);
3490
- return new _ProofOfPermission(_ProofOfPermission.SCHEME_SOLANA, solanaProof);
3479
+ try {
3480
+ const versioned = import_web32.VersionedTransaction.deserialize(txn);
3481
+ return new _ProofOfPermission(_ProofOfPermission.SCHEME_SOLANA, ProofOfPermission2.newVersioned(versioned));
3482
+ } catch {
3483
+ const legacy = import_web32.Transaction.from(Buffer.from(txn));
3484
+ return new _ProofOfPermission(_ProofOfPermission.SCHEME_SOLANA, ProofOfPermission2.newUnversioned(legacy));
3485
+ }
3491
3486
  }
3492
3487
  static deserialize(deserializer) {
3493
3488
  const scheme = deserializer.deserializeU8();
@@ -4151,7 +4146,7 @@ __export(solana_exports, {
4151
4146
  });
4152
4147
  var import_ts_sdk18 = require("@aptos-labs/ts-sdk");
4153
4148
  var import_utils23 = require("@noble/hashes/utils");
4154
- var import_web32 = require("@solana/web3.js");
4149
+ var import_web33 = require("@solana/web3.js");
4155
4150
  var SCHEME_V0 = 0;
4156
4151
  var ContractID5 = class _ContractID {
4157
4152
  scheme;
@@ -4205,7 +4200,7 @@ var ContractIDV0 = class _ContractIDV0 {
4205
4200
  }
4206
4201
  static deserialize(deserializer) {
4207
4202
  const knownChainName = deserializer.deserializeStr();
4208
- const programId = new import_web32.PublicKey(deserializer.deserializeBytes());
4203
+ const programId = new import_web33.PublicKey(deserializer.deserializeBytes());
4209
4204
  return new _ContractIDV0(knownChainName, programId);
4210
4205
  }
4211
4206
  static fromBytes(bytes) {
@@ -4247,10 +4242,10 @@ var ProofOfPermission5 = class _ProofOfPermission {
4247
4242
  const scheme = deserializer.deserializeU8();
4248
4243
  const bytes = deserializer.deserializeBytes();
4249
4244
  if (scheme == POP_SCHEME__VERSIONED_TXN) {
4250
- const inner = import_web32.VersionedTransaction.deserialize(bytes);
4245
+ const inner = import_web33.VersionedTransaction.deserialize(bytes);
4251
4246
  return new _ProofOfPermission(POP_SCHEME__VERSIONED_TXN, inner);
4252
4247
  } else if (scheme == POP_SCHEME__UNVERSIONED_TXN) {
4253
- const inner = import_web32.Transaction.from(Buffer.from(bytes));
4248
+ const inner = import_web33.Transaction.from(Buffer.from(bytes));
4254
4249
  return new _ProofOfPermission(POP_SCHEME__UNVERSIONED_TXN, inner);
4255
4250
  } else {
4256
4251
  throw new Error(`Unknown scheme: ${scheme}`);