@xyo-network/react-wallet 2.26.18 → 2.26.21

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 (55) hide show
  1. package/dist/cjs/components/WalletAccountDetails/WalletAccountDetails.d.ts +8 -0
  2. package/dist/cjs/components/WalletAccountDetails/WalletAccountDetails.js +21 -0
  3. package/dist/cjs/components/WalletAccountDetails/WalletAccountDetails.js.map +1 -0
  4. package/dist/cjs/components/WalletAccountDetails/index.d.ts +1 -0
  5. package/dist/cjs/components/WalletAccountDetails/index.js +5 -0
  6. package/dist/cjs/components/WalletAccountDetails/index.js.map +1 -0
  7. package/dist/cjs/components/WalletAccountSelect/Select.d.ts +8 -0
  8. package/dist/cjs/components/WalletAccountSelect/Select.js +30 -0
  9. package/dist/cjs/components/WalletAccountSelect/Select.js.map +1 -0
  10. package/dist/cjs/components/WalletAccountSelect/SelectBar.d.ts +9 -0
  11. package/dist/cjs/components/WalletAccountSelect/SelectBar.js +14 -0
  12. package/dist/cjs/components/WalletAccountSelect/SelectBar.js.map +1 -0
  13. package/dist/cjs/components/WalletAccountSelect/index.d.ts +2 -0
  14. package/dist/cjs/components/WalletAccountSelect/index.js +6 -0
  15. package/dist/cjs/components/WalletAccountSelect/index.js.map +1 -0
  16. package/dist/cjs/components/index.d.ts +2 -0
  17. package/dist/cjs/components/index.js +6 -0
  18. package/dist/cjs/components/index.js.map +1 -0
  19. package/dist/cjs/contexts/Account/Context.d.ts +3 -0
  20. package/dist/cjs/contexts/Account/Context.js +6 -0
  21. package/dist/cjs/contexts/Account/Context.js.map +1 -0
  22. package/dist/cjs/contexts/Account/MemoryProvider.d.ts +7 -0
  23. package/dist/cjs/contexts/Account/MemoryProvider.js +14 -0
  24. package/dist/cjs/contexts/Account/MemoryProvider.js.map +1 -0
  25. package/dist/cjs/contexts/Account/State.d.ts +7 -0
  26. package/dist/cjs/contexts/Account/State.js +3 -0
  27. package/dist/cjs/contexts/Account/State.js.map +1 -0
  28. package/dist/cjs/contexts/Account/index.d.ts +4 -0
  29. package/dist/cjs/contexts/Account/index.js +8 -0
  30. package/dist/cjs/contexts/Account/index.js.map +1 -0
  31. package/dist/cjs/contexts/Account/use.d.ts +1 -0
  32. package/dist/cjs/contexts/Account/use.js +10 -0
  33. package/dist/cjs/contexts/Account/use.js.map +1 -0
  34. package/dist/cjs/contexts/Wallet/Context.d.ts +3 -0
  35. package/dist/cjs/contexts/Wallet/Context.js +6 -0
  36. package/dist/cjs/contexts/Wallet/Context.js.map +1 -0
  37. package/dist/cjs/contexts/Wallet/Provider.d.ts +8 -0
  38. package/dist/cjs/contexts/Wallet/Provider.js +27 -0
  39. package/dist/cjs/contexts/Wallet/Provider.js.map +1 -0
  40. package/dist/cjs/contexts/Wallet/State.d.ts +9 -0
  41. package/dist/cjs/contexts/Wallet/State.js +3 -0
  42. package/dist/cjs/contexts/Wallet/State.js.map +1 -0
  43. package/dist/cjs/contexts/Wallet/index.d.ts +4 -0
  44. package/dist/cjs/contexts/Wallet/index.js +8 -0
  45. package/dist/cjs/contexts/Wallet/index.js.map +1 -0
  46. package/dist/cjs/contexts/Wallet/use.d.ts +1 -0
  47. package/dist/cjs/contexts/Wallet/use.js +10 -0
  48. package/dist/cjs/contexts/Wallet/use.js.map +1 -0
  49. package/dist/cjs/contexts/index.d.ts +2 -0
  50. package/dist/cjs/contexts/index.js +6 -0
  51. package/dist/cjs/contexts/index.js.map +1 -0
  52. package/dist/cjs/index.d.ts +2 -0
  53. package/dist/cjs/index.js +6 -0
  54. package/dist/cjs/index.js.map +1 -0
  55. package/package.json +13 -14
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ import { XyoAccount } from '@xyo-network/account';
4
+ export interface WalletAccountDetailsProps extends FlexBoxProps {
5
+ account?: XyoAccount;
6
+ exploreUrl?: string;
7
+ }
8
+ export declare const WalletAccountDetails: React.FC<WalletAccountDetailsProps>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletAccountDetails = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_crypto_1 = require("@xylabs/react-crypto");
7
+ const react_flexbox_1 = require("@xylabs/react-flexbox");
8
+ const react_number_status_1 = require("@xylabs/react-number-status");
9
+ const sdk_js_1 = require("@xylabs/sdk-js");
10
+ const react_network_1 = require("@xyo-network/react-network");
11
+ const contexts_1 = require("../../contexts");
12
+ const WalletAccountDetails = (_a) => {
13
+ var _b;
14
+ var { exploreUrl = 'https://explore.xyo.network', account: accountProp } = _a, props = tslib_1.__rest(_a, ["exploreUrl", "account"]);
15
+ const { account = accountProp } = (0, contexts_1.useAccount)();
16
+ const { network } = (0, react_network_1.useNetwork)();
17
+ const exploreAddressUrl = `${exploreUrl}/recent?account=${account === null || account === void 0 ? void 0 : account.addressValue.hex}&network=${(_b = network === null || network === void 0 ? void 0 : network.name) !== null && _b !== void 0 ? _b : 'main'}`;
18
+ return ((0, jsx_runtime_1.jsxs)(react_flexbox_1.FlexCol, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(react_crypto_1.EthAccountButton, { address: sdk_js_1.EthAddress.fromString(account === null || account === void 0 ? void 0 : account.addressValue.hex) }), (0, jsx_runtime_1.jsxs)(react_flexbox_1.FlexRow, Object.assign({ gap: 1 }, { children: [(0, jsx_runtime_1.jsx)(react_number_status_1.NumberStatus, { rounded: true, title: "Tokens", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.tokens`, target: "_blank" }), (0, jsx_runtime_1.jsx)(react_number_status_1.NumberStatus, { rounded: true, title: "NFTs", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.nfts`, target: "_blank" }), (0, jsx_runtime_1.jsx)(react_number_status_1.NumberStatus, { rounded: true, title: "Signatures", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.signatures`, target: "_blank" }), (0, jsx_runtime_1.jsx)(react_number_status_1.NumberStatus, { rounded: true, title: "Signins", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.signins`, target: "_blank" })] }))] })));
19
+ };
20
+ exports.WalletAccountDetails = WalletAccountDetails;
21
+ //# sourceMappingURL=WalletAccountDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WalletAccountDetails.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountDetails/WalletAccountDetails.tsx"],"names":[],"mappings":";;;;;AAAA,uDAAuD;AACvD,yDAAsE;AACtE,qEAA0D;AAC1D,2CAA2C;AAE3C,8DAAuD;AAEvD,6CAA2C;AAOpC,MAAM,oBAAoB,GAAwC,CAAC,EAA8E,EAAE,EAAE;;QAAlF,EAAE,UAAU,GAAG,6BAA6B,EAAE,OAAO,EAAE,WAAW,OAAY,EAAP,KAAK,sBAA5E,yBAA8E,CAAF;IACpJ,MAAM,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,IAAA,qBAAU,GAAE,CAAA;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAU,GAAE,CAAA;IAChC,MAAM,iBAAiB,GAAG,GAAG,UAAU,mBAAmB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,GAAG,YAAY,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,MAAM,EAAE,CAAA;IAExH,OAAO,CACL,wBAAC,uBAAO,oBAAK,KAAK,eAChB,uBAAC,+BAAgB,IAAC,OAAO,EAAE,mBAAU,CAAC,UAAU,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,GAAG,CAAC,GAAI,EAC/E,wBAAC,uBAAO,kBAAC,GAAG,EAAE,CAAC,iBACb,uBAAC,kCAAY,IAAC,OAAO,QAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,iBAAiB,oCAAoC,EAAE,MAAM,EAAC,QAAQ,GAAG,EAC/H,uBAAC,kCAAY,IAAC,OAAO,QAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,iBAAiB,kCAAkC,EAAE,MAAM,EAAC,QAAQ,GAAG,EAC3H,uBAAC,kCAAY,IAAC,OAAO,QAAC,KAAK,EAAC,YAAY,EAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,iBAAiB,wCAAwC,EAAE,MAAM,EAAC,QAAQ,GAAG,EACvI,uBAAC,kCAAY,IAAC,OAAO,QAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,iBAAiB,qCAAqC,EAAE,MAAM,EAAC,QAAQ,GAAG,KACzH,KACF,CACX,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,oBAAoB,wBAgBhC"}
@@ -0,0 +1 @@
1
+ export * from './WalletAccountDetails';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./WalletAccountDetails"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountDetails/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from '@mui/material';
3
+ export interface WalletAccountSelectProps extends SelectProps<number> {
4
+ iconOnly?: boolean;
5
+ icons?: boolean;
6
+ iconSize?: number;
7
+ }
8
+ export declare const WalletAccountSelect: React.FC<WalletAccountSelectProps>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletAccountSelect = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const material_1 = require("@mui/material");
7
+ const react_common_1 = require("@xylabs/react-common");
8
+ const react_crypto_1 = require("@xylabs/react-crypto");
9
+ const react_flexbox_1 = require("@xylabs/react-flexbox");
10
+ const react_identicon_1 = require("@xylabs/react-identicon");
11
+ const sdk_js_1 = require("@xylabs/sdk-js");
12
+ const contexts_1 = require("../../contexts");
13
+ const arrayRange = (length, start = 0) => {
14
+ return Array.from(Array(length).keys()).map((x) => x + start);
15
+ };
16
+ const WalletAccountSelect = (_a) => {
17
+ var { size, iconSize = 24, icons, iconOnly } = _a, props = tslib_1.__rest(_a, ["size", "iconSize", "icons", "iconOnly"]);
18
+ const { wallet, activeAccountIndex = 0, setActiveAccountIndex } = (0, contexts_1.useWallet)();
19
+ return ((0, jsx_runtime_1.jsx)(react_common_1.SelectEx, Object.assign({ renderValue: (selected) => {
20
+ const account = wallet === null || wallet === void 0 ? void 0 : wallet.getAccount(parseInt(`${selected}`));
21
+ return ((0, jsx_runtime_1.jsxs)(react_flexbox_1.FlexRow, Object.assign({ justifyContent: "flex-start", gap: 1 }, { children: [icons ? ((0, jsx_runtime_1.jsx)(react_flexbox_1.FlexRow, { children: (0, jsx_runtime_1.jsx)(react_identicon_1.Identicon, { size: iconSize, value: account === null || account === void 0 ? void 0 : account.addressValue.hex }) })) : null, (0, jsx_runtime_1.jsx)(react_crypto_1.EthAccountBox, { alignItems: "stretch", iconOnly: iconOnly, address: sdk_js_1.EthAddress.fromString(account === null || account === void 0 ? void 0 : account.addressValue.hex) })] })));
22
+ }, value: activeAccountIndex, onChange: (event) => setActiveAccountIndex === null || setActiveAccountIndex === void 0 ? void 0 : setActiveAccountIndex(parseInt(`${event.target.value}`)), size: size, variant: "outlined" }, props, { children: wallet
23
+ ? arrayRange(10).map((index) => {
24
+ const account = wallet === null || wallet === void 0 ? void 0 : wallet.getAccount(index);
25
+ return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: index }, { children: (0, jsx_runtime_1.jsx)(react_crypto_1.EthAccountBox, { iconSize: iconSize, icon: icons, address: sdk_js_1.EthAddress.fromString(account.addressValue.hex) }) }), index));
26
+ })
27
+ : null })));
28
+ };
29
+ exports.WalletAccountSelect = WalletAccountSelect;
30
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountSelect/Select.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAqD;AACrD,uDAA+C;AAC/C,uDAAoD;AACpD,yDAA+C;AAC/C,6DAAmD;AACnD,2CAA2C;AAE3C,6CAA0C;AAQ1C,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAA;AAC/D,CAAC,CAAA;AAEM,MAAM,mBAAmB,GAAuC,CAAC,EAAkD,EAAE,EAAE;QAAtD,EAAE,IAAI,EAAE,QAAQ,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,sBAAhD,yCAAkD,CAAF;IACtH,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,CAAC,EAAE,qBAAqB,EAAE,GAAG,IAAA,oBAAS,GAAE,CAAA;IAE7E,OAAO,CACL,uBAAC,uBAAQ,kBACP,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE;YACxB,MAAM,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAA;YAC3D,OAAO,CACL,wBAAC,uBAAO,kBAAC,cAAc,EAAC,YAAY,EAAC,GAAG,EAAE,CAAC,iBACxC,KAAK,CAAC,CAAC,CAAC,CACP,uBAAC,uBAAO,cACN,uBAAC,2BAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,GAAG,GAAI,GACvD,CACX,CAAC,CAAC,CAAC,IAAI,EACR,uBAAC,4BAAa,IAAC,UAAU,EAAC,SAAS,EAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAU,CAAC,UAAU,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,GAAG,CAAC,GAAI,KAC7G,CACX,CAAA;QACH,CAAC,EACD,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,EAC/E,IAAI,EAAE,IAAI,EACV,OAAO,EAAC,UAAU,IACd,KAAK,cAER,MAAM;YACL,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,KAAK,CAAC,CAAA;gBACzC,OAAO,CACL,uBAAC,mBAAQ,kBAAa,KAAK,EAAE,KAAK,gBAChC,uBAAC,4BAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,mBAAU,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,GAAI,KAD/F,KAAK,CAET,CACZ,CAAA;YACH,CAAC,CAAC;YACJ,CAAC,CAAC,IAAI,IACC,CACZ,CAAA;AACH,CAAC,CAAA;AApCY,QAAA,mBAAmB,uBAoC/B"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ export interface WalletAccountSelectBarProps extends FlexBoxProps {
4
+ size?: 'small' | 'medium';
5
+ iconOnly?: boolean;
6
+ icons?: boolean;
7
+ iconSize?: number;
8
+ }
9
+ export declare const WalletAccountSelectBar: React.FC<WalletAccountSelectBarProps>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletAccountSelectBar = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const material_1 = require("@mui/material");
7
+ const react_flexbox_1 = require("@xylabs/react-flexbox");
8
+ const Select_1 = require("./Select");
9
+ const WalletAccountSelectBar = (_a) => {
10
+ var { iconOnly, icons, iconSize, size = 'small' } = _a, props = tslib_1.__rest(_a, ["iconOnly", "icons", "iconSize", "size"]);
11
+ return ((0, jsx_runtime_1.jsx)(react_flexbox_1.FlexCol, Object.assign({ alignItems: "stretch" }, props, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ variant: "elevation", elevation: 0 }, { children: (0, jsx_runtime_1.jsx)(Select_1.WalletAccountSelect, { fullWidth: true, iconSize: iconSize, iconOnly: iconOnly, icons: icons, size: size !== null && size !== void 0 ? size : 'small' }) })) })));
12
+ };
13
+ exports.WalletAccountSelectBar = WalletAccountSelectBar;
14
+ //# sourceMappingURL=SelectBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectBar.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountSelect/SelectBar.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAqC;AACrC,yDAA6D;AAE7D,qCAA8C;AASvC,MAAM,sBAAsB,GAA0C,CAAC,EAAuD,EAAE,EAAE;QAA3D,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,OAAY,EAAP,KAAK,sBAArD,yCAAuD,CAAF;IACjI,OAAO,CACL,uBAAC,uBAAO,kBAAC,UAAU,EAAC,SAAS,IAAK,KAAK,cACrC,uBAAC,gBAAK,kBAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAE,CAAC,gBACrC,uBAAC,4BAAmB,IAAC,SAAS,QAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,OAAO,GAAI,IACxG,IACA,CACX,CAAA;AACH,CAAC,CAAA;AARY,QAAA,sBAAsB,0BAQlC"}
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './SelectBar';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Select"), exports);
5
+ tslib_1.__exportStar(require("./SelectBar"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountSelect/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwB;AACxB,sDAA2B"}
@@ -0,0 +1,2 @@
1
+ export * from './WalletAccountDetails';
2
+ export * from './WalletAccountSelect';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./WalletAccountDetails"), exports);
5
+ tslib_1.__exportStar(require("./WalletAccountSelect"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC;AACtC,gEAAqC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { AccountContextState } from './State';
3
+ export declare const AccountContext: import("react").Context<AccountContextState & import("@xyo-network/react-shared").ContextExState>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountContext = void 0;
4
+ const react_shared_1 = require("@xyo-network/react-shared");
5
+ exports.AccountContext = (0, react_shared_1.createContextEx)();
6
+ //# sourceMappingURL=Context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../../src/contexts/Account/Context.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAI9C,QAAA,cAAc,GAAG,IAAA,8BAAe,GAAuB,CAAA"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { WithChildren } from '@xylabs/react-shared';
3
+ import { XyoAccount } from '@xyo-network/account';
4
+ export interface AccountMemoryProviderProps {
5
+ defaultAccount?: XyoAccount;
6
+ }
7
+ export declare const AccountMemoryProvider: React.FC<WithChildren<AccountMemoryProviderProps>>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountMemoryProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const Context_1 = require("./Context");
8
+ const AccountMemoryProvider = (_a) => {
9
+ var { defaultAccount } = _a, props = tslib_1.__rest(_a, ["defaultAccount"]);
10
+ const [account, setAccount] = (0, react_1.useState)(defaultAccount);
11
+ return (0, jsx_runtime_1.jsx)(Context_1.AccountContext.Provider, Object.assign({ value: { account: account, provided: true, setAccount } }, props));
12
+ };
13
+ exports.AccountMemoryProvider = AccountMemoryProvider;
14
+ //# sourceMappingURL=MemoryProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MemoryProvider.js","sourceRoot":"","sources":["../../../../src/contexts/Account/MemoryProvider.tsx"],"names":[],"mappings":";;;;;AAEA,iCAAgC;AAEhC,uCAA0C;AAMnC,MAAM,qBAAqB,GAAuD,CAAC,EAA4B,EAAE,EAAE;QAAhC,EAAE,cAAc,OAAY,EAAP,KAAK,sBAA1B,kBAA4B,CAAF;IAClH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAyB,cAAc,CAAC,CAAA;IAE9E,OAAO,uBAAC,wBAAc,CAAC,QAAQ,kBAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAM,KAAK,EAAI,CAAA;AACxG,CAAC,CAAA;AAJY,QAAA,qBAAqB,yBAIjC"}
@@ -0,0 +1,7 @@
1
+ import { XyoAccount } from '@xyo-network/account';
2
+ import { ContextExState } from '@xyo-network/react-shared';
3
+ import { Dispatch } from 'react';
4
+ export interface AccountContextState extends ContextExState {
5
+ account?: XyoAccount;
6
+ setAccount?: Dispatch<XyoAccount>;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=State.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.js","sourceRoot":"","sources":["../../../../src/contexts/Account/State.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './Context';
2
+ export * from './MemoryProvider';
3
+ export * from './State';
4
+ export * from './use';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Context"), exports);
5
+ tslib_1.__exportStar(require("./MemoryProvider"), exports);
6
+ tslib_1.__exportStar(require("./State"), exports);
7
+ tslib_1.__exportStar(require("./use"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contexts/Account/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,2DAAgC;AAChC,kDAAuB;AACvB,gDAAqB"}
@@ -0,0 +1 @@
1
+ export declare const useAccount: (required?: boolean) => Omit<import("./State").AccountContextState & import("@xyo-network/react-shared").ContextExState, "provided">;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAccount = void 0;
4
+ const react_shared_1 = require("@xyo-network/react-shared");
5
+ const Context_1 = require("./Context");
6
+ const useAccount = (required = false) => {
7
+ return (0, react_shared_1.useContextEx)(Context_1.AccountContext, 'Account', required);
8
+ };
9
+ exports.useAccount = useAccount;
10
+ //# sourceMappingURL=use.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../../src/contexts/Account/use.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAExD,uCAA0C;AAEnC,MAAM,UAAU,GAAG,CAAC,QAAQ,GAAG,KAAK,EAAE,EAAE;IAC7C,OAAO,IAAA,2BAAY,EAAC,wBAAc,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC1D,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { WalletContextState } from './State';
3
+ export declare const WalletContext: import("react").Context<WalletContextState & import("@xyo-network/react-shared").ContextExState>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletContext = void 0;
4
+ const react_shared_1 = require("@xyo-network/react-shared");
5
+ exports.WalletContext = (0, react_shared_1.createContextEx)();
6
+ //# sourceMappingURL=Context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../../src/contexts/Wallet/Context.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAI9C,QAAA,aAAa,GAAG,IAAA,8BAAe,GAAsB,CAAA"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { WithChildren } from '@xylabs/react-shared';
3
+ import { XyoWalletBase } from '@xyo-network/wallet';
4
+ export interface WalletProviderProps {
5
+ defaultWallet?: XyoWalletBase;
6
+ defaultActiveAccountIndex?: number;
7
+ }
8
+ export declare const WalletProvider: React.FC<WithChildren<WalletProviderProps>>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const Account_1 = require("../Account");
8
+ const Context_1 = require("./Context");
9
+ const use_1 = require("./use");
10
+ const AccountWalletProvider = (props) => {
11
+ const { wallet, activeAccountIndex = 0 } = (0, use_1.useWallet)();
12
+ return (0, jsx_runtime_1.jsx)(Account_1.AccountContext.Provider, Object.assign({ value: { account: wallet === null || wallet === void 0 ? void 0 : wallet.getAccount(activeAccountIndex), provided: true } }, props));
13
+ };
14
+ const WalletProvider = (_a) => {
15
+ var { defaultWallet, defaultActiveAccountIndex = 0, children } = _a, props = tslib_1.__rest(_a, ["defaultWallet", "defaultActiveAccountIndex", "children"]);
16
+ const [wallet, setWallet] = (0, react_1.useState)(defaultWallet);
17
+ const [activeAccountIndex, setActiveAccountIndex] = (0, react_1.useState)(defaultActiveAccountIndex);
18
+ return ((0, jsx_runtime_1.jsx)(Context_1.WalletContext.Provider, Object.assign({ value: {
19
+ activeAccountIndex,
20
+ provided: true,
21
+ setActiveAccountIndex,
22
+ setWallet,
23
+ wallet,
24
+ } }, props, { children: (0, jsx_runtime_1.jsx)(AccountWalletProvider, { children: children }) })));
25
+ };
26
+ exports.WalletProvider = WalletProvider;
27
+ //# sourceMappingURL=Provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../../src/contexts/Wallet/Provider.tsx"],"names":[],"mappings":";;;;;AAEA,iCAAgC;AAEhC,wCAA2C;AAC3C,uCAAyC;AACzC,+BAAiC;AAOjC,MAAM,qBAAqB,GAA2B,CAAC,KAAK,EAAE,EAAE;IAC9D,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,CAAC,EAAE,GAAG,IAAA,eAAS,GAAE,CAAA;IAEtD,OAAO,uBAAC,wBAAc,CAAC,QAAQ,kBAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAM,KAAK,EAAI,CAAA;AAC3H,CAAC,CAAA;AAEM,MAAM,cAAc,GAAgD,CAAC,EAAoE,EAAE,EAAE;QAAxE,EAAE,aAAa,EAAE,yBAAyB,GAAG,CAAC,EAAE,QAAQ,OAAY,EAAP,KAAK,sBAAlE,0DAAoE,CAAF;IAC5I,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAA4B,aAAa,CAAC,CAAA;IAC9E,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,IAAA,gBAAQ,EAAC,yBAAyB,CAAC,CAAA;IAEvF,OAAO,CACL,uBAAC,uBAAa,CAAC,QAAQ,kBACrB,KAAK,EAAE;YACL,kBAAkB;YAClB,QAAQ,EAAE,IAAI;YACd,qBAAqB;YACrB,SAAS;YACT,MAAM;SACP,IACG,KAAK,cAET,uBAAC,qBAAqB,cAAE,QAAQ,GAAyB,IAClC,CAC1B,CAAA;AACH,CAAC,CAAA;AAlBY,QAAA,cAAc,kBAkB1B"}
@@ -0,0 +1,9 @@
1
+ import { ContextExState } from '@xyo-network/react-shared';
2
+ import { XyoWalletBase } from '@xyo-network/wallet';
3
+ import { Dispatch } from 'react';
4
+ export interface WalletContextState extends ContextExState {
5
+ wallet?: XyoWalletBase;
6
+ setWallet?: Dispatch<XyoWalletBase>;
7
+ activeAccountIndex?: number;
8
+ setActiveAccountIndex?: Dispatch<number>;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=State.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.js","sourceRoot":"","sources":["../../../../src/contexts/Wallet/State.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './Context';
2
+ export * from './Provider';
3
+ export * from './State';
4
+ export * from './use';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Context"), exports);
5
+ tslib_1.__exportStar(require("./Provider"), exports);
6
+ tslib_1.__exportStar(require("./State"), exports);
7
+ tslib_1.__exportStar(require("./use"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/contexts/Wallet/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,qDAA0B;AAC1B,kDAAuB;AACvB,gDAAqB"}
@@ -0,0 +1 @@
1
+ export declare const useWallet: (required?: boolean) => Omit<import("./State").WalletContextState & import("@xyo-network/react-shared").ContextExState, "provided">;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useWallet = void 0;
4
+ const react_shared_1 = require("@xyo-network/react-shared");
5
+ const Context_1 = require("./Context");
6
+ const useWallet = (required = false) => {
7
+ return (0, react_shared_1.useContextEx)(Context_1.WalletContext, 'Wallet', required);
8
+ };
9
+ exports.useWallet = useWallet;
10
+ //# sourceMappingURL=use.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../../src/contexts/Wallet/use.ts"],"names":[],"mappings":";;;AAAA,4DAAwD;AAExD,uCAAyC;AAElC,MAAM,SAAS,GAAG,CAAC,QAAQ,GAAG,KAAK,EAAE,EAAE;IAC5C,OAAO,IAAA,2BAAY,EAAC,uBAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACxD,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB"}
@@ -0,0 +1,2 @@
1
+ export * from './Account';
2
+ export * from './Wallet';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Account"), exports);
5
+ tslib_1.__exportStar(require("./Wallet"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contexts/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,mDAAwB"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ export * from './contexts';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./components"), exports);
5
+ tslib_1.__exportStar(require("./contexts"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,qDAA0B"}
package/package.json CHANGED
@@ -13,17 +13,17 @@
13
13
  "@emotion/react": "^11.9.3",
14
14
  "@emotion/styled": "^11.9.3",
15
15
  "@mui/material": "^5.9.0",
16
- "@xylabs/react-common": "^2.14.8",
17
- "@xylabs/react-crypto": "^2.14.8",
18
- "@xylabs/react-flexbox": "^2.14.8",
19
- "@xylabs/react-identicon": "^2.14.8",
20
- "@xylabs/react-number-status": "^2.14.8",
21
- "@xylabs/react-shared": "^2.14.8",
22
- "@xylabs/sdk-js": "^2.6.1",
23
- "@xyo-network/account": "^2.21.18",
24
- "@xyo-network/react-network": "^2.26.18",
25
- "@xyo-network/react-shared": "^2.26.18",
26
- "@xyo-network/wallet": "^2.21.18",
16
+ "@xylabs/react-common": "^2.14.10",
17
+ "@xylabs/react-crypto": "^2.14.10",
18
+ "@xylabs/react-flexbox": "^2.14.10",
19
+ "@xylabs/react-identicon": "^2.14.10",
20
+ "@xylabs/react-number-status": "^2.14.10",
21
+ "@xylabs/react-shared": "^2.14.10",
22
+ "@xylabs/sdk-js": "^2.6.2",
23
+ "@xyo-network/account": "^2.21.19",
24
+ "@xyo-network/react-network": "^2.26.21",
25
+ "@xyo-network/react-shared": "^2.26.21",
26
+ "@xyo-network/wallet": "^2.21.19",
27
27
  "react": "^18.2.0",
28
28
  "react-dom": "^18.2.0",
29
29
  "react-router-dom": "^6.3.0"
@@ -33,7 +33,7 @@
33
33
  "@babel/core": "^7.18.6",
34
34
  "@babel/preset-env": "^7.18.6",
35
35
  "@storybook/react": "^6.5.9",
36
- "@xylabs/sdk-js": "^2.6.1",
36
+ "@xylabs/sdk-js": "^2.6.2",
37
37
  "@xylabs/tsconfig": "^1.0.14"
38
38
  },
39
39
  "browser": "dist/esm/index.js",
@@ -85,6 +85,5 @@
85
85
  },
86
86
  "sideEffects": false,
87
87
  "types": "dist/esm/index.d.ts",
88
- "version": "2.26.18",
89
- "packageManager": "yarn@3.1.1"
88
+ "version": "2.26.21"
90
89
  }