@aptos-labs/wallet-adapter-core 7.10.1 → 7.10.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 +44 -0
- package/dist/AIP62StandardWallets/WalletStandard.d.ts.map +1 -0
- package/dist/AIP62StandardWallets/index.d.ts +3 -0
- package/dist/AIP62StandardWallets/index.d.ts.map +1 -0
- package/dist/AIP62StandardWallets/registry.d.ts +17 -0
- package/dist/AIP62StandardWallets/registry.d.ts.map +1 -0
- package/dist/AIP62StandardWallets/sdkWallets.d.ts +4 -0
- package/dist/AIP62StandardWallets/sdkWallets.d.ts.map +1 -0
- package/dist/AIP62StandardWallets/types.d.ts +12 -0
- package/dist/AIP62StandardWallets/types.d.ts.map +1 -0
- package/dist/CrossChainCore.d.ts +28 -0
- package/dist/CrossChainCore.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/WalletCoreV1.d.ts +50 -0
- package/dist/LegacyWalletPlugins/WalletCoreV1.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/conversion.d.ts +21 -0
- package/dist/LegacyWalletPlugins/conversion.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/index.d.ts +4 -0
- package/dist/LegacyWalletPlugins/index.d.ts.map +1 -0
- package/dist/LegacyWalletPlugins/types.d.ts +116 -0
- package/dist/LegacyWalletPlugins/types.d.ts.map +1 -0
- package/dist/WalletCoreNew.d.ts +194 -0
- package/dist/WalletCoreNew.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/index.cjs +2376 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +482 -9
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -3
- package/dist/index.mjs.map +1 -1
- package/dist/utils/aptosConnect.d.ts +18 -0
- package/dist/utils/aptosConnect.d.ts.map +1 -0
- package/dist/utils/crossChain/chains/mainnet/index.d.ts +45 -0
- package/dist/utils/crossChain/chains/mainnet/index.d.ts.map +1 -0
- package/dist/utils/crossChain/chains/testnet/index.d.ts +50 -0
- package/dist/utils/crossChain/chains/testnet/index.d.ts.map +1 -0
- package/dist/utils/crossChain/tokens/mainnet.d.ts +15 -0
- package/dist/utils/crossChain/tokens/mainnet.d.ts.map +1 -0
- package/dist/utils/crossChain/tokens/testnet.d.ts +11 -0
- package/dist/utils/crossChain/tokens/testnet.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/scopePollingDetectionStrategy.d.ts +2 -0
- package/dist/utils/scopePollingDetectionStrategy.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AptosSignTransactionInputV1_1, AptosSignTransactionOutput, AptosSignMessageOutput, AptosSignMessageInput, AptosWallet, AptosSignAndSubmitTransactionOutput, AccountInfo as StandardAccountInfo, AptosSignTransactionOutputV1_1 } from "@aptos-labs/wallet-standard";
|
|
2
|
+
import { AnyRawTransaction, Aptos } from "@aptos-labs/ts-sdk";
|
|
3
|
+
import { WalletReadyState } from "../constants";
|
|
4
|
+
import { AccountInfo, InputTransactionData, Wallet } from "../LegacyWalletPlugins";
|
|
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, standardWallets: ReadonlyArray<AptosStandardWallet>): Promise<AptosSignAndSubmitTransactionOutput>;
|
|
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
|
+
signTransaction(input: AptosSignTransactionInputV1_1, wallet: Wallet): Promise<AptosSignTransactionOutputV1_1>;
|
|
29
|
+
/**
|
|
30
|
+
* Sign message
|
|
31
|
+
*
|
|
32
|
+
* @param message AptosSignMessageInput
|
|
33
|
+
* @return AptosSignMessageOutput
|
|
34
|
+
* @throws WalletSignMessageError
|
|
35
|
+
*/
|
|
36
|
+
signMessage(message: AptosSignMessageInput, wallet: Wallet): Promise<AptosSignMessageOutput>;
|
|
37
|
+
/**
|
|
38
|
+
* Signs a message and verifies the signer
|
|
39
|
+
* @param message AptosSignMessageInput
|
|
40
|
+
* @returns boolean
|
|
41
|
+
*/
|
|
42
|
+
signMessageAndVerify(message: AptosSignMessageInput, wallet: Wallet): Promise<boolean>;
|
|
43
|
+
}
|
|
44
|
+
//# 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,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EAEX,mCAAmC,EACnC,WAAW,IAAI,mBAAmB,EAElC,8BAA8B,EAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,iBAAiB,EAEjB,KAAK,EAGN,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,MAAM,EACP,MAAM,wBAAwB,CAAC;AAGhC,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,EACd,eAAe,EAAE,aAAa,CAAC,mBAAmB,CAAC,GAClD,OAAO,CAAC,mCAAmC,CAAC;IAsD/C;;;;;;;;;OASG;IACG,eAAe,CACnB,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,0BAA0B,CAAC;IAChC,eAAe,CACnB,KAAK,EAAE,6BAA6B,EACpC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,8BAA8B,CAAC;IAgB1C;;;;;;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;CAuDpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AIP62StandardWallets/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AptosStandardSupportedWallet } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Registry of AIP-62 wallet standard supported wallets.
|
|
4
|
+
* This list is used to show supported wallets even if they are not installed on the user machine.
|
|
5
|
+
*
|
|
6
|
+
* AIP-62 compatible wallets are required to add their wallet info here if they want to be detected by the adapter
|
|
7
|
+
*
|
|
8
|
+
* @param name - The name of your wallet cast to WalletName (Ex. "Petra" as WalletName<"Petra">)
|
|
9
|
+
* @param url - The link to your chrome extension or main website where new users can create an account with your wallet.
|
|
10
|
+
* @param icon - An icon for your wallet. Can be one of 4 data types. Be sure to follow the below format exactly (including the literal "," after base64).
|
|
11
|
+
* Format: `data:image/${"svg+xml" | "webp" | "png" | "gif"};base64,${string}`
|
|
12
|
+
* Note: ${...} data in the above format should be replaced. Other characters are literals (ex. ";")
|
|
13
|
+
* @param deeplinkProvider optional - An optional deeplink provider for the wallet. If the wallet is not installed, we can redirect the user to the wallet's deeplink provider
|
|
14
|
+
* @example "https://myWallet.app/explore?link="
|
|
15
|
+
*/
|
|
16
|
+
export declare const aptosStandardSupportedWalletList: Array<AptosStandardSupportedWallet>;
|
|
17
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/AIP62StandardWallets/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,4BAA4B,CAyB9E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdkWallets.d.ts","sourceRoot":"","sources":["../../src/AIP62StandardWallets/sdkWallets.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,yBA8CpD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WalletName } from "../LegacyWalletPlugins/types";
|
|
2
|
+
import { WalletReadyState } from "../constants";
|
|
3
|
+
export interface AptosStandardSupportedWallet<Name extends string = string> {
|
|
4
|
+
name: WalletName<Name>;
|
|
5
|
+
url: string;
|
|
6
|
+
icon: `data:image/${"svg+xml" | "webp" | "png" | "gif"};base64,${string}`;
|
|
7
|
+
readyState: WalletReadyState.NotDetected;
|
|
8
|
+
isAIP62Standard: true;
|
|
9
|
+
deeplinkProvider?: string;
|
|
10
|
+
}
|
|
11
|
+
export type AvailableWallets = "Nightly" | "Petra" | "T wallet" | "Pontem Wallet" | "Mizu Wallet" | "Continue with Google";
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/AIP62StandardWallets/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,4BAA4B,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IAExE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAEvB,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,EAAE,cAAc,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,WAAW,MAAM,EAAE,CAAC;IAG1E,UAAU,EAAE,gBAAgB,CAAC,WAAW,CAAC;IAGzC,eAAe,EAAE,IAAI,CAAC;IAGtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAGD,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,OAAO,GACP,UAAU,GACV,eAAe,GACf,aAAa,GACb,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SolanaWallet } from "@xlabs-libs/wallet-aggregator-solana";
|
|
2
|
+
import { Eip6963Wallet } from "@xlabs-libs/wallet-aggregator-evm";
|
|
3
|
+
import { routes } from "@wormhole-foundation/sdk";
|
|
4
|
+
import { Wallet as WalletAggregator } from "@xlabs-libs/wallet-aggregator-core";
|
|
5
|
+
import { Network } from "@aptos-labs/ts-sdk";
|
|
6
|
+
export { SolanaWallet, Eip6963Wallet, WalletAggregator };
|
|
7
|
+
export interface CrossChainDappConfig {
|
|
8
|
+
network: Network;
|
|
9
|
+
aptosGasStationKeys?: Partial<Record<Network, string>>;
|
|
10
|
+
disableTelemetry?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class CrossChainCore {
|
|
13
|
+
private _solana_wallets;
|
|
14
|
+
private _ethereum_wallets;
|
|
15
|
+
private _dappConfig;
|
|
16
|
+
private _cctpProviders;
|
|
17
|
+
private _originChainSelected;
|
|
18
|
+
private _connectedWallet;
|
|
19
|
+
constructor(args: {
|
|
20
|
+
dappConfig: CrossChainDappConfig;
|
|
21
|
+
});
|
|
22
|
+
private fetchSolanaWallets;
|
|
23
|
+
private fetchEthereumWallets;
|
|
24
|
+
get solanaWallets(): ReadonlyArray<SolanaWallet>;
|
|
25
|
+
get ethereumWallets(): ReadonlyArray<Eip6963Wallet>;
|
|
26
|
+
getWormholeCctpRoute(): Promise<routes.Route<"Mainnet" | "Testnet", routes.Options, routes.ValidatedTransferParams<routes.Options>, routes.Receipt<import("@wormhole-foundation/sdk/dist/cjs").AttestationReceipt<keyof import("@wormhole-foundation/sdk/dist/cjs").WormholeRegistry.ProtocolToInterfaceMapping<"Mainnet" | "Testnet" | "Devnet", "Ethereum" | "Solana" | "Aptos" | "Avalanche" | "Sepolia" | "Btc" | "Algorand" | "Sui" | "Near" | "Terra" | "Bsc" | "Polygon" | "Oasis" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia">>>>>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=CrossChainCore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CrossChainCore.d.ts","sourceRoot":"","sources":["../src/CrossChainCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACb,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,aAAa,EAEd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,MAAM,EAOP,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAW7C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,qBAAa,cAAc;IAEzB,OAAO,CAAC,eAAe,CAAmC;IAE1D,OAAO,CAAC,iBAAiB,CAAoC;IAG7D,OAAO,CAAC,WAAW,CAAmC;IAEtD,OAAO,CAAC,cAAc,CAAiC;IAEvD,OAAO,CAAC,oBAAoB,CAAoC;IAEhE,OAAO,CAAC,gBAAgB,CAA+B;gBAE3C,IAAI,EAAE;QAAE,UAAU,EAAE,oBAAoB,CAAA;KAAE;IAOtD,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,oBAAoB;IAc5B,IAAI,aAAa,IAAI,aAAa,CAAC,YAAY,CAAC,CAE/C;IAED,IAAI,eAAe,IAAI,aAAa,CAAC,aAAa,CAAC,CAElD;IAEK,oBAAoB;CA6D3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import { DappConfig } from "../WalletCore";
|
|
6
|
+
export declare class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
7
|
+
connect(wallet: Wallet): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the transaction type (BCS arguments or Simple arguments)
|
|
10
|
+
*
|
|
11
|
+
* @param payloadData
|
|
12
|
+
* @param network
|
|
13
|
+
* @param wallet
|
|
14
|
+
* @param transactionInput
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
resolveSignAndSubmitTransaction(payloadData: InputGenerateTransactionPayloadData, network: NetworkInfo | null, wallet: Wallet, transactionInput: InputTransactionData, dappConfig?: DappConfig): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
Sign and submit an entry (not bcs serialized) transaction type to chain.
|
|
21
|
+
@param transaction a non-bcs serialized transaction
|
|
22
|
+
@param options max_gas_amount and gas_unit_limit
|
|
23
|
+
@return response from the wallet's signAndSubmitTransaction function
|
|
24
|
+
@throws WalletSignAndSubmitMessageError
|
|
25
|
+
*/
|
|
26
|
+
signAndSubmitTransaction(transaction: Types.TransactionPayload, wallet: Wallet, options?: TransactionOptions): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
Sign and submit a bsc serialized transaction type to chain.
|
|
29
|
+
@param transaction a bcs serialized transaction
|
|
30
|
+
@param options max_gas_amount and gas_unit_limit
|
|
31
|
+
@return response from the wallet's signAndSubmitBCSTransaction function
|
|
32
|
+
@throws WalletSignAndSubmitMessageError
|
|
33
|
+
*/
|
|
34
|
+
signAndSubmitBCSTransaction(transaction: TxnBuilderTypes.TransactionPayload, wallet: Wallet, options?: TransactionOptions): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
Sign transaction
|
|
37
|
+
@param transaction
|
|
38
|
+
@param options max_gas_amount and gas_unit_limit
|
|
39
|
+
@return response from the wallet's signTransaction function
|
|
40
|
+
@throws WalletSignTransactionError
|
|
41
|
+
*/
|
|
42
|
+
signTransaction(transaction: Types.TransactionPayload, wallet: Wallet, options?: TransactionOptions): Promise<Uint8Array | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Signs a message and verifies the signer
|
|
45
|
+
* @param message SignMessagePayload
|
|
46
|
+
* @returns boolean
|
|
47
|
+
*/
|
|
48
|
+
signMessageAndVerify(message: SignMessagePayload, wallet: Wallet, account: AccountInfo): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
//# 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;AAWjB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,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,EACtC,UAAU,CAAC,EAAE,UAAU;IAuCzB;;;;;;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,21 @@
|
|
|
1
|
+
import { Network, TransactionPayload, InputGenerateTransactionPayloadData, AptosConfig, InputEntryFunctionData, 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 convertPayloadInputV1ToV2(inputV1: Types.TransactionPayload): InputEntryFunctionData;
|
|
9
|
+
export declare function generateTransactionPayloadFromV1Input(aptosConfig: AptosConfig, inputV1: Types.TransactionPayload): Promise<TransactionPayloadEntryFunction>;
|
|
10
|
+
export interface CompatibleTransactionOptions {
|
|
11
|
+
expireTimestamp?: number;
|
|
12
|
+
expirationSecondsFromNow?: number;
|
|
13
|
+
expirationTimestamp?: number;
|
|
14
|
+
gasUnitPrice?: number;
|
|
15
|
+
gas_unit_price?: number;
|
|
16
|
+
maxGasAmount?: number;
|
|
17
|
+
max_gas_amount?: number;
|
|
18
|
+
sender?: string;
|
|
19
|
+
sequenceNumber?: number;
|
|
20
|
+
}
|
|
21
|
+
//# 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,EACX,sBAAsB,EAItB,+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,CAaT;AAGD,wBAAgB,yCAAyC,CACvD,OAAO,EAAE,kBAAkB,GAC1B,eAAe,CAAC,kBAAkB,CAGpC;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,mCAAmC,GAC3C,KAAK,CAAC,kBAAkB,CA0C1B;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,kBAAkB,0BAW1E;AAED,wBAAsB,qCAAqC,CACzD,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAChC,OAAO,CAAC,+BAA+B,CAAC,CAO1C;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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/LegacyWalletPlugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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, AptosChangeNetworkMethod, AptosSignAndSubmitTransactionInput } from "@aptos-labs/wallet-standard";
|
|
5
|
+
import { AptosStandardSupportedWallet } from "../AIP62StandardWallets/types";
|
|
6
|
+
export { TxnBuilderTypes, Types } from "aptos";
|
|
7
|
+
export type { InputGenerateTransactionData, InputGenerateTransactionOptions, AnyRawTransaction, InputSubmitTransactionData, PendingTransactionResponse, AccountAuthenticator, Network, } from "@aptos-labs/ts-sdk";
|
|
8
|
+
export type { NetworkInfo as StandardNetworkInfo, AptosChangeNetworkOutput, } from "@aptos-labs/wallet-standard";
|
|
9
|
+
export type WalletName<T extends string = string> = T & {
|
|
10
|
+
__brand__: "WalletName";
|
|
11
|
+
};
|
|
12
|
+
export type NetworkInfo = {
|
|
13
|
+
name: Network;
|
|
14
|
+
chainId?: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
};
|
|
17
|
+
export type WalletInfo = {
|
|
18
|
+
name: WalletName;
|
|
19
|
+
icon: string;
|
|
20
|
+
url: string;
|
|
21
|
+
};
|
|
22
|
+
export type AccountInfo = {
|
|
23
|
+
address: string;
|
|
24
|
+
publicKey: string | string[];
|
|
25
|
+
minKeysRequired?: number;
|
|
26
|
+
ansName?: string | null;
|
|
27
|
+
};
|
|
28
|
+
export interface AptosWalletErrorResult {
|
|
29
|
+
code: number;
|
|
30
|
+
name: string;
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
export declare interface WalletCoreEvents {
|
|
34
|
+
connect(account: AccountInfo | null): void;
|
|
35
|
+
disconnect(): void;
|
|
36
|
+
readyStateChange(wallet: Wallet): void;
|
|
37
|
+
standardWalletsAdded(wallets: Wallet | AptosStandardSupportedWallet): void;
|
|
38
|
+
networkChange(network: NetworkInfo | null): void;
|
|
39
|
+
accountChange(account: AccountInfo | null): void;
|
|
40
|
+
}
|
|
41
|
+
export interface SignMessagePayload {
|
|
42
|
+
address?: boolean;
|
|
43
|
+
application?: boolean;
|
|
44
|
+
chainId?: boolean;
|
|
45
|
+
message: string;
|
|
46
|
+
nonce: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SignMessageResponse {
|
|
49
|
+
address?: string;
|
|
50
|
+
application?: string;
|
|
51
|
+
chainId?: number;
|
|
52
|
+
fullMessage: string;
|
|
53
|
+
message: string;
|
|
54
|
+
nonce: string;
|
|
55
|
+
prefix: "APTOS";
|
|
56
|
+
signature: string | string[] | Signature;
|
|
57
|
+
bitmap?: Uint8Array;
|
|
58
|
+
}
|
|
59
|
+
export type OnNetworkChange = (callBack: (networkInfo: NetworkInfo | StandardNetworkInfo) => Promise<void>) => Promise<void>;
|
|
60
|
+
export type OnAccountChange = (callBack: (accountInfo: AccountInfo | StandardAccountInfo) => Promise<any>) => Promise<void>;
|
|
61
|
+
export interface AdapterPluginEvents {
|
|
62
|
+
onNetworkChange: OnNetworkChange;
|
|
63
|
+
onAccountChange: OnAccountChange;
|
|
64
|
+
}
|
|
65
|
+
export interface AdapterPluginProps<Name extends string = string> {
|
|
66
|
+
name: WalletName<Name>;
|
|
67
|
+
url: string;
|
|
68
|
+
icon: `data:image/${"svg+xml" | "webp" | "png" | "gif"};base64,${string}`;
|
|
69
|
+
providerName?: string;
|
|
70
|
+
provider: any;
|
|
71
|
+
deeplinkProvider?: (data: {
|
|
72
|
+
url: string;
|
|
73
|
+
}) => string;
|
|
74
|
+
openInMobileApp?: () => void;
|
|
75
|
+
connect(): Promise<any>;
|
|
76
|
+
disconnect: () => Promise<any>;
|
|
77
|
+
network: () => Promise<any>;
|
|
78
|
+
signAndSubmitTransaction?(transaction: Types.TransactionPayload | InputTransactionData | AnyRawTransaction | AptosSignAndSubmitTransactionInput, options?: InputGenerateTransactionOptions): Promise<{
|
|
79
|
+
hash: Types.HexEncodedBytes;
|
|
80
|
+
output?: any;
|
|
81
|
+
} | PendingTransactionResponse | UserResponse<AptosSignAndSubmitTransactionOutput>>;
|
|
82
|
+
submitTransaction?(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
|
|
83
|
+
signMessage<T extends SignMessagePayload>(message: T): Promise<SignMessageResponse | UserResponse<AptosSignMessageOutput>>;
|
|
84
|
+
signTransaction?(// `any` type for backwards compatibility, especially for identity connect
|
|
85
|
+
transactionOrPayload: any, optionsOrAsFeePayer?: any): Promise<any>;
|
|
86
|
+
account?: () => Promise<AccountInfo | StandardAccountInfo>;
|
|
87
|
+
changeNetwork?: AptosChangeNetworkMethod;
|
|
88
|
+
}
|
|
89
|
+
export type AdapterPlugin<Name extends string = string> = AdapterPluginProps<Name> & AdapterPluginEvents;
|
|
90
|
+
export type Wallet<Name extends string = string> = AdapterPlugin<Name> & {
|
|
91
|
+
readyState?: WalletReadyState;
|
|
92
|
+
isAIP62Standard?: boolean;
|
|
93
|
+
isSignTransactionV1_1?: boolean;
|
|
94
|
+
};
|
|
95
|
+
export interface TransactionOptions {
|
|
96
|
+
max_gas_amount?: bigint;
|
|
97
|
+
gas_unit_price?: bigint;
|
|
98
|
+
}
|
|
99
|
+
export type InputTransactionData = {
|
|
100
|
+
sender?: AccountAddressInput;
|
|
101
|
+
data: InputGenerateTransactionPayloadData;
|
|
102
|
+
options?: InputGenerateTransactionOptions;
|
|
103
|
+
};
|
|
104
|
+
export interface PluginProvider {
|
|
105
|
+
connect: () => Promise<AccountInfo>;
|
|
106
|
+
account: () => Promise<AccountInfo>;
|
|
107
|
+
disconnect: () => Promise<void>;
|
|
108
|
+
signAndSubmitTransaction: (transaction: any, options?: any) => Promise<{
|
|
109
|
+
hash: Types.HexEncodedBytes;
|
|
110
|
+
} | AptosWalletErrorResult>;
|
|
111
|
+
signMessage: (message: SignMessagePayload) => Promise<SignMessageResponse>;
|
|
112
|
+
network: () => Promise<NetworkInfo>;
|
|
113
|
+
onAccountChange: (listener: (newAddress: AccountInfo) => Promise<void>) => Promise<void>;
|
|
114
|
+
onNetworkChange: OnNetworkChange;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Legacy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AAC,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,194 @@
|
|
|
1
|
+
import EventEmitter from "eventemitter3";
|
|
2
|
+
import { DappConfig } from "./WalletCore";
|
|
3
|
+
import { AptosStandardWallet, AvailableWallets } from "./AIP62StandardWallets";
|
|
4
|
+
import { WalletReadyState } from "./constants";
|
|
5
|
+
import { AccountAuthenticator, AnyRawTransaction, InputGenerateTransactionOptions, InputSubmitTransactionData, Network, PendingTransactionResponse } from "@aptos-labs/ts-sdk";
|
|
6
|
+
import { AptosWallet, AptosSignAndSubmitTransactionOutput, AptosSignTransactionOutputV1_1, NetworkInfo, AccountInfo, AptosSignMessageInput, AptosSignMessageOutput, AptosChangeNetworkOutput } from "@aptos-labs/wallet-standard";
|
|
7
|
+
export type { NetworkInfo, AccountInfo } from "@aptos-labs/wallet-standard";
|
|
8
|
+
import { InputTransactionData } from "./LegacyWalletPlugins/types";
|
|
9
|
+
export type AdapterWallet = AptosWallet & {
|
|
10
|
+
readyState?: WalletReadyState;
|
|
11
|
+
};
|
|
12
|
+
export declare class WalletCoreNew extends EventEmitter<any> {
|
|
13
|
+
private _wallets;
|
|
14
|
+
private _wallet;
|
|
15
|
+
private readonly _sdkWallets;
|
|
16
|
+
private _standard_wallets;
|
|
17
|
+
private _network;
|
|
18
|
+
private _connected;
|
|
19
|
+
private _connecting;
|
|
20
|
+
private _account;
|
|
21
|
+
private _dappConfig;
|
|
22
|
+
private _optInWallets;
|
|
23
|
+
private _disableTelemetry;
|
|
24
|
+
private readonly ga4;
|
|
25
|
+
private readonly walletStandardCore;
|
|
26
|
+
constructor(optInWallets?: ReadonlyArray<AvailableWallets>, dappConfig?: DappConfig, disableTelemetry?: boolean);
|
|
27
|
+
private fetchExtensionAIP62AptosWallets;
|
|
28
|
+
/**
|
|
29
|
+
* Set AIP-62 extension wallets
|
|
30
|
+
*
|
|
31
|
+
* @param extensionwWallets
|
|
32
|
+
*/
|
|
33
|
+
private setExtensionAIP62Wallets;
|
|
34
|
+
/**
|
|
35
|
+
* Set AIP-62 SDK wallets
|
|
36
|
+
*/
|
|
37
|
+
private fetchSDKAIP62AptosWallets;
|
|
38
|
+
/**
|
|
39
|
+
* A function that excludes an AIP-62 compatible wallet the dapp doesnt want to include
|
|
40
|
+
*
|
|
41
|
+
* @param walletName
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
excludeWallet(wallet: AptosStandardWallet): boolean;
|
|
45
|
+
private recordEvent;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to ensure wallet exists
|
|
48
|
+
*
|
|
49
|
+
* @param wallet A wallet
|
|
50
|
+
*/
|
|
51
|
+
private ensureWalletExists;
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to ensure account exists
|
|
54
|
+
*
|
|
55
|
+
* @param account An account
|
|
56
|
+
*/
|
|
57
|
+
private ensureAccountExists;
|
|
58
|
+
/**
|
|
59
|
+
* Function to cleat wallet adapter data.
|
|
60
|
+
*
|
|
61
|
+
* - Removes current connected wallet state
|
|
62
|
+
* - Removes current connected account state
|
|
63
|
+
* - Removes current connected network state
|
|
64
|
+
* - Removes autoconnect local storage value
|
|
65
|
+
*/
|
|
66
|
+
private clearData;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the connected wallet
|
|
69
|
+
*
|
|
70
|
+
* @param wallet A wallet
|
|
71
|
+
*/
|
|
72
|
+
setWallet(wallet: AptosWallet | null): void;
|
|
73
|
+
/**
|
|
74
|
+
* Sets the connected account
|
|
75
|
+
*
|
|
76
|
+
* @param account An account
|
|
77
|
+
*/
|
|
78
|
+
setAccount(account: AccountInfo | null): void;
|
|
79
|
+
/**
|
|
80
|
+
* Sets the connected network
|
|
81
|
+
*
|
|
82
|
+
* @param network A network
|
|
83
|
+
*/
|
|
84
|
+
setNetwork(network: NetworkInfo | null): void;
|
|
85
|
+
/**
|
|
86
|
+
* Helper function to detect whether a wallet is connected
|
|
87
|
+
*
|
|
88
|
+
* @returns boolean
|
|
89
|
+
*/
|
|
90
|
+
isConnected(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Getter to fetch all detected wallets
|
|
93
|
+
*/
|
|
94
|
+
get wallets(): ReadonlyArray<AptosWallet>;
|
|
95
|
+
/**
|
|
96
|
+
* Getter for the current connected wallet
|
|
97
|
+
*
|
|
98
|
+
* @return wallet info
|
|
99
|
+
* @throws WalletNotSelectedError
|
|
100
|
+
*/
|
|
101
|
+
get wallet(): AptosWallet | null;
|
|
102
|
+
/**
|
|
103
|
+
* Getter for the current connected account
|
|
104
|
+
*
|
|
105
|
+
* @return account info
|
|
106
|
+
* @throws WalletAccountError
|
|
107
|
+
*/
|
|
108
|
+
get account(): AccountInfo | null;
|
|
109
|
+
/**
|
|
110
|
+
* Getter for the current wallet network
|
|
111
|
+
*
|
|
112
|
+
* @return network info
|
|
113
|
+
* @throws WalletGetNetworkError
|
|
114
|
+
*/
|
|
115
|
+
get network(): NetworkInfo | null;
|
|
116
|
+
/**
|
|
117
|
+
* Helper function to run some checks before we connect with a wallet.
|
|
118
|
+
*
|
|
119
|
+
* @param walletName. The wallet name we want to connect with.
|
|
120
|
+
*/
|
|
121
|
+
connect(walletName: string): Promise<void | string>;
|
|
122
|
+
/**
|
|
123
|
+
* Connects a wallet to the dapp.
|
|
124
|
+
* On connect success, we set the current account and the network, and keeping the selected wallet
|
|
125
|
+
* name in LocalStorage to support autoConnect function.
|
|
126
|
+
*
|
|
127
|
+
* @param selectedWallet. The wallet we want to connect.
|
|
128
|
+
* @emit emits "connect" event
|
|
129
|
+
* @throws WalletConnectionError
|
|
130
|
+
*/
|
|
131
|
+
connectWallet(selectedWallet: AdapterWallet): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Signs and submits a transaction to chain
|
|
134
|
+
*
|
|
135
|
+
* @param transactionInput InputTransactionData
|
|
136
|
+
* @returns PendingTransactionResponse
|
|
137
|
+
*/
|
|
138
|
+
signAndSubmitTransaction(transactionInput: InputTransactionData): Promise<AptosSignAndSubmitTransactionOutput>;
|
|
139
|
+
/**
|
|
140
|
+
* Signs a transaction
|
|
141
|
+
*
|
|
142
|
+
* To support both existing wallet adapter V1 and V2, we support 2 input types
|
|
143
|
+
*
|
|
144
|
+
* @param transactionOrPayload AnyRawTransaction - V2 input | Types.TransactionPayload - V1 input
|
|
145
|
+
* @param options optional. V1 input
|
|
146
|
+
*
|
|
147
|
+
* @returns AccountAuthenticator
|
|
148
|
+
*/
|
|
149
|
+
signTransaction(transactionOrPayload: AnyRawTransaction | InputTransactionData, asFeePayer?: boolean, options?: InputGenerateTransactionOptions & {
|
|
150
|
+
expirationSecondsFromNow?: number;
|
|
151
|
+
expirationTimestamp?: number;
|
|
152
|
+
}): Promise<AccountAuthenticator | AptosSignTransactionOutputV1_1>;
|
|
153
|
+
/**
|
|
154
|
+
* Sign message (doesnt submit to chain).
|
|
155
|
+
*
|
|
156
|
+
* @param message
|
|
157
|
+
* @return response from the wallet's signMessage function
|
|
158
|
+
* @throws WalletSignMessageError
|
|
159
|
+
*/
|
|
160
|
+
signMessage(message: AptosSignMessageInput): Promise<AptosSignMessageOutput>;
|
|
161
|
+
/**
|
|
162
|
+
* Submits transaction to chain
|
|
163
|
+
*
|
|
164
|
+
* @param transaction
|
|
165
|
+
* @returns PendingTransactionResponse
|
|
166
|
+
*/
|
|
167
|
+
submitTransaction(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
|
|
168
|
+
/**
|
|
169
|
+
Event for when account has changed on the wallet
|
|
170
|
+
@return the new account info
|
|
171
|
+
@throws WalletAccountChangeError
|
|
172
|
+
*/
|
|
173
|
+
onAccountChange(): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
Event for when network has changed on the wallet
|
|
176
|
+
@return the new network info
|
|
177
|
+
@throws WalletNetworkChangeError
|
|
178
|
+
*/
|
|
179
|
+
onNetworkChange(): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Sends a change network request to the wallet to change the connected network
|
|
182
|
+
*
|
|
183
|
+
* @param network
|
|
184
|
+
* @returns AptosChangeNetworkOutput
|
|
185
|
+
*/
|
|
186
|
+
changeNetwork(network: Network): Promise<AptosChangeNetworkOutput>;
|
|
187
|
+
/**
|
|
188
|
+
* Signs a message and verifies the signer
|
|
189
|
+
* @param message SignMessagePayload
|
|
190
|
+
* @returns boolean
|
|
191
|
+
*/
|
|
192
|
+
signMessageAndVerify(message: AptosSignMessageInput): Promise<boolean>;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=WalletCoreNew.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletCoreNew.d.ts","sourceRoot":"","sources":["../src/WalletCoreNew.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C,OAAO,EAEL,oBAAoB,EAGpB,iBAAiB,EAKjB,+BAA+B,EAC/B,0BAA0B,EAG1B,OAA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