gun-eth 1.3.1 → 1.3.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/README.md +1 -13
- package/package.json +1 -1
- package/src/gun-eth.js +0 -33
- package/src/index.js +0 -33
package/README.md
CHANGED
@@ -111,19 +111,7 @@ Learn more about plugin implementation [here](https://github.com/amark/gun/wiki/
|
|
111
111
|
```javascript
|
112
112
|
gun.shine("optimismSepolia", nodeId, data, callback);
|
113
113
|
```
|
114
|
-
|
115
|
-
- `setToken(token)`: Sets a custom token for Gun operations.
|
116
|
-
|
117
|
-
```javascript
|
118
|
-
gun.setToken("yourCustomToken");
|
119
|
-
```
|
120
|
-
|
121
|
-
- `getToken()`: Retrieves the current custom token.
|
122
|
-
|
123
|
-
```javascript
|
124
|
-
const currentToken = gun.getToken();
|
125
|
-
```
|
126
|
-
|
114
|
+
|
127
115
|
## SHINE
|
128
116
|
|
129
117
|
SHINE (Secure Hash Integrity Network Ethereum) provides a mechanism for verifying data integrity using Ethereum and Gun.js.
|
package/package.json
CHANGED
package/src/gun-eth.js
CHANGED
@@ -181,7 +181,6 @@
|
|
181
181
|
|
182
182
|
let SHINE_OPTIMISM_SEPOLIA = "0x43D838b683F772F08f321E5FA265ad3e333BE9C2";
|
183
183
|
let SHINE_CONTRACT_ADDRESS;
|
184
|
-
let customToken = "";
|
185
184
|
let rpcUrl = "";
|
186
185
|
let privateKey = "";
|
187
186
|
|
@@ -220,38 +219,6 @@
|
|
220
219
|
return this;
|
221
220
|
};
|
222
221
|
|
223
|
-
/**
|
224
|
-
* Sets a custom token for Gun operations.
|
225
|
-
* @param {string} token - The token to be set.
|
226
|
-
* @returns {Gun} The Gun instance for chaining.
|
227
|
-
*/
|
228
|
-
Gun.chain.setToken = function (token) {
|
229
|
-
if (typeof token === "string" && token.length > 0) {
|
230
|
-
customToken = token;
|
231
|
-
console.log("Token set successfully:", token);
|
232
|
-
} else {
|
233
|
-
console.error("Invalid token. Must be a non-empty string.");
|
234
|
-
}
|
235
|
-
return this;
|
236
|
-
};
|
237
|
-
|
238
|
-
/**
|
239
|
-
* Retrieves the current custom token.
|
240
|
-
* @returns {string} The current custom token.
|
241
|
-
*/
|
242
|
-
Gun.chain.getToken = function () {
|
243
|
-
return customToken;
|
244
|
-
};
|
245
|
-
|
246
|
-
// Add custom token to all 'put' operations
|
247
|
-
Gun.on("put", function (msg) {
|
248
|
-
const to = this.to;
|
249
|
-
msg.headers = {
|
250
|
-
token: customToken,
|
251
|
-
};
|
252
|
-
to.next(msg);
|
253
|
-
});
|
254
|
-
|
255
222
|
/**
|
256
223
|
* Verifies an Ethereum signature.
|
257
224
|
* @param {string} message - The original message that was signed.
|
package/src/index.js
CHANGED
@@ -7,7 +7,6 @@ const SHINE_ABI = SHINE.abi;
|
|
7
7
|
const SHINE_OPTIMISM_SEPOLIA = SHINE.address;
|
8
8
|
|
9
9
|
let SHINE_CONTRACT_ADDRESS;
|
10
|
-
let customToken = "";
|
11
10
|
|
12
11
|
let rpcUrl = "";
|
13
12
|
let privateKey = "";
|
@@ -49,38 +48,6 @@ Gun.chain.setStandaloneConfig = function (newRpcUrl, newPrivateKey) {
|
|
49
48
|
return this;
|
50
49
|
};
|
51
50
|
|
52
|
-
/**
|
53
|
-
* Sets a custom token for Gun operations.
|
54
|
-
* @param {string} token - The token to be set.
|
55
|
-
* @returns {Gun} The Gun instance for chaining.
|
56
|
-
*/
|
57
|
-
Gun.chain.setToken = function (token) {
|
58
|
-
if (typeof token === "string" && token.length > 0) {
|
59
|
-
customToken = token;
|
60
|
-
console.log("Token set successfully:", token);
|
61
|
-
} else {
|
62
|
-
console.error("Invalid token. Must be a non-empty string.");
|
63
|
-
}
|
64
|
-
return this;
|
65
|
-
};
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Retrieves the current custom token.
|
69
|
-
* @returns {string} The current custom token.
|
70
|
-
*/
|
71
|
-
Gun.chain.getToken = function () {
|
72
|
-
return customToken;
|
73
|
-
};
|
74
|
-
|
75
|
-
// Add custom token to all 'put' operations
|
76
|
-
Gun.on("put", function (msg) {
|
77
|
-
const to = this.to;
|
78
|
-
msg.headers = {
|
79
|
-
token: customToken,
|
80
|
-
};
|
81
|
-
to.next(msg);
|
82
|
-
});
|
83
|
-
|
84
51
|
/**
|
85
52
|
* Verifies an Ethereum signature.
|
86
53
|
* @param {string} message - The original message that was signed.
|