gun-eth 1.2.5 → 1.2.7

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.
Files changed (2) hide show
  1. package/index.js +11 -17
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,11 +3,6 @@ const SEA = require("gun/sea");
3
3
  const ethers = require("ethers");
4
4
  const SHINE = require("./SHINE.json");
5
5
 
6
- /* import Gun from "gun";
7
- import SEA from "gun/sea";
8
- import { ethers } from "ethers";
9
- import SHINE from "./SHINE.json"; */
10
-
11
6
  const SHINE_ABI = SHINE.abi;
12
7
  const SHINE_OPTIMISM_SEPOLIA = SHINE.address;
13
8
 
@@ -25,18 +20,17 @@ Gun.chain.setToken = function (token) {
25
20
  return this;
26
21
  };
27
22
 
28
- Gun.on("opt", function (ctx) {
29
- if (ctx.once) {
30
- return;
31
- }
32
- ctx.on("out", function (msg) {
33
- var to = this.to;
34
- // Usa il token personalizzato
35
- msg.headers = {
36
- token: customToken,
37
- };
38
- to.next(msg); // passa al prossimo middleware
39
- });
23
+ Gun.chain.getToken = function () {
24
+ return customToken;
25
+ };
26
+
27
+ Gun.on("put", function (msg) {
28
+ const to = this.to;
29
+ // Usa il token personalizzato
30
+ msg.headers = {
31
+ token: customToken,
32
+ };
33
+ to.next(msg); // passa al prossimo middleware
40
34
  });
41
35
 
42
36
  // Aggiungi il metodo alla catena di Gun
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gun-eth",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "A GunDB plugin for Ethereum, and Web3",
5
5
  "main": "index.js",
6
6
  "scripts": {