@aptos-labs/wallet-adapter-core 3.1.0 → 3.1.1
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 +6 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +10 -13
- package/dist/index.mjs +10 -13
- package/package.json +1 -1
- package/src/WalletCore.ts +13 -17
- package/src/types.ts +6 -5
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Types } from 'aptos';
|
|
2
2
|
export { TxnBuilderTypes, Types } from 'aptos';
|
|
3
|
-
import { Network, InputGenerateTransactionData, InputGenerateTransactionOptions, PendingTransactionResponse, InputSubmitTransactionData, AccountAddressInput, AnyRawTransaction, AccountAuthenticator } from '@aptos-labs/ts-sdk';
|
|
3
|
+
import { Network, InputGenerateTransactionData, InputGenerateTransactionOptions, PendingTransactionResponse, InputSubmitTransactionData, AccountAddressInput, InputGenerateTransactionPayloadData, AnyRawTransaction, AccountAuthenticator } from '@aptos-labs/ts-sdk';
|
|
4
4
|
export { AccountAuthenticator, AnyRawTransaction, InputGenerateTransactionData, InputGenerateTransactionOptions, InputSubmitTransactionData, PendingTransactionResponse } from '@aptos-labs/ts-sdk';
|
|
5
5
|
import EventEmitter from 'eventemitter3';
|
|
6
6
|
|
|
@@ -112,8 +112,10 @@ interface TransactionOptions {
|
|
|
112
112
|
max_gas_amount?: bigint;
|
|
113
113
|
gas_unit_price?: bigint;
|
|
114
114
|
}
|
|
115
|
-
type InputTransactionData =
|
|
115
|
+
type InputTransactionData = {
|
|
116
116
|
sender?: AccountAddressInput;
|
|
117
|
+
data: InputGenerateTransactionPayloadData;
|
|
118
|
+
options?: InputGenerateTransactionOptions;
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
@@ -182,7 +184,7 @@ declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
182
184
|
* @param options optional. A configuration object to generate a transaction by
|
|
183
185
|
* @returns The pending transaction hash (V1 output) | PendingTransactionResponse (V2 output)
|
|
184
186
|
*/
|
|
185
|
-
signAndSubmitTransaction(transactionInput: InputTransactionData
|
|
187
|
+
signAndSubmitTransaction(transactionInput: InputTransactionData): Promise<{
|
|
186
188
|
hash: Types.HexEncodedBytes;
|
|
187
189
|
output?: any;
|
|
188
190
|
} | PendingTransactionResponse>;
|
package/dist/index.js
CHANGED
|
@@ -482,18 +482,15 @@ var WalletCore = class extends import_eventemitter32.default {
|
|
|
482
482
|
throw new WalletDisconnectionError(errMsg).message;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
async signAndSubmitTransaction(transactionInput
|
|
486
|
-
var _a, _b;
|
|
485
|
+
async signAndSubmitTransaction(transactionInput) {
|
|
486
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
487
487
|
try {
|
|
488
488
|
this.doesWalletExist();
|
|
489
489
|
if (((_a = this._wallet) == null ? void 0 : _a.version) === "v2") {
|
|
490
|
-
const response2 = await this._wallet.signAndSubmitTransaction(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
options
|
|
496
|
-
);
|
|
490
|
+
const response2 = await this._wallet.signAndSubmitTransaction({
|
|
491
|
+
...transactionInput,
|
|
492
|
+
sender: (_b = transactionInput.sender) != null ? _b : this._account.address
|
|
493
|
+
});
|
|
497
494
|
return response2;
|
|
498
495
|
}
|
|
499
496
|
const payloadData = transactionInput.data;
|
|
@@ -510,8 +507,8 @@ var WalletCore = class extends import_eventemitter32.default {
|
|
|
510
507
|
oldTransactionPayload2,
|
|
511
508
|
this._wallet,
|
|
512
509
|
{
|
|
513
|
-
max_gas_amount: (options == null ? void 0 :
|
|
514
|
-
gas_unit_price: (options == null ? void 0 :
|
|
510
|
+
max_gas_amount: ((_c = transactionInput.options) == null ? void 0 : _c.maxGasAmount) ? BigInt((_d = transactionInput.options) == null ? void 0 : _d.maxGasAmount) : void 0,
|
|
511
|
+
gas_unit_price: ((_e = transactionInput.options) == null ? void 0 : _e.gasUnitPrice) ? BigInt((_f = transactionInput.options) == null ? void 0 : _f.gasUnitPrice) : void 0
|
|
515
512
|
}
|
|
516
513
|
);
|
|
517
514
|
const { hash: hash2, ...output2 } = response2;
|
|
@@ -522,8 +519,8 @@ var WalletCore = class extends import_eventemitter32.default {
|
|
|
522
519
|
oldTransactionPayload,
|
|
523
520
|
this._wallet,
|
|
524
521
|
{
|
|
525
|
-
max_gas_amount: (options == null ? void 0 :
|
|
526
|
-
gas_unit_price: (options == null ? void 0 :
|
|
522
|
+
max_gas_amount: ((_g = transactionInput.options) == null ? void 0 : _g.maxGasAmount) ? BigInt((_h = transactionInput.options) == null ? void 0 : _h.maxGasAmount) : void 0,
|
|
523
|
+
gas_unit_price: ((_i = transactionInput.options) == null ? void 0 : _i.gasUnitPrice) ? BigInt((_j = transactionInput.options) == null ? void 0 : _j.gasUnitPrice) : void 0
|
|
527
524
|
}
|
|
528
525
|
);
|
|
529
526
|
const { hash, ...output } = response;
|
package/dist/index.mjs
CHANGED
|
@@ -447,18 +447,15 @@ var WalletCore = class extends EventEmitter2 {
|
|
|
447
447
|
throw new WalletDisconnectionError(errMsg).message;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
async signAndSubmitTransaction(transactionInput
|
|
451
|
-
var _a, _b;
|
|
450
|
+
async signAndSubmitTransaction(transactionInput) {
|
|
451
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
452
452
|
try {
|
|
453
453
|
this.doesWalletExist();
|
|
454
454
|
if (((_a = this._wallet) == null ? void 0 : _a.version) === "v2") {
|
|
455
|
-
const response2 = await this._wallet.signAndSubmitTransaction(
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
},
|
|
460
|
-
options
|
|
461
|
-
);
|
|
455
|
+
const response2 = await this._wallet.signAndSubmitTransaction({
|
|
456
|
+
...transactionInput,
|
|
457
|
+
sender: (_b = transactionInput.sender) != null ? _b : this._account.address
|
|
458
|
+
});
|
|
462
459
|
return response2;
|
|
463
460
|
}
|
|
464
461
|
const payloadData = transactionInput.data;
|
|
@@ -475,8 +472,8 @@ var WalletCore = class extends EventEmitter2 {
|
|
|
475
472
|
oldTransactionPayload2,
|
|
476
473
|
this._wallet,
|
|
477
474
|
{
|
|
478
|
-
max_gas_amount: (options == null ? void 0 :
|
|
479
|
-
gas_unit_price: (options == null ? void 0 :
|
|
475
|
+
max_gas_amount: ((_c = transactionInput.options) == null ? void 0 : _c.maxGasAmount) ? BigInt((_d = transactionInput.options) == null ? void 0 : _d.maxGasAmount) : void 0,
|
|
476
|
+
gas_unit_price: ((_e = transactionInput.options) == null ? void 0 : _e.gasUnitPrice) ? BigInt((_f = transactionInput.options) == null ? void 0 : _f.gasUnitPrice) : void 0
|
|
480
477
|
}
|
|
481
478
|
);
|
|
482
479
|
const { hash: hash2, ...output2 } = response2;
|
|
@@ -487,8 +484,8 @@ var WalletCore = class extends EventEmitter2 {
|
|
|
487
484
|
oldTransactionPayload,
|
|
488
485
|
this._wallet,
|
|
489
486
|
{
|
|
490
|
-
max_gas_amount: (options == null ? void 0 :
|
|
491
|
-
gas_unit_price: (options == null ? void 0 :
|
|
487
|
+
max_gas_amount: ((_g = transactionInput.options) == null ? void 0 : _g.maxGasAmount) ? BigInt((_h = transactionInput.options) == null ? void 0 : _h.maxGasAmount) : void 0,
|
|
488
|
+
gas_unit_price: ((_i = transactionInput.options) == null ? void 0 : _i.gasUnitPrice) ? BigInt((_j = transactionInput.options) == null ? void 0 : _j.gasUnitPrice) : void 0
|
|
492
489
|
}
|
|
493
490
|
);
|
|
494
491
|
const { hash, ...output } = response;
|
package/package.json
CHANGED
package/src/WalletCore.ts
CHANGED
|
@@ -290,8 +290,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
290
290
|
* @returns The pending transaction hash (V1 output) | PendingTransactionResponse (V2 output)
|
|
291
291
|
*/
|
|
292
292
|
async signAndSubmitTransaction(
|
|
293
|
-
transactionInput: InputTransactionData
|
|
294
|
-
options?: InputGenerateTransactionOptions
|
|
293
|
+
transactionInput: InputTransactionData
|
|
295
294
|
): Promise<
|
|
296
295
|
{ hash: Types.HexEncodedBytes; output?: any } | PendingTransactionResponse
|
|
297
296
|
> {
|
|
@@ -300,13 +299,10 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
300
299
|
|
|
301
300
|
// wallet supports sdk v2
|
|
302
301
|
if (this._wallet?.version === "v2") {
|
|
303
|
-
const response = await this._wallet.signAndSubmitTransaction(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
},
|
|
308
|
-
options
|
|
309
|
-
);
|
|
302
|
+
const response = await this._wallet.signAndSubmitTransaction({
|
|
303
|
+
...transactionInput,
|
|
304
|
+
sender: transactionInput.sender ?? this._account!.address,
|
|
305
|
+
});
|
|
310
306
|
// response should be PendingTransactionResponse
|
|
311
307
|
return response;
|
|
312
308
|
}
|
|
@@ -330,11 +326,11 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
330
326
|
oldTransactionPayload,
|
|
331
327
|
this._wallet!,
|
|
332
328
|
{
|
|
333
|
-
max_gas_amount: options?.maxGasAmount
|
|
334
|
-
? BigInt(options?.maxGasAmount)
|
|
329
|
+
max_gas_amount: transactionInput.options?.maxGasAmount
|
|
330
|
+
? BigInt(transactionInput.options?.maxGasAmount)
|
|
335
331
|
: undefined,
|
|
336
|
-
gas_unit_price: options?.gasUnitPrice
|
|
337
|
-
? BigInt(options?.gasUnitPrice)
|
|
332
|
+
gas_unit_price: transactionInput.options?.gasUnitPrice
|
|
333
|
+
? BigInt(transactionInput.options?.gasUnitPrice)
|
|
338
334
|
: undefined,
|
|
339
335
|
}
|
|
340
336
|
);
|
|
@@ -350,11 +346,11 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
350
346
|
oldTransactionPayload,
|
|
351
347
|
this._wallet!,
|
|
352
348
|
{
|
|
353
|
-
max_gas_amount: options?.maxGasAmount
|
|
354
|
-
? BigInt(options?.maxGasAmount)
|
|
349
|
+
max_gas_amount: transactionInput.options?.maxGasAmount
|
|
350
|
+
? BigInt(transactionInput.options?.maxGasAmount)
|
|
355
351
|
: undefined,
|
|
356
|
-
gas_unit_price: options?.gasUnitPrice
|
|
357
|
-
? BigInt(options?.gasUnitPrice)
|
|
352
|
+
gas_unit_price: transactionInput.options?.gasUnitPrice
|
|
353
|
+
? BigInt(transactionInput.options?.gasUnitPrice)
|
|
358
354
|
: undefined,
|
|
359
355
|
}
|
|
360
356
|
);
|
package/src/types.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
InputSubmitTransactionData,
|
|
7
7
|
PendingTransactionResponse,
|
|
8
8
|
AccountAddressInput,
|
|
9
|
+
InputGenerateTransactionPayloadData,
|
|
9
10
|
} from "@aptos-labs/ts-sdk";
|
|
10
11
|
import { WalletReadyState } from "./constants";
|
|
11
12
|
|
|
@@ -128,8 +129,8 @@ export interface TransactionOptions {
|
|
|
128
129
|
gas_unit_price?: bigint;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
export type InputTransactionData = {
|
|
133
|
+
sender?: AccountAddressInput;
|
|
134
|
+
data: InputGenerateTransactionPayloadData;
|
|
135
|
+
options?: InputGenerateTransactionOptions;
|
|
136
|
+
};
|