@dynamic-labs/aleo 4.90.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 +36 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/connectors/DynamicWaasAleoConnector/DynamicWaasAleoConnector.cjs +73 -0
- package/src/connectors/DynamicWaasAleoConnector/DynamicWaasAleoConnector.d.ts +30 -0
- package/src/connectors/DynamicWaasAleoConnector/DynamicWaasAleoConnector.js +74 -1
- package/src/wallet/AleoWallet/AleoWallet.cjs +7 -25
- package/src/wallet/AleoWallet/AleoWallet.d.ts +3 -1
- package/src/wallet/AleoWallet/AleoWallet.js +7 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
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
|
+
|
|
21
|
+
## [4.91.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.90.0...v4.91.0) (2026-06-23)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **midnight:** add WaaS layer to @dynamic-labs/midnight ([#11006](https://github.com/dynamic-labs/dynamic-auth/issues/11006)) ([01b9d16](https://github.com/dynamic-labs/dynamic-auth/commit/01b9d16d0ba92a141a9be546ca00cca4029894d5))
|
|
27
|
+
* **sdk-react-core:** widget support for Midnight multi-address display + export hiding ([#11008](https://github.com/dynamic-labs/dynamic-auth/issues/11008)) ([87320b4](https://github.com/dynamic-labs/dynamic-auth/commit/87320b4d6e286b88e17f144641346e16a27e9e71))
|
|
28
|
+
* **waas:** wire session public key through host backup ops for keyshare diagnostics [DYNT-1280] ([#11675](https://github.com/dynamic-labs/dynamic-auth/issues/11675)) ([4f7981c](https://github.com/dynamic-labs/dynamic-auth/commit/4f7981c009930469dec7b3dec93f20f99bbe5498))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **ethereum-aa:** make ZeroDevConnector inert instead of throwing when ZeroDev config is absent ([#11610](https://github.com/dynamic-labs/dynamic-auth/issues/11610)) ([a3aab6a](https://github.com/dynamic-labs/dynamic-auth/commit/a3aab6a97e2e996f96b725f9336704b844f79603))
|
|
34
|
+
* **react-native-extension:** fall back to react-native-webview when embedded native module is unavailable ([#11683](https://github.com/dynamic-labs/dynamic-auth/issues/11683)) ([3f8d92c](https://github.com/dynamic-labs/dynamic-auth/commit/3f8d92ca0c327128b16e3355ab2f4e63d2c8e731))
|
|
35
|
+
* **sdk-react-core:** warn instead of throwing when ZeroDev connector is absent ([#11611](https://github.com/dynamic-labs/dynamic-auth/issues/11611)) ([5836252](https://github.com/dynamic-labs/dynamic-auth/commit/58362524e45205399c0fdc5b92414190d1929e0b))
|
|
36
|
+
* **waas-evm:** sign EOA transactions with the resolved chainId, not the connector default ([#11653](https://github.com/dynamic-labs/dynamic-auth/issues/11653)) ([e634098](https://github.com/dynamic-labs/dynamic-auth/commit/e634098f0f23f4c53f92a580db6f4aacbd6b1f92))
|
|
37
|
+
|
|
2
38
|
## [4.90.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.89.0...v4.90.0) (2026-06-19)
|
|
3
39
|
|
|
4
40
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/aleo",
|
|
3
|
-
"version": "4.
|
|
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.
|
|
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.
|
|
29
|
-
"@dynamic-labs/types": "4.
|
|
30
|
-
"@dynamic-labs/utils": "4.
|
|
31
|
-
"@dynamic-labs/waas": "4.
|
|
32
|
-
"@dynamic-labs/wallet-book": "4.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
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 & {
|
|
@@ -23,6 +24,7 @@ declare const DynamicWaasAleoConnector_base: (abstract new (...args: any[]) => {
|
|
|
23
24
|
overrideKey: string;
|
|
24
25
|
isEmbeddedWallet: boolean;
|
|
25
26
|
getSignedSessionId?: (() => Promise<string>) | undefined;
|
|
27
|
+
getSessionPublicKey?: (() => Promise<string | undefined>) | undefined;
|
|
26
28
|
getMfaToken?: ((props?: {
|
|
27
29
|
mfaAction?: import("@dynamic-labs-sdk/client").MFAAction | undefined;
|
|
28
30
|
} | undefined) => Promise<string | undefined>) | undefined;
|
|
@@ -31,6 +33,7 @@ declare const DynamicWaasAleoConnector_base: (abstract new (...args: any[]) => {
|
|
|
31
33
|
getElevatedAccessToken?: ((props: {
|
|
32
34
|
scope: import("@dynamic-labs-sdk/client").TokenScope;
|
|
33
35
|
}) => Promise<string | undefined>) | undefined;
|
|
36
|
+
onUnauthorized?: (() => void | Promise<void>) | undefined;
|
|
34
37
|
environmentId?: string | undefined;
|
|
35
38
|
baseApiUrl?: string | undefined;
|
|
36
39
|
relayUrl?: string | undefined;
|
|
@@ -42,6 +45,7 @@ declare const DynamicWaasAleoConnector_base: (abstract new (...args: any[]) => {
|
|
|
42
45
|
__exportHandler: import("@dynamic-labs/waas").WaasExportHandler;
|
|
43
46
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
44
47
|
setGetAuthTokenFunction(getAuthToken: () => string): void;
|
|
48
|
+
setOnUnauthorizedFunction(onUnauthorized: () => void | Promise<void>): void;
|
|
45
49
|
setWaasAuthMode(authMode: "cookie" | "header"): void;
|
|
46
50
|
setGetMfaTokenFunction(getMfaToken: (props?: {
|
|
47
51
|
mfaAction?: import("@dynamic-labs-sdk/client").MFAAction | undefined;
|
|
@@ -61,6 +65,7 @@ declare const DynamicWaasAleoConnector_base: (abstract new (...args: any[]) => {
|
|
|
61
65
|
setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl?: string | undefined): void;
|
|
62
66
|
setRelayUrl(relayUrl: string): void;
|
|
63
67
|
setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
|
|
68
|
+
setGetSessionPublicKeyFunction(getSessionPublicKey: () => Promise<string | undefined>): void;
|
|
64
69
|
delegateKeyShares({ accountAddress, password, }: {
|
|
65
70
|
accountAddress: string;
|
|
66
71
|
password?: string | undefined;
|
|
@@ -171,6 +176,16 @@ declare const DynamicWaasAleoConnector_base: (abstract new (...args: any[]) => {
|
|
|
171
176
|
fn: (timing: import("dist/packages/waas/utils/instrumentation").InstrumentationTimer) => Promise<T_1>;
|
|
172
177
|
context?: Record<string, any> | undefined;
|
|
173
178
|
}): Promise<T_1>;
|
|
179
|
+
getPrivateBalance(): Promise<{
|
|
180
|
+
unshielded: Record<string, string>;
|
|
181
|
+
shielded: Record<string, string>;
|
|
182
|
+
dust: {
|
|
183
|
+
balance: string;
|
|
184
|
+
cap: string;
|
|
185
|
+
};
|
|
186
|
+
address: string;
|
|
187
|
+
dustSynced: boolean;
|
|
188
|
+
}>;
|
|
174
189
|
}) & typeof WaasAleoWalletConnector;
|
|
175
190
|
/**
|
|
176
191
|
* Dynamic WaaS connector for Aleo.
|
|
@@ -441,6 +456,21 @@ export declare class DynamicWaasAleoConnector extends DynamicWaasAleoConnector_b
|
|
|
441
456
|
* allowed).
|
|
442
457
|
*/
|
|
443
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>;
|
|
444
474
|
/**
|
|
445
475
|
* Two-step Exchange transfer.
|
|
446
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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() {
|