@rango-dev/wallets-react 0.27.1-next.12 → 0.27.1-next.14
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/helpers/index.js +1 -1
- package/dist/helpers/index.js.map +3 -3
- package/dist/hub/useHubAdapter.d.ts.map +1 -1
- package/dist/hub/utils.d.ts +3 -2
- package/dist/hub/utils.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/legacy/types.d.ts +17 -23
- package/dist/legacy/types.d.ts.map +1 -1
- package/dist/wallets-react.build.json +1 -1
- package/package.json +4 -4
- package/src/hub/useHubAdapter.ts +19 -14
- package/src/hub/utils.ts +123 -144
- package/src/legacy/types.ts +25 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/legacy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EACV,8BAA8B,EAC9B,uBAAuB,EACvB,aAAa,IAAI,OAAO,EACxB,kBAAkB,IAAI,kBAAkB,EACxC,gBAAgB,IAAI,UAAU,EAC9B,WAAW,IAAI,WAAW,EAC1B,gBAAgB,IAAI,UAAU,EAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,MAAM,KAAK,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,
|
|
1
|
+
{"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,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,aAAa,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC;CAC7D;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,MAAM,eAAe,GAAG,GAAG,CAC/B,UAAU,EACV;IACE,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/hub/constants.ts":{"bytes":146,"imports":[],"format":"esm"},"src/hub/lastConnectedWallets.ts":{"bytes":4867,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":4652,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/context.ts":{"bytes":905,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/autoConnect.ts":{"bytes":2046,"imports":[{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/hooks.ts":{"bytes":1545,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/utils.ts":{"bytes":230,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useAutoConnect.ts":{"bytes":628,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useLegacyProviders.ts":{"bytes":7308,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./hooks.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"./useAutoConnect.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/mod.ts":{"bytes":321,"imports":[{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"src/legacy/useLegacyProviders.ts","kind":"import-statement","original":"./useLegacyProviders.js"}],"format":"esm"},"src/hub/helpers.ts":{"bytes":2342,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/utils.ts":{"bytes":10648,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/autoConnect.ts":{"bytes":6964,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubRefs.ts":{"bytes":1365,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubAdapter.ts":{"bytes":12203,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"../legacy/useAutoConnect.js"},{"path":"src/hub/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/useHubRefs.ts","kind":"import-statement","original":"./useHubRefs.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/mod.ts":{"bytes":162,"imports":[{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/hub/useHubAdapter.ts","kind":"import-statement","original":"./useHubAdapter.js"}],"format":"esm"},"src/useProviders.ts":{"bytes":3425,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"./hub/mod.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./legacy/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/provider.tsx":{"bytes":405,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./legacy/context.js"},{"path":"src/useProviders.ts","kind":"import-statement","original":"./useProviders.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/types.ts":{"bytes":5147,"imports":[],"format":"esm"},"src/index.ts":{"bytes":173,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./legacy/helpers.js"},{"path":"src/provider.tsx","kind":"import-statement","original":"./provider.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./legacy/hooks.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./legacy/types.js"}],"format":"esm"},"src/helpers/index.ts":{"bytes":55,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"../hub/mod.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":97076},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["Events","Provider","availableWallets","checkWalletProviders","choose","clearPersistance","connectedWallets","defaultWalletState","isAsync","makeEventHandler","needsCheckInstallation","stateReducer","tryPersistWallet","tryRemoveWalletFromPersistance","useWallets"],"entryPoint":"src/index.ts","inputs":{"src/legacy/helpers.ts":{"bytesInOutput":1401},"src/hub/constants.ts":{"bytesInOutput":65},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":1210},"src/index.ts":{"bytesInOutput":0},"src/provider.tsx":{"bytesInOutput":133},"src/legacy/context.ts":{"bytesInOutput":431},"src/hub/utils.ts":{"bytesInOutput":2902},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":2127},"src/legacy/autoConnect.ts":{"bytesInOutput":395},"src/legacy/hooks.ts":{"bytesInOutput":460},"src/legacy/useAutoConnect.ts":{"bytesInOutput":197},"src/legacy/utils.ts":{"bytesInOutput":94},"src/hub/helpers.ts":{"bytesInOutput":873},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":3881},"src/hub/autoConnect.ts":{"bytesInOutput":2058},"src/hub/useHubRefs.ts":{"bytesInOutput":510},"src/useProviders.ts":{"bytesInOutput":885},"src/legacy/types.ts":{"bytesInOutput":164}},"bytes":18225},"dist/helpers/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":60709},"dist/helpers/index.js":{"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["getAllLegacyProviders"],"entryPoint":"src/helpers/index.ts","inputs":{"src/hub/utils.ts":{"bytesInOutput":547},"src/hub/constants.ts":{"bytesInOutput":65},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/context.ts":{"bytesInOutput":427},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":52},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":1210},"src/legacy/helpers.ts":{"bytesInOutput":59},"src/legacy/hooks.ts":{"bytesInOutput":109},"src/legacy/useAutoConnect.ts":{"bytesInOutput":47},"src/hub/helpers.ts":{"bytesInOutput":178},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":143},"src/hub/autoConnect.ts":{"bytesInOutput":156},"src/hub/useHubRefs.ts":{"bytesInOutput":97},"src/helpers/index.ts":{"bytesInOutput":0}},"bytes":3239}}}
|
|
1
|
+
{"inputs":{"src/hub/constants.ts":{"bytes":146,"imports":[],"format":"esm"},"src/hub/lastConnectedWallets.ts":{"bytes":4867,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":4652,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/context.ts":{"bytes":905,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/autoConnect.ts":{"bytes":2046,"imports":[{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/hooks.ts":{"bytes":1545,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/utils.ts":{"bytes":230,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useAutoConnect.ts":{"bytes":628,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useLegacyProviders.ts":{"bytes":7308,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./hooks.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"./useAutoConnect.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/mod.ts":{"bytes":321,"imports":[{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"src/legacy/useLegacyProviders.ts","kind":"import-statement","original":"./useLegacyProviders.js"}],"format":"esm"},"src/hub/helpers.ts":{"bytes":2342,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/utils.ts":{"bytes":9250,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/autoConnect.ts":{"bytes":6964,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubRefs.ts":{"bytes":1365,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubAdapter.ts":{"bytes":12311,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"../legacy/useAutoConnect.js"},{"path":"src/hub/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/useHubRefs.ts","kind":"import-statement","original":"./useHubRefs.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/mod.ts":{"bytes":162,"imports":[{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/hub/useHubAdapter.ts","kind":"import-statement","original":"./useHubAdapter.js"}],"format":"esm"},"src/useProviders.ts":{"bytes":3425,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"./hub/mod.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./legacy/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/provider.tsx":{"bytes":405,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./legacy/context.js"},{"path":"src/useProviders.ts","kind":"import-statement","original":"./useProviders.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/types.ts":{"bytes":5369,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":173,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./legacy/helpers.js"},{"path":"src/provider.tsx","kind":"import-statement","original":"./provider.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./legacy/hooks.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./legacy/types.js"}],"format":"esm"},"src/helpers/index.ts":{"bytes":55,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"../hub/mod.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":95377},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true}],"exports":["Events","Provider","availableWallets","checkWalletProviders","choose","clearPersistance","connectedWallets","defaultWalletState","isAsync","makeEventHandler","needsCheckInstallation","stateReducer","tryPersistWallet","tryRemoveWalletFromPersistance","useWallets"],"entryPoint":"src/index.ts","inputs":{"src/legacy/helpers.ts":{"bytesInOutput":1401},"src/hub/constants.ts":{"bytesInOutput":65},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":1210},"src/index.ts":{"bytesInOutput":0},"src/provider.tsx":{"bytesInOutput":133},"src/legacy/context.ts":{"bytesInOutput":431},"src/hub/utils.ts":{"bytesInOutput":3108},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":2125},"src/legacy/autoConnect.ts":{"bytesInOutput":393},"src/legacy/hooks.ts":{"bytesInOutput":458},"src/legacy/useAutoConnect.ts":{"bytesInOutput":196},"src/legacy/utils.ts":{"bytesInOutput":92},"src/hub/helpers.ts":{"bytesInOutput":869},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":3923},"src/hub/autoConnect.ts":{"bytesInOutput":2058},"src/hub/useHubRefs.ts":{"bytesInOutput":510},"src/useProviders.ts":{"bytesInOutput":885},"src/legacy/types.ts":{"bytesInOutput":63}},"bytes":18359},"dist/helpers/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":59285},"dist/helpers/index.js":{"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"ts-results","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["getAllLegacyProviders"],"entryPoint":"src/helpers/index.ts","inputs":{"src/hub/utils.ts":{"bytesInOutput":421},"src/hub/constants.ts":{"bytesInOutput":65},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/context.ts":{"bytesInOutput":427},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":52},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":1210},"src/legacy/helpers.ts":{"bytesInOutput":59},"src/legacy/hooks.ts":{"bytesInOutput":109},"src/legacy/useAutoConnect.ts":{"bytesInOutput":47},"src/hub/helpers.ts":{"bytesInOutput":178},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":143},"src/hub/autoConnect.ts":{"bytesInOutput":156},"src/hub/useHubRefs.ts":{"bytesInOutput":97},"src/helpers/index.ts":{"bytesInOutput":0}},"bytes":3113}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/wallets-react",
|
|
3
|
-
"version": "0.27.1-next.
|
|
3
|
+
"version": "0.27.1-next.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@rango-dev/wallets-core": "^0.40.1-next.
|
|
39
|
-
"@rango-dev/wallets-shared": "^0.41.1-next.
|
|
38
|
+
"@rango-dev/wallets-core": "^0.40.1-next.13",
|
|
39
|
+
"@rango-dev/wallets-shared": "^0.41.1-next.6",
|
|
40
40
|
"rango-types": "^0.1.78",
|
|
41
41
|
"ts-results": "^3.3.0"
|
|
42
42
|
},
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
package/src/hub/useHubAdapter.ts
CHANGED
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
import { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js';
|
|
25
25
|
import { useHubRefs } from './useHubRefs.js';
|
|
26
26
|
import {
|
|
27
|
-
checkHubStateAndTriggerEvents,
|
|
28
27
|
getLegacyProvider,
|
|
28
|
+
mapHubEventsToLegacy,
|
|
29
29
|
transformHubResultToLegacyResult,
|
|
30
30
|
tryConvertNamespaceNetworkToChainInfo,
|
|
31
31
|
} from './utils.js';
|
|
@@ -86,19 +86,24 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
|
|
|
86
86
|
*/
|
|
87
87
|
document.addEventListener('readystatechange', initHubWhenPageIsReady);
|
|
88
88
|
|
|
89
|
-
getStore()
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
getStore()
|
|
90
|
+
.subscribe((event) => {
|
|
91
|
+
if (dataRef.current.onUpdateState) {
|
|
92
|
+
try {
|
|
93
|
+
mapHubEventsToLegacy(
|
|
94
|
+
getHub(),
|
|
95
|
+
event,
|
|
96
|
+
dataRef.current.onUpdateState,
|
|
97
|
+
dataRef.current.allVersionedProviders,
|
|
98
|
+
dataRef.current.allBlockChains
|
|
99
|
+
);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(e);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
rerender((currentRender) => currentRender + 1);
|
|
105
|
+
})
|
|
106
|
+
.flushEvents();
|
|
102
107
|
}, []);
|
|
103
108
|
|
|
104
109
|
useAutoConnect({
|
package/src/hub/utils.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import type { AllProxiedNamespaces } from './types.js';
|
|
2
|
-
import type { Hub, Provider
|
|
2
|
+
import type { Hub, Provider } from '@rango-dev/wallets-core';
|
|
3
3
|
import type {
|
|
4
4
|
LegacyNamespaceInputForConnect,
|
|
5
5
|
LegacyProviderInterface,
|
|
6
6
|
LegacyEventHandler as WalletEventHandler,
|
|
7
7
|
} from '@rango-dev/wallets-core/legacy';
|
|
8
|
+
import type { Event } from '@rango-dev/wallets-core/store';
|
|
8
9
|
|
|
9
|
-
import {
|
|
10
|
-
guessProviderStateSelector,
|
|
11
|
-
namespaceStateSelector,
|
|
12
|
-
} from '@rango-dev/wallets-core';
|
|
13
10
|
import { LegacyEvents as Events } from '@rango-dev/wallets-core/legacy';
|
|
14
|
-
import {
|
|
15
|
-
generateStoreId,
|
|
16
|
-
type VersionedProviders,
|
|
17
|
-
} from '@rango-dev/wallets-core/utils';
|
|
11
|
+
import { type VersionedProviders } from '@rango-dev/wallets-core/utils';
|
|
18
12
|
import { pickVersion } from '@rango-dev/wallets-core/utils';
|
|
19
13
|
import {
|
|
20
14
|
type AddEthereumChainParameter,
|
|
@@ -74,178 +68,163 @@ const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(
|
|
|
74
68
|
HUB_LAST_CONNECTED_WALLETS
|
|
75
69
|
);
|
|
76
70
|
|
|
77
|
-
export function
|
|
71
|
+
export function mapHubEventsToLegacy(
|
|
78
72
|
hub: Hub,
|
|
79
|
-
|
|
80
|
-
previousState: State,
|
|
73
|
+
event: Event,
|
|
81
74
|
onUpdateState: WalletEventHandler,
|
|
82
75
|
allProviders: VersionedProviders[],
|
|
83
76
|
allBlockChains: ProviderProps['allBlockChains']
|
|
84
77
|
): void {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
providerId
|
|
78
|
+
let legacyProvider;
|
|
79
|
+
try {
|
|
80
|
+
legacyProvider = getLegacyProvider(allProviders, event.provider);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.warn(
|
|
83
|
+
'Having legacy provider is required for including some information like supported chain. ',
|
|
84
|
+
e
|
|
93
85
|
);
|
|
86
|
+
}
|
|
94
87
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
let hasAccountChanged = false;
|
|
102
|
-
let hasNetworkChanged = false;
|
|
103
|
-
let hasProviderDisconnected = false;
|
|
104
|
-
let anyNamespaceIsConnected = false;
|
|
105
|
-
// It will pick the last network from namespaces.
|
|
106
|
-
let maybeNetwork = null;
|
|
107
|
-
const disconnectedNamespacesIds: string[] = [];
|
|
108
|
-
|
|
109
|
-
provider.getAll().forEach((namespace) => {
|
|
110
|
-
const storeId = generateStoreId(providerId, namespace.namespaceId);
|
|
111
|
-
const currentNamespaceState = namespaceStateSelector(
|
|
112
|
-
currentState,
|
|
113
|
-
storeId
|
|
114
|
-
);
|
|
115
|
-
const previousNamespaceState = namespaceStateSelector(
|
|
116
|
-
previousState,
|
|
117
|
-
storeId
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
if (currentNamespaceState.network !== null) {
|
|
121
|
-
maybeNetwork = currentNamespaceState.network;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Check for network
|
|
125
|
-
if (currentNamespaceState.network !== previousNamespaceState.network) {
|
|
126
|
-
hasNetworkChanged = true;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// TODO: `accounts` has been frozen, we should check and find where object.freeze() is calling.
|
|
130
|
-
|
|
131
|
-
// Check for accounts
|
|
132
|
-
if (currentNamespaceState.accounts) {
|
|
133
|
-
anyNamespaceIsConnected = true;
|
|
134
|
-
if (
|
|
135
|
-
previousNamespaceState.accounts?.slice().sort().toString() !==
|
|
136
|
-
currentNamespaceState.accounts?.slice().sort().toString()
|
|
137
|
-
) {
|
|
138
|
-
hasAccountChanged = true;
|
|
139
|
-
}
|
|
140
|
-
const formattedAddresses = currentNamespaceState.accounts.map(
|
|
141
|
-
fromAccountIdToLegacyAddressFormat
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
if (accounts) {
|
|
145
|
-
accounts = [...accounts, ...formattedAddresses];
|
|
146
|
-
} else {
|
|
147
|
-
accounts = [...formattedAddresses];
|
|
148
|
-
}
|
|
149
|
-
} else if (!!previousNamespaceState.accounts) {
|
|
150
|
-
/*
|
|
151
|
-
* If previously namespace was connected and now we can not get any accounts from the namespace, the namespace should be considered as disconnected.
|
|
152
|
-
* For example switching to an account which did not permitted to connect yet or maybe the account does not support the requested namespace.
|
|
153
|
-
*/
|
|
154
|
-
disconnectedNamespacesIds.push(namespace.namespaceId);
|
|
155
|
-
hasAccountChanged = true;
|
|
88
|
+
const provider = hub.get(event.provider);
|
|
89
|
+
if (!provider) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
"Currently all the events have assigned to a provider. The event doesn't include one.",
|
|
92
|
+
{
|
|
93
|
+
cause: event,
|
|
156
94
|
}
|
|
157
|
-
|
|
95
|
+
);
|
|
96
|
+
}
|
|
158
97
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
providerId,
|
|
162
|
-
disconnectedNamespacesIds
|
|
163
|
-
);
|
|
164
|
-
}
|
|
98
|
+
// @ts-expect-error for those events that doesn't have namespace, it will be undefinded
|
|
99
|
+
const namespaceId: string | undefined = event.namespace;
|
|
165
100
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
101
|
+
const namespace = namespaceId
|
|
102
|
+
? provider.findByNamespace(namespaceId)
|
|
103
|
+
: undefined;
|
|
104
|
+
let accounts: string[] | null = null;
|
|
105
|
+
let network: string | null = null;
|
|
170
106
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
'Having legacy provider is required for including some information like supported chain. ',
|
|
177
|
-
e
|
|
178
|
-
);
|
|
179
|
-
}
|
|
107
|
+
if (namespace) {
|
|
108
|
+
const [getNamespaceState] = namespace.state();
|
|
109
|
+
accounts = getNamespaceState().accounts;
|
|
110
|
+
network = getNamespaceState().network;
|
|
111
|
+
}
|
|
180
112
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
113
|
+
const [getProviderState] = provider.state();
|
|
114
|
+
const coreState = {
|
|
115
|
+
connected: getProviderState().connected,
|
|
116
|
+
connecting: getProviderState().connecting,
|
|
117
|
+
installed: getProviderState().installed,
|
|
118
|
+
accounts,
|
|
119
|
+
network,
|
|
120
|
+
reachable: true,
|
|
121
|
+
};
|
|
189
122
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
123
|
+
const eventInfo = {
|
|
124
|
+
supportedBlockchains:
|
|
125
|
+
legacyProvider?.getWalletInfo(allBlockChains || []).supportedChains || [],
|
|
126
|
+
isContractWallet: false,
|
|
127
|
+
isHub: true,
|
|
128
|
+
namespace: namespaceId,
|
|
129
|
+
};
|
|
197
130
|
|
|
198
|
-
|
|
131
|
+
switch (event.type) {
|
|
132
|
+
case 'provider_detected':
|
|
199
133
|
onUpdateState(
|
|
200
|
-
|
|
134
|
+
event.provider,
|
|
201
135
|
Events.INSTALLED,
|
|
202
|
-
|
|
136
|
+
true,
|
|
203
137
|
coreState,
|
|
204
138
|
eventInfo
|
|
205
139
|
);
|
|
206
|
-
|
|
207
|
-
|
|
140
|
+
break;
|
|
141
|
+
case 'provider_connecting':
|
|
208
142
|
onUpdateState(
|
|
209
|
-
|
|
143
|
+
event.provider,
|
|
210
144
|
Events.CONNECTING,
|
|
211
|
-
|
|
145
|
+
event.value,
|
|
212
146
|
coreState,
|
|
213
147
|
eventInfo
|
|
214
148
|
);
|
|
215
|
-
|
|
216
|
-
|
|
149
|
+
break;
|
|
150
|
+
case 'provider_connected':
|
|
217
151
|
onUpdateState(
|
|
218
|
-
|
|
152
|
+
event.provider,
|
|
219
153
|
Events.CONNECTED,
|
|
220
|
-
|
|
154
|
+
true,
|
|
221
155
|
coreState,
|
|
222
156
|
eventInfo
|
|
223
157
|
);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// This event is triggered to clear wallet state and after that set new accounts for wallet
|
|
227
|
-
onUpdateState(providerId, Events.ACCOUNTS, null, coreState, eventInfo);
|
|
158
|
+
break;
|
|
159
|
+
case 'provider_disconnected':
|
|
228
160
|
onUpdateState(
|
|
229
|
-
|
|
230
|
-
Events.
|
|
231
|
-
|
|
161
|
+
event.provider,
|
|
162
|
+
Events.CONNECTED,
|
|
163
|
+
false,
|
|
232
164
|
coreState,
|
|
233
165
|
eventInfo
|
|
234
166
|
);
|
|
235
|
-
}
|
|
236
|
-
if (hasProviderDisconnected) {
|
|
237
|
-
onUpdateState(providerId, Events.ACCOUNTS, null, coreState, eventInfo);
|
|
238
|
-
}
|
|
239
|
-
if (hasNetworkChanged) {
|
|
240
167
|
onUpdateState(
|
|
241
|
-
|
|
242
|
-
Events.
|
|
243
|
-
|
|
168
|
+
event.provider,
|
|
169
|
+
Events.ACCOUNTS,
|
|
170
|
+
null,
|
|
244
171
|
coreState,
|
|
245
172
|
eventInfo
|
|
246
173
|
);
|
|
247
|
-
|
|
248
|
-
|
|
174
|
+
break;
|
|
175
|
+
case 'namespace_disconnected':
|
|
176
|
+
lastConnectedWalletsFromStorage.removeNamespacesFromWallet(
|
|
177
|
+
event.provider,
|
|
178
|
+
[event.namespace]
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
onUpdateState(
|
|
182
|
+
event.provider,
|
|
183
|
+
Events.NAMESPACE_DISCONNECTED,
|
|
184
|
+
event.namespace,
|
|
185
|
+
coreState,
|
|
186
|
+
{
|
|
187
|
+
...eventInfo,
|
|
188
|
+
namespace: event.namespace,
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
// onUpdateState(event.provider, Events.ACCOUNTS, null, coreState, eventInfo);
|
|
192
|
+
break;
|
|
193
|
+
case 'namespace_connected':
|
|
194
|
+
case 'namespace_account_switched':
|
|
195
|
+
{
|
|
196
|
+
if (event.type === 'namespace_account_switched') {
|
|
197
|
+
onUpdateState(
|
|
198
|
+
event.provider,
|
|
199
|
+
Events.NAMESPACE_DISCONNECTED,
|
|
200
|
+
event.namespace,
|
|
201
|
+
coreState,
|
|
202
|
+
eventInfo
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const formattedAddresses = event.accounts.map(
|
|
207
|
+
fromAccountIdToLegacyAddressFormat
|
|
208
|
+
);
|
|
209
|
+
onUpdateState(
|
|
210
|
+
event.provider,
|
|
211
|
+
Events.ACCOUNTS,
|
|
212
|
+
formattedAddresses,
|
|
213
|
+
coreState,
|
|
214
|
+
{
|
|
215
|
+
...eventInfo,
|
|
216
|
+
namespace: event.namespace,
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
case 'namespace_network_switched':
|
|
222
|
+
onUpdateState(event.provider, Events.NETWORK, event.network, coreState, {
|
|
223
|
+
...eventInfo,
|
|
224
|
+
namespace: event.namespace,
|
|
225
|
+
});
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
249
228
|
}
|
|
250
229
|
|
|
251
230
|
export function getAllLegacyProviders(
|