gun-eth 1.4.32 → 1.4.34
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/gun-eth.min.js +13 -0
- package/dist/browser/gun-eth.min.js.map +1 -0
- package/dist/gun-eth.cjs.js +148 -110
- package/dist/gun-eth.mjs +148 -111
- package/package.json +5 -20
- package/src/index.js +164 -116
- package/dist/gun-eth.cjs.js.map +0 -1
- package/dist/gun-eth.esm.js +0 -1369
- package/dist/gun-eth.esm.js.map +0 -1
- package/dist/gun-eth.min.js +0 -2
- package/dist/gun-eth.min.js.map +0 -1
- package/dist/gun-eth.mjs.map +0 -1
package/dist/gun-eth.mjs
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
import Gun from 'gun';
|
2
|
-
export { default } from 'gun';
|
3
|
-
import SEA from 'gun/sea.js';
|
2
|
+
export { default as Gun, default } from 'gun';
|
4
3
|
import { ethers } from 'ethers';
|
5
|
-
import
|
6
|
-
import { dirname } from 'path';
|
7
|
-
import { readFileSync } from 'fs';
|
4
|
+
import 'gun/sea.js';
|
8
5
|
|
9
6
|
let contractAddresses$1 = {
|
10
7
|
PROOF_OF_INTEGRITY_ADDRESS: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
|
@@ -430,37 +427,48 @@ const PROOF_OF_INTEGRITY_ABI = [
|
|
430
427
|
}
|
431
428
|
];
|
432
429
|
|
433
|
-
|
434
|
-
// IMPORTS AND GLOBAL VARIABLES
|
435
|
-
// =============================================
|
430
|
+
const SEA = Gun.SEA;
|
436
431
|
|
437
432
|
let PROOF_CONTRACT_ADDRESS;
|
438
|
-
let rpcUrl = "";
|
439
|
-
let privateKey = "";
|
440
|
-
|
441
|
-
const MESSAGE_TO_SIGN = "Access GunDB with Ethereum";
|
442
|
-
|
443
433
|
let contractAddresses = {
|
444
|
-
PROOF_OF_INTEGRITY_ADDRESS:
|
445
|
-
|
434
|
+
PROOF_OF_INTEGRITY_ADDRESS:
|
435
|
+
CHAIN_CONFIG.optimismSepolia.PROOF_OF_INTEGRITY_ADDRESS,
|
436
|
+
STEALTH_ANNOUNCER_ADDRESS:
|
437
|
+
CHAIN_CONFIG.optimismSepolia.STEALTH_ANNOUNCER_ADDRESS,
|
446
438
|
};
|
447
439
|
|
448
|
-
//
|
449
|
-
|
450
|
-
|
451
|
-
const __filename = fileURLToPath(import.meta.url);
|
452
|
-
const __dirname = dirname(__filename);
|
453
|
-
|
440
|
+
// Funzione di inizializzazione per Node.js
|
441
|
+
const initNodeEnvironment = async () => {
|
442
|
+
if (typeof window === "undefined") {
|
454
443
|
try {
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
444
|
+
// Importazioni dinamiche
|
445
|
+
const { fileURLToPath } = await import('url');
|
446
|
+
const { dirname } = await import('path');
|
447
|
+
const { readFile } = await import('fs/promises');
|
448
|
+
const { join } = await import('path');
|
449
|
+
|
450
|
+
const __filename = fileURLToPath(import.meta.url);
|
451
|
+
const __dirname = dirname(__filename);
|
452
|
+
|
453
|
+
try {
|
454
|
+
const rawdata = await readFile(
|
455
|
+
join(__dirname, "contract-address.json"),
|
456
|
+
"utf8"
|
457
|
+
);
|
458
|
+
contractAddresses = JSON.parse(rawdata);
|
459
|
+
console.log("Loaded contract addresses:", contractAddresses);
|
460
|
+
} catch (err) {
|
461
|
+
console.warn("Warning: contract-address.json not found or invalid");
|
462
|
+
}
|
463
|
+
} catch (error) {
|
464
|
+
console.error("Error loading Node.js modules:", error);
|
460
465
|
}
|
461
|
-
} catch (error) {
|
462
|
-
console.error('Error loading Node.js modules:', error);
|
463
466
|
}
|
467
|
+
};
|
468
|
+
|
469
|
+
// Inizializza solo in ambiente Node.js
|
470
|
+
if (typeof window === "undefined") {
|
471
|
+
initNodeEnvironment();
|
464
472
|
}
|
465
473
|
|
466
474
|
// =============================================
|
@@ -533,7 +541,7 @@ const getSigner = async () => {
|
|
533
541
|
if (rpcUrl && privateKey) {
|
534
542
|
const provider = new ethers.JsonRpcProvider(rpcUrl, {
|
535
543
|
chainId: LOCAL_CONFIG.CHAIN_ID,
|
536
|
-
name: "localhost"
|
544
|
+
name: "localhost",
|
537
545
|
});
|
538
546
|
return new Wallet(privateKey, provider);
|
539
547
|
} else if (
|
@@ -558,27 +566,24 @@ function deriveStealthAddress(sharedSecret, spendingPublicKey) {
|
|
558
566
|
try {
|
559
567
|
const sharedSecretBytes = ethers.toUtf8Bytes(sharedSecret);
|
560
568
|
const spendingPublicKeyBytes = ethers.toUtf8Bytes(spendingPublicKey);
|
561
|
-
|
569
|
+
|
562
570
|
const stealthPrivateKey = ethers.keccak256(
|
563
|
-
ethers.concat([
|
564
|
-
sharedSecretBytes,
|
565
|
-
spendingPublicKeyBytes
|
566
|
-
])
|
571
|
+
ethers.concat([sharedSecretBytes, spendingPublicKeyBytes])
|
567
572
|
);
|
568
|
-
|
573
|
+
|
569
574
|
const stealthWallet = new Wallet(stealthPrivateKey);
|
570
575
|
|
571
576
|
console.log("Debug deriveStealthAddress:", {
|
572
577
|
sharedSecretHex: stealthPrivateKey,
|
573
578
|
spendingPublicKey,
|
574
579
|
stealthPrivateKey,
|
575
|
-
stealthAddress: stealthWallet.address
|
580
|
+
stealthAddress: stealthWallet.address,
|
576
581
|
});
|
577
582
|
|
578
583
|
return {
|
579
584
|
stealthPrivateKey,
|
580
585
|
stealthAddress: stealthWallet.address,
|
581
|
-
wallet: stealthWallet
|
586
|
+
wallet: stealthWallet,
|
582
587
|
};
|
583
588
|
} catch (error) {
|
584
589
|
console.error("Error in deriveStealthAddress:", error);
|
@@ -680,17 +685,21 @@ Gun.chain.createAndStoreEncryptedPair = async function (address, signature) {
|
|
680
685
|
const viewingAccount = gunToEthAccount(v_pair.priv);
|
681
686
|
const spendingAccount = gunToEthAccount(s_pair.priv);
|
682
687
|
|
683
|
-
gun
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
688
|
+
gun
|
689
|
+
.get("gun-eth")
|
690
|
+
.get("users")
|
691
|
+
.get(address)
|
692
|
+
.put({
|
693
|
+
pair: encryptedPair,
|
694
|
+
v_pair: encryptedV_pair,
|
695
|
+
s_pair: encryptedS_pair,
|
696
|
+
publicKeys: {
|
697
|
+
viewingPublicKey: v_pair.epub, // Use SEA encryption public key
|
698
|
+
viewingPublicKey: v_pair.epub, // Use SEA encryption public key
|
699
|
+
spendingPublicKey: spendingAccount.publicKey, // Use Ethereum address
|
700
|
+
ethViewingAddress: viewingAccount.publicKey, // Also save Ethereum address
|
701
|
+
},
|
702
|
+
});
|
694
703
|
|
695
704
|
console.log("Encrypted pairs and public keys stored for:", address);
|
696
705
|
} catch (error) {
|
@@ -748,9 +757,9 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
748
757
|
|
749
758
|
try {
|
750
759
|
// Se siamo in localhost e in development, usa automaticamente la chain locale
|
751
|
-
const targetChain = isLocalEnvironment() ?
|
760
|
+
const targetChain = isLocalEnvironment() ? "localhost" : chain;
|
752
761
|
const chainConfig = getAddressesForChain(targetChain);
|
753
|
-
|
762
|
+
|
754
763
|
console.log(`Using ${targetChain} configuration:`, chainConfig);
|
755
764
|
|
756
765
|
// Usa gli indirizzi dalla configurazione
|
@@ -786,10 +795,7 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
786
795
|
PROOF_OF_INTEGRITY_ABI,
|
787
796
|
signer
|
788
797
|
);
|
789
|
-
const tx = await contract.updateData(
|
790
|
-
toUtf8Bytes(nodeId),
|
791
|
-
contentHash
|
792
|
-
);
|
798
|
+
const tx = await contract.updateData(toUtf8Bytes(nodeId), contentHash);
|
793
799
|
console.log("Transaction sent:", tx.hash);
|
794
800
|
const receipt = await tx.wait();
|
795
801
|
console.log("Transaction confirmed:", receipt);
|
@@ -816,7 +822,6 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
816
822
|
return { contentHash, timestamp, updater };
|
817
823
|
};
|
818
824
|
|
819
|
-
|
820
825
|
if (nodeId && !data) {
|
821
826
|
// Case 1: User passes only node
|
822
827
|
gun.get(nodeId).once(async (existingData) => {
|
@@ -832,7 +837,8 @@ Gun.chain.proof = function (chain, nodeId, data, callback) {
|
|
832
837
|
console.log("contentHash", contentHash);
|
833
838
|
|
834
839
|
if (!contentHash) {
|
835
|
-
if (callback)
|
840
|
+
if (callback)
|
841
|
+
callback({ err: "No content hash found for this node" });
|
836
842
|
return;
|
837
843
|
}
|
838
844
|
|
@@ -924,10 +930,13 @@ Gun.chain.gunToEthAccount = function (gunPrivateKey) {
|
|
924
930
|
* @param {string} signature - The sender's signature to access their keys
|
925
931
|
* @returns {Promise<Object>} Object containing stealth addresses and keys
|
926
932
|
*/
|
927
|
-
Gun.chain.generateStealthAddress = async function (
|
933
|
+
Gun.chain.generateStealthAddress = async function (
|
934
|
+
recipientAddress,
|
935
|
+
signature
|
936
|
+
) {
|
928
937
|
try {
|
929
938
|
const gun = this;
|
930
|
-
|
939
|
+
|
931
940
|
// Get recipient's public keys
|
932
941
|
const recipientData = await gun
|
933
942
|
.get("gun-eth")
|
@@ -936,14 +945,21 @@ Gun.chain.generateStealthAddress = async function (recipientAddress, signature)
|
|
936
945
|
.get("publicKeys")
|
937
946
|
.then();
|
938
947
|
|
939
|
-
if (
|
948
|
+
if (
|
949
|
+
!recipientData ||
|
950
|
+
!recipientData.viewingPublicKey ||
|
951
|
+
!recipientData.spendingPublicKey
|
952
|
+
) {
|
940
953
|
throw new Error("Recipient's public keys not found");
|
941
954
|
}
|
942
955
|
|
943
956
|
// Get sender's keys
|
944
|
-
const senderAddress = await this.verifySignature(
|
957
|
+
const senderAddress = await this.verifySignature(
|
958
|
+
MESSAGE_TO_SIGN,
|
959
|
+
signature
|
960
|
+
);
|
945
961
|
const password = generatePassword(signature);
|
946
|
-
|
962
|
+
|
947
963
|
const senderData = await gun
|
948
964
|
.get("gun-eth")
|
949
965
|
.get("users")
|
@@ -958,16 +974,20 @@ Gun.chain.generateStealthAddress = async function (recipientAddress, signature)
|
|
958
974
|
let spendingKeyPair;
|
959
975
|
try {
|
960
976
|
const decryptedData = await SEA.decrypt(senderData.s_pair, password);
|
961
|
-
spendingKeyPair =
|
962
|
-
|
963
|
-
|
977
|
+
spendingKeyPair =
|
978
|
+
typeof decryptedData === "string"
|
979
|
+
? JSON.parse(decryptedData)
|
980
|
+
: decryptedData;
|
964
981
|
} catch (error) {
|
965
982
|
console.error("Error decrypting spending pair:", error);
|
966
983
|
throw new Error("Unable to decrypt spending pair");
|
967
984
|
}
|
968
985
|
|
969
986
|
// Generate shared secret using SEA ECDH with encryption public key
|
970
|
-
const sharedSecret = await SEA.secret(
|
987
|
+
const sharedSecret = await SEA.secret(
|
988
|
+
recipientData.viewingPublicKey,
|
989
|
+
spendingKeyPair
|
990
|
+
);
|
971
991
|
|
972
992
|
if (!sharedSecret) {
|
973
993
|
throw new Error("Unable to generate shared secret");
|
@@ -983,9 +1003,8 @@ Gun.chain.generateStealthAddress = async function (recipientAddress, signature)
|
|
983
1003
|
return {
|
984
1004
|
stealthAddress,
|
985
1005
|
senderPublicKey: spendingKeyPair.epub, // Use encryption public key
|
986
|
-
spendingPublicKey: recipientData.spendingPublicKey
|
1006
|
+
spendingPublicKey: recipientData.spendingPublicKey,
|
987
1007
|
};
|
988
|
-
|
989
1008
|
} catch (error) {
|
990
1009
|
console.error("Error generating stealth address:", error);
|
991
1010
|
throw error;
|
@@ -1073,10 +1092,14 @@ Gun.chain.recoverStealthFunds = async function (
|
|
1073
1092
|
// Decrypt viewing and spending pairs
|
1074
1093
|
let viewingKeyPair;
|
1075
1094
|
try {
|
1076
|
-
const decryptedViewingData = await SEA.decrypt(
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1095
|
+
const decryptedViewingData = await SEA.decrypt(
|
1096
|
+
encryptedData.v_pair,
|
1097
|
+
password
|
1098
|
+
);
|
1099
|
+
viewingKeyPair =
|
1100
|
+
typeof decryptedViewingData === "string"
|
1101
|
+
? JSON.parse(decryptedViewingData)
|
1102
|
+
: decryptedViewingData;
|
1080
1103
|
} catch (error) {
|
1081
1104
|
console.error("Error decrypting keys:", error);
|
1082
1105
|
throw new Error("Unable to decrypt keys");
|
@@ -1101,7 +1124,7 @@ Gun.chain.recoverStealthFunds = async function (
|
|
1101
1124
|
console.error("Mismatch:", {
|
1102
1125
|
recovered: recoveredAddress,
|
1103
1126
|
expected: stealthAddress,
|
1104
|
-
sharedSecret
|
1127
|
+
sharedSecret,
|
1105
1128
|
});
|
1106
1129
|
throw new Error("Recovered stealth address does not match");
|
1107
1130
|
}
|
@@ -1129,11 +1152,14 @@ Gun.chain.announceStealthPayment = async function (
|
|
1129
1152
|
senderPublicKey,
|
1130
1153
|
spendingPublicKey,
|
1131
1154
|
signature,
|
1132
|
-
options = { onChain: false, chain:
|
1155
|
+
options = { onChain: false, chain: "optimismSepolia" }
|
1133
1156
|
) {
|
1134
1157
|
try {
|
1135
1158
|
const gun = this;
|
1136
|
-
const senderAddress = await this.verifySignature(
|
1159
|
+
const senderAddress = await this.verifySignature(
|
1160
|
+
MESSAGE_TO_SIGN,
|
1161
|
+
signature
|
1162
|
+
);
|
1137
1163
|
|
1138
1164
|
if (options.onChain) {
|
1139
1165
|
// On-chain announcement
|
@@ -1160,24 +1186,21 @@ Gun.chain.announceStealthPayment = async function (
|
|
1160
1186
|
stealthAddress,
|
1161
1187
|
{ value: devFee }
|
1162
1188
|
);
|
1163
|
-
|
1189
|
+
|
1164
1190
|
console.log("Transaction sent:", tx.hash);
|
1165
1191
|
const receipt = await tx.wait();
|
1166
1192
|
console.log("Transaction confirmed:", receipt.hash);
|
1167
|
-
|
1193
|
+
|
1168
1194
|
console.log("Stealth payment announced on-chain (dev fee paid)");
|
1169
1195
|
} else {
|
1170
1196
|
// Off-chain announcement (GunDB)
|
1171
|
-
gun
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
spendingPublicKey,
|
1179
|
-
timestamp: Date.now(),
|
1180
|
-
});
|
1197
|
+
gun.get("gun-eth").get("stealth-payments").set({
|
1198
|
+
stealthAddress,
|
1199
|
+
senderAddress,
|
1200
|
+
senderPublicKey,
|
1201
|
+
spendingPublicKey,
|
1202
|
+
timestamp: Date.now(),
|
1203
|
+
});
|
1181
1204
|
console.log("Stealth payment announced off-chain");
|
1182
1205
|
}
|
1183
1206
|
} catch (error) {
|
@@ -1192,13 +1215,18 @@ Gun.chain.announceStealthPayment = async function (
|
|
1192
1215
|
* @param {string} signature - The signature to authenticate the user
|
1193
1216
|
* @returns {Promise<Array>} List of stealth payments
|
1194
1217
|
*/
|
1195
|
-
Gun.chain.getStealthPayments = async function (
|
1218
|
+
Gun.chain.getStealthPayments = async function (
|
1219
|
+
signature,
|
1220
|
+
options = { source: "both" }
|
1221
|
+
) {
|
1196
1222
|
try {
|
1197
1223
|
const payments = [];
|
1198
1224
|
|
1199
|
-
if (options.source ===
|
1225
|
+
if (options.source === "onChain" || options.source === "both") {
|
1200
1226
|
const signer = await getSigner();
|
1201
|
-
const chainConfig = getAddressesForChain(
|
1227
|
+
const chainConfig = getAddressesForChain(
|
1228
|
+
options.chain || "optimismSepolia"
|
1229
|
+
);
|
1202
1230
|
const contractAddress = chainConfig.STEALTH_ANNOUNCER_ADDRESS;
|
1203
1231
|
|
1204
1232
|
const contract = new Contract(
|
@@ -1206,28 +1234,32 @@ Gun.chain.getStealthPayments = async function (signature, options = { source: 'b
|
|
1206
1234
|
STEALTH_ANNOUNCER_ABI,
|
1207
1235
|
signer
|
1208
1236
|
);
|
1209
|
-
|
1237
|
+
|
1210
1238
|
try {
|
1211
1239
|
// Get total number of announcements
|
1212
1240
|
const totalAnnouncements = await contract.getAnnouncementsCount();
|
1213
1241
|
const totalCount = Number(totalAnnouncements.toString());
|
1214
1242
|
console.log("Total on-chain announcements:", totalCount);
|
1215
|
-
|
1243
|
+
|
1216
1244
|
if (totalCount > 0) {
|
1217
1245
|
// Get announcements in batches of 100
|
1218
1246
|
const batchSize = 100;
|
1219
1247
|
const lastIndex = totalCount - 1;
|
1220
|
-
|
1221
|
-
for(let i = 0; i <= lastIndex; i += batchSize) {
|
1248
|
+
|
1249
|
+
for (let i = 0; i <= lastIndex; i += batchSize) {
|
1222
1250
|
const toIndex = Math.min(i + batchSize - 1, lastIndex);
|
1223
1251
|
const batch = await contract.getAnnouncementsInRange(i, toIndex);
|
1224
|
-
|
1252
|
+
|
1225
1253
|
// For each announcement, try to decrypt
|
1226
|
-
for(const announcement of batch) {
|
1254
|
+
for (const announcement of batch) {
|
1227
1255
|
try {
|
1228
1256
|
// Verify announcement is valid
|
1229
|
-
if (
|
1230
|
-
|
1257
|
+
if (
|
1258
|
+
!announcement ||
|
1259
|
+
!announcement.stealthAddress ||
|
1260
|
+
!announcement.senderPublicKey ||
|
1261
|
+
!announcement.spendingPublicKey
|
1262
|
+
) {
|
1231
1263
|
console.log("Invalid announcement:", announcement);
|
1232
1264
|
continue;
|
1233
1265
|
}
|
@@ -1239,20 +1271,21 @@ Gun.chain.getStealthPayments = async function (signature, options = { source: 'b
|
|
1239
1271
|
signature,
|
1240
1272
|
announcement.spendingPublicKey
|
1241
1273
|
);
|
1242
|
-
|
1274
|
+
|
1243
1275
|
// If no errors thrown, announcement is for us
|
1244
1276
|
payments.push({
|
1245
1277
|
stealthAddress: announcement.stealthAddress,
|
1246
1278
|
senderPublicKey: announcement.senderPublicKey,
|
1247
1279
|
spendingPublicKey: announcement.spendingPublicKey,
|
1248
1280
|
timestamp: Number(announcement.timestamp),
|
1249
|
-
source:
|
1250
|
-
wallet: recoveredWallet
|
1281
|
+
source: "onChain",
|
1282
|
+
wallet: recoveredWallet,
|
1251
1283
|
});
|
1252
|
-
|
1253
1284
|
} catch (e) {
|
1254
1285
|
// Not for us, continue
|
1255
|
-
console.log(
|
1286
|
+
console.log(
|
1287
|
+
`Announcement not for us: ${announcement.stealthAddress}`
|
1288
|
+
);
|
1256
1289
|
continue;
|
1257
1290
|
}
|
1258
1291
|
}
|
@@ -1263,7 +1296,7 @@ Gun.chain.getStealthPayments = async function (signature, options = { source: 'b
|
|
1263
1296
|
}
|
1264
1297
|
}
|
1265
1298
|
|
1266
|
-
if (options.source ===
|
1299
|
+
if (options.source === "offChain" || options.source === "both") {
|
1267
1300
|
// Get off-chain payments
|
1268
1301
|
const gun = this;
|
1269
1302
|
const offChainPayments = await new Promise((resolve) => {
|
@@ -1275,12 +1308,12 @@ Gun.chain.getStealthPayments = async function (signature, options = { source: 'b
|
|
1275
1308
|
.map()
|
1276
1309
|
.once((payment, id) => {
|
1277
1310
|
if (payment?.stealthAddress) {
|
1278
|
-
p.push({ ...payment, id, source:
|
1311
|
+
p.push({ ...payment, id, source: "offChain" });
|
1279
1312
|
}
|
1280
1313
|
});
|
1281
1314
|
setTimeout(() => resolve(p), 2000);
|
1282
1315
|
});
|
1283
|
-
|
1316
|
+
|
1284
1317
|
payments.push(...offChainPayments);
|
1285
1318
|
}
|
1286
1319
|
|
@@ -1297,7 +1330,7 @@ Gun.chain.getStealthPayments = async function (signature, options = { source: 'b
|
|
1297
1330
|
* @param {string} recipientAddress - The recipient's address
|
1298
1331
|
* @returns {Promise<void>}
|
1299
1332
|
*/
|
1300
|
-
Gun.chain.cleanStealthPayments = async function(recipientAddress) {
|
1333
|
+
Gun.chain.cleanStealthPayments = async function (recipientAddress) {
|
1301
1334
|
try {
|
1302
1335
|
const gun = this;
|
1303
1336
|
const payments = await gun
|
@@ -1312,7 +1345,12 @@ Gun.chain.cleanStealthPayments = async function(recipientAddress) {
|
|
1312
1345
|
if (payments) {
|
1313
1346
|
Object.keys(payments).forEach(async (key) => {
|
1314
1347
|
const payment = payments[key];
|
1315
|
-
if (
|
1348
|
+
if (
|
1349
|
+
!payment ||
|
1350
|
+
!payment.stealthAddress ||
|
1351
|
+
!payment.senderPublicKey ||
|
1352
|
+
!payment.spendingPublicKey
|
1353
|
+
) {
|
1316
1354
|
await gun
|
1317
1355
|
.get("gun-eth")
|
1318
1356
|
.get("stealth-payments")
|
@@ -1339,7 +1377,7 @@ class GunEth {
|
|
1339
1377
|
static gunToEthAccount = gunToEthAccount;
|
1340
1378
|
static getSigner = getSigner;
|
1341
1379
|
static deriveStealthAddress = deriveStealthAddress;
|
1342
|
-
|
1380
|
+
|
1343
1381
|
// Chain methods
|
1344
1382
|
static chainMethods = {
|
1345
1383
|
setSigner: Gun.chain.setSigner,
|
@@ -1356,7 +1394,7 @@ class GunEth {
|
|
1356
1394
|
recoverStealthFunds: Gun.chain.recoverStealthFunds,
|
1357
1395
|
announceStealthPayment: Gun.chain.announceStealthPayment,
|
1358
1396
|
getStealthPayments: Gun.chain.getStealthPayments,
|
1359
|
-
cleanStealthPayments: Gun.chain.cleanStealthPayments
|
1397
|
+
cleanStealthPayments: Gun.chain.cleanStealthPayments,
|
1360
1398
|
};
|
1361
1399
|
|
1362
1400
|
// Constants
|
@@ -1365,5 +1403,4 @@ class GunEth {
|
|
1365
1403
|
static LOCAL_CONFIG = LOCAL_CONFIG;
|
1366
1404
|
}
|
1367
1405
|
|
1368
|
-
export { GunEth,
|
1369
|
-
//# sourceMappingURL=gun-eth.mjs.map
|
1406
|
+
export { GunEth, deriveStealthAddress, generatePassword, generateRandomId, getSigner, gunToEthAccount, initNodeEnvironment };
|
package/package.json
CHANGED
@@ -1,24 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "gun-eth",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.34",
|
4
4
|
"description": "A GunDB plugin for Ethereum, and Web3",
|
5
|
-
"main": "dist/gun-eth.
|
6
|
-
"module": "dist/gun-eth.mjs",
|
7
|
-
"browser": "dist/gun-eth.min.js",
|
8
|
-
"exports": {
|
9
|
-
".": {
|
10
|
-
"types": "./dist/types/index.d.ts",
|
11
|
-
"node": {
|
12
|
-
"import": "./dist/gun-eth.mjs",
|
13
|
-
"require": "./dist/gun-eth.cjs.js"
|
14
|
-
},
|
15
|
-
"browser": {
|
16
|
-
"import": "./dist/gun-eth.esm.js",
|
17
|
-
"require": "./dist/gun-eth.min.js"
|
18
|
-
},
|
19
|
-
"default": "./dist/gun-eth.cjs.js"
|
20
|
-
}
|
21
|
-
},
|
5
|
+
"main": "dist/gun-eth.min.js",
|
22
6
|
"type": "module",
|
23
7
|
"typesVersions": {
|
24
8
|
"*": {
|
@@ -40,7 +24,8 @@
|
|
40
24
|
"prepublishOnly": "npm run build"
|
41
25
|
},
|
42
26
|
"dependencies": {
|
43
|
-
"express": "^4.21.1"
|
27
|
+
"express": "^4.21.1",
|
28
|
+
"rollup-plugin-polyfill-node": "^0.13.0"
|
44
29
|
},
|
45
30
|
"devDependencies": {
|
46
31
|
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
|
@@ -59,7 +44,7 @@
|
|
59
44
|
"chai": "^4.2.0",
|
60
45
|
"cross-env": "^7.0.3",
|
61
46
|
"ethers": "^6.13.4",
|
62
|
-
"gun": "^0.2020.
|
47
|
+
"gun": "^0.2020.1240",
|
63
48
|
"hardhat": "^2.17.0",
|
64
49
|
"hardhat-gas-reporter": "^1.0.8",
|
65
50
|
"rollup": "^3.0.0",
|