@aptos-labs/wallet-adapter-core 2.5.1 → 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,15 @@
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
+
3
13
  ## 2.5.1
4
14
 
5
15
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { Types, TxnBuilderTypes } from 'aptos';
2
2
  export { TxnBuilderTypes, Types } from 'aptos';
3
+ import { InputGenerateTransactionData } from '@aptos-labs/ts-sdk';
4
+ export { InputGenerateTransactionData } from '@aptos-labs/ts-sdk';
3
5
  import EventEmitter from 'eventemitter3';
4
6
 
5
7
  declare enum WalletReadyState {
@@ -27,15 +29,15 @@ declare enum NetworkName {
27
29
  Devnet = "devnet"
28
30
  }
29
31
 
30
- declare type WalletName<T extends string = string> = T & {
32
+ type WalletName<T extends string = string> = T & {
31
33
  __brand__: "WalletName";
32
34
  };
33
- declare type NetworkInfo = {
35
+ type NetworkInfo = {
34
36
  name: NetworkName;
35
37
  chainId?: string;
36
38
  url?: string;
37
39
  };
38
- declare type AccountInfo = {
40
+ type AccountInfo = {
39
41
  address: string;
40
42
  publicKey: string | string[];
41
43
  minKeysRequired?: number;
@@ -46,7 +48,7 @@ interface AptosWalletErrorResult {
46
48
  name: string;
47
49
  message: string;
48
50
  }
49
- declare type OnNetworkChange = (callBack: (networkInfo: NetworkInfo) => Promise<void>) => Promise<void>;
51
+ type OnNetworkChange = (callBack: (networkInfo: NetworkInfo) => Promise<void>) => Promise<void>;
50
52
  interface PluginProvider {
51
53
  connect: () => Promise<AccountInfo>;
52
54
  account: () => Promise<AccountInfo>;
@@ -58,6 +60,7 @@ interface PluginProvider {
58
60
  network: () => Promise<NetworkName>;
59
61
  onAccountChange: (listener: (newAddress: AccountInfo) => Promise<void>) => Promise<void>;
60
62
  onNetworkChange: OnNetworkChange;
63
+ signMultiAgentTransaction: (rawTxn: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction) => Promise<string>;
61
64
  }
62
65
  interface AdapterPluginEvents {
63
66
  onNetworkChange: OnNetworkChange;
@@ -80,11 +83,11 @@ interface AdapterPluginProps<Name extends string = string> {
80
83
  }>;
81
84
  signMessage<T extends SignMessagePayload>(message: T): Promise<SignMessageResponse>;
82
85
  }
83
- declare type AdapterPlugin<Name extends string = string> = AdapterPluginProps<Name> & AdapterPluginEvents;
84
- 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> & {
85
88
  readyState?: WalletReadyState;
86
89
  };
87
- declare type WalletInfo = {
90
+ type WalletInfo = {
88
91
  name: WalletName;
89
92
  icon: string;
90
93
  url: string;
@@ -186,28 +189,42 @@ declare class WalletCore extends EventEmitter<WalletCoreEvents> {
186
189
  */
187
190
  signAndSubmitTransaction(transaction: Types.TransactionPayload, options?: TransactionOptions): Promise<any>;
188
191
  /**
189
- Sign and submit a bsc serialized transaction type to chain.
190
- @param transaction a bcs serialized transaction
191
- @param options max_gas_amount and gas_unit_limit
192
- @return response from the wallet's signAndSubmitBCSTransaction function
193
- @throws WalletSignAndSubmitMessageError
194
- */
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
+ */
195
198
  signAndSubmitBCSTransaction(transaction: TxnBuilderTypes.TransactionPayload, options?: TransactionOptions): Promise<any>;
196
199
  /**
197
- Sign transaction (doesnt submit to chain).
198
- @param transaction
199
- @param options max_gas_amount and gas_unit_limit
200
- @return response from the wallet's signTransaction function
201
- @throws WalletSignTransactionError
202
- */
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
+ */
203
206
  signTransaction(transaction: Types.TransactionPayload, options?: TransactionOptions): Promise<Uint8Array | null>;
204
207
  /**
205
- Sign message (doesnt submit to chain).
206
- @param message
207
- @return response from the wallet's signMessage function
208
- @throws WalletSignMessageError
209
- */
208
+ Sign message (doesnt submit to chain).
209
+ @param message
210
+ @return response from the wallet's signMessage function
211
+ @throws WalletSignMessageError
212
+ */
210
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>;
211
228
  /**
212
229
  Event for when account has changed on the wallet
213
230
  @return the new account info
package/dist/index.js CHANGED
@@ -27,8 +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_aptos2.TxnBuilderTypes,
31
- Types: () => import_aptos2.Types,
30
+ TxnBuilderTypes: () => import_aptos3.TxnBuilderTypes,
31
+ Types: () => import_aptos3.Types,
32
32
  WalletCore: () => WalletCore,
33
33
  WalletReadyState: () => WalletReadyState,
34
34
  getLocalStorage: () => getLocalStorage,
@@ -42,7 +42,8 @@ __export(src_exports, {
42
42
  module.exports = __toCommonJS(src_exports);
43
43
 
44
44
  // src/WalletCore.ts
45
- var import_aptos = require("aptos");
45
+ var import_aptos2 = require("aptos");
46
+ var import_ts_sdk2 = require("@aptos-labs/ts-sdk");
46
47
  var import_eventemitter3 = __toESM(require("eventemitter3"));
47
48
  var import_tweetnacl = __toESM(require("tweetnacl"));
48
49
  var import_buffer = require("buffer");
@@ -237,6 +238,26 @@ var getNameByAddress = async (chainId, address) => {
237
238
  }
238
239
  };
239
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
+
240
261
  // src/WalletCore.ts
241
262
  var WalletCore = class extends import_eventemitter3.default {
242
263
  constructor(plugins) {
@@ -458,6 +479,33 @@ var WalletCore = class extends import_eventemitter3.default {
458
479
  throw new WalletSignMessageError(errMsg).message;
459
480
  }
460
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
+ }
461
509
  async onAccountChange() {
462
510
  var _a;
463
511
  try {
@@ -528,10 +576,10 @@ var WalletCore = class extends import_eventemitter3.default {
528
576
  throw new WalletSignMessageAndVerifyError("Failed to get a bitmap").message;
529
577
  }
530
578
  } else {
531
- const currentAccountPublicKey = new import_aptos.HexString(
579
+ const currentAccountPublicKey = new import_aptos2.HexString(
532
580
  this._account.publicKey
533
581
  );
534
- const signature = new import_aptos.HexString(response.signature);
582
+ const signature = new import_aptos2.HexString(response.signature);
535
583
  verified = import_tweetnacl.default.sign.detached.verify(
536
584
  import_buffer.Buffer.from(response.fullMessage),
537
585
  import_buffer.Buffer.from(signature.noPrefix(), "hex"),
@@ -547,7 +595,7 @@ var WalletCore = class extends import_eventemitter3.default {
547
595
  };
548
596
 
549
597
  // src/types.ts
550
- var import_aptos2 = require("aptos");
598
+ var import_aptos3 = require("aptos");
551
599
  // Annotate the CommonJS export names for ESM import in node:
552
600
  0 && (module.exports = {
553
601
  NetworkName,
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 {
@@ -504,10 +552,10 @@ var WalletCore = class extends EventEmitter {
504
552
  };
505
553
 
506
554
  // src/types.ts
507
- import { TxnBuilderTypes as TxnBuilderTypes2, Types as Types2 } from "aptos";
555
+ import { TxnBuilderTypes as TxnBuilderTypes3, Types as Types2 } from "aptos";
508
556
  export {
509
557
  NetworkName,
510
- TxnBuilderTypes2 as TxnBuilderTypes,
558
+ TxnBuilderTypes3 as TxnBuilderTypes,
511
559
  Types2 as Types,
512
560
  WalletCore,
513
561
  WalletReadyState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/wallet-adapter-core",
3
- "version": "2.5.1",
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.14.0",
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,7 +1,8 @@
1
- import { Types } from "aptos";
1
+ import { TxnBuilderTypes, Types } from "aptos";
2
2
  import { NetworkName, WalletReadyState } from "./constants";
3
3
 
4
4
  export { TxnBuilderTypes, Types } from "aptos";
5
+ export type { InputGenerateTransactionData } from "@aptos-labs/ts-sdk";
5
6
  // WalletName is a nominal type that wallet adapters should use, e.g. `'MyCryptoWallet' as WalletName<'MyCryptoWallet'>`
6
7
  export type WalletName<T extends string = string> = T & {
7
8
  __brand__: "WalletName";
@@ -43,6 +44,9 @@ export interface PluginProvider {
43
44
  listener: (newAddress: AccountInfo) => Promise<void>
44
45
  ) => Promise<void>;
45
46
  onNetworkChange: OnNetworkChange;
47
+ signMultiAgentTransaction: (
48
+ rawTxn: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction
49
+ ) => Promise<string>;
46
50
  }
47
51
 
48
52
  export interface AdapterPluginEvents {