@dynamic-labs-wallet/aleo 0.0.353 → 0.1.0-request-signing
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/index.cjs.js +66 -145
- package/index.esm.js +67 -146
- package/package.json +4 -3
- package/src/client/client.d.ts +16 -11
- package/src/client/client.d.ts.map +1 -1
- package/src/client/constants.d.ts +5 -1
- package/src/client/constants.d.ts.map +1 -1
- package/src/client/feemasterClient.d.ts +3 -10
- package/src/client/feemasterClient.d.ts.map +1 -1
- package/src/client/redcoastRecordScanner.d.ts +2 -4
- package/src/client/redcoastRecordScanner.d.ts.map +1 -1
- /package/{index.cjs.d.ts → index.d.ts} +0 -0
package/index.cjs.js
CHANGED
|
@@ -27,10 +27,12 @@ var AleoSdkTestnet__namespace = /*#__PURE__*/_interopNamespaceDefault(AleoSdkTes
|
|
|
27
27
|
var ERROR_KEYGEN_FAILED = 'Error with Aleo keygen';
|
|
28
28
|
var ERROR_CREATE_WALLET_ACCOUNT = 'Error creating Aleo wallet account';
|
|
29
29
|
var ERROR_ACCOUNT_ADDRESS_REQUIRED = 'Account address is required';
|
|
30
|
-
var
|
|
30
|
+
var ERROR_EXPORT_PRIVATE_KEY_NOT_SUPPORTED = 'Aleo private key export is not supported — MPC-generated keys cannot be reconstructed into an importable format';
|
|
31
31
|
var ERROR_IMPORT_PRIVATE_KEY_NOT_SUPPORTED = 'Aleo importPrivateKey is not supported yet';
|
|
32
|
-
var ERROR_SIGN_MESSAGE_NOT_SUPPORTED = 'Aleo signMessage is not supported yet — pending arbitrary-bytes EdBls12377 signing';
|
|
33
32
|
var ERROR_SIGN_TRANSACTION_NOT_SUPPORTED = 'Aleo signTransaction is not supported yet — coming in Phase 2';
|
|
33
|
+
var ERROR_MESSAGE_REQUIRED = 'Message is required';
|
|
34
|
+
/** Sodot's EdBls12377.signBytes cap on the packed message size. */ var MAX_SIGN_MESSAGE_BYTES = 128 * 1024;
|
|
35
|
+
var ERROR_MESSAGE_TOO_LARGE = "Message exceeds the maximum allowed size of ".concat(MAX_SIGN_MESSAGE_BYTES, " bytes");
|
|
34
36
|
var ALEO_NETWORKS = {
|
|
35
37
|
MAINNET: 'mainnet',
|
|
36
38
|
TESTNET: 'testnet'
|
|
@@ -1051,64 +1053,6 @@ var RedcoastRecordScanner = /*#__PURE__*/ function() {
|
|
|
1051
1053
|
return RedcoastRecordScanner;
|
|
1052
1054
|
}();
|
|
1053
1055
|
|
|
1054
|
-
/**
|
|
1055
|
-
* Encodes Sodot's raw EdBls12377 private key export into Aleo's canonical
|
|
1056
|
-
* bech32 form (`APrivateKey1zk…`) using the Provable SDK.
|
|
1057
|
-
*
|
|
1058
|
-
* The MPC ceremony's `exportFullPrivateKey` returns the reconstructed private
|
|
1059
|
-
* key as a hex-encoded byte string. Aleo's snarkVM `PrivateKey` is built from
|
|
1060
|
-
* the first 32 bytes of that material (the canonical seed scalar); the
|
|
1061
|
-
* Provable SDK's `PrivateKey.fromBytesLe` is lenient about trailing bytes,
|
|
1062
|
-
* but we slice explicitly to 32 so the encoder behaves identically across
|
|
1063
|
-
* SDK versions.
|
|
1064
|
-
*
|
|
1065
|
-
* Sanity check: after encoding we re-derive the address from the resulting
|
|
1066
|
-
* `PrivateKey` and assert it matches the wallet's address, so a corrupted /
|
|
1067
|
-
* truncated export can't silently surface a key for the wrong account.
|
|
1068
|
-
*
|
|
1069
|
-
* `expectedAddress` is required even though encoding is technically
|
|
1070
|
-
* network-agnostic: the address derivation is the only end-to-end signal
|
|
1071
|
-
* that the seed bytes are intact, so we always run it.
|
|
1072
|
-
*/ var ALEO_PRIVATE_KEY_BECH32_PREFIX = 'APrivateKey1';
|
|
1073
|
-
var ALEO_PRIVATE_KEY_SEED_BYTES = 32;
|
|
1074
|
-
var HEX_PREFIX = '0x';
|
|
1075
|
-
var HEX_REGEX = /^[0-9a-fA-F]+$/;
|
|
1076
|
-
var stripHexPrefix = function(value) {
|
|
1077
|
-
return value.startsWith(HEX_PREFIX) ? value.slice(HEX_PREFIX.length) : value;
|
|
1078
|
-
};
|
|
1079
|
-
var hexToBytes = function(hex) {
|
|
1080
|
-
var evenHex = hex.length % 2 === 0 ? hex : hex.slice(0, -1);
|
|
1081
|
-
var _evenHex_match;
|
|
1082
|
-
var matched = (_evenHex_match = evenHex.match(/.{2}/g)) !== null && _evenHex_match !== void 0 ? _evenHex_match : [];
|
|
1083
|
-
return new Uint8Array(matched.map(function(byte) {
|
|
1084
|
-
return Number.parseInt(byte, 16);
|
|
1085
|
-
}));
|
|
1086
|
-
};
|
|
1087
|
-
var encodeAleoPrivateKey = function(param) {
|
|
1088
|
-
var rawKey = param.rawKey, expectedAddress = param.expectedAddress, sdk = param.sdk;
|
|
1089
|
-
if (!rawKey) {
|
|
1090
|
-
throw new Error('Cannot encode empty Aleo private key');
|
|
1091
|
-
}
|
|
1092
|
-
if (rawKey.startsWith(ALEO_PRIVATE_KEY_BECH32_PREFIX)) {
|
|
1093
|
-
return rawKey;
|
|
1094
|
-
}
|
|
1095
|
-
var hex = stripHexPrefix(rawKey);
|
|
1096
|
-
if (!HEX_REGEX.test(hex)) {
|
|
1097
|
-
throw new Error('Aleo private key export is neither bech32 nor hex');
|
|
1098
|
-
}
|
|
1099
|
-
var bytes = hexToBytes(hex);
|
|
1100
|
-
if (bytes.length < ALEO_PRIVATE_KEY_SEED_BYTES) {
|
|
1101
|
-
throw new Error("Aleo private key export is ".concat(bytes.length, " bytes; expected at least ").concat(ALEO_PRIVATE_KEY_SEED_BYTES));
|
|
1102
|
-
}
|
|
1103
|
-
var seedBytes = bytes.slice(0, ALEO_PRIVATE_KEY_SEED_BYTES);
|
|
1104
|
-
var privateKey = sdk.PrivateKey.from_seed_unchecked(seedBytes);
|
|
1105
|
-
var derivedAddress = privateKey.to_address().to_string();
|
|
1106
|
-
if (derivedAddress !== expectedAddress) {
|
|
1107
|
-
throw new Error("Encoded Aleo private key derives ".concat(derivedAddress, ", expected ").concat(expectedAddress));
|
|
1108
|
-
}
|
|
1109
|
-
return privateKey.to_string();
|
|
1110
|
-
};
|
|
1111
|
-
|
|
1112
1056
|
function _array_like_to_array(arr, len) {
|
|
1113
1057
|
if (len == null || len > arr.length) len = arr.length;
|
|
1114
1058
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -1516,26 +1460,10 @@ var lookupSealanceConfig = function(programId) {
|
|
|
1516
1460
|
};
|
|
1517
1461
|
var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
1518
1462
|
_inherits(DynamicAleoWalletClient, DynamicWalletClient);
|
|
1519
|
-
function DynamicAleoWalletClient(
|
|
1520
|
-
var environmentId = param.environmentId, authToken = param.authToken, baseApiUrl = param.baseApiUrl, baseMPCRelayApiUrl = param.baseMPCRelayApiUrl, storageKey = param.storageKey, debug = param.debug, featureFlags = param.featureFlags, _param_authMode = param.authMode, authMode = _param_authMode === void 0 ? browser.AuthMode.HEADER : _param_authMode, sdkVersion = param.sdkVersion, forwardMPCClient = param.forwardMPCClient, logger = param.logger;
|
|
1463
|
+
function DynamicAleoWalletClient() {
|
|
1521
1464
|
_class_call_check(this, DynamicAleoWalletClient);
|
|
1522
1465
|
var _this;
|
|
1523
|
-
_this = _call_super(this, DynamicAleoWalletClient,
|
|
1524
|
-
{
|
|
1525
|
-
environmentId: environmentId,
|
|
1526
|
-
authToken: authToken,
|
|
1527
|
-
baseApiUrl: baseApiUrl,
|
|
1528
|
-
baseMPCRelayApiUrl: baseMPCRelayApiUrl,
|
|
1529
|
-
storageKey: storageKey,
|
|
1530
|
-
debug: debug,
|
|
1531
|
-
featureFlags: featureFlags,
|
|
1532
|
-
authMode: authMode,
|
|
1533
|
-
sdkVersion: sdkVersion,
|
|
1534
|
-
forwardMPCClient: forwardMPCClient,
|
|
1535
|
-
logger: logger
|
|
1536
|
-
},
|
|
1537
|
-
internalOptions
|
|
1538
|
-
]), _define_property(_this, "chainName", 'ALEO'), /**
|
|
1466
|
+
_this = _call_super(this, DynamicAleoWalletClient, arguments), _define_property(_this, "chainName", 'ALEO'), /**
|
|
1539
1467
|
* Cached ProgramManager per Aleo network. The SDK ships separate
|
|
1540
1468
|
* mainnet/testnet builds (`@provablehq/sdk/{mainnet,testnet}.js`) that
|
|
1541
1469
|
* export network-specific class identities — `ExecutionRequest`,
|
|
@@ -1581,7 +1509,7 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1581
1509
|
{
|
|
1582
1510
|
key: "createWalletAccount",
|
|
1583
1511
|
value: function createWalletAccount(param) {
|
|
1584
|
-
var thresholdSignatureScheme = param.thresholdSignatureScheme, _param_password = param.password, password = _param_password === void 0 ? undefined : _param_password, onError = param.onError, signedSessionId = param.signedSessionId;
|
|
1512
|
+
var thresholdSignatureScheme = param.thresholdSignatureScheme, _param_password = param.password, password = _param_password === void 0 ? undefined : _param_password, onError = param.onError, signedSessionId = param.signedSessionId, businessAccountId = param.businessAccountId;
|
|
1585
1513
|
var _this = this;
|
|
1586
1514
|
return _async_to_generator(function() {
|
|
1587
1515
|
var ceremonyCompleteResolver, ceremonyCompletePromise, serverAccountAddress, _ref, rawPublicKey, clientKeyShares, firstShare, accountAddress, publicKeyHex, pubKeyBytes, error, detail;
|
|
@@ -1601,9 +1529,11 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1601
1529
|
4,
|
|
1602
1530
|
_this.keyGen({
|
|
1603
1531
|
chainName: _this.chainName,
|
|
1532
|
+
businessAccountId: businessAccountId,
|
|
1604
1533
|
thresholdSignatureScheme: thresholdSignatureScheme,
|
|
1605
1534
|
onError: onError,
|
|
1606
|
-
onCeremonyComplete: function(
|
|
1535
|
+
onCeremonyComplete: function(param) {
|
|
1536
|
+
var accountAddress = param.accountAddress, walletId = param.walletId, shareSetId = param.shareSetId;
|
|
1607
1537
|
var chainConfig = browser.getMPCChainConfig(_this.chainName);
|
|
1608
1538
|
serverAccountAddress = accountAddress;
|
|
1609
1539
|
_this.initializeWalletMapEntry({
|
|
@@ -1616,7 +1546,8 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1616
1546
|
index,
|
|
1617
1547
|
value
|
|
1618
1548
|
];
|
|
1619
|
-
})))
|
|
1549
|
+
}))),
|
|
1550
|
+
shareSetId: shareSetId
|
|
1620
1551
|
});
|
|
1621
1552
|
ceremonyCompleteResolver(undefined);
|
|
1622
1553
|
},
|
|
@@ -1658,7 +1589,8 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1658
1589
|
accountAddress: accountAddress,
|
|
1659
1590
|
clientKeyShares: clientKeyShares,
|
|
1660
1591
|
password: password,
|
|
1661
|
-
signedSessionId: signedSessionId
|
|
1592
|
+
signedSessionId: signedSessionId,
|
|
1593
|
+
businessAccountId: businessAccountId
|
|
1662
1594
|
})
|
|
1663
1595
|
];
|
|
1664
1596
|
case 4:
|
|
@@ -1678,7 +1610,7 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1678
1610
|
];
|
|
1679
1611
|
case 5:
|
|
1680
1612
|
error = _state.sent();
|
|
1681
|
-
if (_instanceof(error, Error) && error.message === browser.ERROR_PASSWORD_MISMATCH) {
|
|
1613
|
+
if (_instanceof(error, Error) && (error.message === browser.ERROR_PASSWORD_MISMATCH || error.message === browser.ERROR_MULTIPLE_WALLETS_PER_CHAIN)) {
|
|
1682
1614
|
throw error;
|
|
1683
1615
|
}
|
|
1684
1616
|
_this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
|
|
@@ -1695,14 +1627,56 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1695
1627
|
},
|
|
1696
1628
|
{
|
|
1697
1629
|
key: "signMessage",
|
|
1698
|
-
value:
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1630
|
+
value: /**
|
|
1631
|
+
* Signs arbitrary bytes as an Aleo Schnorr signature via Sodot's
|
|
1632
|
+
* EdBls12377.signBytes, matching snarkVM's `Signature::sign_bytes` /
|
|
1633
|
+
* `verify_bytes`. Routed through the shared `sign()` pipeline like every
|
|
1634
|
+
* other chain; the pipeline UTF-8-encodes the resulting bech32 `sign1...`
|
|
1635
|
+
* string into bytes to satisfy its Uint8Array return type, so it's decoded
|
|
1636
|
+
* back to a string here.
|
|
1637
|
+
*/ function signMessage(param) {
|
|
1638
|
+
var message = param.message, accountAddress = param.accountAddress, password = param.password, signedSessionId = param.signedSessionId, mfaToken = param.mfaToken, elevatedAccessToken = param.elevatedAccessToken, context = param.context, approvalQuorum = param.approvalQuorum, onError = param.onError, traceContext = param.traceContext;
|
|
1639
|
+
var _this = this;
|
|
1703
1640
|
return _async_to_generator(function() {
|
|
1641
|
+
var resolvedContext, signature;
|
|
1704
1642
|
return _ts_generator(this, function(_state) {
|
|
1705
|
-
|
|
1643
|
+
switch(_state.label){
|
|
1644
|
+
case 0:
|
|
1645
|
+
if (!accountAddress) {
|
|
1646
|
+
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
1647
|
+
}
|
|
1648
|
+
if (!message) {
|
|
1649
|
+
throw new Error(ERROR_MESSAGE_REQUIRED);
|
|
1650
|
+
}
|
|
1651
|
+
if (Buffer.byteLength(message, 'utf-8') > MAX_SIGN_MESSAGE_BYTES) {
|
|
1652
|
+
throw new Error(ERROR_MESSAGE_TOO_LARGE);
|
|
1653
|
+
}
|
|
1654
|
+
resolvedContext = _object_spread_props(_object_spread({}, context), {
|
|
1655
|
+
aleoMessage: message
|
|
1656
|
+
});
|
|
1657
|
+
return [
|
|
1658
|
+
4,
|
|
1659
|
+
_this.sign({
|
|
1660
|
+
accountAddress: accountAddress,
|
|
1661
|
+
message: message,
|
|
1662
|
+
chainName: _this.chainName,
|
|
1663
|
+
password: password,
|
|
1664
|
+
signedSessionId: signedSessionId,
|
|
1665
|
+
mfaToken: mfaToken,
|
|
1666
|
+
elevatedAccessToken: elevatedAccessToken,
|
|
1667
|
+
context: resolvedContext,
|
|
1668
|
+
approvalQuorum: approvalQuorum,
|
|
1669
|
+
onError: onError,
|
|
1670
|
+
traceContext: traceContext
|
|
1671
|
+
})
|
|
1672
|
+
];
|
|
1673
|
+
case 1:
|
|
1674
|
+
signature = _state.sent();
|
|
1675
|
+
return [
|
|
1676
|
+
2,
|
|
1677
|
+
Buffer.from(signature).toString('utf-8')
|
|
1678
|
+
];
|
|
1679
|
+
}
|
|
1706
1680
|
});
|
|
1707
1681
|
})();
|
|
1708
1682
|
}
|
|
@@ -1725,64 +1699,11 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1725
1699
|
},
|
|
1726
1700
|
{
|
|
1727
1701
|
key: "exportPrivateKey",
|
|
1728
|
-
value:
|
|
1729
|
-
|
|
1730
|
-
var _this = this;
|
|
1702
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1703
|
+
function exportPrivateKey(_args) {
|
|
1731
1704
|
return _async_to_generator(function() {
|
|
1732
|
-
var derivedPrivateKey, error;
|
|
1733
1705
|
return _ts_generator(this, function(_state) {
|
|
1734
|
-
|
|
1735
|
-
case 0:
|
|
1736
|
-
_state.trys.push([
|
|
1737
|
-
0,
|
|
1738
|
-
2,
|
|
1739
|
-
,
|
|
1740
|
-
3
|
|
1741
|
-
]);
|
|
1742
|
-
if (!accountAddress) {
|
|
1743
|
-
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
1744
|
-
}
|
|
1745
|
-
return [
|
|
1746
|
-
4,
|
|
1747
|
-
_this.exportKey({
|
|
1748
|
-
accountAddress: accountAddress,
|
|
1749
|
-
chainName: _this.chainName,
|
|
1750
|
-
password: password,
|
|
1751
|
-
signedSessionId: signedSessionId,
|
|
1752
|
-
mfaToken: mfaToken,
|
|
1753
|
-
elevatedAccessToken: elevatedAccessToken
|
|
1754
|
-
})
|
|
1755
|
-
];
|
|
1756
|
-
case 1:
|
|
1757
|
-
derivedPrivateKey = _state.sent().derivedPrivateKey;
|
|
1758
|
-
if (!derivedPrivateKey) {
|
|
1759
|
-
throw new Error('Derived private key is undefined');
|
|
1760
|
-
}
|
|
1761
|
-
// Sodot's EdBls12377 `exportFullPrivateKey` returns the raw scalar as a
|
|
1762
|
-
// hex string. Aleo wallets / explorers consume the bech32 `APrivateKey1zk…`
|
|
1763
|
-
// form, so we encode via the Provable SDK before returning. Bech32
|
|
1764
|
-
// encoding is network-agnostic (same HRP on testnet and mainnet) so we
|
|
1765
|
-
// use the testnet build, which is already loaded eagerly.
|
|
1766
|
-
return [
|
|
1767
|
-
2,
|
|
1768
|
-
encodeAleoPrivateKey({
|
|
1769
|
-
rawKey: derivedPrivateKey,
|
|
1770
|
-
expectedAddress: accountAddress,
|
|
1771
|
-
sdk: AleoSdkTestnet__namespace
|
|
1772
|
-
})
|
|
1773
|
-
];
|
|
1774
|
-
case 2:
|
|
1775
|
-
error = _state.sent();
|
|
1776
|
-
if (_instanceof(error, Error) && error.message === browser.ERROR_PASSWORD_MISMATCH) {
|
|
1777
|
-
throw error;
|
|
1778
|
-
}
|
|
1779
|
-
_this.logger.error(ERROR_EXPORT_PRIVATE_KEY, error);
|
|
1780
|
-
throw new Error(ERROR_EXPORT_PRIVATE_KEY);
|
|
1781
|
-
case 3:
|
|
1782
|
-
return [
|
|
1783
|
-
2
|
|
1784
|
-
];
|
|
1785
|
-
}
|
|
1706
|
+
throw new Error(ERROR_EXPORT_PRIVATE_KEY_NOT_SUPPORTED);
|
|
1786
1707
|
});
|
|
1787
1708
|
})();
|
|
1788
1709
|
}
|
package/index.esm.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DynamicWalletClient, ERROR_PASSWORD_MISMATCH, ERROR_MULTIPLE_WALLETS_PER_CHAIN, getMPCChainConfig, EdBls12377KeygenResult, getMPCSigner, EdBls12377 } from '@dynamic-labs-wallet/browser';
|
|
2
2
|
import * as AleoSdkMainnet from '@provablehq/sdk/mainnet.js';
|
|
3
3
|
import * as AleoSdkTestnet from '@provablehq/sdk/testnet.js';
|
|
4
4
|
|
|
5
5
|
var ERROR_KEYGEN_FAILED = 'Error with Aleo keygen';
|
|
6
6
|
var ERROR_CREATE_WALLET_ACCOUNT = 'Error creating Aleo wallet account';
|
|
7
7
|
var ERROR_ACCOUNT_ADDRESS_REQUIRED = 'Account address is required';
|
|
8
|
-
var
|
|
8
|
+
var ERROR_EXPORT_PRIVATE_KEY_NOT_SUPPORTED = 'Aleo private key export is not supported — MPC-generated keys cannot be reconstructed into an importable format';
|
|
9
9
|
var ERROR_IMPORT_PRIVATE_KEY_NOT_SUPPORTED = 'Aleo importPrivateKey is not supported yet';
|
|
10
|
-
var ERROR_SIGN_MESSAGE_NOT_SUPPORTED = 'Aleo signMessage is not supported yet — pending arbitrary-bytes EdBls12377 signing';
|
|
11
10
|
var ERROR_SIGN_TRANSACTION_NOT_SUPPORTED = 'Aleo signTransaction is not supported yet — coming in Phase 2';
|
|
11
|
+
var ERROR_MESSAGE_REQUIRED = 'Message is required';
|
|
12
|
+
/** Sodot's EdBls12377.signBytes cap on the packed message size. */ var MAX_SIGN_MESSAGE_BYTES = 128 * 1024;
|
|
13
|
+
var ERROR_MESSAGE_TOO_LARGE = "Message exceeds the maximum allowed size of ".concat(MAX_SIGN_MESSAGE_BYTES, " bytes");
|
|
12
14
|
var ALEO_NETWORKS = {
|
|
13
15
|
MAINNET: 'mainnet',
|
|
14
16
|
TESTNET: 'testnet'
|
|
@@ -1029,64 +1031,6 @@ var RedcoastRecordScanner = /*#__PURE__*/ function() {
|
|
|
1029
1031
|
return RedcoastRecordScanner;
|
|
1030
1032
|
}();
|
|
1031
1033
|
|
|
1032
|
-
/**
|
|
1033
|
-
* Encodes Sodot's raw EdBls12377 private key export into Aleo's canonical
|
|
1034
|
-
* bech32 form (`APrivateKey1zk…`) using the Provable SDK.
|
|
1035
|
-
*
|
|
1036
|
-
* The MPC ceremony's `exportFullPrivateKey` returns the reconstructed private
|
|
1037
|
-
* key as a hex-encoded byte string. Aleo's snarkVM `PrivateKey` is built from
|
|
1038
|
-
* the first 32 bytes of that material (the canonical seed scalar); the
|
|
1039
|
-
* Provable SDK's `PrivateKey.fromBytesLe` is lenient about trailing bytes,
|
|
1040
|
-
* but we slice explicitly to 32 so the encoder behaves identically across
|
|
1041
|
-
* SDK versions.
|
|
1042
|
-
*
|
|
1043
|
-
* Sanity check: after encoding we re-derive the address from the resulting
|
|
1044
|
-
* `PrivateKey` and assert it matches the wallet's address, so a corrupted /
|
|
1045
|
-
* truncated export can't silently surface a key for the wrong account.
|
|
1046
|
-
*
|
|
1047
|
-
* `expectedAddress` is required even though encoding is technically
|
|
1048
|
-
* network-agnostic: the address derivation is the only end-to-end signal
|
|
1049
|
-
* that the seed bytes are intact, so we always run it.
|
|
1050
|
-
*/ var ALEO_PRIVATE_KEY_BECH32_PREFIX = 'APrivateKey1';
|
|
1051
|
-
var ALEO_PRIVATE_KEY_SEED_BYTES = 32;
|
|
1052
|
-
var HEX_PREFIX = '0x';
|
|
1053
|
-
var HEX_REGEX = /^[0-9a-fA-F]+$/;
|
|
1054
|
-
var stripHexPrefix = function(value) {
|
|
1055
|
-
return value.startsWith(HEX_PREFIX) ? value.slice(HEX_PREFIX.length) : value;
|
|
1056
|
-
};
|
|
1057
|
-
var hexToBytes = function(hex) {
|
|
1058
|
-
var evenHex = hex.length % 2 === 0 ? hex : hex.slice(0, -1);
|
|
1059
|
-
var _evenHex_match;
|
|
1060
|
-
var matched = (_evenHex_match = evenHex.match(/.{2}/g)) !== null && _evenHex_match !== void 0 ? _evenHex_match : [];
|
|
1061
|
-
return new Uint8Array(matched.map(function(byte) {
|
|
1062
|
-
return Number.parseInt(byte, 16);
|
|
1063
|
-
}));
|
|
1064
|
-
};
|
|
1065
|
-
var encodeAleoPrivateKey = function(param) {
|
|
1066
|
-
var rawKey = param.rawKey, expectedAddress = param.expectedAddress, sdk = param.sdk;
|
|
1067
|
-
if (!rawKey) {
|
|
1068
|
-
throw new Error('Cannot encode empty Aleo private key');
|
|
1069
|
-
}
|
|
1070
|
-
if (rawKey.startsWith(ALEO_PRIVATE_KEY_BECH32_PREFIX)) {
|
|
1071
|
-
return rawKey;
|
|
1072
|
-
}
|
|
1073
|
-
var hex = stripHexPrefix(rawKey);
|
|
1074
|
-
if (!HEX_REGEX.test(hex)) {
|
|
1075
|
-
throw new Error('Aleo private key export is neither bech32 nor hex');
|
|
1076
|
-
}
|
|
1077
|
-
var bytes = hexToBytes(hex);
|
|
1078
|
-
if (bytes.length < ALEO_PRIVATE_KEY_SEED_BYTES) {
|
|
1079
|
-
throw new Error("Aleo private key export is ".concat(bytes.length, " bytes; expected at least ").concat(ALEO_PRIVATE_KEY_SEED_BYTES));
|
|
1080
|
-
}
|
|
1081
|
-
var seedBytes = bytes.slice(0, ALEO_PRIVATE_KEY_SEED_BYTES);
|
|
1082
|
-
var privateKey = sdk.PrivateKey.from_seed_unchecked(seedBytes);
|
|
1083
|
-
var derivedAddress = privateKey.to_address().to_string();
|
|
1084
|
-
if (derivedAddress !== expectedAddress) {
|
|
1085
|
-
throw new Error("Encoded Aleo private key derives ".concat(derivedAddress, ", expected ").concat(expectedAddress));
|
|
1086
|
-
}
|
|
1087
|
-
return privateKey.to_string();
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
1034
|
function _array_like_to_array(arr, len) {
|
|
1091
1035
|
if (len == null || len > arr.length) len = arr.length;
|
|
1092
1036
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -1494,26 +1438,10 @@ var lookupSealanceConfig = function(programId) {
|
|
|
1494
1438
|
};
|
|
1495
1439
|
var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
1496
1440
|
_inherits(DynamicAleoWalletClient, DynamicWalletClient);
|
|
1497
|
-
function DynamicAleoWalletClient(
|
|
1498
|
-
var environmentId = param.environmentId, authToken = param.authToken, baseApiUrl = param.baseApiUrl, baseMPCRelayApiUrl = param.baseMPCRelayApiUrl, storageKey = param.storageKey, debug = param.debug, featureFlags = param.featureFlags, _param_authMode = param.authMode, authMode = _param_authMode === void 0 ? AuthMode.HEADER : _param_authMode, sdkVersion = param.sdkVersion, forwardMPCClient = param.forwardMPCClient, logger = param.logger;
|
|
1441
|
+
function DynamicAleoWalletClient() {
|
|
1499
1442
|
_class_call_check(this, DynamicAleoWalletClient);
|
|
1500
1443
|
var _this;
|
|
1501
|
-
_this = _call_super(this, DynamicAleoWalletClient,
|
|
1502
|
-
{
|
|
1503
|
-
environmentId: environmentId,
|
|
1504
|
-
authToken: authToken,
|
|
1505
|
-
baseApiUrl: baseApiUrl,
|
|
1506
|
-
baseMPCRelayApiUrl: baseMPCRelayApiUrl,
|
|
1507
|
-
storageKey: storageKey,
|
|
1508
|
-
debug: debug,
|
|
1509
|
-
featureFlags: featureFlags,
|
|
1510
|
-
authMode: authMode,
|
|
1511
|
-
sdkVersion: sdkVersion,
|
|
1512
|
-
forwardMPCClient: forwardMPCClient,
|
|
1513
|
-
logger: logger
|
|
1514
|
-
},
|
|
1515
|
-
internalOptions
|
|
1516
|
-
]), _define_property(_this, "chainName", 'ALEO'), /**
|
|
1444
|
+
_this = _call_super(this, DynamicAleoWalletClient, arguments), _define_property(_this, "chainName", 'ALEO'), /**
|
|
1517
1445
|
* Cached ProgramManager per Aleo network. The SDK ships separate
|
|
1518
1446
|
* mainnet/testnet builds (`@provablehq/sdk/{mainnet,testnet}.js`) that
|
|
1519
1447
|
* export network-specific class identities — `ExecutionRequest`,
|
|
@@ -1559,7 +1487,7 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1559
1487
|
{
|
|
1560
1488
|
key: "createWalletAccount",
|
|
1561
1489
|
value: function createWalletAccount(param) {
|
|
1562
|
-
var thresholdSignatureScheme = param.thresholdSignatureScheme, _param_password = param.password, password = _param_password === void 0 ? undefined : _param_password, onError = param.onError, signedSessionId = param.signedSessionId;
|
|
1490
|
+
var thresholdSignatureScheme = param.thresholdSignatureScheme, _param_password = param.password, password = _param_password === void 0 ? undefined : _param_password, onError = param.onError, signedSessionId = param.signedSessionId, businessAccountId = param.businessAccountId;
|
|
1563
1491
|
var _this = this;
|
|
1564
1492
|
return _async_to_generator(function() {
|
|
1565
1493
|
var ceremonyCompleteResolver, ceremonyCompletePromise, serverAccountAddress, _ref, rawPublicKey, clientKeyShares, firstShare, accountAddress, publicKeyHex, pubKeyBytes, error, detail;
|
|
@@ -1579,9 +1507,11 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1579
1507
|
4,
|
|
1580
1508
|
_this.keyGen({
|
|
1581
1509
|
chainName: _this.chainName,
|
|
1510
|
+
businessAccountId: businessAccountId,
|
|
1582
1511
|
thresholdSignatureScheme: thresholdSignatureScheme,
|
|
1583
1512
|
onError: onError,
|
|
1584
|
-
onCeremonyComplete: function(
|
|
1513
|
+
onCeremonyComplete: function(param) {
|
|
1514
|
+
var accountAddress = param.accountAddress, walletId = param.walletId, shareSetId = param.shareSetId;
|
|
1585
1515
|
var chainConfig = getMPCChainConfig(_this.chainName);
|
|
1586
1516
|
serverAccountAddress = accountAddress;
|
|
1587
1517
|
_this.initializeWalletMapEntry({
|
|
@@ -1594,7 +1524,8 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1594
1524
|
index,
|
|
1595
1525
|
value
|
|
1596
1526
|
];
|
|
1597
|
-
})))
|
|
1527
|
+
}))),
|
|
1528
|
+
shareSetId: shareSetId
|
|
1598
1529
|
});
|
|
1599
1530
|
ceremonyCompleteResolver(undefined);
|
|
1600
1531
|
},
|
|
@@ -1636,7 +1567,8 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1636
1567
|
accountAddress: accountAddress,
|
|
1637
1568
|
clientKeyShares: clientKeyShares,
|
|
1638
1569
|
password: password,
|
|
1639
|
-
signedSessionId: signedSessionId
|
|
1570
|
+
signedSessionId: signedSessionId,
|
|
1571
|
+
businessAccountId: businessAccountId
|
|
1640
1572
|
})
|
|
1641
1573
|
];
|
|
1642
1574
|
case 4:
|
|
@@ -1656,7 +1588,7 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1656
1588
|
];
|
|
1657
1589
|
case 5:
|
|
1658
1590
|
error = _state.sent();
|
|
1659
|
-
if (_instanceof(error, Error) && error.message === ERROR_PASSWORD_MISMATCH) {
|
|
1591
|
+
if (_instanceof(error, Error) && (error.message === ERROR_PASSWORD_MISMATCH || error.message === ERROR_MULTIPLE_WALLETS_PER_CHAIN)) {
|
|
1660
1592
|
throw error;
|
|
1661
1593
|
}
|
|
1662
1594
|
_this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
|
|
@@ -1673,14 +1605,56 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1673
1605
|
},
|
|
1674
1606
|
{
|
|
1675
1607
|
key: "signMessage",
|
|
1676
|
-
value:
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1608
|
+
value: /**
|
|
1609
|
+
* Signs arbitrary bytes as an Aleo Schnorr signature via Sodot's
|
|
1610
|
+
* EdBls12377.signBytes, matching snarkVM's `Signature::sign_bytes` /
|
|
1611
|
+
* `verify_bytes`. Routed through the shared `sign()` pipeline like every
|
|
1612
|
+
* other chain; the pipeline UTF-8-encodes the resulting bech32 `sign1...`
|
|
1613
|
+
* string into bytes to satisfy its Uint8Array return type, so it's decoded
|
|
1614
|
+
* back to a string here.
|
|
1615
|
+
*/ function signMessage(param) {
|
|
1616
|
+
var message = param.message, accountAddress = param.accountAddress, password = param.password, signedSessionId = param.signedSessionId, mfaToken = param.mfaToken, elevatedAccessToken = param.elevatedAccessToken, context = param.context, approvalQuorum = param.approvalQuorum, onError = param.onError, traceContext = param.traceContext;
|
|
1617
|
+
var _this = this;
|
|
1681
1618
|
return _async_to_generator(function() {
|
|
1619
|
+
var resolvedContext, signature;
|
|
1682
1620
|
return _ts_generator(this, function(_state) {
|
|
1683
|
-
|
|
1621
|
+
switch(_state.label){
|
|
1622
|
+
case 0:
|
|
1623
|
+
if (!accountAddress) {
|
|
1624
|
+
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
1625
|
+
}
|
|
1626
|
+
if (!message) {
|
|
1627
|
+
throw new Error(ERROR_MESSAGE_REQUIRED);
|
|
1628
|
+
}
|
|
1629
|
+
if (Buffer.byteLength(message, 'utf-8') > MAX_SIGN_MESSAGE_BYTES) {
|
|
1630
|
+
throw new Error(ERROR_MESSAGE_TOO_LARGE);
|
|
1631
|
+
}
|
|
1632
|
+
resolvedContext = _object_spread_props(_object_spread({}, context), {
|
|
1633
|
+
aleoMessage: message
|
|
1634
|
+
});
|
|
1635
|
+
return [
|
|
1636
|
+
4,
|
|
1637
|
+
_this.sign({
|
|
1638
|
+
accountAddress: accountAddress,
|
|
1639
|
+
message: message,
|
|
1640
|
+
chainName: _this.chainName,
|
|
1641
|
+
password: password,
|
|
1642
|
+
signedSessionId: signedSessionId,
|
|
1643
|
+
mfaToken: mfaToken,
|
|
1644
|
+
elevatedAccessToken: elevatedAccessToken,
|
|
1645
|
+
context: resolvedContext,
|
|
1646
|
+
approvalQuorum: approvalQuorum,
|
|
1647
|
+
onError: onError,
|
|
1648
|
+
traceContext: traceContext
|
|
1649
|
+
})
|
|
1650
|
+
];
|
|
1651
|
+
case 1:
|
|
1652
|
+
signature = _state.sent();
|
|
1653
|
+
return [
|
|
1654
|
+
2,
|
|
1655
|
+
Buffer.from(signature).toString('utf-8')
|
|
1656
|
+
];
|
|
1657
|
+
}
|
|
1684
1658
|
});
|
|
1685
1659
|
})();
|
|
1686
1660
|
}
|
|
@@ -1703,64 +1677,11 @@ var DynamicAleoWalletClient = /*#__PURE__*/ function(DynamicWalletClient) {
|
|
|
1703
1677
|
},
|
|
1704
1678
|
{
|
|
1705
1679
|
key: "exportPrivateKey",
|
|
1706
|
-
value:
|
|
1707
|
-
|
|
1708
|
-
var _this = this;
|
|
1680
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1681
|
+
function exportPrivateKey(_args) {
|
|
1709
1682
|
return _async_to_generator(function() {
|
|
1710
|
-
var derivedPrivateKey, error;
|
|
1711
1683
|
return _ts_generator(this, function(_state) {
|
|
1712
|
-
|
|
1713
|
-
case 0:
|
|
1714
|
-
_state.trys.push([
|
|
1715
|
-
0,
|
|
1716
|
-
2,
|
|
1717
|
-
,
|
|
1718
|
-
3
|
|
1719
|
-
]);
|
|
1720
|
-
if (!accountAddress) {
|
|
1721
|
-
throw new Error(ERROR_ACCOUNT_ADDRESS_REQUIRED);
|
|
1722
|
-
}
|
|
1723
|
-
return [
|
|
1724
|
-
4,
|
|
1725
|
-
_this.exportKey({
|
|
1726
|
-
accountAddress: accountAddress,
|
|
1727
|
-
chainName: _this.chainName,
|
|
1728
|
-
password: password,
|
|
1729
|
-
signedSessionId: signedSessionId,
|
|
1730
|
-
mfaToken: mfaToken,
|
|
1731
|
-
elevatedAccessToken: elevatedAccessToken
|
|
1732
|
-
})
|
|
1733
|
-
];
|
|
1734
|
-
case 1:
|
|
1735
|
-
derivedPrivateKey = _state.sent().derivedPrivateKey;
|
|
1736
|
-
if (!derivedPrivateKey) {
|
|
1737
|
-
throw new Error('Derived private key is undefined');
|
|
1738
|
-
}
|
|
1739
|
-
// Sodot's EdBls12377 `exportFullPrivateKey` returns the raw scalar as a
|
|
1740
|
-
// hex string. Aleo wallets / explorers consume the bech32 `APrivateKey1zk…`
|
|
1741
|
-
// form, so we encode via the Provable SDK before returning. Bech32
|
|
1742
|
-
// encoding is network-agnostic (same HRP on testnet and mainnet) so we
|
|
1743
|
-
// use the testnet build, which is already loaded eagerly.
|
|
1744
|
-
return [
|
|
1745
|
-
2,
|
|
1746
|
-
encodeAleoPrivateKey({
|
|
1747
|
-
rawKey: derivedPrivateKey,
|
|
1748
|
-
expectedAddress: accountAddress,
|
|
1749
|
-
sdk: AleoSdkTestnet
|
|
1750
|
-
})
|
|
1751
|
-
];
|
|
1752
|
-
case 2:
|
|
1753
|
-
error = _state.sent();
|
|
1754
|
-
if (_instanceof(error, Error) && error.message === ERROR_PASSWORD_MISMATCH) {
|
|
1755
|
-
throw error;
|
|
1756
|
-
}
|
|
1757
|
-
_this.logger.error(ERROR_EXPORT_PRIVATE_KEY, error);
|
|
1758
|
-
throw new Error(ERROR_EXPORT_PRIVATE_KEY);
|
|
1759
|
-
case 3:
|
|
1760
|
-
return [
|
|
1761
|
-
2
|
|
1762
|
-
];
|
|
1763
|
-
}
|
|
1684
|
+
throw new Error(ERROR_EXPORT_PRIVATE_KEY_NOT_SUPPORTED);
|
|
1764
1685
|
});
|
|
1765
1686
|
})();
|
|
1766
1687
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/aleo",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-request-signing",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/browser": "0.0
|
|
8
|
-
"@dynamic-labs-wallet/core": "0.0
|
|
7
|
+
"@dynamic-labs-wallet/browser": "0.1.0-request-signing",
|
|
8
|
+
"@dynamic-labs-wallet/core": "0.1.0-request-signing",
|
|
9
|
+
"@dynamic-labs/sdk-api-core": "0.193.0",
|
|
9
10
|
"@provablehq/sdk": "0.10.4"
|
|
10
11
|
},
|
|
11
12
|
"publishConfig": {
|
package/src/client/client.d.ts
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
|
-
import { DynamicWalletClient, type
|
|
1
|
+
import { DynamicWalletClient, type MPCSigner, type RequestWithElevatedAccessToken, type ThresholdSignatureScheme, type WalletProperties, type BaseSignParams } from '@dynamic-labs-wallet/browser';
|
|
2
2
|
export declare class DynamicAleoWalletClient extends DynamicWalletClient {
|
|
3
3
|
readonly chainName = "ALEO";
|
|
4
|
-
|
|
5
|
-
createWalletAccount({ thresholdSignatureScheme, password, onError, signedSessionId, }: {
|
|
4
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, signedSessionId, businessAccountId, }: {
|
|
6
5
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
7
6
|
password?: string;
|
|
8
7
|
onError?: (error: Error) => void;
|
|
9
8
|
signedSessionId: string;
|
|
9
|
+
businessAccountId?: string;
|
|
10
10
|
}): Promise<{
|
|
11
11
|
accountAddress: string;
|
|
12
12
|
publicKeyHex: string;
|
|
13
13
|
rawPublicKey: Uint8Array;
|
|
14
14
|
}>;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Signs arbitrary bytes as an Aleo Schnorr signature via Sodot's
|
|
17
|
+
* EdBls12377.signBytes, matching snarkVM's `Signature::sign_bytes` /
|
|
18
|
+
* `verify_bytes`. Routed through the shared `sign()` pipeline like every
|
|
19
|
+
* other chain; the pipeline UTF-8-encodes the resulting bech32 `sign1...`
|
|
20
|
+
* string into bytes to satisfy its Uint8Array return type, so it's decoded
|
|
21
|
+
* back to a string here.
|
|
22
|
+
*/
|
|
23
|
+
signMessage({ message, accountAddress, password, signedSessionId, mfaToken, elevatedAccessToken, context, approvalQuorum, onError, traceContext, }: {
|
|
16
24
|
message: string;
|
|
17
25
|
accountAddress: string;
|
|
18
|
-
|
|
19
|
-
signedSessionId: string;
|
|
20
|
-
mfaToken?: string;
|
|
21
|
-
elevatedAccessToken?: string;
|
|
22
|
-
}): Promise<string>;
|
|
26
|
+
} & BaseSignParams): Promise<string>;
|
|
23
27
|
signTransaction(args: {
|
|
24
28
|
accountAddress: string;
|
|
25
29
|
signedSessionId: string;
|
|
26
30
|
}): Promise<string>;
|
|
27
|
-
exportPrivateKey(
|
|
31
|
+
exportPrivateKey(_args: {
|
|
28
32
|
accountAddress: string;
|
|
29
33
|
password?: string;
|
|
30
34
|
signedSessionId: string;
|
|
31
35
|
mfaToken?: string;
|
|
32
|
-
|
|
36
|
+
elevatedAccessToken?: string;
|
|
37
|
+
}): Promise<string>;
|
|
33
38
|
importPrivateKey(_args: {
|
|
34
39
|
privateKey: string;
|
|
35
40
|
chainName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EAOnB,KAAK,SAAS,EACd,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AA2GtC,qBAAa,uBAAwB,SAAQ,mBAAmB;IAC9D,QAAQ,CAAC,SAAS,UAAU;IAEtB,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,EACP,eAAe,EACf,iBAAiB,GAClB,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;QACjC,eAAe,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,UAAU,CAAC;KAC1B,CAAC;IAqFF;;;;;;;OAOG;IACG,WAAW,CAAC,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,OAAO,EACP,cAAc,EACd,OAAO,EACP,YAAY,GACb,EAAE;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AC,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;wDAEgD;QAChD,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,CAAC,GACD,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;YAsBpB,qBAAqB;IAyDnC;;;;OAIG;YACW,kBAAkB;IAahC;;;;OAIG;YACW,sBAAsB;IAepC;;;;;;OAMG;YACW,wBAAwB;IAyDtC;;;;OAIG;YACW,qBAAqB;IA+BnC;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAqCzB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;CAgB7B"}
|
|
@@ -2,9 +2,13 @@ export declare const ERROR_KEYGEN_FAILED = "Error with Aleo keygen";
|
|
|
2
2
|
export declare const ERROR_CREATE_WALLET_ACCOUNT = "Error creating Aleo wallet account";
|
|
3
3
|
export declare const ERROR_ACCOUNT_ADDRESS_REQUIRED = "Account address is required";
|
|
4
4
|
export declare const ERROR_EXPORT_PRIVATE_KEY = "Error exporting Aleo private key";
|
|
5
|
+
export declare const ERROR_EXPORT_PRIVATE_KEY_NOT_SUPPORTED = "Aleo private key export is not supported \u2014 MPC-generated keys cannot be reconstructed into an importable format";
|
|
5
6
|
export declare const ERROR_IMPORT_PRIVATE_KEY_NOT_SUPPORTED = "Aleo importPrivateKey is not supported yet";
|
|
6
|
-
export declare const ERROR_SIGN_MESSAGE_NOT_SUPPORTED = "Aleo signMessage is not supported yet \u2014 pending arbitrary-bytes EdBls12377 signing";
|
|
7
7
|
export declare const ERROR_SIGN_TRANSACTION_NOT_SUPPORTED = "Aleo signTransaction is not supported yet \u2014 coming in Phase 2";
|
|
8
|
+
export declare const ERROR_MESSAGE_REQUIRED = "Message is required";
|
|
9
|
+
/** Sodot's EdBls12377.signBytes cap on the packed message size. */
|
|
10
|
+
export declare const MAX_SIGN_MESSAGE_BYTES: number;
|
|
11
|
+
export declare const ERROR_MESSAGE_TOO_LARGE = "Message exceeds the maximum allowed size of 131072 bytes";
|
|
8
12
|
export declare const ALEO_NETWORKS: {
|
|
9
13
|
readonly MAINNET: "mainnet";
|
|
10
14
|
readonly TESTNET: "testnet";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,2BAA2B,uCAAuC,CAAC;AAChF,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,sCAAsC,+CAA+C,CAAC;AACnG,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,2BAA2B,uCAAuC,CAAC;AAChF,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,sCAAsC,yHACgE,CAAC;AACpH,eAAO,MAAM,sCAAsC,+CAA+C,CAAC;AACnG,eAAO,MAAM,oCAAoC,uEAAkE,CAAC;AACpH,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAE5D,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,QAAa,CAAC;AACjD,eAAO,MAAM,uBAAuB,6DAAgF,CAAC;AAErH,eAAO,MAAM,aAAa;;;CAGhB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,oCAAoC,CAAC;AAE7E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -18,16 +18,9 @@
|
|
|
18
18
|
* so call sites in `proveTransaction` don't change.
|
|
19
19
|
*/
|
|
20
20
|
import type { DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
allowed_functions?: string[] | null;
|
|
25
|
-
}
|
|
26
|
-
export interface FeemasterPolicy {
|
|
27
|
-
/** `null` means all programs are sponsored (wildcard). */
|
|
28
|
-
allowed_programs: FeemasterPolicyEntry[] | null;
|
|
29
|
-
}
|
|
30
|
-
export type FeemasterNetwork = 'mainnet' | 'testnet';
|
|
21
|
+
export type FeemasterPolicyEntry = NonNullable<FeemasterPolicy['allowed_programs']>[number];
|
|
22
|
+
export type FeemasterPolicy = Awaited<ReturnType<DynamicApiClient['getAleoFeemasterPolicy']>>;
|
|
23
|
+
export type FeemasterNetwork = Parameters<DynamicApiClient['getAleoFeemasterPolicy']>[0]['network'];
|
|
31
24
|
export declare class FeemasterClient {
|
|
32
25
|
private readonly apiClient;
|
|
33
26
|
private readonly network;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feemasterClient.d.ts","sourceRoot":"","sources":["../../src/client/feemasterClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,
|
|
1
|
+
{"version":3,"file":"feemasterClient.d.ts","sourceRoot":"","sources":["../../src/client/feemasterClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;AAE9F,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAIpG,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,WAAW,CAA8D;gBAErE,IAAI,EAAE;QAAE,SAAS,EAAE,gBAAgB,CAAC;QAAC,OAAO,EAAE,gBAAgB,CAAA;KAAE;IAK5E;0EACsE;IAChE,WAAW,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAW1D;;sEAEkE;IAC5D,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAwB1E;;;kCAG8B;IACxB,uBAAuB,CAAC,MAAM,EAAE;QACpC,oEAAoE;QACpE,mBAAmB,EAAE,MAAM,CAAC;QAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC;QAAE,sBAAsB,EAAE,MAAM,CAAA;KAAE,CAAC;CAQhD"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* `DynamicAleoWalletClient.findOwnedRecordsInner` doesn't change.
|
|
21
21
|
*/
|
|
22
22
|
import type { DynamicApiClient } from '@dynamic-labs-wallet/core';
|
|
23
|
-
export type RedcoastRecordScannerNetwork = '
|
|
23
|
+
export type RedcoastRecordScannerNetwork = Parameters<DynamicApiClient['getAleoScannerPubkey']>[0]['network'];
|
|
24
24
|
interface ProvableSdkLike {
|
|
25
25
|
/** `encryptRegistrationRequest(public_key: string, viewKey: ViewKey, start: number) → ciphertext (base64).`
|
|
26
26
|
* Exported by both `@provablehq/sdk/testnet.js` and `mainnet.js`. */
|
|
@@ -28,9 +28,7 @@ interface ProvableSdkLike {
|
|
|
28
28
|
}
|
|
29
29
|
export type RegisterResult = {
|
|
30
30
|
ok: true;
|
|
31
|
-
data:
|
|
32
|
-
uuid: string;
|
|
33
|
-
} & Record<string, unknown>;
|
|
31
|
+
data: Awaited<ReturnType<DynamicApiClient['registerAleoScanner']>>;
|
|
34
32
|
} | {
|
|
35
33
|
ok: false;
|
|
36
34
|
status?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redcoastRecordScanner.d.ts","sourceRoot":"","sources":["../../src/client/redcoastRecordScanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,4BAA4B,GAAG,
|
|
1
|
+
{"version":3,"file":"redcoastRecordScanner.d.ts","sourceRoot":"","sources":["../../src/client/redcoastRecordScanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAE9G,UAAU,eAAe;IACvB;0EACsE;IACtE,0BAA0B,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5F;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;CAAE,GAChF;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,iBA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