@aptos-labs/wallet-adapter-core 2.5.0 → 2.6.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @aptos-labs/wallet-adapter-core
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7acfa69: Adding support for the new Typescript SDK in the package `@aptos-labs/ts-sdk`. The wallet adapter now supports submitting a basic transaction with the new SDK types.
8
+
9
+ ### Patch Changes
10
+
11
+ - dd6e1ed: Moves dependencies to peer dependencies as needed
12
+
13
+ ## 2.5.1
14
+
15
+ ### Patch Changes
16
+
17
+ - 7e314e5: Update aptos dependency
18
+
3
19
  ## 2.5.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import { Types, TxnBuilderTypes } from 'aptos';
2
+ export { TxnBuilderTypes, Types } from 'aptos';
3
+ import { InputGenerateTransactionData } from '@aptos-labs/ts-sdk';
4
+ export { InputGenerateTransactionData } from '@aptos-labs/ts-sdk';
2
5
  import EventEmitter from 'eventemitter3';
3
6
 
4
7
  declare enum WalletReadyState {
@@ -26,15 +29,15 @@ declare enum NetworkName {
26
29
  Devnet = "devnet"
27
30
  }
28
31
 
29
- declare type WalletName<T extends string = string> = T & {
32
+ type WalletName<T extends string = string> = T & {
30
33
  __brand__: "WalletName";
31
34
  };
32
- declare type NetworkInfo = {
35
+ type NetworkInfo = {
33
36
  name: NetworkName;
34
37
  chainId?: string;
35
38
  url?: string;
36
39
  };
37
- declare type AccountInfo = {
40
+ type AccountInfo = {
38
41
  address: string;
39
42
  publicKey: string | string[];
40
43
  minKeysRequired?: number;
@@ -45,7 +48,7 @@ interface AptosWalletErrorResult {
45
48
  name: string;
46
49
  message: string;
47
50
  }
48
- declare type OnNetworkChange = (callBack: (networkInfo: NetworkInfo) => Promise<void>) => Promise<void>;
51
+ type OnNetworkChange = (callBack: (networkInfo: NetworkInfo) => Promise<void>) => Promise<void>;
49
52
  interface PluginProvider {
50
53
  connect: () => Promise<AccountInfo>;
51
54
  account: () => Promise<AccountInfo>;
@@ -57,6 +60,7 @@ interface PluginProvider {
57
60
  network: () => Promise<NetworkName>;
58
61
  onAccountChange: (listener: (newAddress: AccountInfo) => Promise<void>) => Promise<void>;
59
62
  onNetworkChange: OnNetworkChange;
63
+ signMultiAgentTransaction: (rawTxn: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction) => Promise<string>;
60
64
  }
61
65
  interface AdapterPluginEvents {
62
66
  onNetworkChange: OnNetworkChange;
@@ -79,11 +83,11 @@ interface AdapterPluginProps<Name extends string = string> {
79
83
  }>;
80
84
  signMessage<T extends SignMessagePayload>(message: T): Promise<SignMessageResponse>;
81
85
  }
82
- declare type AdapterPlugin<Name extends string = string> = AdapterPluginProps<Name> & AdapterPluginEvents;
83
- declare type Wallet<Name extends string = string> = AdapterPlugin<Name> & {
86
+ type AdapterPlugin<Name extends string = string> = AdapterPluginProps<Name> & AdapterPluginEvents;
87
+ type Wallet<Name extends string = string> = AdapterPlugin<Name> & {
84
88
  readyState?: WalletReadyState;
85
89
  };
86
- declare type WalletInfo = {
90
+ type WalletInfo = {
87
91
  name: WalletName;
88
92
  icon: string;
89
93
  url: string;
@@ -185,28 +189,42 @@ declare class WalletCore extends EventEmitter<WalletCoreEvents> {
185
189
  */
186
190
  signAndSubmitTransaction(transaction: Types.TransactionPayload, options?: TransactionOptions): Promise<any>;
187
191
  /**
188
- Sign and submit a bsc serialized transaction type to chain.
189
- @param transaction a bcs serialized transaction
190
- @param options max_gas_amount and gas_unit_limit
191
- @return response from the wallet's signAndSubmitBCSTransaction function
192
- @throws WalletSignAndSubmitMessageError
193
- */
192
+ Sign and submit a bsc serialized transaction type to chain.
193
+ @param transaction a bcs serialized transaction
194
+ @param options max_gas_amount and gas_unit_limit
195
+ @return response from the wallet's signAndSubmitBCSTransaction function
196
+ @throws WalletSignAndSubmitMessageError
197
+ */
194
198
  signAndSubmitBCSTransaction(transaction: TxnBuilderTypes.TransactionPayload, options?: TransactionOptions): Promise<any>;
195
199
  /**
196
- Sign transaction (doesnt submit to chain).
197
- @param transaction
198
- @param options max_gas_amount and gas_unit_limit
199
- @return response from the wallet's signTransaction function
200
- @throws WalletSignTransactionError
201
- */
200
+ Sign transaction (doesnt submit to chain).
201
+ @param transaction
202
+ @param options max_gas_amount and gas_unit_limit
203
+ @return response from the wallet's signTransaction function
204
+ @throws WalletSignTransactionError
205
+ */
202
206
  signTransaction(transaction: Types.TransactionPayload, options?: TransactionOptions): Promise<Uint8Array | null>;
203
207
  /**
204
- Sign message (doesnt submit to chain).
205
- @param message
206
- @return response from the wallet's signMessage function
207
- @throws WalletSignMessageError
208
- */
208
+ Sign message (doesnt submit to chain).
209
+ @param message
210
+ @return response from the wallet's signMessage function
211
+ @throws WalletSignMessageError
212
+ */
209
213
  signMessage(message: SignMessagePayload): Promise<SignMessageResponse | null>;
214
+ /**
215
+ * This function is for signing and submitting a transaction using the `@aptos-labs/ts-sdk` (aka the v2 SDK)
216
+ * input types. It's internally converting the input types to the old SDK input types and then calling
217
+ * the v1 SDK's `signAndSubmitBCSTransaction` with it.
218
+ *
219
+ * @param transactionInput the transaction input
220
+ * @param options max_gas_amount and gas_unit_limit
221
+ * @returns the response from the wallet's signAndSubmitBCSTransaction function
222
+ */
223
+ submitTransaction(transactionInput: InputGenerateTransactionData, options?: TransactionOptions): Promise<{
224
+ hash: string;
225
+ output?: any;
226
+ }>;
227
+ signMultiAgentTransaction(transaction: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction): Promise<string | null>;
210
228
  /**
211
229
  Event for when account has changed on the wallet
212
230
  @return the new account info
package/dist/index.js CHANGED
@@ -27,6 +27,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
27
27
  var src_exports = {};
28
28
  __export(src_exports, {
29
29
  NetworkName: () => NetworkName,
30
+ TxnBuilderTypes: () => import_aptos3.TxnBuilderTypes,
31
+ Types: () => import_aptos3.Types,
30
32
  WalletCore: () => WalletCore,
31
33
  WalletReadyState: () => WalletReadyState,
32
34
  getLocalStorage: () => getLocalStorage,
@@ -40,7 +42,8 @@ __export(src_exports, {
40
42
  module.exports = __toCommonJS(src_exports);
41
43
 
42
44
  // src/WalletCore.ts
43
- var import_aptos = require("aptos");
45
+ var import_aptos2 = require("aptos");
46
+ var import_ts_sdk2 = require("@aptos-labs/ts-sdk");
44
47
  var import_eventemitter3 = __toESM(require("eventemitter3"));
45
48
  var import_tweetnacl = __toESM(require("tweetnacl"));
46
49
  var import_buffer = require("buffer");
@@ -235,6 +238,26 @@ var getNameByAddress = async (chainId, address) => {
235
238
  }
236
239
  };
237
240
 
241
+ // src/conversion.ts
242
+ var import_ts_sdk = require("@aptos-labs/ts-sdk");
243
+ var import_aptos = require("aptos");
244
+ function convertNetwork(networkInfo) {
245
+ switch (networkInfo == null ? void 0 : networkInfo.name.toLowerCase()) {
246
+ case "mainnet":
247
+ return import_ts_sdk.Network.MAINNET;
248
+ case "testnet":
249
+ return import_ts_sdk.Network.TESTNET;
250
+ case "devnet":
251
+ return import_ts_sdk.Network.DEVNET;
252
+ default:
253
+ throw new Error("Invalid network name");
254
+ }
255
+ }
256
+ function convertToBCSPayload(payload) {
257
+ const deserializer = new import_aptos.BCS.Deserializer(payload.bcsToBytes());
258
+ return import_aptos.TxnBuilderTypes.TransactionPayload.deserialize(deserializer);
259
+ }
260
+
238
261
  // src/WalletCore.ts
239
262
  var WalletCore = class extends import_eventemitter3.default {
240
263
  constructor(plugins) {
@@ -456,6 +479,33 @@ var WalletCore = class extends import_eventemitter3.default {
456
479
  throw new WalletSignMessageError(errMsg).message;
457
480
  }
458
481
  }
482
+ async submitTransaction(transactionInput, options) {
483
+ const payloadData = transactionInput.data;
484
+ const aptosConfig = new import_ts_sdk2.AptosConfig({ network: convertNetwork(this._network) });
485
+ const newPayload = await (0, import_ts_sdk2.generateTransactionPayload)({ ...payloadData, aptosConfig });
486
+ const oldTransactionPayload = convertToBCSPayload(newPayload);
487
+ const response = await this.signAndSubmitBCSTransaction(oldTransactionPayload, options);
488
+ const { hash, ...output } = response;
489
+ return { hash, output };
490
+ }
491
+ async signMultiAgentTransaction(transaction) {
492
+ var _a;
493
+ if (this._wallet && !("signMultiAgentTransaction" in this._wallet)) {
494
+ throw new WalletNotSupportedMethod(
495
+ `Multi-agent & sponsored transactions are not supported by ${(_a = this.wallet) == null ? void 0 : _a.name}`
496
+ ).message;
497
+ }
498
+ try {
499
+ this.doesWalletExist();
500
+ const response = await this._wallet.signMultiAgentTransaction(
501
+ transaction
502
+ );
503
+ return response;
504
+ } catch (error) {
505
+ const errMsg = typeof error == "object" && "message" in error ? error.message : error;
506
+ throw new WalletSignTransactionError(errMsg).message;
507
+ }
508
+ }
459
509
  async onAccountChange() {
460
510
  var _a;
461
511
  try {
@@ -526,10 +576,10 @@ var WalletCore = class extends import_eventemitter3.default {
526
576
  throw new WalletSignMessageAndVerifyError("Failed to get a bitmap").message;
527
577
  }
528
578
  } else {
529
- const currentAccountPublicKey = new import_aptos.HexString(
579
+ const currentAccountPublicKey = new import_aptos2.HexString(
530
580
  this._account.publicKey
531
581
  );
532
- const signature = new import_aptos.HexString(response.signature);
582
+ const signature = new import_aptos2.HexString(response.signature);
533
583
  verified = import_tweetnacl.default.sign.detached.verify(
534
584
  import_buffer.Buffer.from(response.fullMessage),
535
585
  import_buffer.Buffer.from(signature.noPrefix(), "hex"),
@@ -543,9 +593,14 @@ var WalletCore = class extends import_eventemitter3.default {
543
593
  }
544
594
  }
545
595
  };
596
+
597
+ // src/types.ts
598
+ var import_aptos3 = require("aptos");
546
599
  // Annotate the CommonJS export names for ESM import in node:
547
600
  0 && (module.exports = {
548
601
  NetworkName,
602
+ TxnBuilderTypes,
603
+ Types,
549
604
  WalletCore,
550
605
  WalletReadyState,
551
606
  getLocalStorage,
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/WalletCore.ts
2
2
  import { HexString } from "aptos";
3
+ import { AptosConfig, generateTransactionPayload } from "@aptos-labs/ts-sdk";
3
4
  import EventEmitter from "eventemitter3";
4
5
  import nacl from "tweetnacl";
5
6
  import { Buffer } from "buffer";
@@ -194,6 +195,26 @@ var getNameByAddress = async (chainId, address) => {
194
195
  }
195
196
  };
196
197
 
198
+ // src/conversion.ts
199
+ import { Network } from "@aptos-labs/ts-sdk";
200
+ import { BCS, TxnBuilderTypes } from "aptos";
201
+ function convertNetwork(networkInfo) {
202
+ switch (networkInfo == null ? void 0 : networkInfo.name.toLowerCase()) {
203
+ case "mainnet":
204
+ return Network.MAINNET;
205
+ case "testnet":
206
+ return Network.TESTNET;
207
+ case "devnet":
208
+ return Network.DEVNET;
209
+ default:
210
+ throw new Error("Invalid network name");
211
+ }
212
+ }
213
+ function convertToBCSPayload(payload) {
214
+ const deserializer = new BCS.Deserializer(payload.bcsToBytes());
215
+ return TxnBuilderTypes.TransactionPayload.deserialize(deserializer);
216
+ }
217
+
197
218
  // src/WalletCore.ts
198
219
  var WalletCore = class extends EventEmitter {
199
220
  constructor(plugins) {
@@ -415,6 +436,33 @@ var WalletCore = class extends EventEmitter {
415
436
  throw new WalletSignMessageError(errMsg).message;
416
437
  }
417
438
  }
439
+ async submitTransaction(transactionInput, options) {
440
+ const payloadData = transactionInput.data;
441
+ const aptosConfig = new AptosConfig({ network: convertNetwork(this._network) });
442
+ const newPayload = await generateTransactionPayload({ ...payloadData, aptosConfig });
443
+ const oldTransactionPayload = convertToBCSPayload(newPayload);
444
+ const response = await this.signAndSubmitBCSTransaction(oldTransactionPayload, options);
445
+ const { hash, ...output } = response;
446
+ return { hash, output };
447
+ }
448
+ async signMultiAgentTransaction(transaction) {
449
+ var _a;
450
+ if (this._wallet && !("signMultiAgentTransaction" in this._wallet)) {
451
+ throw new WalletNotSupportedMethod(
452
+ `Multi-agent & sponsored transactions are not supported by ${(_a = this.wallet) == null ? void 0 : _a.name}`
453
+ ).message;
454
+ }
455
+ try {
456
+ this.doesWalletExist();
457
+ const response = await this._wallet.signMultiAgentTransaction(
458
+ transaction
459
+ );
460
+ return response;
461
+ } catch (error) {
462
+ const errMsg = typeof error == "object" && "message" in error ? error.message : error;
463
+ throw new WalletSignTransactionError(errMsg).message;
464
+ }
465
+ }
418
466
  async onAccountChange() {
419
467
  var _a;
420
468
  try {
@@ -502,8 +550,13 @@ var WalletCore = class extends EventEmitter {
502
550
  }
503
551
  }
504
552
  };
553
+
554
+ // src/types.ts
555
+ import { TxnBuilderTypes as TxnBuilderTypes3, Types as Types2 } from "aptos";
505
556
  export {
506
557
  NetworkName,
558
+ TxnBuilderTypes3 as TxnBuilderTypes,
559
+ Types2 as Types,
507
560
  WalletCore,
508
561
  WalletReadyState,
509
562
  getLocalStorage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/wallet-adapter-core",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Aptos Wallet Adapter Core",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -38,11 +38,14 @@
38
38
  "@aptos-labs/wallet-adapter-tsconfig": "0.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "aptos": "^1.3.17",
41
+ "@aptos-labs/ts-sdk": "^0.0.3",
42
42
  "buffer": "^6.0.3",
43
43
  "eventemitter3": "^4.0.7",
44
44
  "tweetnacl": "^1.0.3"
45
45
  },
46
+ "peerDependencies": {
47
+ "aptos": "^1.19.0"
48
+ },
46
49
  "scripts": {
47
50
  "build": "tsup src/index.ts --format esm,cjs --dts",
48
51
  "dev": "tsup src/index.ts --format esm,cjs --watch --dts",
package/src/WalletCore.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { HexString, TxnBuilderTypes, Types } from "aptos";
2
+ import { AptosConfig, InputGenerateTransactionData, generateTransactionPayload } from "@aptos-labs/ts-sdk";
2
3
  import EventEmitter from "eventemitter3";
3
4
  import nacl from "tweetnacl";
4
5
  import { Buffer } from "buffer";
@@ -38,6 +39,8 @@ import {
38
39
  isRedirectable,
39
40
  } from "./utils";
40
41
  import { getNameByAddress } from "./ans";
42
+ import { AccountAuthenticator } from "@aptos-labs/ts-sdk";
43
+ import { convertNetwork, convertToBCSPayload } from "./conversion";
41
44
 
42
45
  export class WalletCore extends EventEmitter<WalletCoreEvents> {
43
46
  private _wallets: ReadonlyArray<Wallet> = [];
@@ -244,8 +247,8 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
244
247
  }
245
248
  }
246
249
 
247
- /**
248
- Disconnect the exisitng wallet. On success, we clear the
250
+ /**
251
+ Disconnect the exisitng wallet. On success, we clear the
249
252
  current account, current network and LocalStorage data.
250
253
  @emit emits "disconnect" event
251
254
  @throws WalletDisconnectionError
@@ -263,7 +266,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
263
266
  }
264
267
  }
265
268
 
266
- /**
269
+ /**
267
270
  Sign and submit an entry (not bcs serialized) transaction type to chain.
268
271
  @param transaction a non-bcs serialized transaction
269
272
  @param options max_gas_amount and gas_unit_limit
@@ -288,13 +291,13 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
288
291
  }
289
292
  }
290
293
 
291
- /**
292
- Sign and submit a bsc serialized transaction type to chain.
293
- @param transaction a bcs serialized transaction
294
- @param options max_gas_amount and gas_unit_limit
295
- @return response from the wallet's signAndSubmitBCSTransaction function
296
- @throws WalletSignAndSubmitMessageError
297
- */
294
+ /**
295
+ Sign and submit a bsc serialized transaction type to chain.
296
+ @param transaction a bcs serialized transaction
297
+ @param options max_gas_amount and gas_unit_limit
298
+ @return response from the wallet's signAndSubmitBCSTransaction function
299
+ @throws WalletSignAndSubmitMessageError
300
+ */
298
301
  async signAndSubmitBCSTransaction(
299
302
  transaction: TxnBuilderTypes.TransactionPayload,
300
303
  options?: TransactionOptions
@@ -319,13 +322,13 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
319
322
  }
320
323
  }
321
324
 
322
- /**
323
- Sign transaction (doesnt submit to chain).
324
- @param transaction
325
- @param options max_gas_amount and gas_unit_limit
326
- @return response from the wallet's signTransaction function
327
- @throws WalletSignTransactionError
328
- */
325
+ /**
326
+ Sign transaction (doesnt submit to chain).
327
+ @param transaction
328
+ @param options max_gas_amount and gas_unit_limit
329
+ @return response from the wallet's signTransaction function
330
+ @throws WalletSignTransactionError
331
+ */
329
332
  async signTransaction(
330
333
  transaction: Types.TransactionPayload,
331
334
  options?: TransactionOptions
@@ -350,12 +353,12 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
350
353
  }
351
354
  }
352
355
 
353
- /**
354
- Sign message (doesnt submit to chain).
355
- @param message
356
- @return response from the wallet's signMessage function
357
- @throws WalletSignMessageError
358
- */
356
+ /**
357
+ Sign message (doesnt submit to chain).
358
+ @param message
359
+ @return response from the wallet's signMessage function
360
+ @throws WalletSignMessageError
361
+ */
359
362
  async signMessage(
360
363
  message: SignMessagePayload
361
364
  ): Promise<SignMessageResponse | null> {
@@ -371,7 +374,51 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
371
374
  }
372
375
  }
373
376
 
374
- /**
377
+ /**
378
+ * This function is for signing and submitting a transaction using the `@aptos-labs/ts-sdk` (aka the v2 SDK)
379
+ * input types. It's internally converting the input types to the old SDK input types and then calling
380
+ * the v1 SDK's `signAndSubmitBCSTransaction` with it.
381
+ *
382
+ * @param transactionInput the transaction input
383
+ * @param options max_gas_amount and gas_unit_limit
384
+ * @returns the response from the wallet's signAndSubmitBCSTransaction function
385
+ */
386
+ async submitTransaction(
387
+ transactionInput: InputGenerateTransactionData,
388
+ options?: TransactionOptions,
389
+ ): Promise<{ hash: string, output?: any }> {
390
+ const payloadData = transactionInput.data;
391
+ const aptosConfig = new AptosConfig({network: convertNetwork(this._network)});
392
+ // TODO: Refactor this any, and remove the need for it by fixing the if ("bytecode" in data) stuff in `generateTransaction` in the v2 SDK
393
+ const newPayload = await generateTransactionPayload({ ...payloadData as any, aptosConfig: aptosConfig });
394
+ const oldTransactionPayload = convertToBCSPayload(newPayload);
395
+ const response = await this.signAndSubmitBCSTransaction(oldTransactionPayload, options);
396
+ const { hash, ...output } = response;
397
+ return { hash, output };
398
+ }
399
+
400
+ async signMultiAgentTransaction(
401
+ transaction: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction
402
+ ): Promise<string | null> {
403
+ if (this._wallet && !("signMultiAgentTransaction" in this._wallet)) {
404
+ throw new WalletNotSupportedMethod(
405
+ `Multi-agent & sponsored transactions are not supported by ${this.wallet?.name}`
406
+ ).message;
407
+ }
408
+ try {
409
+ this.doesWalletExist();
410
+ const response = await (this._wallet as any).signMultiAgentTransaction(
411
+ transaction
412
+ );
413
+ return response;
414
+ } catch (error: any) {
415
+ const errMsg =
416
+ typeof error == "object" && "message" in error ? error.message : error;
417
+ throw new WalletSignTransactionError(errMsg).message;
418
+ }
419
+ }
420
+
421
+ /**
375
422
  Event for when account has changed on the wallet
376
423
  @return the new account info
377
424
  @throws WalletAccountChangeError
@@ -391,7 +438,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
391
438
  }
392
439
  }
393
440
 
394
- /**
441
+ /**
395
442
  Event for when network has changed on the wallet
396
443
  @return the new network info
397
444
  @throws WalletNetworkChangeError
@@ -0,0 +1,24 @@
1
+ import { Network, AnyTransactionPayloadInstance } from "@aptos-labs/ts-sdk"
2
+ import { BCS, TxnBuilderTypes } from "aptos"
3
+ import { NetworkInfo } from "./types";
4
+ import { NetworkName } from "./constants";
5
+
6
+ // old => new
7
+ export function convertNetwork(networkInfo: NetworkInfo | null): Network {
8
+ switch(networkInfo?.name.toLowerCase()) {
9
+ case "mainnet" as NetworkName:
10
+ return Network.MAINNET;
11
+ case "testnet" as NetworkName:
12
+ return Network.TESTNET;
13
+ case "devnet" as NetworkName:
14
+ return Network.DEVNET;
15
+ default:
16
+ throw new Error("Invalid network name")
17
+ }
18
+ }
19
+
20
+ // new => old
21
+ export function convertToBCSPayload(payload: AnyTransactionPayloadInstance): TxnBuilderTypes.TransactionPayload {
22
+ const deserializer = new BCS.Deserializer(payload.bcsToBytes());
23
+ return TxnBuilderTypes.TransactionPayload.deserialize(deserializer);
24
+ }
package/src/types.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { Types } from "aptos";
1
+ import { TxnBuilderTypes, Types } from "aptos";
2
2
  import { NetworkName, WalletReadyState } from "./constants";
3
3
 
4
+ export { TxnBuilderTypes, Types } from "aptos";
5
+ export type { InputGenerateTransactionData } from "@aptos-labs/ts-sdk";
4
6
  // WalletName is a nominal type that wallet adapters should use, e.g. `'MyCryptoWallet' as WalletName<'MyCryptoWallet'>`
5
7
  export type WalletName<T extends string = string> = T & {
6
8
  __brand__: "WalletName";
@@ -42,6 +44,9 @@ export interface PluginProvider {
42
44
  listener: (newAddress: AccountInfo) => Promise<void>
43
45
  ) => Promise<void>;
44
46
  onNetworkChange: OnNetworkChange;
47
+ signMultiAgentTransaction: (
48
+ rawTxn: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction
49
+ ) => Promise<string>;
45
50
  }
46
51
 
47
52
  export interface AdapterPluginEvents {