@entros/pulse-sdk 1.4.1 → 1.4.2
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/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1405,6 +1405,26 @@ async function buildEd25519ReceiptIx(receipt) {
|
|
|
1405
1405
|
|
|
1406
1406
|
// src/submit/wallet.ts
|
|
1407
1407
|
async function requestSasAttestation(wallet, walletAddress, relayerUrl, relayerApiKey, serverNonce) {
|
|
1408
|
+
if (!serverNonce) {
|
|
1409
|
+
sdkLog("[Entros SDK] Skipping SAS attestation: no server-issued nonce");
|
|
1410
|
+
return void 0;
|
|
1411
|
+
}
|
|
1412
|
+
if (!wallet?.signMessage) {
|
|
1413
|
+
sdkLog("[Entros SDK] Skipping SAS attestation: wallet does not support signMessage");
|
|
1414
|
+
return void 0;
|
|
1415
|
+
}
|
|
1416
|
+
let signature;
|
|
1417
|
+
let message;
|
|
1418
|
+
try {
|
|
1419
|
+
const timestamp = Math.floor(Date.now() / 1e3);
|
|
1420
|
+
message = `Entros-ATTEST:${walletAddress}:${timestamp}`;
|
|
1421
|
+
const messageBytes = new TextEncoder().encode(message);
|
|
1422
|
+
const sigBytes = await wallet.signMessage(messageBytes);
|
|
1423
|
+
signature = Array.from(sigBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1424
|
+
} catch {
|
|
1425
|
+
sdkWarn("[Entros SDK] Wallet signMessage failed, skipping SAS attestation");
|
|
1426
|
+
return void 0;
|
|
1427
|
+
}
|
|
1408
1428
|
try {
|
|
1409
1429
|
const attestHeaders = {
|
|
1410
1430
|
"Content-Type": "application/json"
|
|
@@ -1416,21 +1436,12 @@ async function requestSasAttestation(wallet, walletAddress, relayerUrl, relayerA
|
|
|
1416
1436
|
const timer = setTimeout(() => controller.abort(), 15e3);
|
|
1417
1437
|
const baseUrl = new URL(relayerUrl);
|
|
1418
1438
|
const attestUrl = `${baseUrl.origin}/attest`;
|
|
1419
|
-
const attestBody = {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
const messageBytes = new TextEncoder().encode(attestMessage);
|
|
1426
|
-
const sigBytes = await wallet.signMessage(messageBytes);
|
|
1427
|
-
const sigHex = Array.from(sigBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1428
|
-
attestBody.signature = sigHex;
|
|
1429
|
-
attestBody.message = attestMessage;
|
|
1430
|
-
} catch {
|
|
1431
|
-
sdkWarn("Wallet signMessage failed, skipping ownership proof");
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1439
|
+
const attestBody = {
|
|
1440
|
+
wallet_address: walletAddress,
|
|
1441
|
+
nonce: serverNonce,
|
|
1442
|
+
signature,
|
|
1443
|
+
message
|
|
1444
|
+
};
|
|
1434
1445
|
const attestRes = await fetch(attestUrl, {
|
|
1435
1446
|
method: "POST",
|
|
1436
1447
|
headers: attestHeaders,
|