@xyo-network/react-chain-model 1.1.3 → 1.1.4

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.
@@ -1 +1,26 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/provider/xyoProvider.ts
5
+ var hasXyoWalletInjectable = /* @__PURE__ */ __name(() => {
6
+ return "xyo" in globalThis && "walletExtensionId" in globalThis.xyo;
7
+ }, "hasXyoWalletInjectable");
8
+ function getXyoProvider(options) {
9
+ const { assert } = options ?? {};
10
+ if (hasXyoWalletInjectable()) {
11
+ return globalThis.xyo;
12
+ } else {
13
+ console.error("XYO Wallet not installed");
14
+ if (assert) {
15
+ throw new Error("XYO Wallet not installed");
16
+ } else {
17
+ return void 0;
18
+ }
19
+ }
20
+ }
21
+ __name(getXyoProvider, "getXyoProvider");
22
+ export {
23
+ getXyoProvider,
24
+ hasXyoWalletInjectable
25
+ };
1
26
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../src/provider/xyoProvider.ts"],"sourcesContent":["import type { XyoProvider } from '@xyo-network/chain-model'\n\nexport const hasXyoWalletInjectable = () => {\n return 'xyo' in globalThis && 'walletExtensionId' in globalThis.xyo\n}\n\nexport function getXyoProvider(options: { assert: true }): XyoProvider\nexport function getXyoProvider(options?: { assert?: boolean }): XyoProvider | undefined {\n const { assert } = options ?? {}\n if (hasXyoWalletInjectable()) {\n return globalThis.xyo\n } else {\n console.error('XYO Wallet not installed')\n if (assert) {\n throw new Error('XYO Wallet not installed')\n } else {\n return undefined\n }\n }\n}\n"],"mappings":";;;;AAEO,IAAMA,yBAAyB,6BAAA;AACpC,SAAO,SAASC,cAAc,uBAAuBA,WAAWC;AAClE,GAFsC;AAK/B,SAASC,eAAeC,SAA8B;AAC3D,QAAM,EAAEC,OAAM,IAAKD,WAAW,CAAC;AAC/B,MAAIJ,uBAAAA,GAA0B;AAC5B,WAAOC,WAAWC;EACpB,OAAO;AACLI,YAAQC,MAAM,0BAAA;AACd,QAAIF,QAAQ;AACV,YAAM,IAAIG,MAAM,0BAAA;IAClB,OAAO;AACL,aAAOC;IACT;EACF;AACF;AAZgBN;","names":["hasXyoWalletInjectable","globalThis","xyo","getXyoProvider","options","assert","console","error","Error","undefined"]}
@@ -1,2 +1,3 @@
1
+ export * from './provider/index.ts';
1
2
  export * from './types/index.ts';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './xyoProvider.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { XyoProvider } from '@xyo-network/chain-model';
2
+ export declare const hasXyoWalletInjectable: () => boolean;
3
+ export declare function getXyoProvider(options: {
4
+ assert: true;
5
+ }): XyoProvider;
6
+ //# sourceMappingURL=xyoProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xyoProvider.d.ts","sourceRoot":"","sources":["../../../src/provider/xyoProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D,eAAO,MAAM,sBAAsB,eAElC,CAAA;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/react-chain-model",
4
- "version": "1.1.3",
4
+ "version": "1.1.4",
5
5
  "description": "XYO Layer One React SDK Stake",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -34,7 +34,7 @@
34
34
  "module": "dist/browser/index.mjs",
35
35
  "types": "dist/types/index.d.ts",
36
36
  "dependencies": {
37
- "@xyo-network/chain-model": "^1.1.3"
37
+ "@xyo-network/chain-model": "^1.1.4"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@xylabs/ts-scripts-yarn3": "^6.2.1",
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
+ export * from './provider/index.ts'
1
2
  export * from './types/index.ts'
@@ -0,0 +1 @@
1
+ export * from './xyoProvider.ts'
@@ -0,0 +1,20 @@
1
+ import type { XyoProvider } from '@xyo-network/chain-model'
2
+
3
+ export const hasXyoWalletInjectable = () => {
4
+ return 'xyo' in globalThis && 'walletExtensionId' in globalThis.xyo
5
+ }
6
+
7
+ export function getXyoProvider(options: { assert: true }): XyoProvider
8
+ export function getXyoProvider(options?: { assert?: boolean }): XyoProvider | undefined {
9
+ const { assert } = options ?? {}
10
+ if (hasXyoWalletInjectable()) {
11
+ return globalThis.xyo
12
+ } else {
13
+ console.error('XYO Wallet not installed')
14
+ if (assert) {
15
+ throw new Error('XYO Wallet not installed')
16
+ } else {
17
+ return undefined
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ export declare global {
2
+ interface Window {
3
+ xyo: XyoGlobal
4
+ }
5
+
6
+ var xyo: XyoGlobal
7
+ var xyoWalletExtensionId: string
8
+ }