@aptos-labs/wallet-adapter-core 3.4.0 → 3.5.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 +6 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +1 -1
- package/src/WalletCoreV1.ts +6 -0
- package/src/types.ts +18 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ interface AdapterPluginProps<Name extends string = string> {
|
|
|
97
97
|
connect(): Promise<any>;
|
|
98
98
|
disconnect: () => Promise<any>;
|
|
99
99
|
network: () => Promise<any>;
|
|
100
|
-
signAndSubmitTransaction
|
|
100
|
+
signAndSubmitTransaction(transaction: Types.TransactionPayload | InputGenerateTransactionData, options?: InputGenerateTransactionOptions): Promise<{
|
|
101
101
|
hash: Types.HexEncodedBytes;
|
|
102
102
|
output?: any;
|
|
103
103
|
} | PendingTransactionResponse>;
|
|
@@ -117,6 +117,18 @@ type InputTransactionData = {
|
|
|
117
117
|
data: InputGenerateTransactionPayloadData;
|
|
118
118
|
options?: InputGenerateTransactionOptions;
|
|
119
119
|
};
|
|
120
|
+
interface PluginProvider {
|
|
121
|
+
connect: () => Promise<AccountInfo>;
|
|
122
|
+
account: () => Promise<AccountInfo>;
|
|
123
|
+
disconnect: () => Promise<void>;
|
|
124
|
+
signAndSubmitTransaction: (transaction: any, options?: any) => Promise<{
|
|
125
|
+
hash: Types.HexEncodedBytes;
|
|
126
|
+
} | AptosWalletErrorResult>;
|
|
127
|
+
signMessage: (message: SignMessagePayload) => Promise<SignMessageResponse>;
|
|
128
|
+
network: () => Promise<NetworkInfo>;
|
|
129
|
+
onAccountChange: (listener: (newAddress: AccountInfo) => Promise<void>) => Promise<void>;
|
|
130
|
+
onNetworkChange: OnNetworkChange;
|
|
131
|
+
}
|
|
120
132
|
|
|
121
133
|
declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
122
134
|
private _wallets;
|
|
@@ -239,4 +251,4 @@ declare function isRedirectable(): boolean;
|
|
|
239
251
|
declare function generalizedErrorMessage(error: any): string;
|
|
240
252
|
declare const areBCSArguments: (args: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>) => boolean;
|
|
241
253
|
|
|
242
|
-
export { AccountInfo, AdapterPlugin, AdapterPluginEvents, AdapterPluginProps, AptosWalletErrorResult, InputTransactionData, NetworkInfo, NetworkName, OnAccountChange, OnNetworkChange, SignMessagePayload, SignMessageResponse, TransactionOptions, Wallet, WalletCore, WalletCoreEvents, WalletInfo, WalletName, WalletReadyState, areBCSArguments, generalizedErrorMessage, getLocalStorage, isInAppBrowser, isMobile, isRedirectable, removeLocalStorage, scopePollingDetectionStrategy, setLocalStorage };
|
|
254
|
+
export { AccountInfo, AdapterPlugin, AdapterPluginEvents, AdapterPluginProps, AptosWalletErrorResult, InputTransactionData, NetworkInfo, NetworkName, OnAccountChange, OnNetworkChange, PluginProvider, SignMessagePayload, SignMessageResponse, TransactionOptions, Wallet, WalletCore, WalletCoreEvents, WalletInfo, WalletName, WalletReadyState, areBCSArguments, generalizedErrorMessage, getLocalStorage, isInAppBrowser, isMobile, isRedirectable, removeLocalStorage, scopePollingDetectionStrategy, setLocalStorage };
|
package/dist/index.js
CHANGED
|
@@ -309,6 +309,11 @@ var WalletCoreV1 = class extends import_eventemitter3.default {
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
async signAndSubmitBCSTransaction(transaction, wallet, options) {
|
|
312
|
+
if (!("signAndSubmitBCSTransaction" in wallet)) {
|
|
313
|
+
throw new WalletNotSupportedMethod(
|
|
314
|
+
`Submit a BCS Transaction is not supported by ${wallet.name}`
|
|
315
|
+
).message;
|
|
316
|
+
}
|
|
312
317
|
try {
|
|
313
318
|
const response = await wallet.signAndSubmitBCSTransaction(
|
|
314
319
|
transaction,
|
package/dist/index.mjs
CHANGED
|
@@ -275,6 +275,11 @@ var WalletCoreV1 = class extends EventEmitter {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
async signAndSubmitBCSTransaction(transaction, wallet, options) {
|
|
278
|
+
if (!("signAndSubmitBCSTransaction" in wallet)) {
|
|
279
|
+
throw new WalletNotSupportedMethod(
|
|
280
|
+
`Submit a BCS Transaction is not supported by ${wallet.name}`
|
|
281
|
+
).message;
|
|
282
|
+
}
|
|
278
283
|
try {
|
|
279
284
|
const response = await wallet.signAndSubmitBCSTransaction(
|
|
280
285
|
transaction,
|
package/package.json
CHANGED
package/src/WalletCoreV1.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { TxnBuilderTypes, Types } from "aptos";
|
|
|
2
2
|
import EventEmitter from "eventemitter3";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
WalletNotSupportedMethod,
|
|
5
6
|
WalletSignAndSubmitMessageError,
|
|
6
7
|
WalletSignTransactionError,
|
|
7
8
|
} from "./error";
|
|
@@ -45,6 +46,11 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
45
46
|
wallet: Wallet,
|
|
46
47
|
options?: TransactionOptions
|
|
47
48
|
): Promise<any> {
|
|
49
|
+
if (!("signAndSubmitBCSTransaction" in wallet)) {
|
|
50
|
+
throw new WalletNotSupportedMethod(
|
|
51
|
+
`Submit a BCS Transaction is not supported by ${wallet.name}`
|
|
52
|
+
).message;
|
|
53
|
+
}
|
|
48
54
|
try {
|
|
49
55
|
const response = await (wallet as any).signAndSubmitBCSTransaction(
|
|
50
56
|
transaction,
|
package/src/types.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface AdapterPluginProps<Name extends string = string> {
|
|
|
103
103
|
connect(): Promise<any>;
|
|
104
104
|
disconnect: () => Promise<any>;
|
|
105
105
|
network: () => Promise<any>;
|
|
106
|
-
signAndSubmitTransaction
|
|
106
|
+
signAndSubmitTransaction(
|
|
107
107
|
transaction: Types.TransactionPayload | InputGenerateTransactionData,
|
|
108
108
|
options?: InputGenerateTransactionOptions
|
|
109
109
|
): Promise<
|
|
@@ -134,3 +134,20 @@ export type InputTransactionData = {
|
|
|
134
134
|
data: InputGenerateTransactionPayloadData;
|
|
135
135
|
options?: InputGenerateTransactionOptions;
|
|
136
136
|
};
|
|
137
|
+
|
|
138
|
+
// To be used by a wallet plugin
|
|
139
|
+
export interface PluginProvider {
|
|
140
|
+
connect: () => Promise<AccountInfo>;
|
|
141
|
+
account: () => Promise<AccountInfo>;
|
|
142
|
+
disconnect: () => Promise<void>;
|
|
143
|
+
signAndSubmitTransaction: (
|
|
144
|
+
transaction: any,
|
|
145
|
+
options?: any
|
|
146
|
+
) => Promise<{ hash: Types.HexEncodedBytes } | AptosWalletErrorResult>;
|
|
147
|
+
signMessage: (message: SignMessagePayload) => Promise<SignMessageResponse>;
|
|
148
|
+
network: () => Promise<NetworkInfo>;
|
|
149
|
+
onAccountChange: (
|
|
150
|
+
listener: (newAddress: AccountInfo) => Promise<void>
|
|
151
|
+
) => Promise<void>;
|
|
152
|
+
onNetworkChange: OnNetworkChange;
|
|
153
|
+
}
|