@dynamic-labs/aleo 4.91.0 → 4.91.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,23 @@
1
1
 
2
+ ### [4.91.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.0...v4.91.1) (2026-06-24)
3
+
4
+
5
+ ### Features
6
+
7
+ * **aleo:** update sendBalance with individual and marketplace logic ([#11709](https://github.com/dynamic-labs/dynamic-auth/issues/11709)) ([f8dfc48](https://github.com/dynamic-labs/dynamic-auth/commit/f8dfc488ae607fbbbcc3432a3ef69f746f0b7df0))
8
+ * **sdk-react-core:** surface shielded address in Midnight deposit view ([#11698](https://github.com/dynamic-labs/dynamic-auth/issues/11698)) ([79c5402](https://github.com/dynamic-labs/dynamic-auth/commit/79c54029b1d8f722cf9f1d8b4c11977898442ac0))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * display actual error message for WaaS export failures instead of generic fallback ([#11498](https://github.com/dynamic-labs/dynamic-auth/issues/11498)) ([373c931](https://github.com/dynamic-labs/dynamic-auth/commit/373c931eb96c88e484c557ee8f2934660d028f97))
14
+ * **wallet-book:** guard replaceKey and remove stale override ([#11682](https://github.com/dynamic-labs/dynamic-auth/issues/11682)) ([13947d9](https://github.com/dynamic-labs/dynamic-auth/commit/13947d972ed1f8227712bfc01af9cc2be616a78a))
15
+
16
+
17
+ ### Performance Improvements
18
+
19
+ * **e2e:** prebuild Expo web bundle for RN e2e tests ([#11674](https://github.com/dynamic-labs/dynamic-auth/issues/11674)) ([16e002d](https://github.com/dynamic-labs/dynamic-auth/commit/16e002d59b2035e3f2c116879a78418a959da8bc))
20
+
2
21
  ## [4.91.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.90.0...v4.91.0) (2026-06-23)
3
22
 
4
23
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.91.0";
6
+ var version = "4.91.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.91.0";
2
+ var version = "4.91.1";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/aleo",
3
- "version": "4.91.0",
3
+ "version": "4.91.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",
@@ -18,19 +18,19 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/assert-package-version": "4.91.0",
21
+ "@dynamic-labs/assert-package-version": "4.91.1",
22
22
  "@dynamic-labs-sdk/client": "1.12.1",
23
23
  "@dynamic-labs/sdk-api-core": "0.0.1046",
24
24
  "@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.3",
25
25
  "@provablehq/aleo-wallet-adaptor-shield": "0.3.0-alpha.3",
26
26
  "@provablehq/aleo-wallet-standard": "0.3.0-alpha.3",
27
27
  "@provablehq/aleo-types": "0.3.0-alpha.3",
28
- "@dynamic-labs/logger": "4.91.0",
29
- "@dynamic-labs/types": "4.91.0",
30
- "@dynamic-labs/utils": "4.91.0",
31
- "@dynamic-labs/waas": "4.91.0",
32
- "@dynamic-labs/wallet-book": "4.91.0",
33
- "@dynamic-labs/wallet-connector-core": "4.91.0"
28
+ "@dynamic-labs/logger": "4.91.1",
29
+ "@dynamic-labs/types": "4.91.1",
30
+ "@dynamic-labs/utils": "4.91.1",
31
+ "@dynamic-labs/waas": "4.91.1",
32
+ "@dynamic-labs/wallet-book": "4.91.1",
33
+ "@dynamic-labs/wallet-connector-core": "4.91.1"
34
34
  },
35
35
  "peerDependencies": {}
36
36
  }
@@ -950,6 +950,79 @@ class DynamicWaasAleoConnector extends waas.withDynamicWaas(WaasAleoWalletConnec
950
950
  return result.txId;
951
951
  });
952
952
  }
953
+ /**
954
+ * Send from a private record. Automatically selects the smallest owned
955
+ * record of `tokenAddress` that covers `amount`, then routes by mode:
956
+ * - `individual` → `transfer_private` (record → private record)
957
+ * - `exchange` → `transfer_private_to_public` → `transfer_public`
958
+ *
959
+ * Called by `AleoWallet.sendBalance`. Requires `activeAccountAddress` to
960
+ * be set before calling (guaranteed by `getWaasConnectorOrThrow`).
961
+ */
962
+ sendBalance(args) {
963
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
964
+ var _a, _b;
965
+ const { mode, to, amount, tokenAddress } = args;
966
+ const networkId = Number((_b = (_a = this.getSelectedNetwork()) === null || _a === void 0 ? void 0 : _a.chainId) !== null && _b !== void 0 ? _b : 1);
967
+ const programId = tokenAddress !== null && tokenAddress !== void 0 ? tokenAddress : aleoSendableTokens.ALEO_CREDITS_PROGRAM;
968
+ const tokens = aleoSendableTokens.getAleoSendableTokensForNetwork(networkId);
969
+ const token = tokens.find((t) => t.programId === programId);
970
+ if (!token) {
971
+ throw new utils.DynamicError(`sendBalance: Aleo token '${programId}' is not supported on this network. Use proveTransaction for custom programs.`);
972
+ }
973
+ const value = BigInt(Math.round(parseFloat(amount) * Math.pow(10, token.decimals)));
974
+ const { records: rawRecords } = yield this.listOwnedRecords();
975
+ const fitting = rawRecords
976
+ .filter((r) => aleoSendableTokens.recordMatchesSendableToken(r, token) &&
977
+ typeof r.record_plaintext === 'string')
978
+ .map((r) => ({
979
+ atomic: aleoSendableTokens.extractRecordAtomicAmount(r, token),
980
+ plaintext: r.record_plaintext,
981
+ }))
982
+ .filter((r) => r.atomic >= value)
983
+ .sort((a, b) => {
984
+ if (a.atomic < b.atomic)
985
+ return -1;
986
+ if (a.atomic > b.atomic)
987
+ return 1;
988
+ return 0;
989
+ });
990
+ if (fitting.length === 0) {
991
+ throw new utils.DynamicError('No single private record covers this amount. Merge records first via wallet.joinRecords().');
992
+ }
993
+ const recordPlaintext = fitting[0].plaintext;
994
+ if (mode === 'exchange') {
995
+ if (!this.activeAccountAddress) {
996
+ throw new utils.DynamicError('Active account address is required');
997
+ }
998
+ return this.submitExchangeTransfer({
999
+ from: this.activeAccountAddress,
1000
+ recordPlaintext,
1001
+ to,
1002
+ token,
1003
+ value,
1004
+ });
1005
+ }
1006
+ const { functionName, inputs, inputTypes } = buildTransferInputs({
1007
+ mode: 'individual',
1008
+ recordPlaintext,
1009
+ to,
1010
+ token,
1011
+ value,
1012
+ });
1013
+ const result = yield this.proveTransaction({
1014
+ broadcast: true,
1015
+ functionName,
1016
+ inputTypes,
1017
+ inputs,
1018
+ programId: token.programId,
1019
+ });
1020
+ if (!result.txId) {
1021
+ throw new utils.DynamicError('Aleo transfer_private did not return a transaction id.');
1022
+ }
1023
+ return result.txId;
1024
+ });
1025
+ }
953
1026
  /**
954
1027
  * Two-step Exchange transfer.
955
1028
  *
@@ -5,6 +5,7 @@ import { IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wa
5
5
  import { Logger } from '@dynamic-labs/logger';
6
6
  import { WaasAleoWalletConnector, type WaasAleoWalletConnectorProps } from '../WaasAleoWalletConnector';
7
7
  import { AleoWallet } from '../../wallet/AleoWallet';
8
+ import { AleoTransferMode } from '../../utils/AleoUiTransaction';
8
9
  import { AleoOwnedRecord } from '../../utils/aleoSendableTokens';
9
10
  import type { AleoTransaction } from '../../types';
10
11
  export type DynamicWaasAleoConnectorProps = WaasAleoWalletConnectorProps & {
@@ -455,6 +456,21 @@ export declare class DynamicWaasAleoConnector extends DynamicWaasAleoConnector_b
455
456
  * allowed).
456
457
  */
457
458
  private dispatchShieldBroadcast;
459
+ /**
460
+ * Send from a private record. Automatically selects the smallest owned
461
+ * record of `tokenAddress` that covers `amount`, then routes by mode:
462
+ * - `individual` → `transfer_private` (record → private record)
463
+ * - `exchange` → `transfer_private_to_public` → `transfer_public`
464
+ *
465
+ * Called by `AleoWallet.sendBalance`. Requires `activeAccountAddress` to
466
+ * be set before calling (guaranteed by `getWaasConnectorOrThrow`).
467
+ */
468
+ sendBalance(args: {
469
+ mode: AleoTransferMode;
470
+ to: string;
471
+ amount: string;
472
+ tokenAddress?: string;
473
+ }): Promise<string>;
458
474
  /**
459
475
  * Two-step Exchange transfer.
460
476
  *
@@ -7,7 +7,7 @@ import { Logger } from '@dynamic-labs/logger';
7
7
  import { WaasAleoWalletConnector } from '../WaasAleoWalletConnector/WaasAleoWalletConnector.js';
8
8
  import { AleoWallet } from '../../wallet/AleoWallet/AleoWallet.js';
9
9
  import { AleoUiTransaction } from '../../utils/AleoUiTransaction/AleoUiTransaction.js';
10
- import { ALEO_TOKEN_REGISTRY_PROGRAM } from '../../utils/aleoSendableTokens/aleoSendableTokens.js';
10
+ import { getAleoSendableTokensForNetwork, recordMatchesSendableToken, extractRecordAtomicAmount, ALEO_CREDITS_PROGRAM, ALEO_TOKEN_REGISTRY_PROGRAM } from '../../utils/aleoSendableTokens/aleoSendableTokens.js';
11
11
  import { findAleoShieldableToken } from '../../utils/aleoShieldableTokens/aleoShieldableTokens.js';
12
12
 
13
13
  /**
@@ -946,6 +946,79 @@ class DynamicWaasAleoConnector extends withDynamicWaas(WaasAleoWalletConnector)
946
946
  return result.txId;
947
947
  });
948
948
  }
949
+ /**
950
+ * Send from a private record. Automatically selects the smallest owned
951
+ * record of `tokenAddress` that covers `amount`, then routes by mode:
952
+ * - `individual` → `transfer_private` (record → private record)
953
+ * - `exchange` → `transfer_private_to_public` → `transfer_public`
954
+ *
955
+ * Called by `AleoWallet.sendBalance`. Requires `activeAccountAddress` to
956
+ * be set before calling (guaranteed by `getWaasConnectorOrThrow`).
957
+ */
958
+ sendBalance(args) {
959
+ return __awaiter(this, void 0, void 0, function* () {
960
+ var _a, _b;
961
+ const { mode, to, amount, tokenAddress } = args;
962
+ const networkId = Number((_b = (_a = this.getSelectedNetwork()) === null || _a === void 0 ? void 0 : _a.chainId) !== null && _b !== void 0 ? _b : 1);
963
+ const programId = tokenAddress !== null && tokenAddress !== void 0 ? tokenAddress : ALEO_CREDITS_PROGRAM;
964
+ const tokens = getAleoSendableTokensForNetwork(networkId);
965
+ const token = tokens.find((t) => t.programId === programId);
966
+ if (!token) {
967
+ throw new DynamicError(`sendBalance: Aleo token '${programId}' is not supported on this network. Use proveTransaction for custom programs.`);
968
+ }
969
+ const value = BigInt(Math.round(parseFloat(amount) * Math.pow(10, token.decimals)));
970
+ const { records: rawRecords } = yield this.listOwnedRecords();
971
+ const fitting = rawRecords
972
+ .filter((r) => recordMatchesSendableToken(r, token) &&
973
+ typeof r.record_plaintext === 'string')
974
+ .map((r) => ({
975
+ atomic: extractRecordAtomicAmount(r, token),
976
+ plaintext: r.record_plaintext,
977
+ }))
978
+ .filter((r) => r.atomic >= value)
979
+ .sort((a, b) => {
980
+ if (a.atomic < b.atomic)
981
+ return -1;
982
+ if (a.atomic > b.atomic)
983
+ return 1;
984
+ return 0;
985
+ });
986
+ if (fitting.length === 0) {
987
+ throw new DynamicError('No single private record covers this amount. Merge records first via wallet.joinRecords().');
988
+ }
989
+ const recordPlaintext = fitting[0].plaintext;
990
+ if (mode === 'exchange') {
991
+ if (!this.activeAccountAddress) {
992
+ throw new DynamicError('Active account address is required');
993
+ }
994
+ return this.submitExchangeTransfer({
995
+ from: this.activeAccountAddress,
996
+ recordPlaintext,
997
+ to,
998
+ token,
999
+ value,
1000
+ });
1001
+ }
1002
+ const { functionName, inputs, inputTypes } = buildTransferInputs({
1003
+ mode: 'individual',
1004
+ recordPlaintext,
1005
+ to,
1006
+ token,
1007
+ value,
1008
+ });
1009
+ const result = yield this.proveTransaction({
1010
+ broadcast: true,
1011
+ functionName,
1012
+ inputTypes,
1013
+ inputs,
1014
+ programId: token.programId,
1015
+ });
1016
+ if (!result.txId) {
1017
+ throw new DynamicError('Aleo transfer_private did not return a transaction id.');
1018
+ }
1019
+ return result.txId;
1020
+ });
1021
+ }
949
1022
  /**
950
1023
  * Two-step Exchange transfer.
951
1024
  *
@@ -10,31 +10,13 @@ var getAleoExplorerTxUrl = require('../../utils/getAleoExplorerTxUrl/getAleoExpl
10
10
 
11
11
  class AleoWallet extends walletConnectorCore.Wallet {
12
12
  sendBalance(_a) {
13
- return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, }) {
14
- var _b, _c, _d;
15
- const chainId = (_b = (yield this._connector.getNetwork())) !== null && _b !== void 0 ? _b : '0';
16
- const decimals = (_c = token === null || token === void 0 ? void 0 : token.decimals) !== null && _c !== void 0 ? _c : 6;
17
- const microcredits = BigInt(Math.round(parseFloat(amount) * Math.pow(10, decimals)));
18
- const program = (_d = token === null || token === void 0 ? void 0 : token.address) !== null && _d !== void 0 ? _d : 'credits.aleo';
19
- // credits.aleo's transfer_public takes u64; token programs (e.g. stablecoins)
20
- // take u128. Key off the program, NOT merely whether a token was passed —
21
- // passing token { address: 'credits.aleo' } must still produce u64.
22
- const isCredits = program === 'credits.aleo';
23
- const amountSuffix = isCredits ? 'u64' : 'u128';
24
- const transaction = {
25
- address: this.address,
26
- chainId,
27
- fee: 50000,
28
- feePrivate: false,
29
- transitions: [
30
- {
31
- functionName: 'transfer_public',
32
- inputs: [toAddress, `${microcredits}${amountSuffix}`],
33
- program,
34
- },
35
- ],
36
- };
37
- return this._connector.requestTransaction(transaction);
13
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, mode = 'individual', }) {
14
+ return this.getWaasConnectorOrThrow('sendBalance').sendBalance({
15
+ amount,
16
+ mode,
17
+ to: toAddress,
18
+ tokenAddress: token === null || token === void 0 ? void 0 : token.address,
19
+ });
38
20
  });
39
21
  }
40
22
  getBalance() {
@@ -2,14 +2,16 @@ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
2
  import type { AleoWalletConnector } from '../../connectors/AleoWalletConnector';
3
3
  import type { DynamicWaasAleoConnector } from '../../connectors/DynamicWaasAleoConnector';
4
4
  import type { AleoTransaction } from '../../types';
5
+ import type { AleoTransferMode } from '../../utils/AleoUiTransaction';
5
6
  export declare class AleoWallet extends Wallet<AleoWalletConnector> {
6
- sendBalance({ amount, toAddress, token, }: {
7
+ sendBalance({ amount, toAddress, token, mode, }: {
7
8
  amount: string;
8
9
  toAddress: string;
9
10
  token?: {
10
11
  address: string;
11
12
  decimals?: number;
12
13
  };
14
+ mode?: AleoTransferMode;
13
15
  }): Promise<string | undefined>;
14
16
  getBalance(): Promise<string>;
15
17
  /**
@@ -6,31 +6,13 @@ import { getAleoExplorerTxUrl } from '../../utils/getAleoExplorerTxUrl/getAleoEx
6
6
 
7
7
  class AleoWallet extends Wallet {
8
8
  sendBalance(_a) {
9
- return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, }) {
10
- var _b, _c, _d;
11
- const chainId = (_b = (yield this._connector.getNetwork())) !== null && _b !== void 0 ? _b : '0';
12
- const decimals = (_c = token === null || token === void 0 ? void 0 : token.decimals) !== null && _c !== void 0 ? _c : 6;
13
- const microcredits = BigInt(Math.round(parseFloat(amount) * Math.pow(10, decimals)));
14
- const program = (_d = token === null || token === void 0 ? void 0 : token.address) !== null && _d !== void 0 ? _d : 'credits.aleo';
15
- // credits.aleo's transfer_public takes u64; token programs (e.g. stablecoins)
16
- // take u128. Key off the program, NOT merely whether a token was passed —
17
- // passing token { address: 'credits.aleo' } must still produce u64.
18
- const isCredits = program === 'credits.aleo';
19
- const amountSuffix = isCredits ? 'u64' : 'u128';
20
- const transaction = {
21
- address: this.address,
22
- chainId,
23
- fee: 50000,
24
- feePrivate: false,
25
- transitions: [
26
- {
27
- functionName: 'transfer_public',
28
- inputs: [toAddress, `${microcredits}${amountSuffix}`],
29
- program,
30
- },
31
- ],
32
- };
33
- return this._connector.requestTransaction(transaction);
9
+ return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, mode = 'individual', }) {
10
+ return this.getWaasConnectorOrThrow('sendBalance').sendBalance({
11
+ amount,
12
+ mode,
13
+ to: toAddress,
14
+ tokenAddress: token === null || token === void 0 ? void 0 : token.address,
15
+ });
34
16
  });
35
17
  }
36
18
  getBalance() {