@dynamic-labs/aptos 4.43.0 → 4.44.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 +21 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -6
- package/src/connectors/AptosWalletConnector/AptosWalletConnector.cjs +46 -5
- package/src/connectors/AptosWalletConnector/AptosWalletConnector.d.ts +13 -2
- package/src/connectors/AptosWalletConnector/AptosWalletConnector.js +46 -5
- package/src/index.cjs +4 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/injected/InjectedWalletBase.cjs +3 -3
- package/src/injected/InjectedWalletBase.js +3 -3
- package/src/injected/fetchInjectedWalletConnectors.cjs +52 -34
- package/src/injected/fetchInjectedWalletConnectors.d.ts +8 -5
- package/src/injected/fetchInjectedWalletConnectors.js +52 -34
- package/src/types.d.ts +3 -0
- package/src/utils/AptosUiTransaction/AptosUiTransaction.cjs +189 -0
- package/src/utils/AptosUiTransaction/AptosUiTransaction.d.ts +110 -0
- package/src/utils/AptosUiTransaction/AptosUiTransaction.js +185 -0
- package/src/utils/AptosUiTransaction/index.d.ts +1 -0
- package/src/utils/constants/constants.cjs +8 -0
- package/src/utils/constants/constants.d.ts +1 -0
- package/src/utils/constants/constants.js +4 -0
- package/src/utils/constants/index.d.ts +1 -0
- package/src/wallet/AptosWallet.cjs +5 -8
- package/src/wallet/AptosWallet.d.ts +2 -2
- package/src/wallet/AptosWallet.js +5 -8
- package/src/wallet/isAptosWallet/index.d.ts +1 -0
- package/src/wallet/isAptosWallet/isAptosWallet.cjs +8 -0
- package/src/wallet/isAptosWallet/isAptosWallet.d.ts +3 -0
- package/src/wallet/isAptosWallet/isAptosWallet.js +4 -0
- package/src/walletStandard/createAptosSignerFromWalletStandard.cjs +1 -1
- package/src/walletStandard/createAptosSignerFromWalletStandard.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.44.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.44.0...v4.44.1) (2025-11-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* better handling of null and undefined values in StorageService ([#9842](https://github.com/dynamic-labs/dynamic-auth/issues/9842)) ([f959943](https://github.com/dynamic-labs/dynamic-auth/commit/f95994337ea938e7e88d0126053b03ad69340a6a))
|
|
8
|
+
|
|
9
|
+
## [4.44.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.43.0...v4.44.0) (2025-11-05)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add isAptosWallet method ([#9827](https://github.com/dynamic-labs/dynamic-auth/issues/9827)) ([3810b7b](https://github.com/dynamic-labs/dynamic-auth/commit/3810b7b83039a1521cb67ed13dd256eeb336b432))
|
|
15
|
+
* show all Aptos wallets even if not installed ([#9837](https://github.com/dynamic-labs/dynamic-auth/issues/9837)) ([bc32f55](https://github.com/dynamic-labs/dynamic-auth/commit/bc32f55da243574ee1fa1522b65cf5bd1de4958f))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* backpack wallet for solana wallet connect ([#9833](https://github.com/dynamic-labs/dynamic-auth/issues/9833)) ([013bbdd](https://github.com/dynamic-labs/dynamic-auth/commit/013bbdd771adae02d03439074dd4c006e2a9515d))
|
|
21
|
+
* sendbalance on aptos ([#9829](https://github.com/dynamic-labs/dynamic-auth/issues/9829)) ([8bd57b9](https://github.com/dynamic-labs/dynamic-auth/commit/8bd57b96a376095f51a469fe894496952cf2bc0f))
|
|
22
|
+
|
|
2
23
|
## [4.43.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.42.0...v4.43.0) (2025-11-04)
|
|
3
24
|
|
|
4
25
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/aptos",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.44.1",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@aptos-labs/ts-sdk": "5.1.1",
|
|
22
22
|
"@aptos-labs/wallet-standard": "0.5.2",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
23
|
+
"@dynamic-labs/assert-package-version": "4.44.1",
|
|
24
24
|
"@wallet-standard/core": "1.1.1",
|
|
25
25
|
"@wallet-standard/features": "1.0.3",
|
|
26
|
-
"@dynamic-labs/logger": "4.
|
|
27
|
-
"@dynamic-labs/
|
|
28
|
-
"@dynamic-labs/
|
|
29
|
-
"@dynamic-labs/wallet-
|
|
26
|
+
"@dynamic-labs/logger": "4.44.1",
|
|
27
|
+
"@dynamic-labs/types": "4.44.1",
|
|
28
|
+
"@dynamic-labs/utils": "4.44.1",
|
|
29
|
+
"@dynamic-labs/wallet-book": "4.44.1",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "4.44.1"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {}
|
|
32
33
|
}
|
|
@@ -12,6 +12,7 @@ var assertProvider = require('../../utils/assertProvider/assertProvider.cjs');
|
|
|
12
12
|
var invokeWalletMethod = require('../../utils/invokeWalletMethod/invokeWalletMethod.cjs');
|
|
13
13
|
var parseConnectionResult = require('../../utils/parseConnectionResult/parseConnectionResult.cjs');
|
|
14
14
|
var parseTransactionResponse = require('../../utils/parseTransactionResponse/parseTransactionResponse.cjs');
|
|
15
|
+
var AptosUiTransaction = require('../../utils/AptosUiTransaction/AptosUiTransaction.cjs');
|
|
15
16
|
var AptosWallet = require('../../wallet/AptosWallet.cjs');
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -23,6 +24,7 @@ var AptosWallet = require('../../wallet/AptosWallet.cjs');
|
|
|
23
24
|
*/
|
|
24
25
|
class AptosWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
25
26
|
constructor(name, opts) {
|
|
27
|
+
var _a;
|
|
26
28
|
super({ metadata: opts.metadata, walletBook: opts.walletBook });
|
|
27
29
|
this.name = 'Aptos';
|
|
28
30
|
this.ChainWallet = AptosWallet.AptosWallet;
|
|
@@ -33,6 +35,22 @@ class AptosWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
33
35
|
this.isConnecting = false;
|
|
34
36
|
this.name = name;
|
|
35
37
|
this.logger = new logger.Logger(this.name);
|
|
38
|
+
this.aptosNetworks = (_a = opts.aptosNetworks) !== null && _a !== void 0 ? _a : [];
|
|
39
|
+
}
|
|
40
|
+
getEnabledNetworks() {
|
|
41
|
+
return this.aptosNetworks;
|
|
42
|
+
}
|
|
43
|
+
getNetwork() {
|
|
44
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const provider = this.getProvider();
|
|
46
|
+
assertProvider.assertProvider(provider);
|
|
47
|
+
const network = yield invokeWalletMethod.invokeWalletMethod(provider, 'aptos:network', 'network');
|
|
48
|
+
if (network === null || network === void 0 ? void 0 : network.chainId) {
|
|
49
|
+
return network.chainId.toString();
|
|
50
|
+
}
|
|
51
|
+
// default to mainnet
|
|
52
|
+
return '1';
|
|
53
|
+
});
|
|
36
54
|
}
|
|
37
55
|
/**
|
|
38
56
|
* Connects to the Aptos wallet.
|
|
@@ -121,12 +139,9 @@ class AptosWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
121
139
|
return parseTransactionResponse.parseTransactionResponse(response);
|
|
122
140
|
}
|
|
123
141
|
catch (error) {
|
|
124
|
-
|
|
142
|
+
this.logger.error('[signAndSubmitTransaction] Error:', error);
|
|
143
|
+
throw new utils.DynamicError('Failed to sign and submit transaction');
|
|
125
144
|
}
|
|
126
|
-
// Fallback: sign then submit separately
|
|
127
|
-
const signedTx = yield this.signTransaction(transaction);
|
|
128
|
-
const authenticator = 'args' in signedTx ? signedTx.args : signedTx;
|
|
129
|
-
return this.submitTransaction(authenticator);
|
|
130
145
|
});
|
|
131
146
|
}
|
|
132
147
|
/**
|
|
@@ -203,6 +218,32 @@ class AptosWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
203
218
|
}
|
|
204
219
|
});
|
|
205
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Function used to create transactions in the SDK interface
|
|
223
|
+
*
|
|
224
|
+
* @param from - The sender's address
|
|
225
|
+
* @returns A new AptosUiTransaction instance
|
|
226
|
+
*/
|
|
227
|
+
createUiTransaction(from) {
|
|
228
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
yield this.validateActiveWallet(from);
|
|
230
|
+
const aptosClient = yield this.getAptosClient();
|
|
231
|
+
if (!aptosClient) {
|
|
232
|
+
throw new utils.DynamicError('No Aptos client available');
|
|
233
|
+
}
|
|
234
|
+
return new AptosUiTransaction.AptosUiTransaction({
|
|
235
|
+
client: aptosClient,
|
|
236
|
+
from,
|
|
237
|
+
onSubmit: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
if (!transaction) {
|
|
239
|
+
throw new utils.DynamicError('Transaction must be provided');
|
|
240
|
+
}
|
|
241
|
+
const result = yield this.signAndSubmitTransaction(transaction);
|
|
242
|
+
return result;
|
|
243
|
+
}),
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
}
|
|
206
247
|
}
|
|
207
248
|
|
|
208
249
|
exports.AptosWalletConnector = AptosWalletConnector;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AccountAuthenticator, AnyRawTransaction } from '@aptos-labs/ts-sdk';
|
|
2
|
-
import { Aptos } from '@aptos-labs/ts-sdk';
|
|
2
|
+
import { Aptos, InputGenerateTransactionPayloadData } from '@aptos-labs/ts-sdk';
|
|
3
3
|
import type { AccountInfo, AptosSignMessageInput, AptosSignMessageOutput, NetworkInfo, UserResponse } from '@aptos-labs/wallet-standard';
|
|
4
4
|
import { Logger } from '@dynamic-labs/logger';
|
|
5
5
|
import { type Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import { GenericNetwork, IUITransaction } from '@dynamic-labs/types';
|
|
6
7
|
import type { AptosWalletConnectorProps, IAptosProvider } from '../../types';
|
|
7
8
|
import { AptosWallet } from '../../wallet/AptosWallet';
|
|
8
9
|
/**
|
|
@@ -24,12 +25,15 @@ export declare abstract class AptosWalletConnector extends WalletConnectorBase<t
|
|
|
24
25
|
logger: Logger;
|
|
25
26
|
/** Connection state */
|
|
26
27
|
protected isConnecting: boolean;
|
|
28
|
+
aptosNetworks: GenericNetwork[];
|
|
27
29
|
constructor(name: string, opts: AptosWalletConnectorProps);
|
|
28
30
|
/**
|
|
29
31
|
* Abstract method to get the wallet provider.
|
|
30
32
|
* Must be implemented by concrete connector classes.
|
|
31
33
|
*/
|
|
32
34
|
abstract getProvider(): IAptosProvider | undefined;
|
|
35
|
+
getEnabledNetworks(): GenericNetwork[];
|
|
36
|
+
getNetwork(): Promise<string | undefined>;
|
|
33
37
|
/**
|
|
34
38
|
* Connects to the Aptos wallet.
|
|
35
39
|
*/
|
|
@@ -55,7 +59,7 @@ export declare abstract class AptosWalletConnector extends WalletConnectorBase<t
|
|
|
55
59
|
/**
|
|
56
60
|
* Signs and submits a transaction.
|
|
57
61
|
*/
|
|
58
|
-
signAndSubmitTransaction(transaction:
|
|
62
|
+
signAndSubmitTransaction(transaction: InputGenerateTransactionPayloadData): Promise<string>;
|
|
59
63
|
/**
|
|
60
64
|
* Submits a signed transaction.
|
|
61
65
|
*/
|
|
@@ -68,4 +72,11 @@ export declare abstract class AptosWalletConnector extends WalletConnectorBase<t
|
|
|
68
72
|
* Gets the Aptos client instance configured for the current network.
|
|
69
73
|
*/
|
|
70
74
|
getAptosClient(): Promise<Aptos | undefined>;
|
|
75
|
+
/**
|
|
76
|
+
* Function used to create transactions in the SDK interface
|
|
77
|
+
*
|
|
78
|
+
* @param from - The sender's address
|
|
79
|
+
* @returns A new AptosUiTransaction instance
|
|
80
|
+
*/
|
|
81
|
+
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
71
82
|
}
|
|
@@ -8,6 +8,7 @@ import { assertProvider } from '../../utils/assertProvider/assertProvider.js';
|
|
|
8
8
|
import { invokeWalletMethod } from '../../utils/invokeWalletMethod/invokeWalletMethod.js';
|
|
9
9
|
import { parseConnectionResult } from '../../utils/parseConnectionResult/parseConnectionResult.js';
|
|
10
10
|
import { parseTransactionResponse } from '../../utils/parseTransactionResponse/parseTransactionResponse.js';
|
|
11
|
+
import { AptosUiTransaction } from '../../utils/AptosUiTransaction/AptosUiTransaction.js';
|
|
11
12
|
import { AptosWallet } from '../../wallet/AptosWallet.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -19,6 +20,7 @@ import { AptosWallet } from '../../wallet/AptosWallet.js';
|
|
|
19
20
|
*/
|
|
20
21
|
class AptosWalletConnector extends WalletConnectorBase {
|
|
21
22
|
constructor(name, opts) {
|
|
23
|
+
var _a;
|
|
22
24
|
super({ metadata: opts.metadata, walletBook: opts.walletBook });
|
|
23
25
|
this.name = 'Aptos';
|
|
24
26
|
this.ChainWallet = AptosWallet;
|
|
@@ -29,6 +31,22 @@ class AptosWalletConnector extends WalletConnectorBase {
|
|
|
29
31
|
this.isConnecting = false;
|
|
30
32
|
this.name = name;
|
|
31
33
|
this.logger = new Logger(this.name);
|
|
34
|
+
this.aptosNetworks = (_a = opts.aptosNetworks) !== null && _a !== void 0 ? _a : [];
|
|
35
|
+
}
|
|
36
|
+
getEnabledNetworks() {
|
|
37
|
+
return this.aptosNetworks;
|
|
38
|
+
}
|
|
39
|
+
getNetwork() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const provider = this.getProvider();
|
|
42
|
+
assertProvider(provider);
|
|
43
|
+
const network = yield invokeWalletMethod(provider, 'aptos:network', 'network');
|
|
44
|
+
if (network === null || network === void 0 ? void 0 : network.chainId) {
|
|
45
|
+
return network.chainId.toString();
|
|
46
|
+
}
|
|
47
|
+
// default to mainnet
|
|
48
|
+
return '1';
|
|
49
|
+
});
|
|
32
50
|
}
|
|
33
51
|
/**
|
|
34
52
|
* Connects to the Aptos wallet.
|
|
@@ -117,12 +135,9 @@ class AptosWalletConnector extends WalletConnectorBase {
|
|
|
117
135
|
return parseTransactionResponse(response);
|
|
118
136
|
}
|
|
119
137
|
catch (error) {
|
|
120
|
-
|
|
138
|
+
this.logger.error('[signAndSubmitTransaction] Error:', error);
|
|
139
|
+
throw new DynamicError('Failed to sign and submit transaction');
|
|
121
140
|
}
|
|
122
|
-
// Fallback: sign then submit separately
|
|
123
|
-
const signedTx = yield this.signTransaction(transaction);
|
|
124
|
-
const authenticator = 'args' in signedTx ? signedTx.args : signedTx;
|
|
125
|
-
return this.submitTransaction(authenticator);
|
|
126
141
|
});
|
|
127
142
|
}
|
|
128
143
|
/**
|
|
@@ -199,6 +214,32 @@ class AptosWalletConnector extends WalletConnectorBase {
|
|
|
199
214
|
}
|
|
200
215
|
});
|
|
201
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Function used to create transactions in the SDK interface
|
|
219
|
+
*
|
|
220
|
+
* @param from - The sender's address
|
|
221
|
+
* @returns A new AptosUiTransaction instance
|
|
222
|
+
*/
|
|
223
|
+
createUiTransaction(from) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
yield this.validateActiveWallet(from);
|
|
226
|
+
const aptosClient = yield this.getAptosClient();
|
|
227
|
+
if (!aptosClient) {
|
|
228
|
+
throw new DynamicError('No Aptos client available');
|
|
229
|
+
}
|
|
230
|
+
return new AptosUiTransaction({
|
|
231
|
+
client: aptosClient,
|
|
232
|
+
from,
|
|
233
|
+
onSubmit: (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
if (!transaction) {
|
|
235
|
+
throw new DynamicError('Transaction must be provided');
|
|
236
|
+
}
|
|
237
|
+
const result = yield this.signAndSubmitTransaction(transaction);
|
|
238
|
+
return result;
|
|
239
|
+
}),
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
202
243
|
}
|
|
203
244
|
|
|
204
245
|
export { AptosWalletConnector };
|
package/src/index.cjs
CHANGED
|
@@ -14,9 +14,11 @@ var AptosWalletConnector = require('./connectors/AptosWalletConnector/AptosWalle
|
|
|
14
14
|
var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
|
|
15
15
|
var AptosWallet = require('./wallet/AptosWallet.cjs');
|
|
16
16
|
var assertProvider = require('./utils/assertProvider/assertProvider.cjs');
|
|
17
|
+
var AptosUiTransaction = require('./utils/AptosUiTransaction/AptosUiTransaction.cjs');
|
|
17
18
|
var getWalletStandardWallets = require('./utils/getWalletStandardWallets/getWalletStandardWallets.cjs');
|
|
18
19
|
var invokeWalletMethod = require('./utils/invokeWalletMethod/invokeWalletMethod.cjs');
|
|
19
20
|
var isWalletWithRequiredFeatureSet = require('./utils/isWalletWithRequiredFeatureSet/isWalletWithRequiredFeatureSet.cjs');
|
|
21
|
+
var isAptosWallet = require('./wallet/isAptosWallet/isAptosWallet.cjs');
|
|
20
22
|
var parseConnectionResult = require('./utils/parseConnectionResult/parseConnectionResult.cjs');
|
|
21
23
|
var parseTransactionResponse = require('./utils/parseTransactionResponse/parseTransactionResponse.cjs');
|
|
22
24
|
|
|
@@ -31,9 +33,11 @@ const AptosWalletConnectors = (props) => [
|
|
|
31
33
|
exports.AptosWalletConnector = AptosWalletConnector.AptosWalletConnector;
|
|
32
34
|
exports.AptosWallet = AptosWallet.AptosWallet;
|
|
33
35
|
exports.assertProvider = assertProvider.assertProvider;
|
|
36
|
+
exports.AptosUiTransaction = AptosUiTransaction.AptosUiTransaction;
|
|
34
37
|
exports.getWalletStandardWallets = getWalletStandardWallets.getWalletStandardWallets;
|
|
35
38
|
exports.invokeWalletMethod = invokeWalletMethod.invokeWalletMethod;
|
|
36
39
|
exports.isWalletWithRequiredFeatureSet = isWalletWithRequiredFeatureSet.isWalletWithRequiredFeatureSet;
|
|
40
|
+
exports.isAptosWallet = isAptosWallet.isAptosWallet;
|
|
37
41
|
exports.parseConnectionResult = parseConnectionResult.parseConnectionResult;
|
|
38
42
|
exports.parseTransactionResponse = parseTransactionResponse.parseTransactionResponse;
|
|
39
43
|
exports.AptosWalletConnectors = AptosWalletConnectors;
|
package/src/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ export { AptosWallet } from './wallet';
|
|
|
2
2
|
export { AptosWalletConnector } from './connectors/AptosWalletConnector';
|
|
3
3
|
export type { IAptosProvider, AptosConnectionResult, AptosSendBalanceProps, AptosWalletConnectorProps, AptosFeatureName, AptosMethodName, } from './types';
|
|
4
4
|
export { assertProvider } from './utils/assertProvider';
|
|
5
|
+
export { AptosUiTransaction } from './utils/AptosUiTransaction';
|
|
5
6
|
export { getWalletStandardWallets } from './utils/getWalletStandardWallets';
|
|
6
7
|
export { invokeWalletMethod } from './utils/invokeWalletMethod';
|
|
7
8
|
export { isWalletWithRequiredFeatureSet } from './utils/isWalletWithRequiredFeatureSet';
|
|
9
|
+
export { isAptosWallet } from './wallet/isAptosWallet/isAptosWallet';
|
|
8
10
|
export { parseConnectionResult, type ParsedAccountInfo, } from './utils/parseConnectionResult';
|
|
9
11
|
export { parseTransactionResponse } from './utils/parseTransactionResponse';
|
|
10
12
|
export declare const AptosWalletConnectors: (props: any) => import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor[];
|
package/src/index.js
CHANGED
|
@@ -10,9 +10,11 @@ export { AptosWalletConnector } from './connectors/AptosWalletConnector/AptosWal
|
|
|
10
10
|
import { fetchInjectedWalletConnectors } from './injected/fetchInjectedWalletConnectors.js';
|
|
11
11
|
export { AptosWallet } from './wallet/AptosWallet.js';
|
|
12
12
|
export { assertProvider } from './utils/assertProvider/assertProvider.js';
|
|
13
|
+
export { AptosUiTransaction } from './utils/AptosUiTransaction/AptosUiTransaction.js';
|
|
13
14
|
export { getWalletStandardWallets } from './utils/getWalletStandardWallets/getWalletStandardWallets.js';
|
|
14
15
|
export { invokeWalletMethod } from './utils/invokeWalletMethod/invokeWalletMethod.js';
|
|
15
16
|
export { isWalletWithRequiredFeatureSet } from './utils/isWalletWithRequiredFeatureSet/isWalletWithRequiredFeatureSet.js';
|
|
17
|
+
export { isAptosWallet } from './wallet/isAptosWallet/isAptosWallet.js';
|
|
16
18
|
export { parseConnectionResult } from './utils/parseConnectionResult/parseConnectionResult.js';
|
|
17
19
|
export { parseTransactionResponse } from './utils/parseTransactionResponse/parseTransactionResponse.js';
|
|
18
20
|
|
|
@@ -60,14 +60,14 @@ class InjectedWalletBase extends AptosWalletConnector.AptosWalletConnector {
|
|
|
60
60
|
getAddress() {
|
|
61
61
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
62
62
|
var _a;
|
|
63
|
-
|
|
63
|
+
const didOpenInAppBrowser = this.openInAppBrowserIfRequired();
|
|
64
|
+
if (didOpenInAppBrowser) {
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
// If no address, we need to connect first to trigger the wallet popup
|
|
67
68
|
yield this.connect();
|
|
68
69
|
// Now try to get the address again
|
|
69
|
-
|
|
70
|
-
return address;
|
|
70
|
+
return (_a = this.aptosProviderHelper) === null || _a === void 0 ? void 0 : _a.getAddress();
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
signMessage(messageToSign) {
|
|
@@ -56,14 +56,14 @@ class InjectedWalletBase extends AptosWalletConnector {
|
|
|
56
56
|
getAddress() {
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
var _a;
|
|
59
|
-
|
|
59
|
+
const didOpenInAppBrowser = this.openInAppBrowserIfRequired();
|
|
60
|
+
if (didOpenInAppBrowser) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
// If no address, we need to connect first to trigger the wallet popup
|
|
63
64
|
yield this.connect();
|
|
64
65
|
// Now try to get the address again
|
|
65
|
-
|
|
66
|
-
return address;
|
|
66
|
+
return (_a = this.aptosProviderHelper) === null || _a === void 0 ? void 0 : _a.getAddress();
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
signMessage(messageToSign) {
|
|
@@ -77,24 +77,27 @@ const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
|
77
77
|
* Fetches all available injected Aptos wallet connectors.
|
|
78
78
|
*
|
|
79
79
|
* This function discovers and creates wallet connector constructors from two sources:
|
|
80
|
-
* 1. Wallet book entries -
|
|
81
|
-
* 2. Wallet-standard wallets - AIP-62 compliant wallets discovered via wallet-standard
|
|
80
|
+
* 1. Wallet book entries - All Aptos wallets defined in the wallet book (including uninstalled wallet-standard wallets)
|
|
81
|
+
* 2. Wallet-standard wallets - AIP-62 compliant wallets discovered via wallet-standard (installed wallets only)
|
|
82
|
+
*
|
|
83
|
+
* The function creates connectors for:
|
|
84
|
+
* - Installed wallet-standard wallets (discovered via wallet-standard)
|
|
85
|
+
* - Uninstalled wallet-standard wallets (from wallet book, will use wallet-standard when installed)
|
|
86
|
+
* - Traditional wallets without wallet-standard support (from wallet book)
|
|
82
87
|
*
|
|
83
88
|
* The function automatically filters out wallets that:
|
|
84
89
|
* - Have custom connector implementations
|
|
85
|
-
* - Are already
|
|
90
|
+
* - Are already discovered via wallet-standard (to avoid duplicates)
|
|
86
91
|
* - Don't support the required Aptos feature set
|
|
87
92
|
*
|
|
88
93
|
* @param options - Configuration options
|
|
89
94
|
* @param options.walletBook - The wallet book schema containing wallet metadata
|
|
90
|
-
* @param options.authMode - The authentication mode for filtering wallet features
|
|
91
95
|
* @returns Array of wallet connector constructor classes
|
|
92
96
|
*
|
|
93
97
|
* @example
|
|
94
98
|
* ```typescript
|
|
95
99
|
* const connectors = fetchInjectedWalletConnectors({
|
|
96
100
|
* walletBook,
|
|
97
|
-
* authMode: 'connect-and-sign'
|
|
98
101
|
* });
|
|
99
102
|
*
|
|
100
103
|
* // Instantiate connectors
|
|
@@ -105,40 +108,15 @@ const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
|
105
108
|
*/
|
|
106
109
|
const fetchInjectedWalletConnectors = ({ walletBook: walletBook$1, }) => {
|
|
107
110
|
var _a;
|
|
108
|
-
// Get wallet
|
|
109
|
-
const walletBookConnectors = Object.entries((_a = walletBook$1 === null || walletBook$1 === void 0 ? void 0 : walletBook$1.wallets) !== null && _a !== void 0 ? _a : {})
|
|
110
|
-
.filter(([key, wallet]) => {
|
|
111
|
-
var _a, _b, _c;
|
|
112
|
-
const injectedConfig = (_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'aptos');
|
|
113
|
-
const isAptosWallet = Boolean(injectedConfig);
|
|
114
|
-
// Filter out wallets that require a custom connector or wallets that support wallet-standard,
|
|
115
|
-
// since they are already handled automatically with the wallet-standard connector
|
|
116
|
-
const shouldBeFiltered = walletsWithCustomConnectors.includes(key) ||
|
|
117
|
-
((_c = (_b = injectedConfig === null || injectedConfig === void 0 ? void 0 : injectedConfig.walletStandard) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c.length);
|
|
118
|
-
return isAptosWallet && !shouldBeFiltered;
|
|
119
|
-
})
|
|
120
|
-
.map(([key, wallet]) => {
|
|
121
|
-
const { shortName } = wallet;
|
|
122
|
-
const name = shortName || wallet.name;
|
|
123
|
-
return class extends InjectedWalletBase.InjectedWalletBase {
|
|
124
|
-
constructor() {
|
|
125
|
-
super(...arguments);
|
|
126
|
-
this.name = name;
|
|
127
|
-
// This is the key from the wallet book entry so that we don't purely rely on the normalized name
|
|
128
|
-
this.overrideKey = key;
|
|
129
|
-
}
|
|
130
|
-
getProvider() {
|
|
131
|
-
return this.findProvider();
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
// Get wallet-standard wallets
|
|
111
|
+
// Get wallet-standard wallets (only installed wallets are discovered)
|
|
136
112
|
const { aptosWallets } = getWalletStandardWallets.getWalletStandardWallets();
|
|
113
|
+
// Create a map of wallet-standard wallet names for quick lookup
|
|
114
|
+
const walletStandardWalletNames = new Set(aptosWallets.map((wallet) => wallet.name));
|
|
137
115
|
logger.logVerboseTroubleshootingMessage('[APTOS fetchInjectedWalletConnectors] Found wallet-standard wallets:', aptosWallets.map((w) => ({
|
|
138
116
|
features: Object.keys(w.features),
|
|
139
117
|
name: w.name,
|
|
140
118
|
})));
|
|
141
|
-
// Create connectors for wallet-standard wallets
|
|
119
|
+
// Create connectors for installed wallet-standard wallets
|
|
142
120
|
const walletStandardConnectors = aptosWallets
|
|
143
121
|
.filter((wallet) =>
|
|
144
122
|
// Type incompatibility between @wallet-standard versions, casting is safe here
|
|
@@ -160,6 +138,46 @@ const fetchInjectedWalletConnectors = ({ walletBook: walletBook$1, }) => {
|
|
|
160
138
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
161
139
|
wallet, walletBookMetadata);
|
|
162
140
|
});
|
|
141
|
+
// Get wallet book connectors for ALL Aptos wallets
|
|
142
|
+
// This includes:
|
|
143
|
+
// 1. Traditional wallets (no wallet-standard support)
|
|
144
|
+
// 2. Wallet-standard wallets that are NOT yet installed (discovered via wallet book)
|
|
145
|
+
const walletBookConnectors = Object.entries((_a = walletBook$1 === null || walletBook$1 === void 0 ? void 0 : walletBook$1.wallets) !== null && _a !== void 0 ? _a : {})
|
|
146
|
+
.filter(([key, wallet]) => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
const injectedConfig = (_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'aptos');
|
|
149
|
+
const isAptosWallet = Boolean(injectedConfig);
|
|
150
|
+
// Filter out wallets that require a custom connector
|
|
151
|
+
const needsCustomConnector = walletsWithCustomConnectors.includes(key);
|
|
152
|
+
// Filter out wallets that are already discovered via wallet-standard (installed)
|
|
153
|
+
// We want to show uninstalled wallet-standard wallets from wallet book
|
|
154
|
+
const walletStandardName = (_b = injectedConfig === null || injectedConfig === void 0 ? void 0 : injectedConfig.walletStandard) === null || _b === void 0 ? void 0 : _b.name;
|
|
155
|
+
const isAlreadyDiscoveredViaWalletStandard = walletStandardName && walletStandardWalletNames.has(walletStandardName);
|
|
156
|
+
return (isAptosWallet &&
|
|
157
|
+
!needsCustomConnector &&
|
|
158
|
+
!isAlreadyDiscoveredViaWalletStandard);
|
|
159
|
+
})
|
|
160
|
+
.map(([key, wallet]) => {
|
|
161
|
+
const { shortName } = wallet;
|
|
162
|
+
const name = shortName || wallet.name;
|
|
163
|
+
// Get wallet metadata from wallet book
|
|
164
|
+
const walletBookMetadata = walletConnectorCore.getWalletMetadataFromWalletBook({
|
|
165
|
+
walletBook: walletBook$1,
|
|
166
|
+
walletBookWallet: wallet,
|
|
167
|
+
walletKey: key,
|
|
168
|
+
});
|
|
169
|
+
return class extends InjectedWalletBase.InjectedWalletBase {
|
|
170
|
+
constructor(props) {
|
|
171
|
+
super(name, Object.assign(Object.assign({}, props), { aptosNetworks: props.aptosNetworks, metadata: walletBookMetadata, walletBook: props.walletBook }));
|
|
172
|
+
this.name = name;
|
|
173
|
+
// This is the key from the wallet book entry so that we don't purely rely on the normalized name
|
|
174
|
+
this.overrideKey = key;
|
|
175
|
+
}
|
|
176
|
+
getProvider() {
|
|
177
|
+
return this.findProvider();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
});
|
|
163
181
|
logger.logVerboseTroubleshootingMessage('[APTOS fetchInjectedWalletConnectors] Created wallet-standard connectors:', walletStandardConnectors.map((w) => w.name));
|
|
164
182
|
logger.logVerboseTroubleshootingMessage('[APTOS fetchInjectedWalletConnectors] Created wallet-book connectors:', walletBookConnectors.map((w) => w.name));
|
|
165
183
|
return [
|
|
@@ -17,24 +17,27 @@ export declare const injectedWalletOverrides: WalletConnectorConstructor[];
|
|
|
17
17
|
* Fetches all available injected Aptos wallet connectors.
|
|
18
18
|
*
|
|
19
19
|
* This function discovers and creates wallet connector constructors from two sources:
|
|
20
|
-
* 1. Wallet book entries -
|
|
21
|
-
* 2. Wallet-standard wallets - AIP-62 compliant wallets discovered via wallet-standard
|
|
20
|
+
* 1. Wallet book entries - All Aptos wallets defined in the wallet book (including uninstalled wallet-standard wallets)
|
|
21
|
+
* 2. Wallet-standard wallets - AIP-62 compliant wallets discovered via wallet-standard (installed wallets only)
|
|
22
|
+
*
|
|
23
|
+
* The function creates connectors for:
|
|
24
|
+
* - Installed wallet-standard wallets (discovered via wallet-standard)
|
|
25
|
+
* - Uninstalled wallet-standard wallets (from wallet book, will use wallet-standard when installed)
|
|
26
|
+
* - Traditional wallets without wallet-standard support (from wallet book)
|
|
22
27
|
*
|
|
23
28
|
* The function automatically filters out wallets that:
|
|
24
29
|
* - Have custom connector implementations
|
|
25
|
-
* - Are already
|
|
30
|
+
* - Are already discovered via wallet-standard (to avoid duplicates)
|
|
26
31
|
* - Don't support the required Aptos feature set
|
|
27
32
|
*
|
|
28
33
|
* @param options - Configuration options
|
|
29
34
|
* @param options.walletBook - The wallet book schema containing wallet metadata
|
|
30
|
-
* @param options.authMode - The authentication mode for filtering wallet features
|
|
31
35
|
* @returns Array of wallet connector constructor classes
|
|
32
36
|
*
|
|
33
37
|
* @example
|
|
34
38
|
* ```typescript
|
|
35
39
|
* const connectors = fetchInjectedWalletConnectors({
|
|
36
40
|
* walletBook,
|
|
37
|
-
* authMode: 'connect-and-sign'
|
|
38
41
|
* });
|
|
39
42
|
*
|
|
40
43
|
* // Instantiate connectors
|