@dynamic-labs-sdk/aleo 1.0.0 → 1.2.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.
Files changed (48) hide show
  1. package/dist/exports/walletStandard.d.ts +5 -0
  2. package/dist/exports/walletStandard.d.ts.map +1 -0
  3. package/dist/getNetworkByChainId-BPPJi-Ec.cjs +115 -0
  4. package/dist/getNetworkByChainId-BPPJi-Ec.cjs.map +1 -0
  5. package/dist/getNetworkByChainId-ou5QDHJn.esm.js +68 -0
  6. package/dist/getNetworkByChainId-ou5QDHJn.esm.js.map +1 -0
  7. package/dist/index.cjs +10 -73
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.esm.js +1 -64
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  12. package/dist/utils/bytesToHex/bytesToHex.d.ts +15 -0
  13. package/dist/utils/bytesToHex/bytesToHex.d.ts.map +1 -0
  14. package/dist/utils/bytesToHex/index.d.ts +2 -0
  15. package/dist/utils/bytesToHex/index.d.ts.map +1 -0
  16. package/dist/walletStandard/AleoStandardWallet.types.d.ts +80 -0
  17. package/dist/walletStandard/AleoStandardWallet.types.d.ts.map +1 -0
  18. package/dist/walletStandard/addAleoWalletStandardExtension/addAleoWalletStandardExtension.d.ts +18 -0
  19. package/dist/walletStandard/addAleoWalletStandardExtension/addAleoWalletStandardExtension.d.ts.map +1 -0
  20. package/dist/walletStandard/addAleoWalletStandardExtension/index.d.ts +2 -0
  21. package/dist/walletStandard/addAleoWalletStandardExtension/index.d.ts.map +1 -0
  22. package/dist/walletStandard/aleoStandardWalletWindowKeys.d.ts +14 -0
  23. package/dist/walletStandard/aleoStandardWalletWindowKeys.d.ts.map +1 -0
  24. package/dist/walletStandard/utils/aleoChainForChainId/aleoChainForChainId.d.ts +20 -0
  25. package/dist/walletStandard/utils/aleoChainForChainId/aleoChainForChainId.d.ts.map +1 -0
  26. package/dist/walletStandard/utils/aleoChainForChainId/index.d.ts +2 -0
  27. package/dist/walletStandard/utils/aleoChainForChainId/index.d.ts.map +1 -0
  28. package/dist/walletStandard/utils/chainIdForAleoChain/chainIdForAleoChain.d.ts +21 -0
  29. package/dist/walletStandard/utils/chainIdForAleoChain/chainIdForAleoChain.d.ts.map +1 -0
  30. package/dist/walletStandard/utils/chainIdForAleoChain/index.d.ts +2 -0
  31. package/dist/walletStandard/utils/chainIdForAleoChain/index.d.ts.map +1 -0
  32. package/dist/walletStandard/utils/createWalletProviderFromAleoStandardWallet/createWalletProviderFromAleoStandardWallet.d.ts +17 -0
  33. package/dist/walletStandard/utils/createWalletProviderFromAleoStandardWallet/createWalletProviderFromAleoStandardWallet.d.ts.map +1 -0
  34. package/dist/walletStandard/utils/createWalletProviderFromAleoStandardWallet/index.d.ts +2 -0
  35. package/dist/walletStandard/utils/createWalletProviderFromAleoStandardWallet/index.d.ts.map +1 -0
  36. package/dist/walletStandard/utils/isAleoStandardWallet/index.d.ts +2 -0
  37. package/dist/walletStandard/utils/isAleoStandardWallet/index.d.ts.map +1 -0
  38. package/dist/walletStandard/utils/isAleoStandardWallet/isAleoStandardWallet.d.ts +15 -0
  39. package/dist/walletStandard/utils/isAleoStandardWallet/isAleoStandardWallet.d.ts.map +1 -0
  40. package/dist/walletStandard/utils/normalizeAleoStandardWalletAccount/index.d.ts +2 -0
  41. package/dist/walletStandard/utils/normalizeAleoStandardWalletAccount/index.d.ts.map +1 -0
  42. package/dist/walletStandard/utils/normalizeAleoStandardWalletAccount/normalizeAleoStandardWalletAccount.d.ts +22 -0
  43. package/dist/walletStandard/utils/normalizeAleoStandardWalletAccount/normalizeAleoStandardWalletAccount.d.ts.map +1 -0
  44. package/dist/walletStandard.cjs +412 -0
  45. package/dist/walletStandard.cjs.map +1 -0
  46. package/dist/walletStandard.esm.js +409 -0
  47. package/dist/walletStandard.esm.js.map +1 -0
  48. package/package.json +9 -4
@@ -0,0 +1,5 @@
1
+ export { ALEO_WALLET_STANDARD_EXTENSION_KEY, addAleoWalletStandardExtension, } from '../walletStandard/addAleoWalletStandardExtension';
2
+ export { ALEO_STANDARD_WALLET_WINDOW_KEYS } from '../walletStandard/aleoStandardWalletWindowKeys';
3
+ export { createWalletProviderFromAleoStandardWallet } from '../walletStandard/utils/createWalletProviderFromAleoStandardWallet';
4
+ export type { TypedStandardWallet } from '../walletStandard/AleoStandardWallet.types';
5
+ //# sourceMappingURL=walletStandard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walletStandard.d.ts","sourceRoot":"","sources":["../../src/exports/walletStandard.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,kCAAkC,EAClC,8BAA8B,GAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,0CAA0C,EAAE,MAAM,oEAAoE,CAAC;AAChI,YAAY,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
@@ -0,0 +1,115 @@
1
+ let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
2
+ let _provablehq_aleo_types = require("@provablehq/aleo-types");
3
+
4
+ //#region package.json
5
+ var name = "@dynamic-labs-sdk/aleo";
6
+ var version = "1.2.0";
7
+
8
+ //#endregion
9
+ //#region src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts
10
+ /**
11
+ * Thrown when an Aleo wallet does not advertise a feature the caller asked
12
+ * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is
13
+ * invoked. Carries the feature name and the wallet display name so the
14
+ * UI / logs can surface which wallet was missing what.
15
+ */
16
+ var AleoFeatureUnsupportedError = class extends _dynamic_labs_sdk_client.BaseError {
17
+ featureName;
18
+ walletName;
19
+ constructor(params) {
20
+ super({
21
+ cause: null,
22
+ code: "aleo_feature_unsupported_error",
23
+ docsUrl: null,
24
+ name: "AleoFeatureUnsupportedError",
25
+ shortMessage: `${params.walletName} does not support ${params.featureName}`
26
+ });
27
+ this.featureName = params.featureName;
28
+ this.walletName = params.walletName;
29
+ }
30
+ };
31
+
32
+ //#endregion
33
+ //#region src/utils/constants.ts
34
+ /**
35
+ * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.
36
+ * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.
37
+ */
38
+ const MICROCREDITS_PER_CREDIT = 1e6;
39
+ const ALEO_MAINNET_NETWORK_ID = 0;
40
+ const ALEO_TESTNET_NETWORK_ID = 1;
41
+
42
+ //#endregion
43
+ //#region src/utils/getNetworkByChainId/getNetworkByChainId.ts
44
+ /**
45
+ * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used
46
+ * everywhere else in the SDK (`0` = mainnet, `1` = testnet).
47
+ */
48
+ const ALEO_NETWORK_TO_ID_MAP = {
49
+ [_provablehq_aleo_types.Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,
50
+ [_provablehq_aleo_types.Network.TESTNET]: ALEO_TESTNET_NETWORK_ID
51
+ };
52
+ /**
53
+ * Resolve the `@provablehq/aleo-types` Network enum value for a numeric
54
+ * chain id, the bridge between the SDK's chain ids and the on-chain
55
+ * network identifier the Aleo libraries expect.
56
+ *
57
+ * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).
58
+ * @returns The matching `Network` enum value, or `undefined` when the id is
59
+ * not a known Aleo network.
60
+ * @not-instrumented
61
+ */
62
+ const getNetworkByChainId = ({ chainId }) => {
63
+ return Object.entries(ALEO_NETWORK_TO_ID_MAP).find(([, id]) => id === chainId)?.[0];
64
+ };
65
+
66
+ //#endregion
67
+ Object.defineProperty(exports, 'ALEO_MAINNET_NETWORK_ID', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return ALEO_MAINNET_NETWORK_ID;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, 'ALEO_NETWORK_TO_ID_MAP', {
74
+ enumerable: true,
75
+ get: function () {
76
+ return ALEO_NETWORK_TO_ID_MAP;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, 'ALEO_TESTNET_NETWORK_ID', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return ALEO_TESTNET_NETWORK_ID;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, 'AleoFeatureUnsupportedError', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return AleoFeatureUnsupportedError;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, 'MICROCREDITS_PER_CREDIT', {
92
+ enumerable: true,
93
+ get: function () {
94
+ return MICROCREDITS_PER_CREDIT;
95
+ }
96
+ });
97
+ Object.defineProperty(exports, 'getNetworkByChainId', {
98
+ enumerable: true,
99
+ get: function () {
100
+ return getNetworkByChainId;
101
+ }
102
+ });
103
+ Object.defineProperty(exports, 'name', {
104
+ enumerable: true,
105
+ get: function () {
106
+ return name;
107
+ }
108
+ });
109
+ Object.defineProperty(exports, 'version', {
110
+ enumerable: true,
111
+ get: function () {
112
+ return version;
113
+ }
114
+ });
115
+ //# sourceMappingURL=getNetworkByChainId-BPPJi-Ec.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNetworkByChainId-BPPJi-Ec.cjs","names":["BaseError","ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>>","Network"],"sources":["../package.json","../src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts","../src/utils/constants.ts","../src/utils/getNetworkByChainId/getNetworkByChainId.ts"],"sourcesContent":["","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an Aleo wallet does not advertise a feature the caller asked\n * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is\n * invoked. Carries the feature name and the wallet display name so the\n * UI / logs can surface which wallet was missing what.\n */\nexport class AleoFeatureUnsupportedError extends BaseError {\n public readonly featureName: string;\n\n public readonly walletName: string;\n\n constructor(params: { featureName: string; walletName: string }) {\n super({\n cause: null,\n code: 'aleo_feature_unsupported_error',\n docsUrl: null,\n name: 'AleoFeatureUnsupportedError',\n shortMessage: `${params.walletName} does not support ${params.featureName}`,\n });\n\n this.featureName = params.featureName;\n this.walletName = params.walletName;\n }\n}\n","/**\n * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.\n * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.\n */\nexport const MICROCREDITS_PER_CREDIT = 1_000_000;\n\nexport const ALEO_MAINNET_NETWORK_ID = 0;\nexport const ALEO_TESTNET_NETWORK_ID = 1;\n","import { Network } from '@provablehq/aleo-types';\n\nimport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n} from '../constants';\n\n/**\n * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used\n * everywhere else in the SDK (`0` = mainnet, `1` = testnet).\n */\nexport const ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>> = {\n [Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,\n [Network.TESTNET]: ALEO_TESTNET_NETWORK_ID,\n};\n\ntype GetNetworkByChainIdParams = {\n chainId: number;\n};\n\n/**\n * Resolve the `@provablehq/aleo-types` Network enum value for a numeric\n * chain id, the bridge between the SDK's chain ids and the on-chain\n * network identifier the Aleo libraries expect.\n *\n * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).\n * @returns The matching `Network` enum value, or `undefined` when the id is\n * not a known Aleo network.\n * @not-instrumented\n */\nexport const getNetworkByChainId = ({\n chainId,\n}: GetNetworkByChainIdParams): Network | undefined => {\n const entry = (\n Object.entries(ALEO_NETWORK_TO_ID_MAP) as [Network, number][]\n ).find(([, id]) => id === chainId);\n return entry?.[0];\n};\n"],"mappings":";;;;;;;;;;;;;;;ACQA,IAAa,8BAAb,cAAiDA,mCAAU;CACzD,AAAgB;CAEhB,AAAgB;CAEhB,YAAY,QAAqD;AAC/D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,GAAG,OAAO,WAAW,oBAAoB,OAAO;GAC/D,CAAC;AAEF,OAAK,cAAc,OAAO;AAC1B,OAAK,aAAa,OAAO;;;;;;;;;;ACnB7B,MAAa,0BAA0B;AAEvC,MAAa,0BAA0B;AACvC,MAAa,0BAA0B;;;;;;;;ACIvC,MAAaC,yBAA2D;EACrEC,+BAAQ,UAAU;EAClBA,+BAAQ,UAAU;CACpB;;;;;;;;;;;AAgBD,MAAa,uBAAuB,EAClC,cACoD;AAIpD,QAFE,OAAO,QAAQ,uBAAuB,CACtC,MAAM,GAAG,QAAQ,OAAO,QAAQ,GACnB"}
@@ -0,0 +1,68 @@
1
+ import { BaseError } from "@dynamic-labs-sdk/client";
2
+ import { Network } from "@provablehq/aleo-types";
3
+
4
+ //#region package.json
5
+ var name = "@dynamic-labs-sdk/aleo";
6
+ var version = "1.2.0";
7
+
8
+ //#endregion
9
+ //#region src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts
10
+ /**
11
+ * Thrown when an Aleo wallet does not advertise a feature the caller asked
12
+ * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is
13
+ * invoked. Carries the feature name and the wallet display name so the
14
+ * UI / logs can surface which wallet was missing what.
15
+ */
16
+ var AleoFeatureUnsupportedError = class extends BaseError {
17
+ featureName;
18
+ walletName;
19
+ constructor(params) {
20
+ super({
21
+ cause: null,
22
+ code: "aleo_feature_unsupported_error",
23
+ docsUrl: null,
24
+ name: "AleoFeatureUnsupportedError",
25
+ shortMessage: `${params.walletName} does not support ${params.featureName}`
26
+ });
27
+ this.featureName = params.featureName;
28
+ this.walletName = params.walletName;
29
+ }
30
+ };
31
+
32
+ //#endregion
33
+ //#region src/utils/constants.ts
34
+ /**
35
+ * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.
36
+ * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.
37
+ */
38
+ const MICROCREDITS_PER_CREDIT = 1e6;
39
+ const ALEO_MAINNET_NETWORK_ID = 0;
40
+ const ALEO_TESTNET_NETWORK_ID = 1;
41
+
42
+ //#endregion
43
+ //#region src/utils/getNetworkByChainId/getNetworkByChainId.ts
44
+ /**
45
+ * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used
46
+ * everywhere else in the SDK (`0` = mainnet, `1` = testnet).
47
+ */
48
+ const ALEO_NETWORK_TO_ID_MAP = {
49
+ [Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,
50
+ [Network.TESTNET]: ALEO_TESTNET_NETWORK_ID
51
+ };
52
+ /**
53
+ * Resolve the `@provablehq/aleo-types` Network enum value for a numeric
54
+ * chain id, the bridge between the SDK's chain ids and the on-chain
55
+ * network identifier the Aleo libraries expect.
56
+ *
57
+ * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).
58
+ * @returns The matching `Network` enum value, or `undefined` when the id is
59
+ * not a known Aleo network.
60
+ * @not-instrumented
61
+ */
62
+ const getNetworkByChainId = ({ chainId }) => {
63
+ return Object.entries(ALEO_NETWORK_TO_ID_MAP).find(([, id]) => id === chainId)?.[0];
64
+ };
65
+
66
+ //#endregion
67
+ export { MICROCREDITS_PER_CREDIT as a, version as c, ALEO_TESTNET_NETWORK_ID as i, getNetworkByChainId as n, AleoFeatureUnsupportedError as o, ALEO_MAINNET_NETWORK_ID as r, name as s, ALEO_NETWORK_TO_ID_MAP as t };
68
+ //# sourceMappingURL=getNetworkByChainId-ou5QDHJn.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNetworkByChainId-ou5QDHJn.esm.js","names":["ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>>"],"sources":["../package.json","../src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts","../src/utils/constants.ts","../src/utils/getNetworkByChainId/getNetworkByChainId.ts"],"sourcesContent":["","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an Aleo wallet does not advertise a feature the caller asked\n * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is\n * invoked. Carries the feature name and the wallet display name so the\n * UI / logs can surface which wallet was missing what.\n */\nexport class AleoFeatureUnsupportedError extends BaseError {\n public readonly featureName: string;\n\n public readonly walletName: string;\n\n constructor(params: { featureName: string; walletName: string }) {\n super({\n cause: null,\n code: 'aleo_feature_unsupported_error',\n docsUrl: null,\n name: 'AleoFeatureUnsupportedError',\n shortMessage: `${params.walletName} does not support ${params.featureName}`,\n });\n\n this.featureName = params.featureName;\n this.walletName = params.walletName;\n }\n}\n","/**\n * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.\n * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.\n */\nexport const MICROCREDITS_PER_CREDIT = 1_000_000;\n\nexport const ALEO_MAINNET_NETWORK_ID = 0;\nexport const ALEO_TESTNET_NETWORK_ID = 1;\n","import { Network } from '@provablehq/aleo-types';\n\nimport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n} from '../constants';\n\n/**\n * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used\n * everywhere else in the SDK (`0` = mainnet, `1` = testnet).\n */\nexport const ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>> = {\n [Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,\n [Network.TESTNET]: ALEO_TESTNET_NETWORK_ID,\n};\n\ntype GetNetworkByChainIdParams = {\n chainId: number;\n};\n\n/**\n * Resolve the `@provablehq/aleo-types` Network enum value for a numeric\n * chain id, the bridge between the SDK's chain ids and the on-chain\n * network identifier the Aleo libraries expect.\n *\n * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).\n * @returns The matching `Network` enum value, or `undefined` when the id is\n * not a known Aleo network.\n * @not-instrumented\n */\nexport const getNetworkByChainId = ({\n chainId,\n}: GetNetworkByChainIdParams): Network | undefined => {\n const entry = (\n Object.entries(ALEO_NETWORK_TO_ID_MAP) as [Network, number][]\n ).find(([, id]) => id === chainId);\n return entry?.[0];\n};\n"],"mappings":";;;;;;;;;;;;;;;ACQA,IAAa,8BAAb,cAAiD,UAAU;CACzD,AAAgB;CAEhB,AAAgB;CAEhB,YAAY,QAAqD;AAC/D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,GAAG,OAAO,WAAW,oBAAoB,OAAO;GAC/D,CAAC;AAEF,OAAK,cAAc,OAAO;AAC1B,OAAK,aAAa,OAAO;;;;;;;;;;ACnB7B,MAAa,0BAA0B;AAEvC,MAAa,0BAA0B;AACvC,MAAa,0BAA0B;;;;;;;;ACIvC,MAAaA,yBAA2D;EACrE,QAAQ,UAAU;EAClB,QAAQ,UAAU;CACpB;;;;;;;;;;;AAgBD,MAAa,uBAAuB,EAClC,cACoD;AAIpD,QAFE,OAAO,QAAQ,uBAAuB,CACtC,MAAM,GAAG,QAAQ,OAAO,QAAQ,GACnB"}
package/dist/index.cjs CHANGED
@@ -1,36 +1,7 @@
1
+ const require_getNetworkByChainId = require('./getNetworkByChainId-BPPJi-Ec.cjs');
1
2
  let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
2
3
  let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
3
- let _provablehq_aleo_types = require("@provablehq/aleo-types");
4
4
 
5
- //#region package.json
6
- var name = "@dynamic-labs-sdk/aleo";
7
- var version = "1.0.0";
8
-
9
- //#endregion
10
- //#region src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts
11
- /**
12
- * Thrown when an Aleo wallet does not advertise a feature the caller asked
13
- * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is
14
- * invoked. Carries the feature name and the wallet display name so the
15
- * UI / logs can surface which wallet was missing what.
16
- */
17
- var AleoFeatureUnsupportedError = class extends _dynamic_labs_sdk_client.BaseError {
18
- featureName;
19
- walletName;
20
- constructor(params) {
21
- super({
22
- cause: null,
23
- code: "aleo_feature_unsupported_error",
24
- docsUrl: null,
25
- name: "AleoFeatureUnsupportedError",
26
- shortMessage: `${params.walletName} does not support ${params.featureName}`
27
- });
28
- this.featureName = params.featureName;
29
- this.walletName = params.walletName;
30
- }
31
- };
32
-
33
- //#endregion
34
5
  //#region src/errors/InvalidAleoTransactionIdError/InvalidAleoTransactionIdError.ts
35
6
  /**
36
7
  * Thrown when an input meant to be an Aleo transaction id (`at1...`) does
@@ -111,16 +82,6 @@ const isAleoWalletProvider = (provider) => {
111
82
  return provider.chain === "ALEO";
112
83
  };
113
84
 
114
- //#endregion
115
- //#region src/utils/constants.ts
116
- /**
117
- * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.
118
- * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.
119
- */
120
- const MICROCREDITS_PER_CREDIT = 1e6;
121
- const ALEO_MAINNET_NETWORK_ID = 0;
122
- const ALEO_TESTNET_NETWORK_ID = 1;
123
-
124
85
  //#endregion
125
86
  //#region src/utils/isAleoMainnet/isAleoMainnet.ts
126
87
  /**
@@ -135,8 +96,8 @@ const ALEO_TESTNET_NETWORK_ID = 1;
135
96
  */
136
97
  const isAleoMainnet = (networkId) => {
137
98
  if (networkId === void 0 || networkId === null) return false;
138
- if (typeof networkId === "number") return networkId === ALEO_MAINNET_NETWORK_ID;
139
- return Number(networkId) === ALEO_MAINNET_NETWORK_ID;
99
+ if (typeof networkId === "number") return networkId === require_getNetworkByChainId.ALEO_MAINNET_NETWORK_ID;
100
+ return Number(networkId) === require_getNetworkByChainId.ALEO_MAINNET_NETWORK_ID;
140
101
  };
141
102
 
142
103
  //#endregion
@@ -167,44 +128,20 @@ const getAleoExplorerTxUrl = ({ txId, networkId }) => {
167
128
  return `https://${isAleoMainnet(networkId) ? "" : "testnet."}explorer.provable.com/transaction/${txId}`;
168
129
  };
169
130
 
170
- //#endregion
171
- //#region src/utils/getNetworkByChainId/getNetworkByChainId.ts
172
- /**
173
- * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used
174
- * everywhere else in the SDK (`0` = mainnet, `1` = testnet).
175
- */
176
- const ALEO_NETWORK_TO_ID_MAP = {
177
- [_provablehq_aleo_types.Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,
178
- [_provablehq_aleo_types.Network.TESTNET]: ALEO_TESTNET_NETWORK_ID
179
- };
180
- /**
181
- * Resolve the `@provablehq/aleo-types` Network enum value for a numeric
182
- * chain id, the bridge between the SDK's chain ids and the on-chain
183
- * network identifier the Aleo libraries expect.
184
- *
185
- * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).
186
- * @returns The matching `Network` enum value, or `undefined` when the id is
187
- * not a known Aleo network.
188
- * @not-instrumented
189
- */
190
- const getNetworkByChainId = ({ chainId }) => {
191
- return Object.entries(ALEO_NETWORK_TO_ID_MAP).find(([, id]) => id === chainId)?.[0];
192
- };
193
-
194
131
  //#endregion
195
132
  //#region src/exports/index.ts
196
- (0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(name, version);
133
+ (0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_getNetworkByChainId.name, require_getNetworkByChainId.version);
197
134
 
198
135
  //#endregion
199
- exports.ALEO_MAINNET_NETWORK_ID = ALEO_MAINNET_NETWORK_ID;
200
- exports.ALEO_NETWORK_TO_ID_MAP = ALEO_NETWORK_TO_ID_MAP;
201
- exports.ALEO_TESTNET_NETWORK_ID = ALEO_TESTNET_NETWORK_ID;
202
- exports.AleoFeatureUnsupportedError = AleoFeatureUnsupportedError;
136
+ exports.ALEO_MAINNET_NETWORK_ID = require_getNetworkByChainId.ALEO_MAINNET_NETWORK_ID;
137
+ exports.ALEO_NETWORK_TO_ID_MAP = require_getNetworkByChainId.ALEO_NETWORK_TO_ID_MAP;
138
+ exports.ALEO_TESTNET_NETWORK_ID = require_getNetworkByChainId.ALEO_TESTNET_NETWORK_ID;
139
+ exports.AleoFeatureUnsupportedError = require_getNetworkByChainId.AleoFeatureUnsupportedError;
203
140
  exports.InvalidAleoTransactionIdError = InvalidAleoTransactionIdError;
204
- exports.MICROCREDITS_PER_CREDIT = MICROCREDITS_PER_CREDIT;
141
+ exports.MICROCREDITS_PER_CREDIT = require_getNetworkByChainId.MICROCREDITS_PER_CREDIT;
205
142
  exports.NotAleoProviderError = NotAleoProviderError;
206
143
  exports.getAleoExplorerTxUrl = getAleoExplorerTxUrl;
207
- exports.getNetworkByChainId = getNetworkByChainId;
144
+ exports.getNetworkByChainId = require_getNetworkByChainId.getNetworkByChainId;
208
145
  exports.isAleoNetworkProvider = isAleoNetworkProvider;
209
146
  exports.isAleoWalletAccount = isAleoWalletAccount;
210
147
  exports.isAleoWalletProvider = isAleoWalletProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BaseError","BaseError","BaseError","ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>>","Network","packageName","packageVersion"],"sources":["../package.json","../src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts","../src/errors/InvalidAleoTransactionIdError/InvalidAleoTransactionIdError.ts","../src/errors/NotAleoProviderError/NotAleoProviderError.ts","../src/isAleoNetworkProvider/isAleoNetworkProvider.ts","../src/isAleoWalletAccount/isAleoWalletAccount.ts","../src/isAleoWalletProvider/isAleoWalletProvider.ts","../src/utils/constants.ts","../src/utils/isAleoMainnet/isAleoMainnet.ts","../src/utils/getAleoExplorerTxUrl/getAleoExplorerTxUrl.ts","../src/utils/getNetworkByChainId/getNetworkByChainId.ts","../src/exports/index.ts"],"sourcesContent":["","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an Aleo wallet does not advertise a feature the caller asked\n * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is\n * invoked. Carries the feature name and the wallet display name so the\n * UI / logs can surface which wallet was missing what.\n */\nexport class AleoFeatureUnsupportedError extends BaseError {\n public readonly featureName: string;\n\n public readonly walletName: string;\n\n constructor(params: { featureName: string; walletName: string }) {\n super({\n cause: null,\n code: 'aleo_feature_unsupported_error',\n docsUrl: null,\n name: 'AleoFeatureUnsupportedError',\n shortMessage: `${params.walletName} does not support ${params.featureName}`,\n });\n\n this.featureName = params.featureName;\n this.walletName = params.walletName;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an input meant to be an Aleo transaction id (`at1...`) does\n * not match the bech32 pattern. Carries the offending value on `txId` for\n * inclusion in error logs / UI surfaces.\n */\nexport class InvalidAleoTransactionIdError extends BaseError {\n public readonly txId: string;\n\n constructor(params: { txId: string }) {\n super({\n cause: null,\n code: 'invalid_aleo_transaction_id_error',\n docsUrl: null,\n name: 'InvalidAleoTransactionIdError',\n shortMessage: `Invalid Aleo transaction id: ${params.txId}`,\n });\n\n this.txId = params.txId;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown by Aleo-specific top-level helpers (`signMessage`,\n * `requestTransaction`, `decrypt`, `requestRecords`) when the wallet\n * provider resolved from a wallet account is not an Aleo provider — i.e.\n * the caller passed a wallet account from a different chain. Carries the\n * offending provider's key on `providerKey`.\n */\nexport class NotAleoProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aleo_provider_error',\n docsUrl: null,\n name: 'NotAleoProviderError',\n shortMessage: 'Provider is not an Aleo wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\n\n/**\n * Type guard narrowing a generic `NetworkProvider` to `AleoNetworkProvider`.\n * Use this to filter the network-provider registry down to the Aleo\n * network providers.\n *\n * @not-instrumented\n */\nexport const isAleoNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AleoNetworkProvider => networkProvider.chain === 'ALEO';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AleoWalletAccount } from '../AleoWalletAccount.types';\n\n/**\n * Type guard narrowing a generic `WalletAccount` to `AleoWalletAccount`.\n * Use this to filter mixed-chain wallet account lists down to the Aleo\n * accounts.\n *\n * @not-instrumented\n */\nexport const isAleoWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AleoWalletAccount => walletAccount.chain === 'ALEO';\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AleoWalletProvider } from '../AleoWalletProvider.types';\n\n/**\n * Type guard narrowing a generic `WalletProvider` to `AleoWalletProvider`.\n * Returns `true` when the provider's chain is `'ALEO'`. Mirrors the\n * `is{Chain}WalletProvider` pattern used by the sibling chain packages\n * (Tron, Sui, Aptos) — exposes the Aleo-specific methods like\n * `requestTransaction`, `decrypt`, and `requestRecords` to the caller.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- standard type-guard signature shared with sibling chains\nexport const isAleoWalletProvider = (\n provider: WalletProvider | AleoWalletProvider\n): provider is AleoWalletProvider => {\n return provider.chain === 'ALEO';\n};\n","/**\n * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.\n * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.\n */\nexport const MICROCREDITS_PER_CREDIT = 1_000_000;\n\nexport const ALEO_MAINNET_NETWORK_ID = 0;\nexport const ALEO_TESTNET_NETWORK_ID = 1;\n","import { ALEO_MAINNET_NETWORK_ID } from '../constants';\n\n/**\n * Whether a numeric/string chain id points at the Aleo mainnet (`0`)\n * rather than a testnet. Both numeric and string ids are accepted so\n * callers can pass `walletAccount.activeNetworkId` (which is stringly-\n * typed) directly. `undefined` and `null` resolve to `false` so a\n * stale or unknown id falls back to testnet behaviour at the call\n * site.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- single primitive arg; named-arg ceremony would not improve clarity\nexport const isAleoMainnet = (\n networkId: number | string | undefined | null\n): boolean => {\n if (networkId === undefined || networkId === null) return false;\n if (typeof networkId === 'number') {\n return networkId === ALEO_MAINNET_NETWORK_ID;\n }\n return Number(networkId) === ALEO_MAINNET_NETWORK_ID;\n};\n","import { InvalidAleoTransactionIdError } from '../../errors/InvalidAleoTransactionIdError';\nimport { isAleoMainnet } from '../isAleoMainnet';\n\n/**\n * Aleo transaction ids are bech32-encoded with the `at1` prefix and a body\n * of lowercase alphanumerics — same character set as account addresses. We\n * validate strictly before letting the id reach the URL, refusing `/`, `?`,\n * `#`, `..`, etc. so a hostile id cannot produce path traversal or an open\n * redirect when the rendered URL is opened.\n */\nconst ALEO_TX_ID_PATTERN = /^at1[a-z0-9]{1,62}$/;\n\ntype GetAleoExplorerTxUrlParams = {\n /**\n * `0` = mainnet, `1` = testnet. When omitted, defaults to testnet so a\n * stale UI never accidentally links to a mainnet explorer for a testnet\n * transaction.\n */\n networkId?: number | string;\n /** Aleo transaction id (`at1...`). */\n txId: string;\n};\n\n/**\n * Build the Provable explorer URL for an Aleo transaction id.\n *\n * Examples:\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 0 })\n * → 'https://explorer.provable.com/transaction/at1abc...'\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 1 })\n * → 'https://testnet.explorer.provable.com/transaction/at1abc...'\n *\n * @throws InvalidAleoTransactionIdError when `txId` is not a well-formed\n * bech32 Aleo transaction id.\n * @not-instrumented\n */\nexport const getAleoExplorerTxUrl = ({\n txId,\n networkId,\n}: GetAleoExplorerTxUrlParams): string => {\n if (!ALEO_TX_ID_PATTERN.test(txId)) {\n throw new InvalidAleoTransactionIdError({ txId });\n }\n const subdomain = isAleoMainnet(networkId) ? '' : 'testnet.';\n return `https://${subdomain}explorer.provable.com/transaction/${txId}`;\n};\n","import { Network } from '@provablehq/aleo-types';\n\nimport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n} from '../constants';\n\n/**\n * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used\n * everywhere else in the SDK (`0` = mainnet, `1` = testnet).\n */\nexport const ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>> = {\n [Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,\n [Network.TESTNET]: ALEO_TESTNET_NETWORK_ID,\n};\n\ntype GetNetworkByChainIdParams = {\n chainId: number;\n};\n\n/**\n * Resolve the `@provablehq/aleo-types` Network enum value for a numeric\n * chain id, the bridge between the SDK's chain ids and the on-chain\n * network identifier the Aleo libraries expect.\n *\n * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).\n * @returns The matching `Network` enum value, or `undefined` when the id is\n * not a known Aleo network.\n * @not-instrumented\n */\nexport const getNetworkByChainId = ({\n chainId,\n}: GetNetworkByChainIdParams): Network | undefined => {\n const entry = (\n Object.entries(ALEO_NETWORK_TO_ID_MAP) as [Network, number][]\n ).find(([, id]) => id === chainId);\n return entry?.[0];\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { AleoFeatureUnsupportedError } from '../errors/AleoFeatureUnsupportedError';\nexport { InvalidAleoTransactionIdError } from '../errors/InvalidAleoTransactionIdError';\nexport { NotAleoProviderError } from '../errors/NotAleoProviderError';\nexport { isAleoNetworkProvider } from '../isAleoNetworkProvider';\nexport { isAleoWalletAccount } from '../isAleoWalletAccount';\nexport { isAleoWalletProvider } from '../isAleoWalletProvider';\nexport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\nexport type { AleoWalletAccount } from '../AleoWalletAccount.types';\nexport type {\n AleoDecryptOptions,\n AleoRequestRecordsOptions,\n AleoTransaction,\n AleoTransition,\n AleoWalletProvider,\n} from '../AleoWalletProvider.types';\nexport { getAleoExplorerTxUrl } from '../utils/getAleoExplorerTxUrl';\nexport {\n ALEO_NETWORK_TO_ID_MAP,\n getNetworkByChainId,\n} from '../utils/getNetworkByChainId';\nexport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n MICROCREDITS_PER_CREDIT,\n} from '../utils/constants';\n"],"mappings":";;;;;;;;;;;;;;;;ACQA,IAAa,8BAAb,cAAiDA,mCAAU;CACzD,AAAgB;CAEhB,AAAgB;CAEhB,YAAY,QAAqD;AAC/D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,GAAG,OAAO,WAAW,oBAAoB,OAAO;GAC/D,CAAC;AAEF,OAAK,cAAc,OAAO;AAC1B,OAAK,aAAa,OAAO;;;;;;;;;;;AChB7B,IAAa,gCAAb,cAAmDC,mCAAU;CAC3D,AAAgB;CAEhB,YAAY,QAA0B;AACpC,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,gCAAgC,OAAO;GACtD,CAAC;AAEF,OAAK,OAAO,OAAO;;;;;;;;;;;;;ACVvB,IAAa,uBAAb,cAA0CC,mCAAU;CAClD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;;;;;;;;ACV9B,MAAa,yBACX,oBAC2C,gBAAgB,UAAU;;;;;;;;;;;ACFvE,MAAa,uBACX,kBACuC,cAAc,UAAU;;;;;;;;;;;;;ACCjE,MAAa,wBACX,aACmC;AACnC,QAAO,SAAS,UAAU;;;;;;;;;ACb5B,MAAa,0BAA0B;AAEvC,MAAa,0BAA0B;AACvC,MAAa,0BAA0B;;;;;;;;;;;;;;ACMvC,MAAa,iBACX,cACY;AACZ,KAAI,cAAc,UAAa,cAAc,KAAM,QAAO;AAC1D,KAAI,OAAO,cAAc,SACvB,QAAO,cAAc;AAEvB,QAAO,OAAO,UAAU,KAAK;;;;;;;;;;;;ACV/B,MAAM,qBAAqB;;;;;;;;;;;;;;AA0B3B,MAAa,wBAAwB,EACnC,MACA,gBACwC;AACxC,KAAI,CAAC,mBAAmB,KAAK,KAAK,CAChC,OAAM,IAAI,8BAA8B,EAAE,MAAM,CAAC;AAGnD,QAAO,WADW,cAAc,UAAU,GAAG,KAAK,WACtB,oCAAoC;;;;;;;;;ACjClE,MAAaC,yBAA2D;EACrEC,+BAAQ,UAAU;EAClBA,+BAAQ,UAAU;CACpB;;;;;;;;;;;AAgBD,MAAa,uBAAuB,EAClC,cACoD;AAIpD,QAFE,OAAO,QAAQ,uBAAuB,CACtC,MAAM,GAAG,QAAQ,OAAO,QAAQ,GACnB;;;;;mEC9BIC,MAAaC,QAAe"}
1
+ {"version":3,"file":"index.cjs","names":["BaseError","BaseError","ALEO_MAINNET_NETWORK_ID","packageName","packageVersion"],"sources":["../src/errors/InvalidAleoTransactionIdError/InvalidAleoTransactionIdError.ts","../src/errors/NotAleoProviderError/NotAleoProviderError.ts","../src/isAleoNetworkProvider/isAleoNetworkProvider.ts","../src/isAleoWalletAccount/isAleoWalletAccount.ts","../src/isAleoWalletProvider/isAleoWalletProvider.ts","../src/utils/isAleoMainnet/isAleoMainnet.ts","../src/utils/getAleoExplorerTxUrl/getAleoExplorerTxUrl.ts","../src/exports/index.ts"],"sourcesContent":["import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an input meant to be an Aleo transaction id (`at1...`) does\n * not match the bech32 pattern. Carries the offending value on `txId` for\n * inclusion in error logs / UI surfaces.\n */\nexport class InvalidAleoTransactionIdError extends BaseError {\n public readonly txId: string;\n\n constructor(params: { txId: string }) {\n super({\n cause: null,\n code: 'invalid_aleo_transaction_id_error',\n docsUrl: null,\n name: 'InvalidAleoTransactionIdError',\n shortMessage: `Invalid Aleo transaction id: ${params.txId}`,\n });\n\n this.txId = params.txId;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown by Aleo-specific top-level helpers (`signMessage`,\n * `requestTransaction`, `decrypt`, `requestRecords`) when the wallet\n * provider resolved from a wallet account is not an Aleo provider — i.e.\n * the caller passed a wallet account from a different chain. Carries the\n * offending provider's key on `providerKey`.\n */\nexport class NotAleoProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aleo_provider_error',\n docsUrl: null,\n name: 'NotAleoProviderError',\n shortMessage: 'Provider is not an Aleo wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\n\n/**\n * Type guard narrowing a generic `NetworkProvider` to `AleoNetworkProvider`.\n * Use this to filter the network-provider registry down to the Aleo\n * network providers.\n *\n * @not-instrumented\n */\nexport const isAleoNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AleoNetworkProvider => networkProvider.chain === 'ALEO';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AleoWalletAccount } from '../AleoWalletAccount.types';\n\n/**\n * Type guard narrowing a generic `WalletAccount` to `AleoWalletAccount`.\n * Use this to filter mixed-chain wallet account lists down to the Aleo\n * accounts.\n *\n * @not-instrumented\n */\nexport const isAleoWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AleoWalletAccount => walletAccount.chain === 'ALEO';\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AleoWalletProvider } from '../AleoWalletProvider.types';\n\n/**\n * Type guard narrowing a generic `WalletProvider` to `AleoWalletProvider`.\n * Returns `true` when the provider's chain is `'ALEO'`. Mirrors the\n * `is{Chain}WalletProvider` pattern used by the sibling chain packages\n * (Tron, Sui, Aptos) — exposes the Aleo-specific methods like\n * `requestTransaction`, `decrypt`, and `requestRecords` to the caller.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- standard type-guard signature shared with sibling chains\nexport const isAleoWalletProvider = (\n provider: WalletProvider | AleoWalletProvider\n): provider is AleoWalletProvider => {\n return provider.chain === 'ALEO';\n};\n","import { ALEO_MAINNET_NETWORK_ID } from '../constants';\n\n/**\n * Whether a numeric/string chain id points at the Aleo mainnet (`0`)\n * rather than a testnet. Both numeric and string ids are accepted so\n * callers can pass `walletAccount.activeNetworkId` (which is stringly-\n * typed) directly. `undefined` and `null` resolve to `false` so a\n * stale or unknown id falls back to testnet behaviour at the call\n * site.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- single primitive arg; named-arg ceremony would not improve clarity\nexport const isAleoMainnet = (\n networkId: number | string | undefined | null\n): boolean => {\n if (networkId === undefined || networkId === null) return false;\n if (typeof networkId === 'number') {\n return networkId === ALEO_MAINNET_NETWORK_ID;\n }\n return Number(networkId) === ALEO_MAINNET_NETWORK_ID;\n};\n","import { InvalidAleoTransactionIdError } from '../../errors/InvalidAleoTransactionIdError';\nimport { isAleoMainnet } from '../isAleoMainnet';\n\n/**\n * Aleo transaction ids are bech32-encoded with the `at1` prefix and a body\n * of lowercase alphanumerics — same character set as account addresses. We\n * validate strictly before letting the id reach the URL, refusing `/`, `?`,\n * `#`, `..`, etc. so a hostile id cannot produce path traversal or an open\n * redirect when the rendered URL is opened.\n */\nconst ALEO_TX_ID_PATTERN = /^at1[a-z0-9]{1,62}$/;\n\ntype GetAleoExplorerTxUrlParams = {\n /**\n * `0` = mainnet, `1` = testnet. When omitted, defaults to testnet so a\n * stale UI never accidentally links to a mainnet explorer for a testnet\n * transaction.\n */\n networkId?: number | string;\n /** Aleo transaction id (`at1...`). */\n txId: string;\n};\n\n/**\n * Build the Provable explorer URL for an Aleo transaction id.\n *\n * Examples:\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 0 })\n * → 'https://explorer.provable.com/transaction/at1abc...'\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 1 })\n * → 'https://testnet.explorer.provable.com/transaction/at1abc...'\n *\n * @throws InvalidAleoTransactionIdError when `txId` is not a well-formed\n * bech32 Aleo transaction id.\n * @not-instrumented\n */\nexport const getAleoExplorerTxUrl = ({\n txId,\n networkId,\n}: GetAleoExplorerTxUrlParams): string => {\n if (!ALEO_TX_ID_PATTERN.test(txId)) {\n throw new InvalidAleoTransactionIdError({ txId });\n }\n const subdomain = isAleoMainnet(networkId) ? '' : 'testnet.';\n return `https://${subdomain}explorer.provable.com/transaction/${txId}`;\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { AleoFeatureUnsupportedError } from '../errors/AleoFeatureUnsupportedError';\nexport { InvalidAleoTransactionIdError } from '../errors/InvalidAleoTransactionIdError';\nexport { NotAleoProviderError } from '../errors/NotAleoProviderError';\nexport { isAleoNetworkProvider } from '../isAleoNetworkProvider';\nexport { isAleoWalletAccount } from '../isAleoWalletAccount';\nexport { isAleoWalletProvider } from '../isAleoWalletProvider';\nexport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\nexport type { AleoWalletAccount } from '../AleoWalletAccount.types';\nexport type {\n AleoDecryptOptions,\n AleoRequestRecordsOptions,\n AleoTransaction,\n AleoTransition,\n AleoWalletProvider,\n} from '../AleoWalletProvider.types';\nexport { getAleoExplorerTxUrl } from '../utils/getAleoExplorerTxUrl';\nexport {\n ALEO_NETWORK_TO_ID_MAP,\n getNetworkByChainId,\n} from '../utils/getNetworkByChainId';\nexport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n MICROCREDITS_PER_CREDIT,\n} from '../utils/constants';\n"],"mappings":";;;;;;;;;;AAOA,IAAa,gCAAb,cAAmDA,mCAAU;CAC3D,AAAgB;CAEhB,YAAY,QAA0B;AACpC,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,gCAAgC,OAAO;GACtD,CAAC;AAEF,OAAK,OAAO,OAAO;;;;;;;;;;;;;ACVvB,IAAa,uBAAb,cAA0CC,mCAAU;CAClD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;;;;;;;;ACV9B,MAAa,yBACX,oBAC2C,gBAAgB,UAAU;;;;;;;;;;;ACFvE,MAAa,uBACX,kBACuC,cAAc,UAAU;;;;;;;;;;;;;ACCjE,MAAa,wBACX,aACmC;AACnC,QAAO,SAAS,UAAU;;;;;;;;;;;;;;;ACJ5B,MAAa,iBACX,cACY;AACZ,KAAI,cAAc,UAAa,cAAc,KAAM,QAAO;AAC1D,KAAI,OAAO,cAAc,SACvB,QAAO,cAAcC;AAEvB,QAAO,OAAO,UAAU,KAAKA;;;;;;;;;;;;ACV/B,MAAM,qBAAqB;;;;;;;;;;;;;;AA0B3B,MAAa,wBAAwB,EACnC,MACA,gBACwC;AACxC,KAAI,CAAC,mBAAmB,KAAK,KAAK,CAChC,OAAM,IAAI,8BAA8B,EAAE,MAAM,CAAC;AAGnD,QAAO,WADW,cAAc,UAAU,GAAG,KAAK,WACtB,oCAAoC;;;;;mECtC7CC,kCAAaC,oCAAe"}
package/dist/index.esm.js CHANGED
@@ -1,36 +1,7 @@
1
+ import { a as MICROCREDITS_PER_CREDIT, c as version, i as ALEO_TESTNET_NETWORK_ID, n as getNetworkByChainId, o as AleoFeatureUnsupportedError, r as ALEO_MAINNET_NETWORK_ID, s as name, t as ALEO_NETWORK_TO_ID_MAP } from "./getNetworkByChainId-ou5QDHJn.esm.js";
1
2
  import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
2
3
  import { BaseError } from "@dynamic-labs-sdk/client";
3
- import { Network } from "@provablehq/aleo-types";
4
4
 
5
- //#region package.json
6
- var name = "@dynamic-labs-sdk/aleo";
7
- var version = "1.0.0";
8
-
9
- //#endregion
10
- //#region src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts
11
- /**
12
- * Thrown when an Aleo wallet does not advertise a feature the caller asked
13
- * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is
14
- * invoked. Carries the feature name and the wallet display name so the
15
- * UI / logs can surface which wallet was missing what.
16
- */
17
- var AleoFeatureUnsupportedError = class extends BaseError {
18
- featureName;
19
- walletName;
20
- constructor(params) {
21
- super({
22
- cause: null,
23
- code: "aleo_feature_unsupported_error",
24
- docsUrl: null,
25
- name: "AleoFeatureUnsupportedError",
26
- shortMessage: `${params.walletName} does not support ${params.featureName}`
27
- });
28
- this.featureName = params.featureName;
29
- this.walletName = params.walletName;
30
- }
31
- };
32
-
33
- //#endregion
34
5
  //#region src/errors/InvalidAleoTransactionIdError/InvalidAleoTransactionIdError.ts
35
6
  /**
36
7
  * Thrown when an input meant to be an Aleo transaction id (`at1...`) does
@@ -111,16 +82,6 @@ const isAleoWalletProvider = (provider) => {
111
82
  return provider.chain === "ALEO";
112
83
  };
113
84
 
114
- //#endregion
115
- //#region src/utils/constants.ts
116
- /**
117
- * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.
118
- * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.
119
- */
120
- const MICROCREDITS_PER_CREDIT = 1e6;
121
- const ALEO_MAINNET_NETWORK_ID = 0;
122
- const ALEO_TESTNET_NETWORK_ID = 1;
123
-
124
85
  //#endregion
125
86
  //#region src/utils/isAleoMainnet/isAleoMainnet.ts
126
87
  /**
@@ -167,30 +128,6 @@ const getAleoExplorerTxUrl = ({ txId, networkId }) => {
167
128
  return `https://${isAleoMainnet(networkId) ? "" : "testnet."}explorer.provable.com/transaction/${txId}`;
168
129
  };
169
130
 
170
- //#endregion
171
- //#region src/utils/getNetworkByChainId/getNetworkByChainId.ts
172
- /**
173
- * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used
174
- * everywhere else in the SDK (`0` = mainnet, `1` = testnet).
175
- */
176
- const ALEO_NETWORK_TO_ID_MAP = {
177
- [Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,
178
- [Network.TESTNET]: ALEO_TESTNET_NETWORK_ID
179
- };
180
- /**
181
- * Resolve the `@provablehq/aleo-types` Network enum value for a numeric
182
- * chain id, the bridge between the SDK's chain ids and the on-chain
183
- * network identifier the Aleo libraries expect.
184
- *
185
- * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).
186
- * @returns The matching `Network` enum value, or `undefined` when the id is
187
- * not a known Aleo network.
188
- * @not-instrumented
189
- */
190
- const getNetworkByChainId = ({ chainId }) => {
191
- return Object.entries(ALEO_NETWORK_TO_ID_MAP).find(([, id]) => id === chainId)?.[0];
192
- };
193
-
194
131
  //#endregion
195
132
  //#region src/exports/index.ts
196
133
  assertPackageVersion(name, version);
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","names":["ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>>","packageName","packageVersion"],"sources":["../package.json","../src/errors/AleoFeatureUnsupportedError/AleoFeatureUnsupportedError.ts","../src/errors/InvalidAleoTransactionIdError/InvalidAleoTransactionIdError.ts","../src/errors/NotAleoProviderError/NotAleoProviderError.ts","../src/isAleoNetworkProvider/isAleoNetworkProvider.ts","../src/isAleoWalletAccount/isAleoWalletAccount.ts","../src/isAleoWalletProvider/isAleoWalletProvider.ts","../src/utils/constants.ts","../src/utils/isAleoMainnet/isAleoMainnet.ts","../src/utils/getAleoExplorerTxUrl/getAleoExplorerTxUrl.ts","../src/utils/getNetworkByChainId/getNetworkByChainId.ts","../src/exports/index.ts"],"sourcesContent":["","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an Aleo wallet does not advertise a feature the caller asked\n * for — e.g. a wallet that lacks `aleo:decrypt` when `decrypt(...)` is\n * invoked. Carries the feature name and the wallet display name so the\n * UI / logs can surface which wallet was missing what.\n */\nexport class AleoFeatureUnsupportedError extends BaseError {\n public readonly featureName: string;\n\n public readonly walletName: string;\n\n constructor(params: { featureName: string; walletName: string }) {\n super({\n cause: null,\n code: 'aleo_feature_unsupported_error',\n docsUrl: null,\n name: 'AleoFeatureUnsupportedError',\n shortMessage: `${params.walletName} does not support ${params.featureName}`,\n });\n\n this.featureName = params.featureName;\n this.walletName = params.walletName;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an input meant to be an Aleo transaction id (`at1...`) does\n * not match the bech32 pattern. Carries the offending value on `txId` for\n * inclusion in error logs / UI surfaces.\n */\nexport class InvalidAleoTransactionIdError extends BaseError {\n public readonly txId: string;\n\n constructor(params: { txId: string }) {\n super({\n cause: null,\n code: 'invalid_aleo_transaction_id_error',\n docsUrl: null,\n name: 'InvalidAleoTransactionIdError',\n shortMessage: `Invalid Aleo transaction id: ${params.txId}`,\n });\n\n this.txId = params.txId;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown by Aleo-specific top-level helpers (`signMessage`,\n * `requestTransaction`, `decrypt`, `requestRecords`) when the wallet\n * provider resolved from a wallet account is not an Aleo provider — i.e.\n * the caller passed a wallet account from a different chain. Carries the\n * offending provider's key on `providerKey`.\n */\nexport class NotAleoProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aleo_provider_error',\n docsUrl: null,\n name: 'NotAleoProviderError',\n shortMessage: 'Provider is not an Aleo wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\n\n/**\n * Type guard narrowing a generic `NetworkProvider` to `AleoNetworkProvider`.\n * Use this to filter the network-provider registry down to the Aleo\n * network providers.\n *\n * @not-instrumented\n */\nexport const isAleoNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AleoNetworkProvider => networkProvider.chain === 'ALEO';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AleoWalletAccount } from '../AleoWalletAccount.types';\n\n/**\n * Type guard narrowing a generic `WalletAccount` to `AleoWalletAccount`.\n * Use this to filter mixed-chain wallet account lists down to the Aleo\n * accounts.\n *\n * @not-instrumented\n */\nexport const isAleoWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AleoWalletAccount => walletAccount.chain === 'ALEO';\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AleoWalletProvider } from '../AleoWalletProvider.types';\n\n/**\n * Type guard narrowing a generic `WalletProvider` to `AleoWalletProvider`.\n * Returns `true` when the provider's chain is `'ALEO'`. Mirrors the\n * `is{Chain}WalletProvider` pattern used by the sibling chain packages\n * (Tron, Sui, Aptos) — exposes the Aleo-specific methods like\n * `requestTransaction`, `decrypt`, and `requestRecords` to the caller.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- standard type-guard signature shared with sibling chains\nexport const isAleoWalletProvider = (\n provider: WalletProvider | AleoWalletProvider\n): provider is AleoWalletProvider => {\n return provider.chain === 'ALEO';\n};\n","/**\n * Aleo credits are denominated in microcredits — 1 credit = 1,000,000 mc.\n * Mirrors the SUN_PER_TRX / lamports-per-sol pattern in sibling chain packages.\n */\nexport const MICROCREDITS_PER_CREDIT = 1_000_000;\n\nexport const ALEO_MAINNET_NETWORK_ID = 0;\nexport const ALEO_TESTNET_NETWORK_ID = 1;\n","import { ALEO_MAINNET_NETWORK_ID } from '../constants';\n\n/**\n * Whether a numeric/string chain id points at the Aleo mainnet (`0`)\n * rather than a testnet. Both numeric and string ids are accepted so\n * callers can pass `walletAccount.activeNetworkId` (which is stringly-\n * typed) directly. `undefined` and `null` resolve to `false` so a\n * stale or unknown id falls back to testnet behaviour at the call\n * site.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- single primitive arg; named-arg ceremony would not improve clarity\nexport const isAleoMainnet = (\n networkId: number | string | undefined | null\n): boolean => {\n if (networkId === undefined || networkId === null) return false;\n if (typeof networkId === 'number') {\n return networkId === ALEO_MAINNET_NETWORK_ID;\n }\n return Number(networkId) === ALEO_MAINNET_NETWORK_ID;\n};\n","import { InvalidAleoTransactionIdError } from '../../errors/InvalidAleoTransactionIdError';\nimport { isAleoMainnet } from '../isAleoMainnet';\n\n/**\n * Aleo transaction ids are bech32-encoded with the `at1` prefix and a body\n * of lowercase alphanumerics — same character set as account addresses. We\n * validate strictly before letting the id reach the URL, refusing `/`, `?`,\n * `#`, `..`, etc. so a hostile id cannot produce path traversal or an open\n * redirect when the rendered URL is opened.\n */\nconst ALEO_TX_ID_PATTERN = /^at1[a-z0-9]{1,62}$/;\n\ntype GetAleoExplorerTxUrlParams = {\n /**\n * `0` = mainnet, `1` = testnet. When omitted, defaults to testnet so a\n * stale UI never accidentally links to a mainnet explorer for a testnet\n * transaction.\n */\n networkId?: number | string;\n /** Aleo transaction id (`at1...`). */\n txId: string;\n};\n\n/**\n * Build the Provable explorer URL for an Aleo transaction id.\n *\n * Examples:\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 0 })\n * → 'https://explorer.provable.com/transaction/at1abc...'\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 1 })\n * → 'https://testnet.explorer.provable.com/transaction/at1abc...'\n *\n * @throws InvalidAleoTransactionIdError when `txId` is not a well-formed\n * bech32 Aleo transaction id.\n * @not-instrumented\n */\nexport const getAleoExplorerTxUrl = ({\n txId,\n networkId,\n}: GetAleoExplorerTxUrlParams): string => {\n if (!ALEO_TX_ID_PATTERN.test(txId)) {\n throw new InvalidAleoTransactionIdError({ txId });\n }\n const subdomain = isAleoMainnet(networkId) ? '' : 'testnet.';\n return `https://${subdomain}explorer.provable.com/transaction/${txId}`;\n};\n","import { Network } from '@provablehq/aleo-types';\n\nimport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n} from '../constants';\n\n/**\n * Map from `@provablehq/aleo-types` Network enum to the numeric chain id used\n * everywhere else in the SDK (`0` = mainnet, `1` = testnet).\n */\nexport const ALEO_NETWORK_TO_ID_MAP: Partial<Record<Network, number>> = {\n [Network.MAINNET]: ALEO_MAINNET_NETWORK_ID,\n [Network.TESTNET]: ALEO_TESTNET_NETWORK_ID,\n};\n\ntype GetNetworkByChainIdParams = {\n chainId: number;\n};\n\n/**\n * Resolve the `@provablehq/aleo-types` Network enum value for a numeric\n * chain id, the bridge between the SDK's chain ids and the on-chain\n * network identifier the Aleo libraries expect.\n *\n * @param params.chainId The numeric chain id (`0` = mainnet, `1` = testnet).\n * @returns The matching `Network` enum value, or `undefined` when the id is\n * not a known Aleo network.\n * @not-instrumented\n */\nexport const getNetworkByChainId = ({\n chainId,\n}: GetNetworkByChainIdParams): Network | undefined => {\n const entry = (\n Object.entries(ALEO_NETWORK_TO_ID_MAP) as [Network, number][]\n ).find(([, id]) => id === chainId);\n return entry?.[0];\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { AleoFeatureUnsupportedError } from '../errors/AleoFeatureUnsupportedError';\nexport { InvalidAleoTransactionIdError } from '../errors/InvalidAleoTransactionIdError';\nexport { NotAleoProviderError } from '../errors/NotAleoProviderError';\nexport { isAleoNetworkProvider } from '../isAleoNetworkProvider';\nexport { isAleoWalletAccount } from '../isAleoWalletAccount';\nexport { isAleoWalletProvider } from '../isAleoWalletProvider';\nexport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\nexport type { AleoWalletAccount } from '../AleoWalletAccount.types';\nexport type {\n AleoDecryptOptions,\n AleoRequestRecordsOptions,\n AleoTransaction,\n AleoTransition,\n AleoWalletProvider,\n} from '../AleoWalletProvider.types';\nexport { getAleoExplorerTxUrl } from '../utils/getAleoExplorerTxUrl';\nexport {\n ALEO_NETWORK_TO_ID_MAP,\n getNetworkByChainId,\n} from '../utils/getNetworkByChainId';\nexport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n MICROCREDITS_PER_CREDIT,\n} from '../utils/constants';\n"],"mappings":";;;;;;;;;;;;;;;;ACQA,IAAa,8BAAb,cAAiD,UAAU;CACzD,AAAgB;CAEhB,AAAgB;CAEhB,YAAY,QAAqD;AAC/D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,GAAG,OAAO,WAAW,oBAAoB,OAAO;GAC/D,CAAC;AAEF,OAAK,cAAc,OAAO;AAC1B,OAAK,aAAa,OAAO;;;;;;;;;;;AChB7B,IAAa,gCAAb,cAAmD,UAAU;CAC3D,AAAgB;CAEhB,YAAY,QAA0B;AACpC,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,gCAAgC,OAAO;GACtD,CAAC;AAEF,OAAK,OAAO,OAAO;;;;;;;;;;;;;ACVvB,IAAa,uBAAb,cAA0C,UAAU;CAClD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;;;;;;;;ACV9B,MAAa,yBACX,oBAC2C,gBAAgB,UAAU;;;;;;;;;;;ACFvE,MAAa,uBACX,kBACuC,cAAc,UAAU;;;;;;;;;;;;;ACCjE,MAAa,wBACX,aACmC;AACnC,QAAO,SAAS,UAAU;;;;;;;;;ACb5B,MAAa,0BAA0B;AAEvC,MAAa,0BAA0B;AACvC,MAAa,0BAA0B;;;;;;;;;;;;;;ACMvC,MAAa,iBACX,cACY;AACZ,KAAI,cAAc,UAAa,cAAc,KAAM,QAAO;AAC1D,KAAI,OAAO,cAAc,SACvB,QAAO,cAAc;AAEvB,QAAO,OAAO,UAAU,KAAK;;;;;;;;;;;;ACV/B,MAAM,qBAAqB;;;;;;;;;;;;;;AA0B3B,MAAa,wBAAwB,EACnC,MACA,gBACwC;AACxC,KAAI,CAAC,mBAAmB,KAAK,KAAK,CAChC,OAAM,IAAI,8BAA8B,EAAE,MAAM,CAAC;AAGnD,QAAO,WADW,cAAc,UAAU,GAAG,KAAK,WACtB,oCAAoC;;;;;;;;;ACjClE,MAAaA,yBAA2D;EACrE,QAAQ,UAAU;EAClB,QAAQ,UAAU;CACpB;;;;;;;;;;;AAgBD,MAAa,uBAAuB,EAClC,cACoD;AAIpD,QAFE,OAAO,QAAQ,uBAAuB,CACtC,MAAM,GAAG,QAAQ,OAAO,QAAQ,GACnB;;;;;AC9BjB,qBAAqBC,MAAaC,QAAe"}
1
+ {"version":3,"file":"index.esm.js","names":["packageName","packageVersion"],"sources":["../src/errors/InvalidAleoTransactionIdError/InvalidAleoTransactionIdError.ts","../src/errors/NotAleoProviderError/NotAleoProviderError.ts","../src/isAleoNetworkProvider/isAleoNetworkProvider.ts","../src/isAleoWalletAccount/isAleoWalletAccount.ts","../src/isAleoWalletProvider/isAleoWalletProvider.ts","../src/utils/isAleoMainnet/isAleoMainnet.ts","../src/utils/getAleoExplorerTxUrl/getAleoExplorerTxUrl.ts","../src/exports/index.ts"],"sourcesContent":["import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when an input meant to be an Aleo transaction id (`at1...`) does\n * not match the bech32 pattern. Carries the offending value on `txId` for\n * inclusion in error logs / UI surfaces.\n */\nexport class InvalidAleoTransactionIdError extends BaseError {\n public readonly txId: string;\n\n constructor(params: { txId: string }) {\n super({\n cause: null,\n code: 'invalid_aleo_transaction_id_error',\n docsUrl: null,\n name: 'InvalidAleoTransactionIdError',\n shortMessage: `Invalid Aleo transaction id: ${params.txId}`,\n });\n\n this.txId = params.txId;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown by Aleo-specific top-level helpers (`signMessage`,\n * `requestTransaction`, `decrypt`, `requestRecords`) when the wallet\n * provider resolved from a wallet account is not an Aleo provider — i.e.\n * the caller passed a wallet account from a different chain. Carries the\n * offending provider's key on `providerKey`.\n */\nexport class NotAleoProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aleo_provider_error',\n docsUrl: null,\n name: 'NotAleoProviderError',\n shortMessage: 'Provider is not an Aleo wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\n\n/**\n * Type guard narrowing a generic `NetworkProvider` to `AleoNetworkProvider`.\n * Use this to filter the network-provider registry down to the Aleo\n * network providers.\n *\n * @not-instrumented\n */\nexport const isAleoNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AleoNetworkProvider => networkProvider.chain === 'ALEO';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AleoWalletAccount } from '../AleoWalletAccount.types';\n\n/**\n * Type guard narrowing a generic `WalletAccount` to `AleoWalletAccount`.\n * Use this to filter mixed-chain wallet account lists down to the Aleo\n * accounts.\n *\n * @not-instrumented\n */\nexport const isAleoWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AleoWalletAccount => walletAccount.chain === 'ALEO';\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AleoWalletProvider } from '../AleoWalletProvider.types';\n\n/**\n * Type guard narrowing a generic `WalletProvider` to `AleoWalletProvider`.\n * Returns `true` when the provider's chain is `'ALEO'`. Mirrors the\n * `is{Chain}WalletProvider` pattern used by the sibling chain packages\n * (Tron, Sui, Aptos) — exposes the Aleo-specific methods like\n * `requestTransaction`, `decrypt`, and `requestRecords` to the caller.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- standard type-guard signature shared with sibling chains\nexport const isAleoWalletProvider = (\n provider: WalletProvider | AleoWalletProvider\n): provider is AleoWalletProvider => {\n return provider.chain === 'ALEO';\n};\n","import { ALEO_MAINNET_NETWORK_ID } from '../constants';\n\n/**\n * Whether a numeric/string chain id points at the Aleo mainnet (`0`)\n * rather than a testnet. Both numeric and string ids are accepted so\n * callers can pass `walletAccount.activeNetworkId` (which is stringly-\n * typed) directly. `undefined` and `null` resolve to `false` so a\n * stale or unknown id falls back to testnet behaviour at the call\n * site.\n *\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param -- single primitive arg; named-arg ceremony would not improve clarity\nexport const isAleoMainnet = (\n networkId: number | string | undefined | null\n): boolean => {\n if (networkId === undefined || networkId === null) return false;\n if (typeof networkId === 'number') {\n return networkId === ALEO_MAINNET_NETWORK_ID;\n }\n return Number(networkId) === ALEO_MAINNET_NETWORK_ID;\n};\n","import { InvalidAleoTransactionIdError } from '../../errors/InvalidAleoTransactionIdError';\nimport { isAleoMainnet } from '../isAleoMainnet';\n\n/**\n * Aleo transaction ids are bech32-encoded with the `at1` prefix and a body\n * of lowercase alphanumerics — same character set as account addresses. We\n * validate strictly before letting the id reach the URL, refusing `/`, `?`,\n * `#`, `..`, etc. so a hostile id cannot produce path traversal or an open\n * redirect when the rendered URL is opened.\n */\nconst ALEO_TX_ID_PATTERN = /^at1[a-z0-9]{1,62}$/;\n\ntype GetAleoExplorerTxUrlParams = {\n /**\n * `0` = mainnet, `1` = testnet. When omitted, defaults to testnet so a\n * stale UI never accidentally links to a mainnet explorer for a testnet\n * transaction.\n */\n networkId?: number | string;\n /** Aleo transaction id (`at1...`). */\n txId: string;\n};\n\n/**\n * Build the Provable explorer URL for an Aleo transaction id.\n *\n * Examples:\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 0 })\n * → 'https://explorer.provable.com/transaction/at1abc...'\n * getAleoExplorerTxUrl({ txId: 'at1abc...', networkId: 1 })\n * → 'https://testnet.explorer.provable.com/transaction/at1abc...'\n *\n * @throws InvalidAleoTransactionIdError when `txId` is not a well-formed\n * bech32 Aleo transaction id.\n * @not-instrumented\n */\nexport const getAleoExplorerTxUrl = ({\n txId,\n networkId,\n}: GetAleoExplorerTxUrlParams): string => {\n if (!ALEO_TX_ID_PATTERN.test(txId)) {\n throw new InvalidAleoTransactionIdError({ txId });\n }\n const subdomain = isAleoMainnet(networkId) ? '' : 'testnet.';\n return `https://${subdomain}explorer.provable.com/transaction/${txId}`;\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { AleoFeatureUnsupportedError } from '../errors/AleoFeatureUnsupportedError';\nexport { InvalidAleoTransactionIdError } from '../errors/InvalidAleoTransactionIdError';\nexport { NotAleoProviderError } from '../errors/NotAleoProviderError';\nexport { isAleoNetworkProvider } from '../isAleoNetworkProvider';\nexport { isAleoWalletAccount } from '../isAleoWalletAccount';\nexport { isAleoWalletProvider } from '../isAleoWalletProvider';\nexport type { AleoNetworkProvider } from '../AleoNetworkProvider.types';\nexport type { AleoWalletAccount } from '../AleoWalletAccount.types';\nexport type {\n AleoDecryptOptions,\n AleoRequestRecordsOptions,\n AleoTransaction,\n AleoTransition,\n AleoWalletProvider,\n} from '../AleoWalletProvider.types';\nexport { getAleoExplorerTxUrl } from '../utils/getAleoExplorerTxUrl';\nexport {\n ALEO_NETWORK_TO_ID_MAP,\n getNetworkByChainId,\n} from '../utils/getNetworkByChainId';\nexport {\n ALEO_MAINNET_NETWORK_ID,\n ALEO_TESTNET_NETWORK_ID,\n MICROCREDITS_PER_CREDIT,\n} from '../utils/constants';\n"],"mappings":";;;;;;;;;;AAOA,IAAa,gCAAb,cAAmD,UAAU;CAC3D,AAAgB;CAEhB,YAAY,QAA0B;AACpC,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,gCAAgC,OAAO;GACtD,CAAC;AAEF,OAAK,OAAO,OAAO;;;;;;;;;;;;;ACVvB,IAAa,uBAAb,cAA0C,UAAU;CAClD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;;;;;;;;ACV9B,MAAa,yBACX,oBAC2C,gBAAgB,UAAU;;;;;;;;;;;ACFvE,MAAa,uBACX,kBACuC,cAAc,UAAU;;;;;;;;;;;;;ACCjE,MAAa,wBACX,aACmC;AACnC,QAAO,SAAS,UAAU;;;;;;;;;;;;;;;ACJ5B,MAAa,iBACX,cACY;AACZ,KAAI,cAAc,UAAa,cAAc,KAAM,QAAO;AAC1D,KAAI,OAAO,cAAc,SACvB,QAAO,cAAc;AAEvB,QAAO,OAAO,UAAU,KAAK;;;;;;;;;;;;ACV/B,MAAM,qBAAqB;;;;;;;;;;;;;;AA0B3B,MAAa,wBAAwB,EACnC,MACA,gBACwC;AACxC,KAAI,CAAC,mBAAmB,KAAK,KAAK,CAChC,OAAM,IAAI,8BAA8B,EAAE,MAAM,CAAC;AAGnD,QAAO,WADW,cAAc,UAAU,GAAG,KAAK,WACtB,oCAAoC;;;;;ACtClE,qBAAqBA,MAAaC,QAAe"}