@dynamic-labs-wallet/node 0.0.321 → 0.0.323
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 +11 -8
- package/index.esm.js +11 -9
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -72,12 +72,8 @@ const base64ToBytes = (base64)=>{
|
|
|
72
72
|
const ensureBase64Padding = (str)=>{
|
|
73
73
|
return str.padEnd(Math.ceil(str.length / 4) * 4, '=');
|
|
74
74
|
};
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const hex = str.startsWith('0x') ? str.slice(2) : str;
|
|
78
|
-
// Check if string contains only hex characters
|
|
79
|
-
return /^[0-9A-Fa-f]+$/.test(hex);
|
|
80
|
-
};
|
|
75
|
+
const stripHexPrefix = (str)=>str.startsWith('0x') ? str.slice(2) : str;
|
|
76
|
+
const isHexString = (str)=>/^[0-9A-Fa-f]+$/.test(stripHexPrefix(str));
|
|
81
77
|
const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
82
78
|
var _params_walletProperties, _params_walletProperties_keyShares_;
|
|
83
79
|
const backups = {
|
|
@@ -1440,7 +1436,10 @@ class DynamicWalletClient {
|
|
|
1440
1436
|
}
|
|
1441
1437
|
// Get backup info from server
|
|
1442
1438
|
const user = await this.apiClient.getUser(uuid.v4());
|
|
1443
|
-
const walletData = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>
|
|
1439
|
+
const walletData = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>{
|
|
1440
|
+
var _vc_address;
|
|
1441
|
+
return ((_vc_address = vc.address) == null ? void 0 : _vc_address.toLowerCase()) === accountAddress.toLowerCase();
|
|
1442
|
+
});
|
|
1444
1443
|
return getExternalServerKeyShareBackupInfo({
|
|
1445
1444
|
walletProperties: walletData == null ? void 0 : walletData.walletProperties
|
|
1446
1445
|
});
|
|
@@ -1533,7 +1532,10 @@ class DynamicWalletClient {
|
|
|
1533
1532
|
this.logger.debug('getWaasWalletByAddress endpoint not available, falling back to getUser()');
|
|
1534
1533
|
// Fallback to getUser() approach
|
|
1535
1534
|
const user = await this.apiClient.getUser(uuid.v4());
|
|
1536
|
-
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>
|
|
1535
|
+
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>{
|
|
1536
|
+
var _vc_address;
|
|
1537
|
+
return vc.walletName === 'dynamicwaas' && ((_vc_address = vc.address) == null ? void 0 : _vc_address.toLowerCase()) === accountAddress.toLowerCase();
|
|
1538
|
+
});
|
|
1537
1539
|
if (!wallet) {
|
|
1538
1540
|
return null;
|
|
1539
1541
|
}
|
|
@@ -1877,6 +1879,7 @@ exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
|
|
|
1877
1879
|
exports.retryPromise = retryPromise;
|
|
1878
1880
|
exports.revokeDelegation = revokeDelegation;
|
|
1879
1881
|
exports.stringToBytes = stringToBytes;
|
|
1882
|
+
exports.stripHexPrefix = stripHexPrefix;
|
|
1880
1883
|
Object.keys(core).forEach(function (k) {
|
|
1881
1884
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1882
1885
|
enumerable: true,
|
package/index.esm.js
CHANGED
|
@@ -71,12 +71,8 @@ const base64ToBytes = (base64)=>{
|
|
|
71
71
|
const ensureBase64Padding = (str)=>{
|
|
72
72
|
return str.padEnd(Math.ceil(str.length / 4) * 4, '=');
|
|
73
73
|
};
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const hex = str.startsWith('0x') ? str.slice(2) : str;
|
|
77
|
-
// Check if string contains only hex characters
|
|
78
|
-
return /^[0-9A-Fa-f]+$/.test(hex);
|
|
79
|
-
};
|
|
74
|
+
const stripHexPrefix = (str)=>str.startsWith('0x') ? str.slice(2) : str;
|
|
75
|
+
const isHexString = (str)=>/^[0-9A-Fa-f]+$/.test(stripHexPrefix(str));
|
|
80
76
|
const getExternalServerKeyShareBackupInfo = (params)=>{
|
|
81
77
|
var _params_walletProperties, _params_walletProperties_keyShares_;
|
|
82
78
|
const backups = {
|
|
@@ -1439,7 +1435,10 @@ class DynamicWalletClient {
|
|
|
1439
1435
|
}
|
|
1440
1436
|
// Get backup info from server
|
|
1441
1437
|
const user = await this.apiClient.getUser(v4());
|
|
1442
|
-
const walletData = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>
|
|
1438
|
+
const walletData = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>{
|
|
1439
|
+
var _vc_address;
|
|
1440
|
+
return ((_vc_address = vc.address) == null ? void 0 : _vc_address.toLowerCase()) === accountAddress.toLowerCase();
|
|
1441
|
+
});
|
|
1443
1442
|
return getExternalServerKeyShareBackupInfo({
|
|
1444
1443
|
walletProperties: walletData == null ? void 0 : walletData.walletProperties
|
|
1445
1444
|
});
|
|
@@ -1532,7 +1531,10 @@ class DynamicWalletClient {
|
|
|
1532
1531
|
this.logger.debug('getWaasWalletByAddress endpoint not available, falling back to getUser()');
|
|
1533
1532
|
// Fallback to getUser() approach
|
|
1534
1533
|
const user = await this.apiClient.getUser(v4());
|
|
1535
|
-
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>
|
|
1534
|
+
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>{
|
|
1535
|
+
var _vc_address;
|
|
1536
|
+
return vc.walletName === 'dynamicwaas' && ((_vc_address = vc.address) == null ? void 0 : _vc_address.toLowerCase()) === accountAddress.toLowerCase();
|
|
1537
|
+
});
|
|
1536
1538
|
if (!wallet) {
|
|
1537
1539
|
return null;
|
|
1538
1540
|
}
|
|
@@ -1842,4 +1844,4 @@ const revokeDelegation = async (client, walletId)=>{
|
|
|
1842
1844
|
}
|
|
1843
1845
|
};
|
|
1844
1846
|
|
|
1845
|
-
export { DynamicWalletClient, base64ToBytes, bytesToBase64, createDelegatedWalletClient, createLogError, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, logError, mergeUniqueKeyShares, retryPromise, revokeDelegation, stringToBytes };
|
|
1847
|
+
export { DynamicWalletClient, base64ToBytes, bytesToBase64, createDelegatedWalletClient, createLogError, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, logError, mergeUniqueKeyShares, retryPromise, revokeDelegation, stringToBytes, stripHexPrefix };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.323",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.323",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "0.5.5",
|
|
9
9
|
"@dynamic-labs/logger": "^4.45.2",
|
|
10
10
|
"@dynamic-labs/sdk-api-core": "^0.0.900",
|