@xyo-network/react-chain-model 1.15.26 → 1.15.28
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/browser/index.d.ts +0 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.mjs +10 -24
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/types/XyoGlobal.d.ts +14 -13
- package/dist/browser/types/XyoGlobal.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/index.ts +0 -1
- package/src/types/XyoGlobal.ts +40 -18
- package/dist/browser/provider/index.d.ts +0 -2
- package/dist/browser/provider/index.d.ts.map +0 -1
- package/dist/browser/provider/xyoProvider.d.ts +0 -15
- package/dist/browser/provider/xyoProvider.d.ts.map +0 -1
- package/src/provider/index.ts +0 -1
- package/src/provider/xyoProvider.ts +0 -35
package/dist/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const { assert } = options ?? {};
|
|
13
|
-
if (hasXyoWalletProvider()) {
|
|
14
|
-
return globalThis.xyo.provider;
|
|
15
|
-
} else {
|
|
16
|
-
console.error("XYO Wallet not installed");
|
|
17
|
-
if (assert) {
|
|
18
|
-
throw new Error("XYO Wallet not installed");
|
|
19
|
-
} else {
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
__name(getXyoProvider, "getXyoProvider");
|
|
4
|
+
// src/types/XyoGlobal.ts
|
|
5
|
+
import { isDefinedNotNull, isObject } from "@xylabs/typeof";
|
|
6
|
+
var isXyoGlobal = /* @__PURE__ */ __name((obj) => {
|
|
7
|
+
return isDefinedNotNull(obj) && isObject(obj) && "client" in obj && "connections" in obj && "errors" in obj && "sessionId" in obj && "walletExtensionId" in obj;
|
|
8
|
+
}, "isXyoGlobal");
|
|
9
|
+
var isUninitializedXyoGlobal = /* @__PURE__ */ __name((obj) => {
|
|
10
|
+
return isDefinedNotNull(obj) && isObject(obj) && "connections" in obj && "sessionId" in obj && "walletExtensionId" in obj && !("client" in obj) && "errors" in obj && Array.isArray(obj.errors) && obj.errors.length === 0;
|
|
11
|
+
}, "isUninitializedXyoGlobal");
|
|
25
12
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
hasXyoWalletProvider
|
|
13
|
+
isUninitializedXyoGlobal,
|
|
14
|
+
isXyoGlobal
|
|
29
15
|
};
|
|
30
16
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/types/XyoGlobal.ts"],"sourcesContent":["import { isDefinedNotNull, isObject } from '@xylabs/typeof'\nimport type { NetworkBootstrap } from '@xyo-network/xl1-network-model'\nimport type { NetworkId, XyoClient } from '@xyo-network/xl1-protocol'\n\nexport interface XyoGlobal extends UninitializedXyoGlobal {\n client: XyoClient\n errors: Error[]\n}\n\n/**\n * Describes the initial state of the global XYO object before initialization\n * (i.e. before the client is initialized)\n */\nexport interface UninitializedXyoGlobal {\n connections: Record<NetworkId, NetworkBootstrap>\n sessionId: () => string\n walletExtensionId: () => string\n}\n\nexport const isXyoGlobal = (obj: unknown): obj is XyoGlobal => {\n return (\n isDefinedNotNull(obj)\n && isObject(obj)\n && 'client' in obj\n && 'connections' in obj\n && 'errors' in obj\n && 'sessionId' in obj\n && 'walletExtensionId' in obj\n )\n}\n\nexport const isUninitializedXyoGlobal = (obj: unknown): obj is UninitializedXyoGlobal => {\n return (\n isDefinedNotNull(obj)\n && isObject(obj)\n && 'connections' in obj\n && 'sessionId' in obj\n && 'walletExtensionId' in obj\n && !('client' in obj)\n && ('errors' in obj)\n && Array.isArray((obj).errors)\n && obj.errors.length === 0\n )\n}\n"],"mappings":";;;;AAAA,SAASA,kBAAkBC,gBAAgB;AAmBpC,IAAMC,cAAc,wBAACC,QAAAA;AAC1B,SACEC,iBAAiBD,GAAAA,KACdE,SAASF,GAAAA,KACT,YAAYA,OACZ,iBAAiBA,OACjB,YAAYA,OACZ,eAAeA,OACf,uBAAuBA;AAE9B,GAV2B;AAYpB,IAAMG,2BAA2B,wBAACH,QAAAA;AACvC,SACEC,iBAAiBD,GAAAA,KACdE,SAASF,GAAAA,KACT,iBAAiBA,OACjB,eAAeA,OACf,uBAAuBA,OACvB,EAAE,YAAYA,QACb,YAAYA,OACbI,MAAMC,QAASL,IAAKM,MAAM,KAC1BN,IAAIM,OAAOC,WAAW;AAE7B,GAZwC;","names":["isDefinedNotNull","isObject","isXyoGlobal","obj","isDefinedNotNull","isObject","isUninitializedXyoGlobal","Array","isArray","errors","length"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export interface XyoGlobal {
|
|
4
|
-
client
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { NetworkBootstrap } from '@xyo-network/xl1-network-model';
|
|
2
|
+
import type { NetworkId, XyoClient } from '@xyo-network/xl1-protocol';
|
|
3
|
+
export interface XyoGlobal extends UninitializedXyoGlobal {
|
|
4
|
+
client: XyoClient;
|
|
5
|
+
errors: Error[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Describes the initial state of the global XYO object before initialization
|
|
9
|
+
* (i.e. before the client is initialized)
|
|
10
|
+
*/
|
|
11
|
+
export interface UninitializedXyoGlobal {
|
|
12
|
+
connections: Record<NetworkId, NetworkBootstrap>;
|
|
13
13
|
sessionId: () => string;
|
|
14
|
-
/** @deprecated - use session id instead */
|
|
15
14
|
walletExtensionId: () => string;
|
|
16
15
|
}
|
|
16
|
+
export declare const isXyoGlobal: (obj: unknown) => obj is XyoGlobal;
|
|
17
|
+
export declare const isUninitializedXyoGlobal: (obj: unknown) => obj is UninitializedXyoGlobal;
|
|
17
18
|
//# sourceMappingURL=XyoGlobal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyoGlobal.d.ts","sourceRoot":"","sources":["../../../src/types/XyoGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"XyoGlobal.d.ts","sourceRoot":"","sources":["../../../src/types/XyoGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErE,MAAM,WAAW,SAAU,SAAQ,sBAAsB;IACvD,MAAM,EAAE,SAAS,CAAA;IACjB,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAChD,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,MAAM,CAAA;CAChC;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,SAUjD,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,sBAY9D,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.15.
|
|
4
|
+
"version": "1.15.28",
|
|
5
5
|
"description": "XYO Layer One React SDK Stake",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
"src"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@xyo-network/xl1-
|
|
44
|
+
"@xylabs/typeof": "~5.0.18",
|
|
45
|
+
"@xyo-network/xl1-network-model": "~1.15.28",
|
|
46
|
+
"@xyo-network/xl1-protocol": "~1.12.102"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.
|
|
49
|
-
"@xylabs/tsconfig": "~7.
|
|
50
|
-
"@xylabs/tsconfig-dom": "~7.
|
|
51
|
-
"@xylabs/tsconfig-react": "~7.
|
|
52
|
-
"eslint": "^9.39.
|
|
49
|
+
"@xylabs/ts-scripts-yarn3": "~7.2.4",
|
|
50
|
+
"@xylabs/tsconfig": "~7.2.4",
|
|
51
|
+
"@xylabs/tsconfig-dom": "~7.2.4",
|
|
52
|
+
"@xylabs/tsconfig-react": "~7.2.4",
|
|
53
|
+
"eslint": "^9.39.1",
|
|
53
54
|
"typescript": "~5.9.3"
|
|
54
55
|
},
|
|
55
56
|
"publishConfig": {
|
package/src/index.ts
CHANGED
package/src/types/XyoGlobal.ts
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
XyoClient, XyoConnection, XyoGatewayProvider,
|
|
5
|
-
} from '@xyo-network/xl1-protocol'
|
|
1
|
+
import { isDefinedNotNull, isObject } from '@xylabs/typeof'
|
|
2
|
+
import type { NetworkBootstrap } from '@xyo-network/xl1-network-model'
|
|
3
|
+
import type { NetworkId, XyoClient } from '@xyo-network/xl1-protocol'
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
provider?: XyoConnection
|
|
5
|
+
export interface XyoGlobal extends UninitializedXyoGlobal {
|
|
6
|
+
client: XyoClient
|
|
7
|
+
errors: Error[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Describes the initial state of the global XYO object before initialization
|
|
12
|
+
* (i.e. before the client is initialized)
|
|
13
|
+
*/
|
|
14
|
+
export interface UninitializedXyoGlobal {
|
|
15
|
+
connections: Record<NetworkId, NetworkBootstrap>
|
|
19
16
|
sessionId: () => string
|
|
20
|
-
/** @deprecated - use session id instead */
|
|
21
17
|
walletExtensionId: () => string
|
|
22
18
|
}
|
|
19
|
+
|
|
20
|
+
export const isXyoGlobal = (obj: unknown): obj is XyoGlobal => {
|
|
21
|
+
return (
|
|
22
|
+
isDefinedNotNull(obj)
|
|
23
|
+
&& isObject(obj)
|
|
24
|
+
&& 'client' in obj
|
|
25
|
+
&& 'connections' in obj
|
|
26
|
+
&& 'errors' in obj
|
|
27
|
+
&& 'sessionId' in obj
|
|
28
|
+
&& 'walletExtensionId' in obj
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const isUninitializedXyoGlobal = (obj: unknown): obj is UninitializedXyoGlobal => {
|
|
33
|
+
return (
|
|
34
|
+
isDefinedNotNull(obj)
|
|
35
|
+
&& isObject(obj)
|
|
36
|
+
&& 'connections' in obj
|
|
37
|
+
&& 'sessionId' in obj
|
|
38
|
+
&& 'walletExtensionId' in obj
|
|
39
|
+
&& !('client' in obj)
|
|
40
|
+
&& ('errors' in obj)
|
|
41
|
+
&& Array.isArray((obj).errors)
|
|
42
|
+
&& obj.errors.length === 0
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { XyoConnection } from '@xyo-network/xl1-protocol';
|
|
2
|
-
import type { XyoGlobal } from '../types/index.ts';
|
|
3
|
-
declare global {
|
|
4
|
-
interface Window {
|
|
5
|
-
xyo: XyoGlobal;
|
|
6
|
-
}
|
|
7
|
-
var xyo: XyoGlobal;
|
|
8
|
-
var xyoWalletExtensionId: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const hasXyoWalletInjectable: () => boolean;
|
|
11
|
-
export declare const hasXyoWalletProvider: () => boolean;
|
|
12
|
-
export declare function getXyoProvider(options: {
|
|
13
|
-
assert: true;
|
|
14
|
-
}): XyoConnection;
|
|
15
|
-
//# sourceMappingURL=xyoProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xyoProvider.d.ts","sourceRoot":"","sources":["../../../src/provider/xyoProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,GAAG,EAAE,SAAS,CAAA;KACf;IAED,IAAI,GAAG,EAAE,SAAS,CAAA;IAClB,IAAI,oBAAoB,EAAE,MAAM,CAAA;CACjC;AAED,eAAO,MAAM,sBAAsB,eAElC,CAAA;AAED,eAAO,MAAM,oBAAoB,eAEhC,CAAA;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,aAAa,CAAA"}
|
package/src/provider/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './xyoProvider.ts'
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { XyoConnection } from '@xyo-network/xl1-protocol'
|
|
2
|
-
|
|
3
|
-
import type { XyoGlobal } from '../types/index.ts'
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
interface Window {
|
|
7
|
-
xyo: XyoGlobal
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
var xyo: XyoGlobal
|
|
11
|
-
var xyoWalletExtensionId: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const hasXyoWalletInjectable = () => {
|
|
15
|
-
return 'xyo' in globalThis && 'walletExtensionId' in globalThis.xyo
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const hasXyoWalletProvider = () => {
|
|
19
|
-
return hasXyoWalletInjectable() && 'provider' in globalThis.xyo
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getXyoProvider(options: { assert: true }): XyoConnection
|
|
23
|
-
export function getXyoProvider(options?: { assert?: boolean }): XyoConnection | undefined {
|
|
24
|
-
const { assert } = options ?? {}
|
|
25
|
-
if (hasXyoWalletProvider()) {
|
|
26
|
-
return globalThis.xyo.provider
|
|
27
|
-
} else {
|
|
28
|
-
console.error('XYO Wallet not installed')
|
|
29
|
-
if (assert) {
|
|
30
|
-
throw new Error('XYO Wallet not installed')
|
|
31
|
-
} else {
|
|
32
|
-
return undefined
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|