@getpara/core-sdk 3.0.0-alpha.0 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/shares/enclave.js +3 -3
- package/dist/cjs/utils/formatting.js +5 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/shares/enclave.js +3 -3
- package/dist/esm/utils/formatting.js +4 -0
- package/dist/types/utils/formatting.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/constants.js
CHANGED
|
@@ -46,7 +46,7 @@ __export(constants_exports, {
|
|
|
46
46
|
TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(constants_exports);
|
|
49
|
-
const PARA_CORE_VERSION = "3.0.0-alpha.
|
|
49
|
+
const PARA_CORE_VERSION = "3.0.0-alpha.1";
|
|
50
50
|
const PREFIX = "@CAPSULE/";
|
|
51
51
|
const PARA_PREFIX = "@PARA/";
|
|
52
52
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
@@ -244,7 +244,7 @@ ${exportedAsBase64}
|
|
|
244
244
|
const response = yield this.userManagementClient.retrieveEnclaveShares(encryptedPayloadStr);
|
|
245
245
|
const encryptedResponse = JSON.parse(response.payload);
|
|
246
246
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
247
|
-
return decryptedData.shares;
|
|
247
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
deleteShares() {
|
|
@@ -286,13 +286,13 @@ ${exportedAsBase64}
|
|
|
286
286
|
};
|
|
287
287
|
const encryptedPayload = yield this.encryptForEnclave(JSON.stringify(payload));
|
|
288
288
|
const encryptedPayloadStr = JSON.stringify(encryptedPayload);
|
|
289
|
-
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr);
|
|
289
|
+
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr, query.walletIds);
|
|
290
290
|
if (!response.payload) {
|
|
291
291
|
return [];
|
|
292
292
|
}
|
|
293
293
|
const encryptedResponse = JSON.parse(response.payload);
|
|
294
294
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
295
|
-
return decryptedData.shares;
|
|
295
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
296
296
|
} catch (error) {
|
|
297
297
|
throw new Error(
|
|
298
298
|
`Failed to retrieve pregen shares for user ${query.userId}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
@@ -27,6 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var formatting_exports = {};
|
|
29
29
|
__export(formatting_exports, {
|
|
30
|
+
base58ToBase64: () => base58ToBase64,
|
|
30
31
|
compressPubkey: () => compressPubkey,
|
|
31
32
|
decimalToHex: () => decimalToHex,
|
|
32
33
|
getCosmosAddress: () => getCosmosAddress,
|
|
@@ -51,6 +52,9 @@ function hexStringToBase64(hexString) {
|
|
|
51
52
|
}
|
|
52
53
|
return Buffer.from(hexString, "hex").toString("base64");
|
|
53
54
|
}
|
|
55
|
+
function base58ToBase64(base58Str) {
|
|
56
|
+
return Buffer.from(base58Decode(base58Str)).toString("base64");
|
|
57
|
+
}
|
|
54
58
|
function hexToSignature(hexSig) {
|
|
55
59
|
return {
|
|
56
60
|
r: `0x${hexSig.slice(2, 66)}`,
|
|
@@ -202,6 +206,7 @@ function truncateAddress(str, addressType, {
|
|
|
202
206
|
}
|
|
203
207
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204
208
|
0 && (module.exports = {
|
|
209
|
+
base58ToBase64,
|
|
205
210
|
compressPubkey,
|
|
206
211
|
decimalToHex,
|
|
207
212
|
getCosmosAddress,
|
package/dist/esm/constants.js
CHANGED
|
@@ -205,7 +205,7 @@ ${exportedAsBase64}
|
|
|
205
205
|
const response = yield this.userManagementClient.retrieveEnclaveShares(encryptedPayloadStr);
|
|
206
206
|
const encryptedResponse = JSON.parse(response.payload);
|
|
207
207
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
208
|
-
return decryptedData.shares;
|
|
208
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
deleteShares() {
|
|
@@ -247,13 +247,13 @@ ${exportedAsBase64}
|
|
|
247
247
|
};
|
|
248
248
|
const encryptedPayload = yield this.encryptForEnclave(JSON.stringify(payload));
|
|
249
249
|
const encryptedPayloadStr = JSON.stringify(encryptedPayload);
|
|
250
|
-
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr);
|
|
250
|
+
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr, query.walletIds);
|
|
251
251
|
if (!response.payload) {
|
|
252
252
|
return [];
|
|
253
253
|
}
|
|
254
254
|
const encryptedResponse = JSON.parse(response.payload);
|
|
255
255
|
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
256
|
-
return decryptedData.shares;
|
|
256
|
+
return Array.isArray(decryptedData == null ? void 0 : decryptedData.shares) ? decryptedData.shares : [];
|
|
257
257
|
} catch (error) {
|
|
258
258
|
throw new Error(
|
|
259
259
|
`Failed to retrieve pregen shares for user ${query.userId}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
@@ -10,6 +10,9 @@ function hexStringToBase64(hexString) {
|
|
|
10
10
|
}
|
|
11
11
|
return Buffer.from(hexString, "hex").toString("base64");
|
|
12
12
|
}
|
|
13
|
+
function base58ToBase64(base58Str) {
|
|
14
|
+
return Buffer.from(base58Decode(base58Str)).toString("base64");
|
|
15
|
+
}
|
|
13
16
|
function hexToSignature(hexSig) {
|
|
14
17
|
return {
|
|
15
18
|
r: `0x${hexSig.slice(2, 66)}`,
|
|
@@ -160,6 +163,7 @@ function truncateAddress(str, addressType, {
|
|
|
160
163
|
return `${str.slice(0, minimum + margin)}...${str.slice(-1 * margin)}`;
|
|
161
164
|
}
|
|
162
165
|
export {
|
|
166
|
+
base58ToBase64,
|
|
163
167
|
compressPubkey,
|
|
164
168
|
decimalToHex,
|
|
165
169
|
getCosmosAddress,
|
|
@@ -6,6 +6,7 @@ export interface Signature {
|
|
|
6
6
|
v: bigint;
|
|
7
7
|
}
|
|
8
8
|
export declare function hexStringToBase64(hexString: string): string;
|
|
9
|
+
export declare function base58ToBase64(base58Str: string): string;
|
|
9
10
|
export declare function hexToSignature(hexSig: string): Signature;
|
|
10
11
|
export declare function hexToUint8Array(hex: string): Uint8Array;
|
|
11
12
|
export declare function hexToDecimal(hex: string): string;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "3.0.0-alpha.
|
|
8
|
+
"@getpara/user-management-client": "3.0.0-alpha.1",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"axios": "^1.8.4",
|
|
11
11
|
"base64url": "^3.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"package.json"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "839d225579de67feb5be4da225d232290b2a2a04",
|
|
34
34
|
"main": "dist/cjs/index.js",
|
|
35
35
|
"module": "dist/esm/index.js",
|
|
36
36
|
"scripts": {
|