@aptos-labs/wallet-adapter-core 3.11.0 → 3.11.2
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/dist/AIP62StandardWallets/WalletStandard.d.ts +43 -0
- package/dist/AIP62StandardWallets/WalletStandard.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/WalletCoreV1.d.ts +49 -0
- package/dist/LegacyWalletPlugins/WalletCoreV1.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/conversion.d.ts +20 -0
- package/dist/LegacyWalletPlugins/conversion.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/types.d.ts +112 -0
- package/dist/LegacyWalletPlugins/types.d.ts.map +1 -0
- package/dist/WalletCore.d.ts +213 -0
- package/dist/WalletCore.d.ts.map +1 -0
- package/dist/__tests__/WalletCore.test.d.ts +2 -0
- package/dist/__tests__/WalletCore.test.d.ts.map +1 -0
- package/dist/constants.d.ts +26 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/error/index.d.ts +77 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/ga/index.d.ts +7 -0
- package/dist/ga/index.d.ts.map +1 -0
- package/dist/index.d.ts +6 -411
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +41 -17
- package/dist/index.mjs.map +1 -0
- package/dist/utils/helpers.d.ts +23 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/localStorage.d.ts +5 -0
- package/dist/utils/localStorage.d.ts.map +1 -0
- package/dist/utils/scopePollingDetectionStrategy.d.ts +2 -0
- package/dist/utils/scopePollingDetectionStrategy.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +11 -3
- package/src/LegacyWalletPlugins/conversion.ts +34 -0
- package/src/WalletCore.ts +19 -7
- package/src/version.ts +1 -1
- package/CHANGELOG.md +0 -219
- package/jest.config.js +0 -5
- package/src/__tests__/WalletCore.test.ts +0 -106
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AptosSignTransactionOutput, AptosSignMessageOutput, AptosSignMessageInput, AptosWallet, AccountInfo as StandardAccountInfo } from "@aptos-labs/wallet-standard";
|
|
2
|
+
import { AnyRawTransaction, PendingTransactionResponse, Aptos } from "@aptos-labs/ts-sdk";
|
|
3
|
+
import { WalletReadyState } from "../constants";
|
|
4
|
+
import { AccountInfo, InputTransactionData, Wallet } from "../LegacyWalletPlugins/types";
|
|
5
|
+
export type AptosStandardWallet = AptosWallet & {
|
|
6
|
+
readyState?: WalletReadyState;
|
|
7
|
+
};
|
|
8
|
+
export declare class WalletStandardCore {
|
|
9
|
+
connect(wallet: Wallet): Promise<StandardAccountInfo>;
|
|
10
|
+
/**
|
|
11
|
+
* Signs and submits a transaction to chain
|
|
12
|
+
*
|
|
13
|
+
* @param transactionInput InputTransactionData
|
|
14
|
+
* @returns PendingTransactionResponse
|
|
15
|
+
*/
|
|
16
|
+
signAndSubmitTransaction(transactionInput: InputTransactionData, aptos: Aptos, account: AccountInfo, wallet: Wallet): Promise<PendingTransactionResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Signs a transaction
|
|
19
|
+
*
|
|
20
|
+
* To support both existing wallet adapter V1 and V2, we support 2 input types
|
|
21
|
+
*
|
|
22
|
+
* @param transactionOrPayload AnyRawTransaction
|
|
23
|
+
* @param options asFeePayer. To sign a transaction as the fee payer sponsor
|
|
24
|
+
*
|
|
25
|
+
* @returns AptosSignTransactionOutput
|
|
26
|
+
*/
|
|
27
|
+
signTransaction(transaction: AnyRawTransaction, wallet: Wallet, asFeePayer?: boolean): Promise<AptosSignTransactionOutput>;
|
|
28
|
+
/**
|
|
29
|
+
* Sign message
|
|
30
|
+
*
|
|
31
|
+
* @param message AptosSignMessageInput
|
|
32
|
+
* @return AptosSignMessageOutput
|
|
33
|
+
* @throws WalletSignMessageError
|
|
34
|
+
*/
|
|
35
|
+
signMessage(message: AptosSignMessageInput, wallet: Wallet): Promise<AptosSignMessageOutput>;
|
|
36
|
+
/**
|
|
37
|
+
* Signs a message and verifies the signer
|
|
38
|
+
* @param message AptosSignMessageInput
|
|
39
|
+
* @returns boolean
|
|
40
|
+
*/
|
|
41
|
+
signMessageAndVerify(message: AptosSignMessageInput, wallet: Wallet): Promise<boolean>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=WalletStandard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletStandard.d.ts","sourceRoot":"","sources":["../../src/AIP62StandardWallets/WalletStandard.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EAGX,WAAW,IAAI,mBAAmB,EAEnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,KAAK,EAGN,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAGtC,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,qBAAa,kBAAkB;IACvB,OAAO,CAAC,MAAM,EAAE,MAAM;IAU5B;;;;;OAKG;IACG,wBAAwB,CAC5B,gBAAgB,EAAE,oBAAoB,EACtC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,0BAA0B,CAAC;IAsBtC;;;;;;;;;OASG;IACG,eAAe,CACnB,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,0BAA0B,CAAC;IAWtC;;;;;;OAMG;IACG,WAAW,CACf,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,sBAAsB,CAAC;IAgBlC;;;;OAIG;IACG,oBAAoB,CACxB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC;CA8CpB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TxnBuilderTypes, Types } from "aptos";
|
|
2
|
+
import EventEmitter from "eventemitter3";
|
|
3
|
+
import { InputGenerateTransactionPayloadData } from "@aptos-labs/ts-sdk";
|
|
4
|
+
import { Wallet, WalletCoreEvents, TransactionOptions, NetworkInfo, InputTransactionData, AccountInfo, SignMessagePayload } from "./types";
|
|
5
|
+
export declare class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
6
|
+
connect(wallet: Wallet): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the transaction type (BCS arguments or Simple arguments)
|
|
9
|
+
*
|
|
10
|
+
* @param payloadData
|
|
11
|
+
* @param network
|
|
12
|
+
* @param wallet
|
|
13
|
+
* @param transactionInput
|
|
14
|
+
*
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
resolveSignAndSubmitTransaction(payloadData: InputGenerateTransactionPayloadData, network: NetworkInfo | null, wallet: Wallet, transactionInput: InputTransactionData): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
Sign and submit an entry (not bcs serialized) transaction type to chain.
|
|
20
|
+
@param transaction a non-bcs serialized transaction
|
|
21
|
+
@param options max_gas_amount and gas_unit_limit
|
|
22
|
+
@return response from the wallet's signAndSubmitTransaction function
|
|
23
|
+
@throws WalletSignAndSubmitMessageError
|
|
24
|
+
*/
|
|
25
|
+
signAndSubmitTransaction(transaction: Types.TransactionPayload, wallet: Wallet, options?: TransactionOptions): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
Sign and submit a bsc serialized transaction type to chain.
|
|
28
|
+
@param transaction a bcs serialized transaction
|
|
29
|
+
@param options max_gas_amount and gas_unit_limit
|
|
30
|
+
@return response from the wallet's signAndSubmitBCSTransaction function
|
|
31
|
+
@throws WalletSignAndSubmitMessageError
|
|
32
|
+
*/
|
|
33
|
+
signAndSubmitBCSTransaction(transaction: TxnBuilderTypes.TransactionPayload, wallet: Wallet, options?: TransactionOptions): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
Sign transaction
|
|
36
|
+
@param transaction
|
|
37
|
+
@param options max_gas_amount and gas_unit_limit
|
|
38
|
+
@return response from the wallet's signTransaction function
|
|
39
|
+
@throws WalletSignTransactionError
|
|
40
|
+
*/
|
|
41
|
+
signTransaction(transaction: Types.TransactionPayload, wallet: Wallet, options?: TransactionOptions): Promise<Uint8Array | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Signs a message and verifies the signer
|
|
44
|
+
* @param message SignMessagePayload
|
|
45
|
+
* @returns boolean
|
|
46
|
+
*/
|
|
47
|
+
signMessageAndVerify(message: SignMessagePayload, wallet: Wallet, account: AccountInfo): Promise<boolean>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=WalletCoreV1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletCoreV1.d.ts","sourceRoot":"","sources":["../../src/LegacyWalletPlugins/WalletCoreV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,EAEL,mCAAmC,EAEpC,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAYjB,qBAAa,YAAa,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IACxD,OAAO,CAAC,MAAM,EAAE,MAAM;IAK5B;;;;;;;;;OASG;IACG,+BAA+B,CACnC,WAAW,EAAE,mCAAmC,EAChD,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,oBAAoB;IAuCxC;;;;;;MAME;IACI,wBAAwB,CAC5B,WAAW,EAAE,KAAK,CAAC,kBAAkB,EACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,GAAG,CAAC;IAcf;;;;;;OAMG;IACG,2BAA2B,CAC/B,WAAW,EAAE,eAAe,CAAC,kBAAkB,EAC/C,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,GAAG,CAAC;IAmBf;;;;;;OAMG;IACG,eAAe,CACnB,WAAW,EAAE,KAAK,CAAC,kBAAkB,EACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAc7B;;;;OAIG;IACG,oBAAoB,CACxB,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC;CAuEpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Network, TransactionPayload, InputGenerateTransactionPayloadData, AptosConfig, TransactionPayloadEntryFunction } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import { NetworkInfo as StandardNetworkInfo } from "@aptos-labs/wallet-standard";
|
|
3
|
+
import { TxnBuilderTypes, Types } from "aptos";
|
|
4
|
+
import { NetworkInfo } from "./types";
|
|
5
|
+
export declare function convertNetwork(networkInfo: NetworkInfo | StandardNetworkInfo | null): Network;
|
|
6
|
+
export declare function convertV2TransactionPayloadToV1BCSPayload(payload: TransactionPayload): TxnBuilderTypes.TransactionPayload;
|
|
7
|
+
export declare function convertV2PayloadToV1JSONPayload(payload: InputGenerateTransactionPayloadData): Types.TransactionPayload;
|
|
8
|
+
export declare function generateTransactionPayloadFromV1Input(aptosConfig: AptosConfig, inputV1: Types.TransactionPayload): Promise<TransactionPayloadEntryFunction>;
|
|
9
|
+
export interface CompatibleTransactionOptions {
|
|
10
|
+
expireTimestamp?: number;
|
|
11
|
+
expirationSecondsFromNow?: number;
|
|
12
|
+
expirationTimestamp?: number;
|
|
13
|
+
gasUnitPrice?: number;
|
|
14
|
+
gas_unit_price?: number;
|
|
15
|
+
maxGasAmount?: number;
|
|
16
|
+
max_gas_amount?: number;
|
|
17
|
+
sender?: string;
|
|
18
|
+
sequenceNumber?: number;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversion.d.ts","sourceRoot":"","sources":["../../src/LegacyWalletPlugins/conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,mCAAmC,EAEnC,WAAW,EAKX,+BAA+B,EAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAO,eAAe,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,GAAG,mBAAmB,GAAG,IAAI,GACpD,OAAO,CAWT;AAGD,wBAAgB,yCAAyC,CACvD,OAAO,EAAE,kBAAkB,GAC1B,eAAe,CAAC,kBAAkB,CAGpC;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,mCAAmC,GAC3C,KAAK,CAAC,kBAAkB,CAuB1B;AAED,wBAAsB,qCAAqC,CACzD,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAChC,OAAO,CAAC,+BAA+B,CAAC,CAW1C;AAED,MAAM,WAAW,4BAA4B;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Types } from "aptos";
|
|
2
|
+
import { Network, InputGenerateTransactionOptions, InputSubmitTransactionData, PendingTransactionResponse, AccountAddressInput, InputGenerateTransactionPayloadData, AnyRawTransaction, Signature } from "@aptos-labs/ts-sdk";
|
|
3
|
+
import { WalletReadyState } from "../constants";
|
|
4
|
+
import { AptosSignAndSubmitTransactionOutput, AptosSignMessageOutput, UserResponse, AccountInfo as StandardAccountInfo, NetworkInfo as StandardNetworkInfo } from "@aptos-labs/wallet-standard";
|
|
5
|
+
export { TxnBuilderTypes, Types } from "aptos";
|
|
6
|
+
export type { InputGenerateTransactionData, InputGenerateTransactionOptions, AnyRawTransaction, InputSubmitTransactionData, PendingTransactionResponse, AccountAuthenticator, } from "@aptos-labs/ts-sdk";
|
|
7
|
+
export type WalletName<T extends string = string> = T & {
|
|
8
|
+
__brand__: "WalletName";
|
|
9
|
+
};
|
|
10
|
+
export type NetworkInfo = {
|
|
11
|
+
name: Network;
|
|
12
|
+
chainId?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
};
|
|
15
|
+
export type WalletInfo = {
|
|
16
|
+
name: WalletName;
|
|
17
|
+
icon: string;
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
export type AccountInfo = {
|
|
21
|
+
address: string;
|
|
22
|
+
publicKey: string | string[];
|
|
23
|
+
minKeysRequired?: number;
|
|
24
|
+
ansName?: string | null;
|
|
25
|
+
};
|
|
26
|
+
export interface AptosWalletErrorResult {
|
|
27
|
+
code: number;
|
|
28
|
+
name: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export declare interface WalletCoreEvents {
|
|
32
|
+
connect(account: AccountInfo | null): void;
|
|
33
|
+
disconnect(): void;
|
|
34
|
+
readyStateChange(wallet: Wallet): void;
|
|
35
|
+
standardWalletsAdded(wallets: Wallet): void;
|
|
36
|
+
networkChange(network: NetworkInfo | null): void;
|
|
37
|
+
accountChange(account: AccountInfo | null): void;
|
|
38
|
+
}
|
|
39
|
+
export interface SignMessagePayload {
|
|
40
|
+
address?: boolean;
|
|
41
|
+
application?: boolean;
|
|
42
|
+
chainId?: boolean;
|
|
43
|
+
message: string;
|
|
44
|
+
nonce: string;
|
|
45
|
+
}
|
|
46
|
+
export interface SignMessageResponse {
|
|
47
|
+
address?: string;
|
|
48
|
+
application?: string;
|
|
49
|
+
chainId?: number;
|
|
50
|
+
fullMessage: string;
|
|
51
|
+
message: string;
|
|
52
|
+
nonce: string;
|
|
53
|
+
prefix: "APTOS";
|
|
54
|
+
signature: string | string[] | Signature;
|
|
55
|
+
bitmap?: Uint8Array;
|
|
56
|
+
}
|
|
57
|
+
export type OnNetworkChange = (callBack: (networkInfo: NetworkInfo | StandardNetworkInfo) => Promise<void>) => Promise<void>;
|
|
58
|
+
export type OnAccountChange = (callBack: (accountInfo: AccountInfo | StandardAccountInfo) => Promise<any>) => Promise<void>;
|
|
59
|
+
export interface AdapterPluginEvents {
|
|
60
|
+
onNetworkChange: OnNetworkChange;
|
|
61
|
+
onAccountChange: OnAccountChange;
|
|
62
|
+
}
|
|
63
|
+
export interface AdapterPluginProps<Name extends string = string> {
|
|
64
|
+
name: WalletName<Name>;
|
|
65
|
+
url: string;
|
|
66
|
+
icon: `data:image/${"svg+xml" | "webp" | "png" | "gif"};base64,${string}`;
|
|
67
|
+
providerName?: string;
|
|
68
|
+
provider: any;
|
|
69
|
+
deeplinkProvider?: (data: {
|
|
70
|
+
url: string;
|
|
71
|
+
}) => string;
|
|
72
|
+
openInMobileApp?: () => void;
|
|
73
|
+
connect(): Promise<any>;
|
|
74
|
+
disconnect: () => Promise<any>;
|
|
75
|
+
network: () => Promise<any>;
|
|
76
|
+
signAndSubmitTransaction?(transaction: Types.TransactionPayload | InputTransactionData | AnyRawTransaction, options?: InputGenerateTransactionOptions): Promise<{
|
|
77
|
+
hash: Types.HexEncodedBytes;
|
|
78
|
+
output?: any;
|
|
79
|
+
} | PendingTransactionResponse | UserResponse<AptosSignAndSubmitTransactionOutput>>;
|
|
80
|
+
submitTransaction?(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
|
|
81
|
+
signMessage<T extends SignMessagePayload>(message: T): Promise<SignMessageResponse | UserResponse<AptosSignMessageOutput>>;
|
|
82
|
+
signTransaction?(// `any` type for backwards compatibility, especially for identity connect
|
|
83
|
+
transactionOrPayload: any, optionsOrAsFeePayer?: any): Promise<any>;
|
|
84
|
+
account?: () => Promise<AccountInfo | StandardAccountInfo>;
|
|
85
|
+
}
|
|
86
|
+
export type AdapterPlugin<Name extends string = string> = AdapterPluginProps<Name> & AdapterPluginEvents;
|
|
87
|
+
export type Wallet<Name extends string = string> = AdapterPlugin<Name> & {
|
|
88
|
+
readyState?: WalletReadyState;
|
|
89
|
+
isAIP62Standard?: boolean;
|
|
90
|
+
};
|
|
91
|
+
export interface TransactionOptions {
|
|
92
|
+
max_gas_amount?: bigint;
|
|
93
|
+
gas_unit_price?: bigint;
|
|
94
|
+
}
|
|
95
|
+
export type InputTransactionData = {
|
|
96
|
+
sender?: AccountAddressInput;
|
|
97
|
+
data: InputGenerateTransactionPayloadData;
|
|
98
|
+
options?: InputGenerateTransactionOptions;
|
|
99
|
+
};
|
|
100
|
+
export interface PluginProvider {
|
|
101
|
+
connect: () => Promise<AccountInfo>;
|
|
102
|
+
account: () => Promise<AccountInfo>;
|
|
103
|
+
disconnect: () => Promise<void>;
|
|
104
|
+
signAndSubmitTransaction: (transaction: any, options?: any) => Promise<{
|
|
105
|
+
hash: Types.HexEncodedBytes;
|
|
106
|
+
} | AptosWalletErrorResult>;
|
|
107
|
+
signMessage: (message: SignMessagePayload) => Promise<SignMessageResponse>;
|
|
108
|
+
network: () => Promise<NetworkInfo>;
|
|
109
|
+
onAccountChange: (listener: (newAddress: AccountInfo) => Promise<void>) => Promise<void>;
|
|
110
|
+
onNetworkChange: OnNetworkChange;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/LegacyWalletPlugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,EACnB,mCAAmC,EACnC,iBAAiB,EACjB,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,mCAAmC,EACnC,sBAAsB,EACtB,YAAY,EACZ,WAAW,IAAI,mBAAmB,EAClC,WAAW,IAAI,mBAAmB,EACnC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC/C,YAAY,EACV,4BAA4B,EAC5B,+BAA+B,EAC/B,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG;IACtD,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CA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,CAAC;IAC1C,OAAO,CAAC,EAAE,+BAA+B,CAAC;CAC3C,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,wBAAwB,EAAE,CACxB,WAAW,EAAE,GAAG,EAChB,OAAO,CAAC,EAAE,GAAG,KACV,OAAO,CAAC;QAAE,IAAI,EAAE,KAAK,CAAC,eAAe,CAAA;KAAE,GAAG,sBAAsB,CAAC,CAAC;IACvE,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC3E,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,KACjD,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;CAClC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Types } from "aptos";
|
|
2
|
+
import { AnyRawTransaction, AccountAuthenticator, InputGenerateTransactionOptions, InputSubmitTransactionData, PendingTransactionResponse } from "@aptos-labs/ts-sdk";
|
|
3
|
+
import EventEmitter from "eventemitter3";
|
|
4
|
+
import { AccountInfo, InputTransactionData, NetworkInfo, SignMessagePayload, SignMessageResponse, Wallet, WalletCoreEvents, WalletInfo } from "./LegacyWalletPlugins/types";
|
|
5
|
+
import { AccountInfo as StandardAccountInfo, NetworkInfo as StandardNetworkInfo, UserResponse } from "@aptos-labs/wallet-standard";
|
|
6
|
+
import { AptosStandardWallet } from "./AIP62StandardWallets/WalletStandard";
|
|
7
|
+
export type IAptosWallet = AptosStandardWallet & Wallet;
|
|
8
|
+
export declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
9
|
+
private _wallets;
|
|
10
|
+
private _standard_wallets;
|
|
11
|
+
private _all_wallets;
|
|
12
|
+
private _wallet;
|
|
13
|
+
private _account;
|
|
14
|
+
private _network;
|
|
15
|
+
private readonly walletCoreV1;
|
|
16
|
+
private readonly walletStandardCore;
|
|
17
|
+
private _connecting;
|
|
18
|
+
private _connected;
|
|
19
|
+
private readonly ga4;
|
|
20
|
+
/**
|
|
21
|
+
* Core functionality constructor.
|
|
22
|
+
* For legacy wallet adapter v1 support we expect the dapp to pass in wallet plugins,
|
|
23
|
+
* since AIP-62 standard support this is optional for dapps.
|
|
24
|
+
*
|
|
25
|
+
* @param plugins legacy wallet adapter v1 wallet plugins
|
|
26
|
+
*/
|
|
27
|
+
constructor(plugins: ReadonlyArray<Wallet>);
|
|
28
|
+
private scopePollingDetectionStrategy;
|
|
29
|
+
private fetchAptosWallets;
|
|
30
|
+
private setWallets;
|
|
31
|
+
/**
|
|
32
|
+
* To maintain support for both plugins and AIP-62 standard wallets,
|
|
33
|
+
* without introducing dapps breaking changes, we convert
|
|
34
|
+
* AIP-62 standard compatible wallets to the legacy adapter wallet plugin type.
|
|
35
|
+
*
|
|
36
|
+
* @param standardWallet An AIP-62 standard compatible wallet
|
|
37
|
+
*/
|
|
38
|
+
private standardizeStandardWalletToPluginWalletType;
|
|
39
|
+
private recordEvent;
|
|
40
|
+
/**
|
|
41
|
+
* Helper function to ensure wallet exists
|
|
42
|
+
*
|
|
43
|
+
* @param wallet A wallet
|
|
44
|
+
*/
|
|
45
|
+
private ensureWalletExists;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to ensure account exists
|
|
48
|
+
*
|
|
49
|
+
* @param account An account
|
|
50
|
+
*/
|
|
51
|
+
private ensureAccountExists;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated use ensureWalletExists
|
|
54
|
+
*/
|
|
55
|
+
private doesWalletExist;
|
|
56
|
+
/**
|
|
57
|
+
* Function to cleat wallet adapter data.
|
|
58
|
+
*
|
|
59
|
+
* - Removes current connected wallet state
|
|
60
|
+
* - Removes current connected account state
|
|
61
|
+
* - Removes current connected network state
|
|
62
|
+
* - Removes autoconnect local storage value
|
|
63
|
+
*/
|
|
64
|
+
private clearData;
|
|
65
|
+
/**
|
|
66
|
+
* Queries and sets ANS name for the current connected wallet account
|
|
67
|
+
*/
|
|
68
|
+
private setAnsName;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the connected wallet
|
|
71
|
+
*
|
|
72
|
+
* @param wallet A wallet
|
|
73
|
+
*/
|
|
74
|
+
setWallet(wallet: Wallet | null): void;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the connected account
|
|
77
|
+
*
|
|
78
|
+
* `AccountInfo` type comes from a legacy wallet adapter plugin
|
|
79
|
+
* `StandardAccountInfo` type comes from AIP-62 standard compatible wallet when onAccountChange event is called
|
|
80
|
+
* `UserResponse<StandardAccountInfo>` type comes from AIP-62 standard compatible wallet on wallet connect
|
|
81
|
+
*
|
|
82
|
+
* @param account An account
|
|
83
|
+
*/
|
|
84
|
+
setAccount(account: AccountInfo | StandardAccountInfo | UserResponse<StandardAccountInfo> | null): void;
|
|
85
|
+
/**
|
|
86
|
+
* Sets the connected network
|
|
87
|
+
*
|
|
88
|
+
* `NetworkInfo` type comes from a legacy wallet adapter plugin
|
|
89
|
+
* `StandardNetworkInfo` type comes from AIP-62 standard compatible wallet
|
|
90
|
+
*
|
|
91
|
+
* @param network A network
|
|
92
|
+
*/
|
|
93
|
+
setNetwork(network: NetworkInfo | StandardNetworkInfo | null): void;
|
|
94
|
+
/**
|
|
95
|
+
* Helper function to detect whether a wallet is connected
|
|
96
|
+
*
|
|
97
|
+
* @returns boolean
|
|
98
|
+
*/
|
|
99
|
+
isConnected(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Getter to fetch all detected wallets
|
|
102
|
+
*/
|
|
103
|
+
get wallets(): ReadonlyArray<Wallet>;
|
|
104
|
+
/**
|
|
105
|
+
* Getter to fetch all detected plugin wallets
|
|
106
|
+
*/
|
|
107
|
+
get pluginWallets(): ReadonlyArray<Wallet>;
|
|
108
|
+
/**
|
|
109
|
+
* Getter to fetch all detected AIP-62 standard compatible wallets
|
|
110
|
+
*/
|
|
111
|
+
get standardWallets(): ReadonlyArray<AptosStandardWallet>;
|
|
112
|
+
/**
|
|
113
|
+
* Getter for the current connected wallet
|
|
114
|
+
*
|
|
115
|
+
* @return wallet info
|
|
116
|
+
* @throws WalletNotSelectedError
|
|
117
|
+
*/
|
|
118
|
+
get wallet(): WalletInfo | null;
|
|
119
|
+
/**
|
|
120
|
+
* Getter for the current connected account
|
|
121
|
+
*
|
|
122
|
+
* @return account info
|
|
123
|
+
* @throws WalletAccountError
|
|
124
|
+
*/
|
|
125
|
+
get account(): AccountInfo | null;
|
|
126
|
+
/**
|
|
127
|
+
* Getter for the current wallet network
|
|
128
|
+
*
|
|
129
|
+
* @return network info
|
|
130
|
+
* @throws WalletGetNetworkError
|
|
131
|
+
*/
|
|
132
|
+
get network(): NetworkInfo | null;
|
|
133
|
+
/**
|
|
134
|
+
* Helper function to run some checks before we connect with a wallet.
|
|
135
|
+
*
|
|
136
|
+
* @param walletName. The wallet name we want to connect with.
|
|
137
|
+
*/
|
|
138
|
+
connect(walletName: string): Promise<void | string>;
|
|
139
|
+
/**
|
|
140
|
+
* Connects a wallet to the dapp.
|
|
141
|
+
* On connect success, we set the current account and the network, and keeping the selected wallet
|
|
142
|
+
* name in LocalStorage to support autoConnect function.
|
|
143
|
+
*
|
|
144
|
+
* @param selectedWallet. The wallet we want to connect.
|
|
145
|
+
* @emit emits "connect" event
|
|
146
|
+
* @throws WalletConnectionError
|
|
147
|
+
*/
|
|
148
|
+
connectWallet(selectedWallet: Wallet): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Disconnect the current connected wallet. On success, we clear the
|
|
151
|
+
* current account, current network and LocalStorage data.
|
|
152
|
+
*
|
|
153
|
+
* @emit emits "disconnect" event
|
|
154
|
+
* @throws WalletDisconnectionError
|
|
155
|
+
*/
|
|
156
|
+
disconnect(): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Signs and submits a transaction to chain
|
|
159
|
+
*
|
|
160
|
+
* @param transactionInput InputTransactionData
|
|
161
|
+
* @param options optional. A configuration object to generate a transaction by
|
|
162
|
+
* @returns The pending transaction hash (V1 output) | PendingTransactionResponse (V2 output)
|
|
163
|
+
*/
|
|
164
|
+
signAndSubmitTransaction(transactionInput: InputTransactionData): Promise<{
|
|
165
|
+
hash: Types.HexEncodedBytes;
|
|
166
|
+
output?: any;
|
|
167
|
+
} | PendingTransactionResponse>;
|
|
168
|
+
/**
|
|
169
|
+
* Signs a transaction
|
|
170
|
+
*
|
|
171
|
+
* To support both existing wallet adapter V1 and V2, we support 2 input types
|
|
172
|
+
*
|
|
173
|
+
* @param transactionOrPayload AnyRawTransaction - V2 input | Types.TransactionPayload - V1 input
|
|
174
|
+
* @param options optional. V1 input
|
|
175
|
+
*
|
|
176
|
+
* @returns AccountAuthenticator
|
|
177
|
+
*/
|
|
178
|
+
signTransaction(transactionOrPayload: AnyRawTransaction | Types.TransactionPayload, asFeePayer?: boolean, options?: InputGenerateTransactionOptions): Promise<AccountAuthenticator>;
|
|
179
|
+
/**
|
|
180
|
+
* Sign message (doesnt submit to chain).
|
|
181
|
+
*
|
|
182
|
+
* @param message
|
|
183
|
+
* @return response from the wallet's signMessage function
|
|
184
|
+
* @throws WalletSignMessageError
|
|
185
|
+
*/
|
|
186
|
+
signMessage(message: SignMessagePayload): Promise<SignMessageResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* Submits transaction to chain
|
|
189
|
+
*
|
|
190
|
+
* @param transaction
|
|
191
|
+
* @returns PendingTransactionResponse
|
|
192
|
+
*/
|
|
193
|
+
submitTransaction(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
|
|
194
|
+
/**
|
|
195
|
+
Event for when account has changed on the wallet
|
|
196
|
+
@return the new account info
|
|
197
|
+
@throws WalletAccountChangeError
|
|
198
|
+
*/
|
|
199
|
+
onAccountChange(): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
Event for when network has changed on the wallet
|
|
202
|
+
@return the new network info
|
|
203
|
+
@throws WalletNetworkChangeError
|
|
204
|
+
*/
|
|
205
|
+
onNetworkChange(): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Signs a message and verifies the signer
|
|
208
|
+
* @param message SignMessagePayload
|
|
209
|
+
* @returns boolean
|
|
210
|
+
*/
|
|
211
|
+
signMessageAndVerify(message: SignMessagePayload): Promise<boolean>;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=WalletCore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletCore.d.ts","sourceRoot":"","sources":["../src/WalletCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAO,MAAM,OAAO,CAAC;AACpD,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,EAGpB,+BAA+B,EAG/B,0BAA0B,EAC1B,0BAA0B,EAG3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,YAAY,MAAM,eAAe,CAAC;AAmBzC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,gBAAgB,EAChB,UAAU,EAEX,MAAM,6BAA6B,CAAC;AAgBrC,OAAO,EACL,WAAW,IAAI,mBAAmB,EAGlC,WAAW,IAAI,mBAAmB,EAClC,YAAY,EAEb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,EAEpB,MAAM,uCAAuC,CAAC;AAI/C,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAExD,qBAAa,UAAW,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IAE5D,OAAO,CAAC,QAAQ,CAA6B;IAG7C,OAAO,CAAC,iBAAiB,CAA0C;IAInE,OAAO,CAAC,YAAY,CA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1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletCore.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/WalletCore.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare enum WalletReadyState {
|
|
2
|
+
/**
|
|
3
|
+
* User-installable wallets can typically be detected by scanning for an API
|
|
4
|
+
* that they've injected into the global context. If such an API is present,
|
|
5
|
+
* we consider the wallet to have been installed.
|
|
6
|
+
*/
|
|
7
|
+
Installed = "Installed",
|
|
8
|
+
NotDetected = "NotDetected",
|
|
9
|
+
/**
|
|
10
|
+
* Loadable wallets are always available to you. Since you can load them at
|
|
11
|
+
* any time, it's meaningless to say that they have been detected.
|
|
12
|
+
*/
|
|
13
|
+
Loadable = "Loadable",
|
|
14
|
+
/**
|
|
15
|
+
* If a wallet is not supported on a given platform (eg. server-rendering, or
|
|
16
|
+
* mobile) then it will stay in the `Unsupported` state.
|
|
17
|
+
*/
|
|
18
|
+
Unsupported = "Unsupported"
|
|
19
|
+
}
|
|
20
|
+
export declare enum NetworkName {
|
|
21
|
+
Mainnet = "mainnet",
|
|
22
|
+
Testnet = "testnet",
|
|
23
|
+
Devnet = "devnet"
|
|
24
|
+
}
|
|
25
|
+
export declare const ChainIdToAnsSupportedNetworkMap: Record<string, string>;
|
|
26
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B;;;;OAIG;IACH,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B;;;OAGG;IACH,QAAQ,aAAa;IACrB;;;OAGG;IACH,WAAW,gBAAgB;CAC5B;AAED,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGlE,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export declare class WalletError extends Error {
|
|
2
|
+
error: any;
|
|
3
|
+
constructor(message?: string, error?: any);
|
|
4
|
+
}
|
|
5
|
+
export declare class WalletNotSelectedError extends WalletError {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class WalletNotReadyError extends WalletError {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class WalletLoadError extends WalletError {
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class WalletConfigError extends WalletError {
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class WalletConnectionError extends WalletError {
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class WalletDisconnectedError extends WalletError {
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class WalletDisconnectionError extends WalletError {
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class WalletAccountError extends WalletError {
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class WalletGetNetworkError extends WalletError {
|
|
30
|
+
name: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class WalletAccountChangeError extends WalletError {
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class WalletNetworkChangeError extends WalletError {
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
export declare class WalletPublicKeyError extends WalletError {
|
|
39
|
+
name: string;
|
|
40
|
+
}
|
|
41
|
+
export declare class WalletKeypairError extends WalletError {
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
export declare class WalletNotConnectedError extends WalletError {
|
|
45
|
+
name: string;
|
|
46
|
+
}
|
|
47
|
+
export declare class WalletSendTransactionError extends WalletError {
|
|
48
|
+
name: string;
|
|
49
|
+
}
|
|
50
|
+
export declare class WalletSignMessageError extends WalletError {
|
|
51
|
+
name: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class WalletSignMessageAndVerifyError extends WalletError {
|
|
54
|
+
name: string;
|
|
55
|
+
}
|
|
56
|
+
export declare class WalletSignAndSubmitMessageError extends WalletError {
|
|
57
|
+
name: string;
|
|
58
|
+
}
|
|
59
|
+
export declare class WalletSignTransactionError extends WalletError {
|
|
60
|
+
name: string;
|
|
61
|
+
}
|
|
62
|
+
export declare class WalletTimeoutError extends WalletError {
|
|
63
|
+
name: string;
|
|
64
|
+
}
|
|
65
|
+
export declare class WalletWindowBlockedError extends WalletError {
|
|
66
|
+
name: string;
|
|
67
|
+
}
|
|
68
|
+
export declare class WalletWindowClosedError extends WalletError {
|
|
69
|
+
name: string;
|
|
70
|
+
}
|
|
71
|
+
export declare class WalletResponseError extends WalletError {
|
|
72
|
+
name: string;
|
|
73
|
+
}
|
|
74
|
+
export declare class WalletNotSupportedMethod extends WalletError {
|
|
75
|
+
name: string;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;IAC7B,KAAK,EAAE,GAAG,CAAC;gBAGN,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;CAI1C;AAED,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,IAAI,SAA4B;CACjC;AAED,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,IAAI,SAAyB;CAC9B;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,IAAI,SAAqB;CAC1B;AAED,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,IAAI,SAAuB;CAC5B;AAED,qBAAa,qBAAsB,SAAQ,WAAW;IACpD,IAAI,SAA2B;CAChC;AAED,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,IAAI,SAA6B;CAClC;AAED,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