@1sat/react 0.0.66 → 0.0.67
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 +17 -21
- package/dist/wallet-context.d.ts.map +1 -1
- package/package.json +42 -42
package/dist/index.js
CHANGED
|
@@ -6,7 +6,8 @@ export * from "@1sat/connect";
|
|
|
6
6
|
// src/wallet-context.tsx
|
|
7
7
|
import {
|
|
8
8
|
connectWallet,
|
|
9
|
-
getAvailableProviders
|
|
9
|
+
getAvailableProviders,
|
|
10
|
+
reconnectSigmaWallet
|
|
10
11
|
} from "@1sat/connect";
|
|
11
12
|
import {
|
|
12
13
|
createContext,
|
|
@@ -43,16 +44,6 @@ function clearStored() {
|
|
|
43
44
|
localStorage.removeItem(STORAGE_KEY);
|
|
44
45
|
}
|
|
45
46
|
var SIGMA_GUARD_KEY = "onesat_sigma_reconnecting";
|
|
46
|
-
function setSigmaGuard() {
|
|
47
|
-
if (typeof window === "undefined")
|
|
48
|
-
return;
|
|
49
|
-
sessionStorage.setItem(SIGMA_GUARD_KEY, "true");
|
|
50
|
-
}
|
|
51
|
-
function hasSigmaGuard() {
|
|
52
|
-
if (typeof window === "undefined")
|
|
53
|
-
return false;
|
|
54
|
-
return sessionStorage.getItem(SIGMA_GUARD_KEY) === "true";
|
|
55
|
-
}
|
|
56
47
|
function clearSigmaGuard() {
|
|
57
48
|
if (typeof window === "undefined")
|
|
58
49
|
return;
|
|
@@ -135,7 +126,8 @@ function WalletProvider({
|
|
|
135
126
|
const {
|
|
136
127
|
autoReconnect: shouldReconnect,
|
|
137
128
|
availableProviders: configured,
|
|
138
|
-
connect: doConnect
|
|
129
|
+
connect: doConnect,
|
|
130
|
+
applyResult: doApply
|
|
139
131
|
} = mountRef.current;
|
|
140
132
|
if (!shouldReconnect) {
|
|
141
133
|
setStatus("disconnected");
|
|
@@ -159,19 +151,23 @@ function WalletProvider({
|
|
|
159
151
|
setStatus("disconnected");
|
|
160
152
|
return;
|
|
161
153
|
}
|
|
162
|
-
if (stored === "sigma" && hasSigmaGuard()) {
|
|
163
|
-
clearStored();
|
|
164
|
-
clearSigmaGuard();
|
|
165
|
-
setStatus("disconnected");
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
154
|
if (stored === "sigma") {
|
|
169
|
-
|
|
155
|
+
setStatus("connecting");
|
|
156
|
+
reconnectSigmaWallet().then((result) => {
|
|
157
|
+
if (result) {
|
|
158
|
+
doApply(result);
|
|
159
|
+
} else {
|
|
160
|
+
clearStored();
|
|
161
|
+
setStatus("disconnected");
|
|
162
|
+
}
|
|
163
|
+
}).catch(() => {
|
|
164
|
+
clearStored();
|
|
165
|
+
setStatus("disconnected");
|
|
166
|
+
});
|
|
167
|
+
return;
|
|
170
168
|
}
|
|
171
169
|
doConnect(stored).catch(() => {
|
|
172
170
|
clearStored();
|
|
173
|
-
if (stored === "sigma")
|
|
174
|
-
clearSigmaGuard();
|
|
175
171
|
setStatus("disconnected");
|
|
176
172
|
});
|
|
177
173
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-context.d.ts","sourceRoot":"","sources":["../src/wallet-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"wallet-context.d.ts","sourceRoot":"","sources":["../src/wallet-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAIzB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EACN,KAAK,SAAS,EAQd,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,YAAY,GACrB,cAAc,GACd,WAAW,GACX,WAAW,GACX,YAAY,GACZ,WAAW,CAAA;AAEd,MAAM,WAAW,kBAAkB;IAClC,MAAM,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-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
2
|
+
"name": "@1sat/react",
|
|
3
|
+
"version": "0.0.67",
|
|
4
|
+
"description": "React hooks and components for 1Sat wallet integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "bun run build.ts && tsc --emitDeclarationOnly",
|
|
19
|
+
"dev": "tsc --watch"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"1sat",
|
|
23
|
+
"bsv",
|
|
24
|
+
"ordinals",
|
|
25
|
+
"wallet",
|
|
26
|
+
"sdk",
|
|
27
|
+
"react",
|
|
28
|
+
"hooks"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@1sat/connect": "0.0.70"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@bsv/sdk": "^2.0.13",
|
|
36
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@bsv/sdk": "^2.0.13",
|
|
40
|
+
"@types/react": "^19.0.0",
|
|
41
|
+
"react": "^19.0.0",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
}
|
|
44
44
|
}
|