@dynamic-labs/aptos 4.40.2 → 4.41.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 CHANGED
@@ -1,4 +1,24 @@
1
1
 
2
+ ### [4.41.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.41.0...v4.41.1) (2025-10-30)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * aptos login with petra keyless accounts ([#9795](https://github.com/dynamic-labs/dynamic-auth/issues/9795)) ([99dc34b](https://github.com/dynamic-labs/dynamic-auth/commit/99dc34b95d1ec23d168c9e092e2d735b1d50a71d))
8
+ * backpack aptos login due to invalid public key ([#9806](https://github.com/dynamic-labs/dynamic-auth/issues/9806)) ([ec8b761](https://github.com/dynamic-labs/dynamic-auth/commit/ec8b76181acff7906fd92c77c2fca42ce52010ae))
9
+
10
+ ## [4.41.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.40.2...v4.41.0) (2025-10-29)
11
+
12
+
13
+ ### Features
14
+
15
+ * **react-native:** add MFA recovery methods ([#9788](https://github.com/dynamic-labs/dynamic-auth/issues/9788)) ([664e0d5](https://github.com/dynamic-labs/dynamic-auth/commit/664e0d5878530abc9e645c8801a87f3109cfd8f9))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * crypto.com link opening on mobile ([#9779](https://github.com/dynamic-labs/dynamic-auth/issues/9779)) ([3439ac9](https://github.com/dynamic-labs/dynamic-auth/commit/3439ac9e2610360c6204f6195433ae3e05e26c30))
21
+
2
22
  ### [4.40.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.40.1...v4.40.2) (2025-10-28)
3
23
 
4
24
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.40.2";
6
+ var version = "4.41.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.40.2";
2
+ var version = "4.41.1";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/aptos",
3
- "version": "4.40.2",
3
+ "version": "4.41.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,13 @@
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.40.2",
23
+ "@dynamic-labs/assert-package-version": "4.41.1",
24
24
  "@wallet-standard/core": "1.1.1",
25
25
  "@wallet-standard/features": "1.0.3",
26
- "@dynamic-labs/logger": "4.40.2",
27
- "@dynamic-labs/utils": "4.40.2",
28
- "@dynamic-labs/wallet-book": "4.40.2",
29
- "@dynamic-labs/wallet-connector-core": "4.40.2"
26
+ "@dynamic-labs/logger": "4.41.1",
27
+ "@dynamic-labs/utils": "4.41.1",
28
+ "@dynamic-labs/wallet-book": "4.41.1",
29
+ "@dynamic-labs/wallet-connector-core": "4.41.1"
30
30
  },
31
31
  "peerDependencies": {}
32
32
  }
@@ -189,17 +189,31 @@ class AptosProviderHelper {
189
189
  */
190
190
  handleUserResponseSignature(result) {
191
191
  return _tslib.__awaiter(this, void 0, void 0, function* () {
192
- var _a;
192
+ var _a, _b, _c, _d, _e;
193
193
  const resultWithArgs = result;
194
194
  const signature = (_a = resultWithArgs.args.signature) === null || _a === void 0 ? void 0 : _a.toString();
195
+ // Extract ephemeral values if they exist
196
+ const signatureObj = resultWithArgs.args.signature;
197
+ // for keyless wallets, we need to extract the ephemeral signature and public key from the signature object
198
+ // this is because the public key is not provided in the result
199
+ const ephemeralSignature = (_c = (_b = signatureObj === null || signatureObj === void 0 ? void 0 : signatureObj.signature) === null || _b === void 0 ? void 0 : _b.ephemeralSignature) === null || _c === void 0 ? void 0 : _c.toString();
200
+ const ephemeralPublicKey = (_e = (_d = signatureObj === null || signatureObj === void 0 ? void 0 : signatureObj.signature) === null || _d === void 0 ? void 0 : _d.ephemeralPublicKey) === null || _e === void 0 ? void 0 : _e.toString();
195
201
  const { fullMessage, publicKey: walletPublicKey } = resultWithArgs.args;
196
202
  // Get public key from account if not provided in result
197
203
  const publicKey = walletPublicKey || (yield this.getPublicKeyFromAccount());
198
- return JSON.stringify({
204
+ // Build return object with ephemeral values if they exist
205
+ const returnObj = {
199
206
  fullMessage,
200
207
  publicKey,
201
208
  signature,
202
- });
209
+ };
210
+ if (ephemeralSignature) {
211
+ returnObj.signature = ephemeralSignature;
212
+ }
213
+ if (ephemeralPublicKey) {
214
+ returnObj.publicKey = ephemeralPublicKey;
215
+ }
216
+ return JSON.stringify(returnObj);
203
217
  });
204
218
  }
205
219
  /**
@@ -185,17 +185,31 @@ class AptosProviderHelper {
185
185
  */
186
186
  handleUserResponseSignature(result) {
187
187
  return __awaiter(this, void 0, void 0, function* () {
188
- var _a;
188
+ var _a, _b, _c, _d, _e;
189
189
  const resultWithArgs = result;
190
190
  const signature = (_a = resultWithArgs.args.signature) === null || _a === void 0 ? void 0 : _a.toString();
191
+ // Extract ephemeral values if they exist
192
+ const signatureObj = resultWithArgs.args.signature;
193
+ // for keyless wallets, we need to extract the ephemeral signature and public key from the signature object
194
+ // this is because the public key is not provided in the result
195
+ const ephemeralSignature = (_c = (_b = signatureObj === null || signatureObj === void 0 ? void 0 : signatureObj.signature) === null || _b === void 0 ? void 0 : _b.ephemeralSignature) === null || _c === void 0 ? void 0 : _c.toString();
196
+ const ephemeralPublicKey = (_e = (_d = signatureObj === null || signatureObj === void 0 ? void 0 : signatureObj.signature) === null || _d === void 0 ? void 0 : _d.ephemeralPublicKey) === null || _e === void 0 ? void 0 : _e.toString();
191
197
  const { fullMessage, publicKey: walletPublicKey } = resultWithArgs.args;
192
198
  // Get public key from account if not provided in result
193
199
  const publicKey = walletPublicKey || (yield this.getPublicKeyFromAccount());
194
- return JSON.stringify({
200
+ // Build return object with ephemeral values if they exist
201
+ const returnObj = {
195
202
  fullMessage,
196
203
  publicKey,
197
204
  signature,
198
- });
205
+ };
206
+ if (ephemeralSignature) {
207
+ returnObj.signature = ephemeralSignature;
208
+ }
209
+ if (ephemeralPublicKey) {
210
+ returnObj.publicKey = ephemeralPublicKey;
211
+ }
212
+ return JSON.stringify(returnObj);
199
213
  });
200
214
  }
201
215
  /**
@@ -14,6 +14,25 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
14
14
  * methods for transactions, signing, and network operations.
15
15
  */
16
16
  class AptosWallet extends walletConnectorCore.Wallet {
17
+ /**
18
+ * Get balance of the wallet.
19
+ * @returns Balance of the wallet
20
+ */
21
+ getBalance() {
22
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
23
+ yield this._connector.connect();
24
+ const aptosClient = yield this.getAptosClient();
25
+ if (!aptosClient) {
26
+ throw new Error('Aptos client not available');
27
+ }
28
+ const balance = yield aptosClient.getBalance({
29
+ accountAddress: this.address,
30
+ // APT coin type
31
+ asset: '0x1::aptos_coin::AptosCoin',
32
+ });
33
+ return (balance / Math.pow(10, 8)).toString();
34
+ });
35
+ }
17
36
  /**
18
37
  * Sends balance to another address.
19
38
  * @param amount - Amount to send (in APT for native transfers)
@@ -11,6 +11,11 @@ import type { AptosWalletConnector } from '../connectors/AptosWalletConnector/Ap
11
11
  * methods for transactions, signing, and network operations.
12
12
  */
13
13
  export declare class AptosWallet extends Wallet<AptosWalletConnector> {
14
+ /**
15
+ * Get balance of the wallet.
16
+ * @returns Balance of the wallet
17
+ */
18
+ getBalance(): Promise<string>;
14
19
  /**
15
20
  * Sends balance to another address.
16
21
  * @param amount - Amount to send (in APT for native transfers)
@@ -10,6 +10,25 @@ import { Wallet } from '@dynamic-labs/wallet-connector-core';
10
10
  * methods for transactions, signing, and network operations.
11
11
  */
12
12
  class AptosWallet extends Wallet {
13
+ /**
14
+ * Get balance of the wallet.
15
+ * @returns Balance of the wallet
16
+ */
17
+ getBalance() {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ yield this._connector.connect();
20
+ const aptosClient = yield this.getAptosClient();
21
+ if (!aptosClient) {
22
+ throw new Error('Aptos client not available');
23
+ }
24
+ const balance = yield aptosClient.getBalance({
25
+ accountAddress: this.address,
26
+ // APT coin type
27
+ asset: '0x1::aptos_coin::AptosCoin',
28
+ });
29
+ return (balance / Math.pow(10, 8)).toString();
30
+ });
31
+ }
13
32
  /**
14
33
  * Sends balance to another address.
15
34
  * @param amount - Amount to send (in APT for native transfers)
@@ -8,7 +8,7 @@ var walletStandard = require('@aptos-labs/wallet-standard');
8
8
  var logger$1 = require('@dynamic-labs/logger');
9
9
 
10
10
  const logger = new logger$1.Logger('AptosWalletStandardConnector');
11
- const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
11
+ const createAptosSignerFromWalletStandard = ({ wallet, }) => {
12
12
  const features = wallet.features;
13
13
  const hasAutoConnectedAccounts = () => {
14
14
  var _a, _b, _c;
@@ -18,11 +18,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
18
18
  };
19
19
  const getCurrentAccount = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
20
20
  var _a, _b;
21
- const accountMethod = (_a = features['aptos:account']) === null || _a === void 0 ? void 0 : _a.account;
22
- if (accountMethod) {
23
- return accountMethod();
24
- }
25
- if (((_b = wallet.accounts) === null || _b === void 0 ? void 0 : _b.length) > 0) {
21
+ if (((_a = wallet.accounts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
26
22
  const [account] = wallet.accounts;
27
23
  // Validate that the account has valid address and publicKey
28
24
  if (account.address && account.publicKey) {
@@ -31,11 +27,17 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
31
27
  return new walletStandard.AccountInfo({
32
28
  address: account.address,
33
29
  // using this typing since account.publicKey is a ReadonlyUint8Array
34
- publicKey: account.publicKey,
30
+ publicKey: account.publicKey instanceof Uint8Array
31
+ ? Buffer.from(account.publicKey).toString('hex')
32
+ : account.publicKey,
35
33
  });
36
34
  }
37
35
  }
38
36
  }
37
+ const accountMethod = (_b = features['aptos:account']) === null || _b === void 0 ? void 0 : _b.account;
38
+ if (accountMethod) {
39
+ return accountMethod();
40
+ }
39
41
  throw new Error('Account not found');
40
42
  });
41
43
  const connect = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -63,9 +65,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
63
65
  }
64
66
  return {
65
67
  args: new walletStandard.AccountInfo({
66
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
68
  address: resultArgs.address,
68
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
69
  publicKey: resultArgs.publicKey,
70
70
  }),
71
71
  status: walletStandard.UserResponseStatus.APPROVED,
@@ -91,9 +91,10 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
91
91
  });
92
92
  });
93
93
  const network = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
94
+ var _e;
94
95
  try {
95
96
  // Try to get network info from the wallet connector
96
- const networkInfo = yield walletConnector.getNetworkInfo();
97
+ const networkInfo = yield ((_e = features['aptos:network']) === null || _e === void 0 ? void 0 : _e.network());
97
98
  if (networkInfo) {
98
99
  return networkInfo;
99
100
  }
@@ -151,9 +152,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
151
152
  const account = (_a = prop.accounts) === null || _a === void 0 ? void 0 : _a[0];
152
153
  if (account) {
153
154
  callback(new walletStandard.AccountInfo({
154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
155
  address: account.address,
156
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
156
  publicKey: account.publicKey,
158
157
  }));
159
158
  }
@@ -1,9 +1,7 @@
1
1
  import type { Wallet } from '@aptos-labs/wallet-standard';
2
2
  import type { IAptosProvider } from '../types';
3
- import { AptosWalletConnector } from '../connectors/AptosWalletConnector';
4
3
  type CreateAptosSignerFromWalletStandardProps = {
5
4
  wallet: Wallet;
6
- walletConnector: AptosWalletConnector;
7
5
  };
8
- export declare const createAptosSignerFromWalletStandard: ({ wallet, walletConnector, }: CreateAptosSignerFromWalletStandardProps) => IAptosProvider;
6
+ export declare const createAptosSignerFromWalletStandard: ({ wallet, }: CreateAptosSignerFromWalletStandardProps) => IAptosProvider;
9
7
  export {};
@@ -4,7 +4,7 @@ import { AccountInfo, UserResponseStatus } from '@aptos-labs/wallet-standard';
4
4
  import { Logger } from '@dynamic-labs/logger';
5
5
 
6
6
  const logger = new Logger('AptosWalletStandardConnector');
7
- const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
7
+ const createAptosSignerFromWalletStandard = ({ wallet, }) => {
8
8
  const features = wallet.features;
9
9
  const hasAutoConnectedAccounts = () => {
10
10
  var _a, _b, _c;
@@ -14,11 +14,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
14
14
  };
15
15
  const getCurrentAccount = () => __awaiter(void 0, void 0, void 0, function* () {
16
16
  var _a, _b;
17
- const accountMethod = (_a = features['aptos:account']) === null || _a === void 0 ? void 0 : _a.account;
18
- if (accountMethod) {
19
- return accountMethod();
20
- }
21
- if (((_b = wallet.accounts) === null || _b === void 0 ? void 0 : _b.length) > 0) {
17
+ if (((_a = wallet.accounts) === null || _a === void 0 ? void 0 : _a.length) > 0) {
22
18
  const [account] = wallet.accounts;
23
19
  // Validate that the account has valid address and publicKey
24
20
  if (account.address && account.publicKey) {
@@ -27,11 +23,17 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
27
23
  return new AccountInfo({
28
24
  address: account.address,
29
25
  // using this typing since account.publicKey is a ReadonlyUint8Array
30
- publicKey: account.publicKey,
26
+ publicKey: account.publicKey instanceof Uint8Array
27
+ ? Buffer.from(account.publicKey).toString('hex')
28
+ : account.publicKey,
31
29
  });
32
30
  }
33
31
  }
34
32
  }
33
+ const accountMethod = (_b = features['aptos:account']) === null || _b === void 0 ? void 0 : _b.account;
34
+ if (accountMethod) {
35
+ return accountMethod();
36
+ }
35
37
  throw new Error('Account not found');
36
38
  });
37
39
  const connect = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -59,9 +61,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
59
61
  }
60
62
  return {
61
63
  args: new AccountInfo({
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
64
  address: resultArgs.address,
64
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
65
  publicKey: resultArgs.publicKey,
66
66
  }),
67
67
  status: UserResponseStatus.APPROVED,
@@ -87,9 +87,10 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
87
87
  });
88
88
  });
89
89
  const network = () => __awaiter(void 0, void 0, void 0, function* () {
90
+ var _e;
90
91
  try {
91
92
  // Try to get network info from the wallet connector
92
- const networkInfo = yield walletConnector.getNetworkInfo();
93
+ const networkInfo = yield ((_e = features['aptos:network']) === null || _e === void 0 ? void 0 : _e.network());
93
94
  if (networkInfo) {
94
95
  return networkInfo;
95
96
  }
@@ -147,9 +148,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, walletConnector, }) => {
147
148
  const account = (_a = prop.accounts) === null || _a === void 0 ? void 0 : _a[0];
148
149
  if (account) {
149
150
  callback(new AccountInfo({
150
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
151
151
  address: account.address,
152
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
152
  publicKey: account.publicKey,
154
153
  }));
155
154
  }
@@ -16,7 +16,6 @@ const getConnectorConstructorForWalletStandardWallet = (wallet, walletBookMetada
16
16
  this.overrideKey = `${sanitizedName}aptos`;
17
17
  this._provider = createAptosSignerFromWalletStandard.createAptosSignerFromWalletStandard({
18
18
  wallet,
19
- walletConnector: this,
20
19
  });
21
20
  }
22
21
  findProvider() {
@@ -12,7 +12,6 @@ const getConnectorConstructorForWalletStandardWallet = (wallet, walletBookMetada
12
12
  this.overrideKey = `${sanitizedName}aptos`;
13
13
  this._provider = createAptosSignerFromWalletStandard({
14
14
  wallet,
15
- walletConnector: this,
16
15
  });
17
16
  }
18
17
  findProvider() {