@aptos-labs/wallet-adapter-core 2.3.2 → 2.3.3
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 +11 -4
- package/dist/index.js +8 -6
- package/dist/index.mjs +8 -6
- package/package.json +1 -1
- package/src/WalletCore.ts +15 -6
- package/src/types.ts +5 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -114,6 +114,10 @@ interface SignMessageResponse {
|
|
|
114
114
|
signature: string | string[];
|
|
115
115
|
bitmap?: Uint8Array;
|
|
116
116
|
}
|
|
117
|
+
interface TransactionOptions {
|
|
118
|
+
max_gas_amount?: bigint;
|
|
119
|
+
gas_unit_price?: bigint;
|
|
120
|
+
}
|
|
117
121
|
|
|
118
122
|
declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
119
123
|
private _wallets;
|
|
@@ -171,24 +175,27 @@ declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
171
175
|
/**
|
|
172
176
|
Sign and submit an entry (not bcs serialized) transaction type to chain.
|
|
173
177
|
@param transaction a non-bcs serialized transaction
|
|
178
|
+
@param options max_gas_amount and gas_unit_limit
|
|
174
179
|
@return response from the wallet's signAndSubmitTransaction function
|
|
175
180
|
@throws WalletSignAndSubmitMessageError
|
|
176
181
|
*/
|
|
177
|
-
signAndSubmitTransaction(transaction: Types.TransactionPayload): Promise<any>;
|
|
182
|
+
signAndSubmitTransaction(transaction: Types.TransactionPayload, options?: TransactionOptions): Promise<any>;
|
|
178
183
|
/**
|
|
179
184
|
Sign and submit a bsc serialized transaction type to chain.
|
|
180
185
|
@param transaction a bcs serialized transaction
|
|
186
|
+
@param options max_gas_amount and gas_unit_limit
|
|
181
187
|
@return response from the wallet's signAndSubmitBCSTransaction function
|
|
182
188
|
@throws WalletSignAndSubmitMessageError
|
|
183
189
|
*/
|
|
184
|
-
signAndSubmitBCSTransaction(transaction: TxnBuilderTypes.TransactionPayload): Promise<any>;
|
|
190
|
+
signAndSubmitBCSTransaction(transaction: TxnBuilderTypes.TransactionPayload, options?: TransactionOptions): Promise<any>;
|
|
185
191
|
/**
|
|
186
192
|
Sign transaction (doesnt submit to chain).
|
|
187
193
|
@param transaction
|
|
194
|
+
@param options max_gas_amount and gas_unit_limit
|
|
188
195
|
@return response from the wallet's signTransaction function
|
|
189
196
|
@throws WalletSignTransactionError
|
|
190
197
|
*/
|
|
191
|
-
signTransaction(transaction: Types.TransactionPayload): Promise<Uint8Array | null>;
|
|
198
|
+
signTransaction(transaction: Types.TransactionPayload, options?: TransactionOptions): Promise<Uint8Array | null>;
|
|
192
199
|
/**
|
|
193
200
|
Sign message (doesnt submit to chain).
|
|
194
201
|
@param message
|
|
@@ -221,4 +228,4 @@ declare function isMobile(): boolean;
|
|
|
221
228
|
declare function isInAppBrowser(): boolean;
|
|
222
229
|
declare function isRedirectable(): boolean;
|
|
223
230
|
|
|
224
|
-
export { AccountInfo, AdapterPlugin, AdapterPluginEvents, AdapterPluginProps, AptosWalletErrorResult, NetworkInfo, NetworkName, PluginProvider, SignMessagePayload, SignMessageResponse, Wallet, WalletCore, WalletCoreEvents, WalletInfo, WalletName, WalletReadyState, getLocalStorage, isInAppBrowser, isMobile, isRedirectable, removeLocalStorage, scopePollingDetectionStrategy, setLocalStorage };
|
|
231
|
+
export { AccountInfo, AdapterPlugin, AdapterPluginEvents, AdapterPluginProps, AptosWalletErrorResult, NetworkInfo, NetworkName, PluginProvider, SignMessagePayload, SignMessageResponse, TransactionOptions, Wallet, WalletCore, WalletCoreEvents, WalletInfo, WalletName, WalletReadyState, getLocalStorage, isInAppBrowser, isMobile, isRedirectable, removeLocalStorage, scopePollingDetectionStrategy, setLocalStorage };
|
package/dist/index.js
CHANGED
|
@@ -387,12 +387,13 @@ var WalletCore = class extends import_eventemitter3.default {
|
|
|
387
387
|
throw new WalletDisconnectionError(error).message;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
async signAndSubmitTransaction(transaction) {
|
|
390
|
+
async signAndSubmitTransaction(transaction, options) {
|
|
391
391
|
var _a;
|
|
392
392
|
try {
|
|
393
393
|
this.doesWalletExist();
|
|
394
394
|
const response = await ((_a = this._wallet) == null ? void 0 : _a.signAndSubmitTransaction(
|
|
395
|
-
transaction
|
|
395
|
+
transaction,
|
|
396
|
+
options
|
|
396
397
|
));
|
|
397
398
|
return response;
|
|
398
399
|
} catch (error) {
|
|
@@ -400,7 +401,7 @@ var WalletCore = class extends import_eventemitter3.default {
|
|
|
400
401
|
throw new WalletSignAndSubmitMessageError(errMsg).message;
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
|
-
async signAndSubmitBCSTransaction(transaction) {
|
|
404
|
+
async signAndSubmitBCSTransaction(transaction, options) {
|
|
404
405
|
var _a;
|
|
405
406
|
if (this._wallet && !("signAndSubmitBCSTransaction" in this._wallet)) {
|
|
406
407
|
throw new WalletNotSupportedMethod(
|
|
@@ -410,7 +411,8 @@ var WalletCore = class extends import_eventemitter3.default {
|
|
|
410
411
|
try {
|
|
411
412
|
this.doesWalletExist();
|
|
412
413
|
const response = await this._wallet.signAndSubmitBCSTransaction(
|
|
413
|
-
transaction
|
|
414
|
+
transaction,
|
|
415
|
+
options
|
|
414
416
|
);
|
|
415
417
|
return response;
|
|
416
418
|
} catch (error) {
|
|
@@ -418,7 +420,7 @@ var WalletCore = class extends import_eventemitter3.default {
|
|
|
418
420
|
throw new WalletSignAndSubmitMessageError(errMsg).message;
|
|
419
421
|
}
|
|
420
422
|
}
|
|
421
|
-
async signTransaction(transaction) {
|
|
423
|
+
async signTransaction(transaction, options) {
|
|
422
424
|
var _a;
|
|
423
425
|
if (this._wallet && !("signTransaction" in this._wallet)) {
|
|
424
426
|
throw new WalletNotSupportedMethod(
|
|
@@ -427,7 +429,7 @@ var WalletCore = class extends import_eventemitter3.default {
|
|
|
427
429
|
}
|
|
428
430
|
try {
|
|
429
431
|
this.doesWalletExist();
|
|
430
|
-
const response = await this._wallet.signTransaction(transaction);
|
|
432
|
+
const response = await this._wallet.signTransaction(transaction, options);
|
|
431
433
|
return response;
|
|
432
434
|
} catch (error) {
|
|
433
435
|
const errMsg = typeof error == "object" && "message" in error ? error.message : error;
|
package/dist/index.mjs
CHANGED
|
@@ -346,12 +346,13 @@ var WalletCore = class extends EventEmitter {
|
|
|
346
346
|
throw new WalletDisconnectionError(error).message;
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
async signAndSubmitTransaction(transaction) {
|
|
349
|
+
async signAndSubmitTransaction(transaction, options) {
|
|
350
350
|
var _a;
|
|
351
351
|
try {
|
|
352
352
|
this.doesWalletExist();
|
|
353
353
|
const response = await ((_a = this._wallet) == null ? void 0 : _a.signAndSubmitTransaction(
|
|
354
|
-
transaction
|
|
354
|
+
transaction,
|
|
355
|
+
options
|
|
355
356
|
));
|
|
356
357
|
return response;
|
|
357
358
|
} catch (error) {
|
|
@@ -359,7 +360,7 @@ var WalletCore = class extends EventEmitter {
|
|
|
359
360
|
throw new WalletSignAndSubmitMessageError(errMsg).message;
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
|
-
async signAndSubmitBCSTransaction(transaction) {
|
|
363
|
+
async signAndSubmitBCSTransaction(transaction, options) {
|
|
363
364
|
var _a;
|
|
364
365
|
if (this._wallet && !("signAndSubmitBCSTransaction" in this._wallet)) {
|
|
365
366
|
throw new WalletNotSupportedMethod(
|
|
@@ -369,7 +370,8 @@ var WalletCore = class extends EventEmitter {
|
|
|
369
370
|
try {
|
|
370
371
|
this.doesWalletExist();
|
|
371
372
|
const response = await this._wallet.signAndSubmitBCSTransaction(
|
|
372
|
-
transaction
|
|
373
|
+
transaction,
|
|
374
|
+
options
|
|
373
375
|
);
|
|
374
376
|
return response;
|
|
375
377
|
} catch (error) {
|
|
@@ -377,7 +379,7 @@ var WalletCore = class extends EventEmitter {
|
|
|
377
379
|
throw new WalletSignAndSubmitMessageError(errMsg).message;
|
|
378
380
|
}
|
|
379
381
|
}
|
|
380
|
-
async signTransaction(transaction) {
|
|
382
|
+
async signTransaction(transaction, options) {
|
|
381
383
|
var _a;
|
|
382
384
|
if (this._wallet && !("signTransaction" in this._wallet)) {
|
|
383
385
|
throw new WalletNotSupportedMethod(
|
|
@@ -386,7 +388,7 @@ var WalletCore = class extends EventEmitter {
|
|
|
386
388
|
}
|
|
387
389
|
try {
|
|
388
390
|
this.doesWalletExist();
|
|
389
|
-
const response = await this._wallet.signTransaction(transaction);
|
|
391
|
+
const response = await this._wallet.signTransaction(transaction, options);
|
|
390
392
|
return response;
|
|
391
393
|
} catch (error) {
|
|
392
394
|
const errMsg = typeof error == "object" && "message" in error ? error.message : error;
|
package/package.json
CHANGED
package/src/WalletCore.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
Wallet,
|
|
30
30
|
WalletInfo,
|
|
31
31
|
WalletCoreEvents,
|
|
32
|
+
TransactionOptions,
|
|
32
33
|
} from "./types";
|
|
33
34
|
import {
|
|
34
35
|
removeLocalStorage,
|
|
@@ -254,16 +255,19 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
254
255
|
/**
|
|
255
256
|
Sign and submit an entry (not bcs serialized) transaction type to chain.
|
|
256
257
|
@param transaction a non-bcs serialized transaction
|
|
258
|
+
@param options max_gas_amount and gas_unit_limit
|
|
257
259
|
@return response from the wallet's signAndSubmitTransaction function
|
|
258
260
|
@throws WalletSignAndSubmitMessageError
|
|
259
261
|
*/
|
|
260
262
|
async signAndSubmitTransaction(
|
|
261
|
-
transaction: Types.TransactionPayload
|
|
263
|
+
transaction: Types.TransactionPayload,
|
|
264
|
+
options?: TransactionOptions
|
|
262
265
|
): Promise<any> {
|
|
263
266
|
try {
|
|
264
267
|
this.doesWalletExist();
|
|
265
268
|
const response = await this._wallet?.signAndSubmitTransaction(
|
|
266
|
-
transaction
|
|
269
|
+
transaction,
|
|
270
|
+
options
|
|
267
271
|
);
|
|
268
272
|
return response;
|
|
269
273
|
} catch (error: any) {
|
|
@@ -276,11 +280,13 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
276
280
|
/**
|
|
277
281
|
Sign and submit a bsc serialized transaction type to chain.
|
|
278
282
|
@param transaction a bcs serialized transaction
|
|
283
|
+
@param options max_gas_amount and gas_unit_limit
|
|
279
284
|
@return response from the wallet's signAndSubmitBCSTransaction function
|
|
280
285
|
@throws WalletSignAndSubmitMessageError
|
|
281
286
|
*/
|
|
282
287
|
async signAndSubmitBCSTransaction(
|
|
283
|
-
transaction: TxnBuilderTypes.TransactionPayload
|
|
288
|
+
transaction: TxnBuilderTypes.TransactionPayload,
|
|
289
|
+
options?: TransactionOptions
|
|
284
290
|
): Promise<any> {
|
|
285
291
|
if (this._wallet && !("signAndSubmitBCSTransaction" in this._wallet)) {
|
|
286
292
|
throw new WalletNotSupportedMethod(
|
|
@@ -291,7 +297,8 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
291
297
|
try {
|
|
292
298
|
this.doesWalletExist();
|
|
293
299
|
const response = await (this._wallet as any).signAndSubmitBCSTransaction(
|
|
294
|
-
transaction
|
|
300
|
+
transaction,
|
|
301
|
+
options
|
|
295
302
|
);
|
|
296
303
|
return response;
|
|
297
304
|
} catch (error: any) {
|
|
@@ -304,11 +311,13 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
304
311
|
/**
|
|
305
312
|
Sign transaction (doesnt submit to chain).
|
|
306
313
|
@param transaction
|
|
314
|
+
@param options max_gas_amount and gas_unit_limit
|
|
307
315
|
@return response from the wallet's signTransaction function
|
|
308
316
|
@throws WalletSignTransactionError
|
|
309
317
|
*/
|
|
310
318
|
async signTransaction(
|
|
311
|
-
transaction: Types.TransactionPayload
|
|
319
|
+
transaction: Types.TransactionPayload,
|
|
320
|
+
options?: TransactionOptions
|
|
312
321
|
): Promise<Uint8Array | null> {
|
|
313
322
|
if (this._wallet && !("signTransaction" in this._wallet)) {
|
|
314
323
|
throw new WalletNotSupportedMethod(
|
|
@@ -318,7 +327,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
318
327
|
|
|
319
328
|
try {
|
|
320
329
|
this.doesWalletExist();
|
|
321
|
-
const response = await (this._wallet as any).signTransaction(transaction);
|
|
330
|
+
const response = await (this._wallet as any).signTransaction(transaction, options);
|
|
322
331
|
return response;
|
|
323
332
|
} catch (error: any) {
|
|
324
333
|
const errMsg =
|
package/src/types.ts
CHANGED
|
@@ -106,3 +106,8 @@ export interface SignMessageResponse {
|
|
|
106
106
|
signature: string | string[]; // The signed full message
|
|
107
107
|
bitmap?: Uint8Array; // a 4-byte (32 bits) bit-vector of length N
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
export interface TransactionOptions {
|
|
111
|
+
max_gas_amount?: bigint;
|
|
112
|
+
gas_unit_price?: bigint;
|
|
113
|
+
}
|