@dynamic-labs/aleo 4.67.2 → 4.67.3-device-registration.0

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,26 @@
1
1
 
2
+ ### [4.67.3-device-registration.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.67.2...v4.67.3-device-registration.0) (2026-03-19)
3
+
4
+
5
+ ### Features
6
+
7
+ * add device registration icons ([#10637](https://github.com/dynamic-labs/dynamic-auth/issues/10637)) ([01bfe15](https://github.com/dynamic-labs/dynamic-auth/commit/01bfe155722111f321d289629bed95e8b9e4344d))
8
+ * add DeviceRegistrationView ([#10638](https://github.com/dynamic-labs/dynamic-auth/issues/10638)) ([11ccbbc](https://github.com/dynamic-labs/dynamic-auth/commit/11ccbbcc5cfaeab9fbeb01c040225a731137b465))
9
+ * add Prompt MFA and Prompt Reauthenticate to Step Up Auth methods ([#10645](https://github.com/dynamic-labs/dynamic-auth/issues/10645)) ([c97d8ee](https://github.com/dynamic-labs/dynamic-auth/commit/c97d8ee27f48d376259a921b01d151b4cf7fa27b))
10
+ * add step-up auth for email and SMS credential updates ([#10676](https://github.com/dynamic-labs/dynamic-auth/issues/10676)) ([4c7f0a5](https://github.com/dynamic-labs/dynamic-auth/commit/4c7f0a5330e557aea4db85359f7ac10d3c7545a5))
11
+ * add step-up auth for wallet link and unlink ([#10678](https://github.com/dynamic-labs/dynamic-auth/issues/10678)) ([8a015ca](https://github.com/dynamic-labs/dynamic-auth/commit/8a015ca0fd0bda71559c21b811b7e6acb43a7909))
12
+ * add TrustedDevicesSection and ManageTrustedDevicesView ([#10639](https://github.com/dynamic-labs/dynamic-auth/issues/10639)) ([17df870](https://github.com/dynamic-labs/dynamic-auth/commit/17df870caa34a8428d65510e5b3c9e9c7b93cea2))
13
+ * add useSyncDeviceRegistrationFlow ([#10640](https://github.com/dynamic-labs/dynamic-auth/issues/10640)) ([8c7752d](https://github.com/dynamic-labs/dynamic-auth/commit/8c7752d7a8afedaa3cc99fad83091586f7b6107e))
14
+ * **sdk-react-core:** prompt step-up auth before export private key ([#10647](https://github.com/dynamic-labs/dynamic-auth/issues/10647)) ([a39d886](https://github.com/dynamic-labs/dynamic-auth/commit/a39d88643af83484aae09332adcd05df8c0f923c))
15
+ * **step-up:** reauth flow with signInCredentialId and choose-method UI ([#10644](https://github.com/dynamic-labs/dynamic-auth/issues/10644)) ([086a97f](https://github.com/dynamic-labs/dynamic-auth/commit/086a97f27d908780b17f49f8a85ce88c34f61ed8))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * close auth flow on re-login when user already has embedded wallets ([#10641](https://github.com/dynamic-labs/dynamic-auth/issues/10641)) ([1aab930](https://github.com/dynamic-labs/dynamic-auth/commit/1aab9307c904f79bc0534026547fc112c55f6dc9))
21
+ * remove WalletConnect QR code fallback for Solflare wallet ([#10627](https://github.com/dynamic-labs/dynamic-auth/issues/10627)) ([6d83ead](https://github.com/dynamic-labs/dynamic-auth/commit/6d83ead833f560ee3c22e12262300e58fe21caa1))
22
+ * sync logout state between SDKs ([#10646](https://github.com/dynamic-labs/dynamic-auth/issues/10646)) ([44d0183](https://github.com/dynamic-labs/dynamic-auth/commit/44d01831cc672c1c9f015dee4e4c54582fd9e36a))
23
+
2
24
  ### [4.67.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.67.1...v4.67.2) (2026-03-13)
3
25
 
4
26
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.67.2";
6
+ var version = "4.67.3-device-registration.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.67.2";
2
+ var version = "4.67.3-device-registration.0";
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.67.2",
3
+ "version": "4.67.3-device-registration.0",
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,15 +18,15 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/assert-package-version": "4.67.2",
21
+ "@dynamic-labs/assert-package-version": "4.67.3-device-registration.0",
22
22
  "@provablehq/aleo-wallet-adaptor-core": "0.3.0-alpha.3",
23
23
  "@provablehq/aleo-wallet-adaptor-shield": "0.3.0-alpha.3",
24
24
  "@provablehq/aleo-wallet-standard": "0.3.0-alpha.3",
25
25
  "@provablehq/aleo-types": "0.3.0-alpha.3",
26
- "@dynamic-labs/types": "4.67.2",
27
- "@dynamic-labs/utils": "4.67.2",
28
- "@dynamic-labs/wallet-book": "4.67.2",
29
- "@dynamic-labs/wallet-connector-core": "4.67.2"
26
+ "@dynamic-labs/types": "4.67.3-device-registration.0",
27
+ "@dynamic-labs/utils": "4.67.3-device-registration.0",
28
+ "@dynamic-labs/wallet-book": "4.67.3-device-registration.0",
29
+ "@dynamic-labs/wallet-connector-core": "4.67.3-device-registration.0"
30
30
  },
31
31
  "peerDependencies": {}
32
32
  }
@@ -9,6 +9,9 @@ var aleoWalletAdaptorShield = require('@provablehq/aleo-wallet-adaptor-shield');
9
9
  var aleoTypes = require('@provablehq/aleo-types');
10
10
  var utils = require('@dynamic-labs/utils');
11
11
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
12
+ var getNetworkByChainId = require('../../utils/getNetworkByChainId/getNetworkByChainId.cjs');
13
+ var fetchPrivateBalance = require('../../utils/fetchPrivateBalance/fetchPrivateBalance.cjs');
14
+ var fetchPublicBalance = require('../../utils/fetchPublicBalance/fetchPublicBalance.cjs');
12
15
  var AleoWalletConnector = require('../AleoWalletConnector/AleoWalletConnector.cjs');
13
16
 
14
17
  /**
@@ -20,50 +23,8 @@ var AleoWalletConnector = require('../AleoWalletConnector/AleoWalletConnector.cj
20
23
  const adapterRegistry = {
21
24
  shield: aleoWalletAdaptorShield.ShieldWalletAdapter,
22
25
  };
23
- const AleoNetworkToIdMap = {
24
- [aleoTypes.Network.MAINNET]: 0,
25
- [aleoTypes.Network.TESTNET]: 1,
26
- };
27
- const getNetworkByChainId = (chainId) => {
28
- const entry = Object.entries(AleoNetworkToIdMap).find(([, id]) => id === chainId);
29
- return entry === null || entry === void 0 ? void 0 : entry[0];
30
- };
31
26
  const WALLET_NOT_CONNECTED = 'Wallet not connected';
32
27
  const MICROCREDITS_PER_CREDIT = 1000000;
33
- const fetchPublicBalance = (address, network) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
34
- const networkSegment = network === aleoTypes.Network.TESTNET ? 'testnet' : 'mainnet';
35
- const url = `https://api.explorer.provable.com/v1/${networkSegment}/program/credits.aleo/mapping/account/${address}`;
36
- const response = yield fetch(url);
37
- if (!response.ok)
38
- return BigInt(0);
39
- const text = yield response.text();
40
- if (!text || text === 'null')
41
- return BigInt(0);
42
- const cleaned = text.replace(/u64\.private|u64|[_"]/g, '').trim();
43
- const value = BigInt(cleaned);
44
- return value > BigInt(0) ? value : BigInt(0);
45
- });
46
- const extractRecordMicrocredits = (record) => {
47
- var _a, _b;
48
- if (!record || typeof record !== 'object')
49
- return BigInt(0);
50
- const r = record;
51
- const plaintext = (_a = r.plaintext) !== null && _a !== void 0 ? _a : r.data;
52
- if (!plaintext || typeof plaintext !== 'object')
53
- return BigInt(0);
54
- const pt = plaintext;
55
- const microcredits = (_b = pt.microcredits) !== null && _b !== void 0 ? _b : pt.microcredits_;
56
- if (typeof microcredits !== 'string')
57
- return BigInt(0);
58
- const value = BigInt(microcredits.replace(/u64\.private|u64|_/g, '').trim());
59
- return value > BigInt(0) ? value : BigInt(0);
60
- };
61
- const fetchPrivateBalance = (adapter) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
62
- const records = yield adapter.requestRecords('credits.aleo', true);
63
- if (!Array.isArray(records))
64
- return BigInt(0);
65
- return records.reduce((total, record) => total + extractRecordMicrocredits(record), BigInt(0));
66
- });
67
28
  /**
68
29
  * Connector for Aleo wallets that use a direct adapter interface rather than
69
30
  * the @provablehq/aleo-wallet-standard StandardWallet feature-map API.
@@ -117,7 +78,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
117
78
  if (!isValidNetwork) {
118
79
  return;
119
80
  }
120
- const network = getNetworkByChainId(chainIdNum);
81
+ const network = getNetworkByChainId.getNetworkByChainId(chainIdNum);
121
82
  if (network && this.adapter) {
122
83
  yield this.adapter.switchNetwork(network);
123
84
  this.emit('chainChange', { chain: String(chainIdNum) });
@@ -130,7 +91,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
130
91
  if (!((_a = this.adapter) === null || _a === void 0 ? void 0 : _a.network)) {
131
92
  return undefined;
132
93
  }
133
- const id = AleoNetworkToIdMap[this.adapter.network];
94
+ const id = getNetworkByChainId.ALEO_NETWORK_TO_ID_MAP[this.adapter.network];
134
95
  return id !== undefined ? String(id) : undefined;
135
96
  });
136
97
  }
@@ -152,7 +113,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
152
113
  }
153
114
  try {
154
115
  yield this.adapter.connect(((_a = this.adapter) === null || _a === void 0 ? void 0 : _a.network) ||
155
- getNetworkByChainId(Number((_c = (_b = this.aleoNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId) !== null && _c !== void 0 ? _c : -1)) ||
116
+ getNetworkByChainId.getNetworkByChainId(Number((_c = (_b = this.aleoNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId) !== null && _c !== void 0 ? _c : -1)) ||
156
117
  aleoTypes.Network.MAINNET, aleoWalletStandard.WalletDecryptPermission.UponRequest);
157
118
  }
158
119
  catch (error) {
@@ -174,7 +135,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
174
135
  return account.address;
175
136
  }
176
137
  const result = yield this.adapter.connect(((_a = this.adapter) === null || _a === void 0 ? void 0 : _a.network) ||
177
- getNetworkByChainId(Number((_c = (_b = this.aleoNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId) !== null && _c !== void 0 ? _c : -1)) ||
138
+ getNetworkByChainId.getNetworkByChainId(Number((_c = (_b = this.aleoNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId) !== null && _c !== void 0 ? _c : -1)) ||
178
139
  aleoTypes.Network.MAINNET, aleoWalletStandard.WalletDecryptPermission.UponRequest);
179
140
  return (_d = result === null || result === void 0 ? void 0 : result.address) !== null && _d !== void 0 ? _d : '';
180
141
  });
@@ -229,13 +190,13 @@ class AleoWalletAdapterConnector extends AleoWalletConnector.AleoWalletConnector
229
190
  const network = (_b = this.adapter.network) !== null && _b !== void 0 ? _b : aleoTypes.Network.MAINNET;
230
191
  let totalMicrocredits = BigInt(0);
231
192
  try {
232
- totalMicrocredits += yield fetchPublicBalance(resolvedAddress, network);
193
+ totalMicrocredits += yield fetchPublicBalance.fetchPublicBalance(resolvedAddress, network);
233
194
  }
234
195
  catch (error) {
235
196
  walletConnectorCore.logger.debug(`[${this.name}] Failed to fetch public balance:`, error);
236
197
  }
237
198
  try {
238
- totalMicrocredits += yield fetchPrivateBalance(this.adapter);
199
+ totalMicrocredits += yield fetchPrivateBalance.fetchPrivateBalance(this.adapter);
239
200
  }
240
201
  catch (error) {
241
202
  walletConnectorCore.logger.debug(`[${this.name}] Failed to fetch private records:`, error);
@@ -5,6 +5,9 @@ import { ShieldWalletAdapter } from '@provablehq/aleo-wallet-adaptor-shield';
5
5
  import { Network } from '@provablehq/aleo-types';
6
6
  import { DynamicError } from '@dynamic-labs/utils';
7
7
  import { logger } from '@dynamic-labs/wallet-connector-core';
8
+ import { getNetworkByChainId, ALEO_NETWORK_TO_ID_MAP } from '../../utils/getNetworkByChainId/getNetworkByChainId.js';
9
+ import { fetchPrivateBalance } from '../../utils/fetchPrivateBalance/fetchPrivateBalance.js';
10
+ import { fetchPublicBalance } from '../../utils/fetchPublicBalance/fetchPublicBalance.js';
8
11
  import { AleoWalletConnector } from '../AleoWalletConnector/AleoWalletConnector.js';
9
12
 
10
13
  /**
@@ -16,50 +19,8 @@ import { AleoWalletConnector } from '../AleoWalletConnector/AleoWalletConnector.
16
19
  const adapterRegistry = {
17
20
  shield: ShieldWalletAdapter,
18
21
  };
19
- const AleoNetworkToIdMap = {
20
- [Network.MAINNET]: 0,
21
- [Network.TESTNET]: 1,
22
- };
23
- const getNetworkByChainId = (chainId) => {
24
- const entry = Object.entries(AleoNetworkToIdMap).find(([, id]) => id === chainId);
25
- return entry === null || entry === void 0 ? void 0 : entry[0];
26
- };
27
22
  const WALLET_NOT_CONNECTED = 'Wallet not connected';
28
23
  const MICROCREDITS_PER_CREDIT = 1000000;
29
- const fetchPublicBalance = (address, network) => __awaiter(void 0, void 0, void 0, function* () {
30
- const networkSegment = network === Network.TESTNET ? 'testnet' : 'mainnet';
31
- const url = `https://api.explorer.provable.com/v1/${networkSegment}/program/credits.aleo/mapping/account/${address}`;
32
- const response = yield fetch(url);
33
- if (!response.ok)
34
- return BigInt(0);
35
- const text = yield response.text();
36
- if (!text || text === 'null')
37
- return BigInt(0);
38
- const cleaned = text.replace(/u64\.private|u64|[_"]/g, '').trim();
39
- const value = BigInt(cleaned);
40
- return value > BigInt(0) ? value : BigInt(0);
41
- });
42
- const extractRecordMicrocredits = (record) => {
43
- var _a, _b;
44
- if (!record || typeof record !== 'object')
45
- return BigInt(0);
46
- const r = record;
47
- const plaintext = (_a = r.plaintext) !== null && _a !== void 0 ? _a : r.data;
48
- if (!plaintext || typeof plaintext !== 'object')
49
- return BigInt(0);
50
- const pt = plaintext;
51
- const microcredits = (_b = pt.microcredits) !== null && _b !== void 0 ? _b : pt.microcredits_;
52
- if (typeof microcredits !== 'string')
53
- return BigInt(0);
54
- const value = BigInt(microcredits.replace(/u64\.private|u64|_/g, '').trim());
55
- return value > BigInt(0) ? value : BigInt(0);
56
- };
57
- const fetchPrivateBalance = (adapter) => __awaiter(void 0, void 0, void 0, function* () {
58
- const records = yield adapter.requestRecords('credits.aleo', true);
59
- if (!Array.isArray(records))
60
- return BigInt(0);
61
- return records.reduce((total, record) => total + extractRecordMicrocredits(record), BigInt(0));
62
- });
63
24
  /**
64
25
  * Connector for Aleo wallets that use a direct adapter interface rather than
65
26
  * the @provablehq/aleo-wallet-standard StandardWallet feature-map API.
@@ -126,7 +87,7 @@ class AleoWalletAdapterConnector extends AleoWalletConnector {
126
87
  if (!((_a = this.adapter) === null || _a === void 0 ? void 0 : _a.network)) {
127
88
  return undefined;
128
89
  }
129
- const id = AleoNetworkToIdMap[this.adapter.network];
90
+ const id = ALEO_NETWORK_TO_ID_MAP[this.adapter.network];
130
91
  return id !== undefined ? String(id) : undefined;
131
92
  });
132
93
  }
@@ -0,0 +1,25 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const extractRecordMicrocredits = (record) => {
7
+ var _a, _b;
8
+ if (!record || typeof record !== 'object')
9
+ return BigInt(0);
10
+ const r = record;
11
+ const plaintext = (_a = r.plaintext) !== null && _a !== void 0 ? _a : r.data;
12
+ if (!plaintext || typeof plaintext !== 'object')
13
+ return BigInt(0);
14
+ const pt = plaintext;
15
+ const microcredits = (_b = pt.microcredits) !== null && _b !== void 0 ? _b : pt.microcredits_;
16
+ if (typeof microcredits !== 'string')
17
+ return BigInt(0);
18
+ const cleaned = microcredits.replace(/u64\.private|u64|_/g, '').trim();
19
+ if (!cleaned)
20
+ return BigInt(0);
21
+ const value = BigInt(cleaned);
22
+ return value > BigInt(0) ? value : BigInt(0);
23
+ };
24
+
25
+ exports.extractRecordMicrocredits = extractRecordMicrocredits;
@@ -0,0 +1 @@
1
+ export declare const extractRecordMicrocredits: (record: unknown) => bigint;
@@ -0,0 +1,21 @@
1
+ 'use client'
2
+ const extractRecordMicrocredits = (record) => {
3
+ var _a, _b;
4
+ if (!record || typeof record !== 'object')
5
+ return BigInt(0);
6
+ const r = record;
7
+ const plaintext = (_a = r.plaintext) !== null && _a !== void 0 ? _a : r.data;
8
+ if (!plaintext || typeof plaintext !== 'object')
9
+ return BigInt(0);
10
+ const pt = plaintext;
11
+ const microcredits = (_b = pt.microcredits) !== null && _b !== void 0 ? _b : pt.microcredits_;
12
+ if (typeof microcredits !== 'string')
13
+ return BigInt(0);
14
+ const cleaned = microcredits.replace(/u64\.private|u64|_/g, '').trim();
15
+ if (!cleaned)
16
+ return BigInt(0);
17
+ const value = BigInt(cleaned);
18
+ return value > BigInt(0) ? value : BigInt(0);
19
+ };
20
+
21
+ export { extractRecordMicrocredits };
@@ -0,0 +1 @@
1
+ export { extractRecordMicrocredits } from './extractRecordMicrocredits';
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var extractRecordMicrocredits = require('../extractRecordMicrocredits/extractRecordMicrocredits.cjs');
8
+
9
+ const fetchPrivateBalance = (adapter) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
10
+ const records = yield adapter.requestRecords('credits.aleo', false);
11
+ if (!Array.isArray(records))
12
+ return BigInt(0);
13
+ return records.reduce((total, record) => total + extractRecordMicrocredits.extractRecordMicrocredits(record), BigInt(0));
14
+ });
15
+
16
+ exports.fetchPrivateBalance = fetchPrivateBalance;
@@ -0,0 +1,2 @@
1
+ import type { BaseAleoWalletAdapter } from '@provablehq/aleo-wallet-adaptor-core';
2
+ export declare const fetchPrivateBalance: (adapter: BaseAleoWalletAdapter) => Promise<bigint>;
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import { extractRecordMicrocredits } from '../extractRecordMicrocredits/extractRecordMicrocredits.js';
4
+
5
+ const fetchPrivateBalance = (adapter) => __awaiter(void 0, void 0, void 0, function* () {
6
+ const records = yield adapter.requestRecords('credits.aleo', false);
7
+ if (!Array.isArray(records))
8
+ return BigInt(0);
9
+ return records.reduce((total, record) => total + extractRecordMicrocredits(record), BigInt(0));
10
+ });
11
+
12
+ export { fetchPrivateBalance };
@@ -0,0 +1 @@
1
+ export { fetchPrivateBalance } from './fetchPrivateBalance';
@@ -0,0 +1,25 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var aleoTypes = require('@provablehq/aleo-types');
8
+
9
+ const fetchPublicBalance = (address, network) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
10
+ const networkSegment = network === aleoTypes.Network.TESTNET ? 'testnet' : 'mainnet';
11
+ const url = `https://api.explorer.provable.com/v1/${networkSegment}/program/credits.aleo/mapping/account/${address}`;
12
+ const response = yield fetch(url);
13
+ if (!response.ok)
14
+ return BigInt(0);
15
+ const text = yield response.text();
16
+ if (!text || text === 'null')
17
+ return BigInt(0);
18
+ const cleaned = text.replace(/u64\.private|u64|[_"]/g, '').trim();
19
+ if (!cleaned)
20
+ return BigInt(0);
21
+ const value = BigInt(cleaned);
22
+ return value > BigInt(0) ? value : BigInt(0);
23
+ });
24
+
25
+ exports.fetchPublicBalance = fetchPublicBalance;
@@ -0,0 +1,2 @@
1
+ import { Network } from '@provablehq/aleo-types';
2
+ export declare const fetchPublicBalance: (address: string, network: Network) => Promise<bigint>;
@@ -0,0 +1,21 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import { Network } from '@provablehq/aleo-types';
4
+
5
+ const fetchPublicBalance = (address, network) => __awaiter(void 0, void 0, void 0, function* () {
6
+ const networkSegment = network === Network.TESTNET ? 'testnet' : 'mainnet';
7
+ const url = `https://api.explorer.provable.com/v1/${networkSegment}/program/credits.aleo/mapping/account/${address}`;
8
+ const response = yield fetch(url);
9
+ if (!response.ok)
10
+ return BigInt(0);
11
+ const text = yield response.text();
12
+ if (!text || text === 'null')
13
+ return BigInt(0);
14
+ const cleaned = text.replace(/u64\.private|u64|[_"]/g, '').trim();
15
+ if (!cleaned)
16
+ return BigInt(0);
17
+ const value = BigInt(cleaned);
18
+ return value > BigInt(0) ? value : BigInt(0);
19
+ });
20
+
21
+ export { fetchPublicBalance };
@@ -0,0 +1 @@
1
+ export { fetchPublicBalance } from './fetchPublicBalance';
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var aleoTypes = require('@provablehq/aleo-types');
7
+
8
+ const ALEO_NETWORK_TO_ID_MAP = {
9
+ [aleoTypes.Network.MAINNET]: 0,
10
+ [aleoTypes.Network.TESTNET]: 1,
11
+ };
12
+ const getNetworkByChainId = (chainId) => {
13
+ const entry = Object.entries(ALEO_NETWORK_TO_ID_MAP).find(([, id]) => id === chainId);
14
+ return entry === null || entry === void 0 ? void 0 : entry[0];
15
+ };
16
+
17
+ exports.ALEO_NETWORK_TO_ID_MAP = ALEO_NETWORK_TO_ID_MAP;
18
+ exports.getNetworkByChainId = getNetworkByChainId;
@@ -0,0 +1,3 @@
1
+ import { Network } from '@provablehq/aleo-types';
2
+ export declare const ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>>;
3
+ export declare const getNetworkByChainId: (chainId: number) => Network | undefined;
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ import { Network } from '@provablehq/aleo-types';
3
+
4
+ const ALEO_NETWORK_TO_ID_MAP = {
5
+ [Network.MAINNET]: 0,
6
+ [Network.TESTNET]: 1,
7
+ };
8
+ const getNetworkByChainId = (chainId) => {
9
+ const entry = Object.entries(ALEO_NETWORK_TO_ID_MAP).find(([, id]) => id === chainId);
10
+ return entry === null || entry === void 0 ? void 0 : entry[0];
11
+ };
12
+
13
+ export { ALEO_NETWORK_TO_ID_MAP, getNetworkByChainId };
@@ -0,0 +1 @@
1
+ export { ALEO_NETWORK_TO_ID_MAP, getNetworkByChainId, } from './getNetworkByChainId';