@rango-dev/wallets-core 0.46.1-next.1 → 0.47.0
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/namespaces/evm/actions.d.ts +1 -0
- package/dist/namespaces/evm/actions.d.ts.map +1 -1
- package/dist/namespaces/evm/builders.d.ts +1 -0
- package/dist/namespaces/evm/builders.d.ts.map +1 -1
- package/dist/namespaces/evm/mod.js +1 -1
- package/dist/namespaces/evm/mod.js.map +3 -3
- package/dist/namespaces/evm/types.d.ts +7 -0
- package/dist/namespaces/evm/types.d.ts.map +1 -1
- package/dist/namespaces/evm/utils.d.ts +2 -0
- package/dist/namespaces/evm/utils.d.ts.map +1 -1
- package/dist/wallets-core.build.json +1 -1
- package/package.json +1 -1
- package/src/namespaces/evm/actions.ts +14 -1
- package/src/namespaces/evm/builders.ts +2 -0
- package/src/namespaces/evm/types.ts +6 -0
- package/src/namespaces/evm/utils.ts +6 -1
|
@@ -7,4 +7,5 @@ export declare function connect(instance: () => ProviderAPI, options?: ConnectOp
|
|
|
7
7
|
export declare function changeAccountSubscriber(instance: () => ProviderAPI): [Subscriber<EvmActions>, SubscriberCleanUp<EvmActions>];
|
|
8
8
|
export declare function changeChainSubscriber(instance: () => ProviderAPI): [Subscriber<EvmActions>, SubscriberCleanUp<EvmActions>];
|
|
9
9
|
export declare function canEagerConnect(instance: () => ProviderAPI | undefined): CanEagerConnect<EvmActions>;
|
|
10
|
+
export declare function canSwitchNetwork(): FunctionWithContext<EvmActions['canSwitchNetwork'], Context>;
|
|
10
11
|
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAalE,eAAO,MAAM,WAAW,+EAAyB,CAAC;AAElD,wBAAgB,OAAO,CACrB,QAAQ,EAAE,MAAM,WAAW,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,mBAAmB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAsDrD;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,WAAW,GAC1B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAyDzD;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,WAAW,GAC1B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,CA4BzD;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,WAAW,GAAG,SAAS,GACtC,eAAe,CAAC,UAAU,CAAC,CAsB7B;AACD,wBAAgB,gBAAgB,IAAI,mBAAmB,CACrD,UAAU,CAAC,kBAAkB,CAAC,EAC9B,OAAO,CACR,CAKA"}
|
|
@@ -2,4 +2,5 @@ import type { EvmActions } from './types.js';
|
|
|
2
2
|
import { ActionBuilder } from '../../mod.js';
|
|
3
3
|
export declare const connect: () => ActionBuilder<EvmActions, "connect">;
|
|
4
4
|
export declare const canEagerConnect: () => ActionBuilder<EvmActions, "canEagerConnect">;
|
|
5
|
+
export declare const canSwitchNetwork: () => ActionBuilder<EvmActions, "canSwitchNetwork">;
|
|
5
6
|
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO7C,eAAO,MAAM,OAAO,4CAIc,CAAC;AAEnC,eAAO,MAAM,eAAe,oDACyC,CAAC"}
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO7C,eAAO,MAAM,OAAO,4CAIc,CAAC;AAEnC,eAAO,MAAM,eAAe,oDACyC,CAAC;AACtE,eAAO,MAAM,gBAAgB,qDAC0C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var E=Object.defineProperty;var t=(o,e)=>E(o,"name",{value:e,configurable:!0});var p=(o,e)=>{for(var r in e)E(o,r,{get:e[r],enumerable:!0})};var O={};p(O,{canEagerConnect:()=>Q,canSwitchNetwork:()=>X,changeAccountSubscriber:()=>G,changeChainSubscriber:()=>J,connect:()=>q,recommended:()=>Y});import{AccountId as R}from"caip";function P(o){let[,e]=o.state();e("network",null),e("accounts",null),e("connected",!1),e("connecting",!1)}t(P,"disconnect");var N=[["disconnect",P]];var u="eip155",B="1";var _={};p(_,{filterAndGetEvmBlockchainNames:()=>y,getAccounts:()=>v,isUserRejectionError:()=>$,suggestNetwork:()=>k,switchNetwork:()=>T,switchOrAddNetwork:()=>x});import{evmBlockchains as L}from"rango-types";async function v(o){let[e,r]=await Promise.all([o.request({method:"eth_requestAccounts"}),o.request({method:"eth_chainId"})]);return{accounts:e,chainId:r}}t(v,"getAccounts");async function k(o,e){return await o.request({method:"wallet_addEthereumChain",params:[e]})}t(k,"suggestNetwork");async function T(o,e){return await o.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}t(T,"switchNetwork");function y(o){return L(o).map(e=>e.name)}t(y,"filterAndGetEvmBlockchainNames");async function x(o,e){try{let r=typeof e=="string"?e:e.chainId;await T(o,r)}catch(r){let n=r;if(typeof e!="string"&&(n.code===4902||!n.code)){await k(o,e);return}throw r}}t(x,"switchOrAddNetwork");var I=4001;function $(o){if(typeof o=="object"&&o!==null){let e=o.code,r=o.cause?.code;return e===I||r===I}return!1}t($,"isUserRejectionError");var Y=[...N],z=16;function q(o,e){return async(r,n)=>{let s=o();if(!s)throw new Error("Do your wallet injected correctly and is evm compatible?");n&&(e?.switchOrAddNetwork?await e.switchOrAddNetwork(s,n):await x(s,n));let c=await v(s),i=c.chainId;return typeof i=="number"&&(i=`0x${Number(i).toString(z)}`),{accounts:c.accounts.map(l=>R.format({address:l,chainId:{namespace:u,reference:i}})),network:i}}}t(q,"connect");function G(o){let e;return[(r,n)=>{let s=o();if(!s)throw new Error("Trying to subscribe to your EVM wallet, but seems its instance is not available.");let[,c]=r.state();if(e=t(async i=>{if(!i||i.length===0){r.action("disconnect");return}let A=await s.request({method:"eth_chainId"}),l=i.map(H=>R.format({address:H,chainId:{namespace:u,reference:A}}));c("accounts",l)},"eventCallback"),s.on("accountsChanged",e),n instanceof Error)throw n},(r,n)=>{let s=o();return e&&s&&s.removeListener?.("accountsChanged",e),n}]}t(G,"changeAccountSubscriber");function J(o){let e;return[r=>{let n=o();if(!n)throw new Error("Trying to subscribe to your EVM wallet, but seems its instance is not available.");let[,s]=r.state();e=t(async c=>{s("network",c)},"eventCallback"),n.on("chainChanged",e)},()=>{let r=o();e&&r&&r.removeListener("chainChanged",e)}]}t(J,"changeChainSubscriber");function Q(o){return async()=>{let e=o();if(!e)throw new Error("Trying to eagerly connect to your EVM wallet, but seems its instance is not available.");try{return!!(await e.request({method:"eth_accounts"})).length}catch{return!1}}}t(Q,"canEagerConnect");function X(){return(o,e)=>{let{network:r,supportedChains:n}=e;return y(n).includes(r)}}t(X,"canSwitchNetwork");var j={};p(j,{recommended:()=>Z});function m(o){let[,e]=o.state();e("connecting",!1)}t(m,"intoConnectionFinished");var g=[["connect",m]];var Z=[...g];var V={};p(V,{recommended:()=>ae});import{createStore as xt}from"zustand/vanilla";import{produce as ot}from"immer";import{produce as ct}from"immer";var a=class{static{t(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#o=new Map;#r=new Map;#n;constructor(e){this.name=e}and(e){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(e),this}or(e){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(e),this}before(e){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(e),this}after(e){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(e),this}action(e){return this.#n=e,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#r,after:this.#o,and:this.#e,or:this.#t}}};import*as Gt from"caip";import{AccountId as ie}from"caip";function D(o){try{return ie.parse(o),!0}catch{return!1}}t(D,"isValidCaipAddress");function d(o,e){if(!e.accounts.every(D))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${e.accounts}`);let[,r]=o.state();return r("accounts",e.accounts),r("network",e.network),r("connected",!0),e}t(d,"connectAndUpdateStateForMultiNetworks");function h(o){let[,e]=o.state();e("connecting",!0)}t(h,"intoConnecting");var w=[["connect",h]];var ae=[["connect",d]];var M={};p(M,{recommended:()=>ce});var ce=[...w];var W={};p(W,{canEagerConnect:()=>de,canSwitchNetwork:()=>ue,connect:()=>pe});var pe=t(()=>new a("connect").and(d).before(h).after(m),"connect"),de=t(()=>new a("canEagerConnect"),"canEagerConnect"),ue=t(()=>new a("canSwitchNetwork"),"canSwitchNetwork");export{B as CAIP_ETHEREUM_CHAIN_ID,u as CAIP_NAMESPACE,O as actions,j as after,V as and,M as before,W as builders,_ as utils};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/namespaces/evm/actions.ts", "../../../src/namespaces/common/actions.ts", "../../../src/namespaces/evm/constants.ts", "../../../src/namespaces/evm/utils.ts", "../../../src/namespaces/evm/after.ts", "../../../src/namespaces/common/after.ts", "../../../src/namespaces/evm/and.ts", "../../../src/hub/store/store.ts", "../../../src/hub/store/namespaces.ts", "../../../src/hub/store/providers.ts", "../../../src/builders/action.ts", "../../../src/utils/mod.ts", "../../../src/namespaces/common/helpers.ts", "../../../src/namespaces/common/and.ts", "../../../src/namespaces/common/before.ts", "../../../src/namespaces/evm/before.ts", "../../../src/namespaces/evm/builders.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EIP1193EventMap } from './eip1193.js';\nimport type { ConnectOptions, EvmActions, ProviderAPI } from './types.js';\nimport type { Context, Subscriber } from '../../hub/namespaces/mod.js';\nimport type {\n CanEagerConnect,\n SubscriberCleanUp,\n} from '../../hub/namespaces/types.js';\nimport type { CaipAccount } from '../../types/accounts.js';\nimport type { FunctionWithContext } from '../../types/actions.js';\n\nimport { AccountId } from 'caip';\n\nimport { recommended as commonRecommended } from '../common/actions.js';\n\nimport { CAIP_NAMESPACE } from './constants.js';\nimport { getAccounts, switchOrAddNetwork } from './utils.js';\n\nexport const recommended = [...commonRecommended];\nconst CHAIN_ID_RADIX = 16;\nexport function connect(\n instance: () => ProviderAPI,\n options?: ConnectOptions\n): FunctionWithContext<EvmActions['connect'], Context> {\n return async (_context, chain) => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Do your wallet injected correctly and is evm compatible?'\n );\n }\n\n if (chain) {\n /*\n * The `switchOrAddNetwork` function can be optionally provided through `options`\n * to handle network switching or addition in a way that is compatible with the specific wallet provider.\n * This approach is necessary because not all providers follow the same conventions\u2014\n * for example, Rabby uses a different error code for \"chain not found\".\n */\n if (options?.switchOrAddNetwork) {\n await options.switchOrAddNetwork(evmInstance, chain);\n } else {\n await switchOrAddNetwork(evmInstance, chain);\n }\n }\n\n const result = await getAccounts(evmInstance);\n\n /*\n * Trust Wallet Compatibility Fix:\n * Trust Wallet's in-app browser has been observed to return the `chainId` as a\n * number (e.g., 1) rather than the standard hexadecimal string (e.g., \"0x1\").\n * This code block standardizes the `chainId` to the required hex format to\n * prevent downstream errors.\n */\n let chainId = result.chainId;\n if (typeof chainId === 'number') {\n chainId = `0x${Number(chainId).toString(CHAIN_ID_RADIX)}`;\n }\n\n const formatAccounts = result.accounts.map(\n (account) =>\n AccountId.format({\n address: account,\n chainId: {\n namespace: CAIP_NAMESPACE,\n reference: chainId,\n },\n }) as CaipAccount\n );\n\n return {\n accounts: formatAccounts,\n network: chainId,\n };\n };\n}\n\nexport function changeAccountSubscriber(\n instance: () => ProviderAPI\n): [Subscriber<EvmActions>, SubscriberCleanUp<EvmActions>] {\n let eventCallback: EIP1193EventMap['accountsChanged'];\n\n // subscriber can be passed to `or`, it will get the error and should rethrow error to pass the error to next `or` or throw error.\n return [\n (context, err) => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Trying to subscribe to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n const [, setState] = context.state();\n\n eventCallback = async (accounts) => {\n /*\n * In Phantom, when user is switching to an account which is not connected to dApp yet, it returns a null.\n * So null means we don't have access to account and we need to disconnect and let the user connect the account.\n *\n * This assumption may not work for other wallets, if that the case, we need to consider a new approach.\n */\n if (!accounts || accounts.length === 0) {\n context.action('disconnect');\n return;\n }\n\n const chainId = await evmInstance.request({ method: 'eth_chainId' });\n const formatAccounts = accounts.map((account) =>\n AccountId.format({\n address: account,\n chainId: {\n namespace: CAIP_NAMESPACE,\n reference: chainId,\n },\n })\n );\n\n setState('accounts', formatAccounts);\n };\n evmInstance.on('accountsChanged', eventCallback);\n\n if (err instanceof Error) {\n throw err;\n }\n },\n (_, err) => {\n const evmInstance = instance();\n\n if (eventCallback && evmInstance) {\n evmInstance.removeListener?.('accountsChanged', eventCallback);\n }\n\n return err;\n },\n ];\n}\n\nexport function changeChainSubscriber(\n instance: () => ProviderAPI\n): [Subscriber<EvmActions>, SubscriberCleanUp<EvmActions>] {\n let eventCallback: EIP1193EventMap['chainChanged'];\n\n return [\n (context) => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Trying to subscribe to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n const [, setState] = context.state();\n\n eventCallback = async (chainId: string) => {\n setState('network', chainId);\n };\n evmInstance.on('chainChanged', eventCallback);\n },\n () => {\n const evmInstance = instance();\n\n if (eventCallback && evmInstance) {\n evmInstance.removeListener('chainChanged', eventCallback);\n }\n },\n ];\n}\n\nexport function canEagerConnect(\n instance: () => ProviderAPI | undefined\n): CanEagerConnect<EvmActions> {\n return async () => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Trying to eagerly connect to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n try {\n const accounts: string[] = await evmInstance.request({\n method: 'eth_accounts',\n });\n if (accounts.length) {\n return true;\n }\n return false;\n } catch {\n return false;\n }\n };\n}\n", "import type { Context } from '../../hub/namespaces/mod.js';\n\nexport function disconnect(context: Context): void {\n const [, setState] = context.state();\n setState('network', null);\n setState('accounts', null);\n setState('connected', false);\n setState('connecting', false);\n}\n\nexport const recommended = [['disconnect', disconnect] as const];\n", "export const CAIP_NAMESPACE = 'eip155';\nexport const CAIP_ETHEREUM_CHAIN_ID = '1';\n", "import type { Chain, ChainId, ProviderAPI } from './types.js';\n\nexport async function getAccounts(provider: ProviderAPI) {\n const [accounts, chainId] = await Promise.all([\n provider.request({ method: 'eth_requestAccounts' }),\n provider.request({ method: 'eth_chainId' }),\n ]);\n\n return {\n accounts,\n chainId,\n };\n}\n\nexport async function suggestNetwork(instance: ProviderAPI, chain: Chain) {\n return await instance.request({\n method: 'wallet_addEthereumChain',\n params: [chain],\n });\n}\n\nexport async function switchNetwork(instance: ProviderAPI, chainId: ChainId) {\n return await instance.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: chainId }],\n });\n}\n\nexport async function switchOrAddNetwork(\n instance: ProviderAPI,\n chain: ChainId | Chain\n) {\n try {\n const chainId = typeof chain === 'string' ? chain : chain.chainId;\n await switchNetwork(instance, chainId);\n } catch (switchError) {\n const error = switchError as { code: number };\n\n /*\n * Error code 4902 is used by MetaMask to indicate that the requested chain has not been added to the wallet.\n * This code is not part of the official EIP-1193 spec (https://eips.ethereum.org/EIPS/eip-1193#supported-rpc-methods),\n * so other providers may use a different code or behavior for the same condition.\n */\n const NOT_FOUND_CHAIN_ERROR_CODE = 4902;\n if (\n typeof chain !== 'string' &&\n (error.code === NOT_FOUND_CHAIN_ERROR_CODE || !error.code)\n ) {\n /*\n * Note: on WalletConnect `code` is undefined so we have to use !switchError.code as fallback.\n * This error code indicates that the chain has not been added to wallet.\n */\n await suggestNetwork(instance, chain);\n }\n throw switchError;\n }\n}\n\nconst EIP_1193_USER_REJECTION_ERROR_CODE = 4001;\nexport function isUserRejectionError(error: unknown): boolean {\n // EIP-1193 user rejection error can be in error.code or error.cause.code\n if (typeof error === 'object' && error !== null) {\n const code = (error as { code?: number }).code;\n const causeCode = (error as { cause?: { code?: number } }).cause?.code;\n return (\n code === EIP_1193_USER_REJECTION_ERROR_CODE ||\n causeCode === EIP_1193_USER_REJECTION_ERROR_CODE\n );\n }\n return false;\n}\n", "import { recommended as commonRecommended } from '../common/after.js';\n\nexport const recommended = [...commonRecommended];\n", "import type { Context } from '../../hub/namespaces/mod.js';\n\nexport function intoConnectionFinished(context: Context) {\n const [, setState] = context.state();\n setState('connecting', false);\n}\n\nexport const recommended = [['connect', intoConnectionFinished] as const];\n", "import { connectAndUpdateStateForMultiNetworks } from '../common/mod.js';\n\nexport const recommended = [\n ['connect', connectAndUpdateStateForMultiNetworks] as const,\n];\n", "import type { StoreApi } from 'zustand/vanilla';\n\nimport { createStore as createZustandStore } from 'zustand/vanilla';\n\nimport { extend, type Store } from './extend.js';\nimport { hubStore, type HubStore } from './hub.js';\nimport { namespacesStore, type NamespaceStore } from './namespaces.js';\nimport { providersStore, type ProviderStore } from './providers.js';\n\n/************ State ************/\n\nexport interface State {\n hub: HubStore;\n providers: ProviderStore;\n namespaces: NamespaceStore;\n}\n\nexport type RawStore = StoreApi<State>;\n\nexport const createStore = (): Store => {\n const store = createZustandStore<State>((...api) => {\n return {\n hub: hubStore(...api),\n providers: providersStore(...api),\n namespaces: namespacesStore(...api),\n };\n });\n\n return extend(store);\n};\n", "/************ Namespace ************/\n\nimport type { StateCreator } from 'zustand';\n\nimport { produce } from 'immer';\n\nimport {\n ConsumableEvents,\n type NamespaceConnectedEvent,\n type NamespaceDisconnectedEvent,\n type NamespaceSwitchedAccountEvent,\n type NamespaceSwitchedNetworkEvent,\n} from './events.js';\nimport { namespaceStateSelector, type State } from './mod.js';\n\n// Currently, namespace doesn't has any config.\nexport type NamespaceConfig = object;\n\nexport interface NamespaceData {\n accounts: null | string[];\n network: null | string;\n connected: boolean;\n connecting: boolean;\n}\n\ninterface NamespaceInfo {\n providerId: string;\n namespaceId: string;\n}\n\ninterface NamespaceItem {\n info: NamespaceInfo;\n data: NamespaceData;\n error: unknown;\n}\n\ntype NamespaceState = {\n events: InstanceType<typeof ConsumableEvents>;\n list: Record<string, NamespaceItem>;\n};\n\ninterface NamespaceActions {\n addNamespace: (id: string, config: NamespaceInfo) => void;\n updateStatus: <K extends keyof NamespaceData>(\n id: string,\n key: K,\n value: NamespaceData[K]\n ) => void;\n\n _produceEventsWhenUpdatingStatus: <K extends keyof NamespaceData>(\n namespace: NamespaceItem,\n id: string,\n key: K,\n value: NamespaceData[K]\n ) => void;\n}\ninterface NamespaceSelectors {\n getNamespaceData(storeId: string): NamespaceData;\n}\n\nexport type NamespaceStore = NamespaceState &\n NamespaceActions &\n NamespaceSelectors;\ntype NamespaceStateCreator = StateCreator<State, [], [], NamespaceStore>;\n\nconst namespacesStore: NamespaceStateCreator = (set, get) => ({\n events: new ConsumableEvents(),\n\n list: {},\n addNamespace: (id, info) => {\n const data: NamespaceData = {\n accounts: null,\n network: null,\n connected: false,\n connecting: false,\n };\n\n const item = {\n data,\n error: '',\n info,\n };\n\n set(\n produce((state: State) => {\n state.namespaces.list[id] = item;\n })\n );\n },\n updateStatus: (id, key, value) => {\n const ns = get().namespaces.list[id];\n if (!ns) {\n throw new Error(`No namespace with '${id}' found.`);\n }\n\n get().namespaces._produceEventsWhenUpdatingStatus(ns, id, key, value);\n\n // Updating state\n set(\n produce((state: State) => {\n state.namespaces.list[id].data[key] = value;\n })\n );\n },\n getNamespaceData(storeId) {\n return namespaceStateSelector(get(), storeId);\n },\n\n _produceEventsWhenUpdatingStatus: (namespace, id, key, value) => {\n if (key === 'accounts') {\n // check for both null and empty array\n const isAccountsEmpty =\n Object.is(value, null) || (Array.isArray(value) && value.length === 0);\n\n if (isAccountsEmpty) {\n const currentConnectedStatus = get().namespaces.list[id].data.connected;\n if (currentConnectedStatus) {\n const event: NamespaceDisconnectedEvent = {\n type: 'namespace_disconnected',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n };\n\n get().namespaces.events.push(event);\n }\n // Skip emitting disconnect event, if the `connected` is false\n } else {\n const currentAccounts = get().namespaces.list[id].data.accounts;\n\n if (!currentAccounts) {\n const event: NamespaceConnectedEvent = {\n type: 'namespace_connected',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n accounts: value as string[],\n };\n\n get().namespaces.events.push(event);\n } else {\n const areSameAccounts =\n currentAccounts.sort().toString() ===\n (value as string[]).sort().toString();\n\n if (!areSameAccounts) {\n const event: NamespaceSwitchedAccountEvent = {\n type: 'namespace_account_switched',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n previousAccounts: currentAccounts,\n accounts: value as string[],\n };\n\n get().namespaces.events.push(event);\n }\n }\n }\n } else if (key === 'network') {\n const currentNetwork = get().namespaces.list[id].data.network;\n\n const event: NamespaceSwitchedNetworkEvent = {\n type: 'namespace_network_switched',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n network: value as string,\n previousNetwork: currentNetwork,\n };\n\n get().namespaces.events.push(event);\n }\n },\n});\n\nexport { namespacesStore };\n", "import type { Namespace } from '../../namespaces/common/types.js';\nimport type { State as InternalProviderState } from '../provider/mod.js';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\nimport type { StateCreator } from 'zustand';\n\nimport { produce } from 'immer';\n\nimport { ConsumableEvents, type ProviderDetectedEvent } from './events.js';\nimport { guessProviderStateSelector, type State } from './mod.js';\n\ntype Browsers = 'firefox' | 'chrome' | 'edge' | 'brave' | 'homepage';\ntype Property<N extends string, V> = { name: N; value: V };\n\ntype NamespacesProperty = Property<\n 'namespaces',\n {\n selection: 'single' | 'multiple';\n data: {\n label: string;\n id: string;\n value: Namespace;\n unsupported?: boolean;\n getSupportedChains: (chains: BlockchainMeta[]) => BlockchainMeta[];\n }[];\n }\n>;\ntype DerivationPathProperty = Property<\n 'derivationPath',\n {\n data: {\n id: string;\n label: string;\n namespace: Namespace;\n generateDerivationPath: (index: string) => string;\n }[];\n }\n>;\ntype DetailsProperty = Property<\n 'details',\n {\n mobileWallet?: boolean;\n showOnMobile?: boolean;\n isContractWallet?: boolean;\n }\n>;\ntype SignersProperty = Property<\n 'signers',\n {\n getSigners: () => Promise<SignerFactory>;\n }\n>;\n\nexport type ProviderInfo = {\n name: string;\n icon: string;\n extensions: Partial<Record<Browsers, string>>;\n properties?: Array<\n | NamespacesProperty\n | DerivationPathProperty\n | DetailsProperty\n | SignersProperty\n >;\n};\n\nexport interface ProviderConfig {\n info: ProviderInfo;\n}\n\ninterface ProviderData {\n installed: boolean;\n}\n\ninterface ProviderItem {\n config: ProviderConfig;\n data: ProviderData;\n error: unknown;\n}\n\ntype ProviderState = {\n events: ConsumableEvents;\n list: Record<string, ProviderItem>;\n};\ninterface ProviderActions {\n addProvider: (id: string, config: ProviderConfig) => void;\n removeProvider: (id: string) => void;\n updateStatus: <K extends keyof ProviderData>(\n id: string,\n key: K,\n value: ProviderData[K]\n ) => void;\n\n _produceEventsWhenUpdatingStatus: <K extends keyof ProviderData>(\n provider: ProviderItem,\n id: string,\n key: K,\n value: ProviderData[K]\n ) => void;\n}\n\ninterface ProviderSelectors {\n /**\n * Provider has a limited state to itself, to be compatible with legacy, we try to produce same object as legacy\n * which includes namespace state as well.\n */\n guessNamespacesState: (id: string) => InternalProviderState;\n}\n\nexport type ProviderStore = ProviderState & ProviderActions & ProviderSelectors;\ntype ProvidersStateCreator = StateCreator<State, [], [], ProviderStore>;\n\nconst providersStore: ProvidersStateCreator = (set, get) => ({\n events: new ConsumableEvents(),\n\n list: {},\n addProvider: (id, config) => {\n const item = {\n data: {\n installed: false,\n },\n error: '',\n config,\n };\n\n set(\n produce((state: State) => {\n state.providers.list[id] = item;\n })\n );\n },\n removeProvider: (id) => {\n set(\n produce((state: State) => {\n delete state.providers.list[id];\n })\n );\n },\n updateStatus: (id, key, value) => {\n const provider = get().providers.list[id];\n if (!provider) {\n throw new Error(`No namespace namespace with '${id}' found.`);\n }\n\n get().providers._produceEventsWhenUpdatingStatus(provider, id, key, value);\n\n set(\n produce((state: State) => {\n state.providers.list[id].data[key] = value;\n })\n );\n },\n guessNamespacesState: (providerId: string): InternalProviderState => {\n return guessProviderStateSelector(get(), providerId);\n },\n\n _produceEventsWhenUpdatingStatus: (_provider, id, key, _value) => {\n if (key === 'installed') {\n const event: ProviderDetectedEvent = {\n type: 'provider_detected',\n provider: id,\n };\n\n get().providers.events.push(event);\n }\n },\n});\n\nexport { providersStore };\n", "import type { Actions, Context, Operators } from '../hub/namespaces/types.js';\nimport type { AnyFunction, FunctionWithContext } from '../types/actions.js';\n\nexport interface ActionByBuilder<T, Context> {\n actionName: keyof T;\n and: Operators<T>;\n or: Operators<T>;\n after: Operators<T>;\n before: Operators<T>;\n action: FunctionWithContext<T[keyof T], Context>;\n}\n\n/*\n * TODO:\n * Currently, to use this builder you will write something like this:\n * new ActionBuilder<EvmActions, 'disconnect'>('disconnect').after(....)\n *\n * I couldn't figure it out to be able typescript infer the constructor value as key of actions.\n * Ideal usage:\n * new ActionBuilder<EvmActions>('disconnect').after(....)\n *\n */\nexport class ActionBuilder<T extends Actions<T>, K extends keyof T> {\n readonly name: K;\n #and: Operators<T> = new Map();\n #or: Operators<T> = new Map();\n #after: Operators<T> = new Map();\n #before: Operators<T> = new Map();\n #action: FunctionWithContext<T[keyof T], Context<T>> | undefined;\n\n constructor(name: K) {\n this.name = name;\n }\n\n public and(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#and.has(this.name)) {\n this.#and.set(this.name, []);\n }\n this.#and.get(this.name)?.push(action);\n return this;\n }\n\n public or(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#or.has(this.name)) {\n this.#or.set(this.name, []);\n }\n this.#or.get(this.name)?.push(action);\n return this;\n }\n\n public before(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#before.has(this.name)) {\n this.#before.set(this.name, []);\n }\n this.#before.get(this.name)?.push(action);\n return this;\n }\n\n public after(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#after.has(this.name)) {\n this.#after.set(this.name, []);\n }\n this.#after.get(this.name)?.push(action);\n return this;\n }\n\n public action(action: FunctionWithContext<T[keyof T], Context<T>>) {\n this.#action = action;\n return this;\n }\n\n public build(): ActionByBuilder<T, Context<T>> {\n if (!this.#action) {\n throw new Error('Your action builder should includes an action.');\n }\n\n return {\n actionName: this.name,\n action: this.#action,\n before: this.#before,\n after: this.#after,\n and: this.#and,\n or: this.#or,\n };\n }\n}\n", "/*\n * It is not a good idea to re-export all of CAIP because if they have a breaking change, we will break as well.\n * It would be better to create an abstraction over them and export our own interface to ensure it is under our control.\n */\nexport * as CAIP from 'caip';\n\nexport { generateStoreId } from '../hub/helpers.js';\nexport * from './versions.js';\n", "import { AccountId } from 'caip';\n\nexport function isValidCaipAddress(address: string): boolean {\n try {\n AccountId.parse(address);\n return true;\n } catch {\n return false;\n }\n}\n", "import type {\n Accounts,\n AccountsWithActiveChain,\n} from './../../types/accounts.js';\nimport type { Context } from '../../hub/namespaces/mod.js';\n\nimport { isValidCaipAddress } from './helpers.js';\n\nexport function connectAndUpdateStateForSingleNetwork(\n context: Context,\n accounts: Accounts\n) {\n if (!accounts.every(isValidCaipAddress)) {\n throw new Error(\n `Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${accounts}`\n );\n }\n\n const [, setState] = context.state();\n setState('accounts', accounts);\n setState('connected', true);\n return accounts;\n}\n\nexport function connectAndUpdateStateForMultiNetworks(\n context: Context,\n accounts: AccountsWithActiveChain\n) {\n if (!accounts.accounts.every(isValidCaipAddress)) {\n throw new Error(\n `Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${accounts.accounts}`\n );\n }\n\n const [, setState] = context.state();\n setState('accounts', accounts.accounts);\n setState('network', accounts.network);\n setState('connected', true);\n return accounts;\n}\n\nexport const recommended = [];\n", "import type { Context } from '../../hub/namespaces/mod.js';\n\nexport function intoConnecting(context: Context) {\n const [, setState] = context.state();\n setState('connecting', true);\n}\n\n// Please consider if you are going to add something here, make sure it works on all namespaces.\nexport const recommended = [['connect', intoConnecting] as const];\n", "import { beforeRecommended } from '../common/mod.js';\n\nexport const recommended = [...beforeRecommended];\n", "import type { EvmActions } from './types.js';\n\nimport { ActionBuilder } from '../../mod.js';\nimport {\n connectAndUpdateStateForMultiNetworks,\n intoConnecting,\n intoConnectionFinished,\n} from '../common/mod.js';\n\nexport const connect = () =>\n new ActionBuilder<EvmActions, 'connect'>('connect')\n .and(connectAndUpdateStateForMultiNetworks)\n .before(intoConnecting)\n .after(intoConnectionFinished);\n\nexport const canEagerConnect = () =>\n new ActionBuilder<EvmActions, 'canEagerConnect'>('canEagerConnect');\n"],
|
|
5
|
-
"mappings": "6IAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,4BAAAC,EAAA,0BAAAC,EAAA,YAAAC,EAAA,gBAAAC,IAUA,OAAS,aAAAC,MAAiB,OCRnB,SAASC,EAAWC,EAAwB,CACjD,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EACnCC,EAAS,UAAW,IAAI,EACxBA,EAAS,WAAY,IAAI,EACzBA,EAAS,YAAa,EAAK,EAC3BA,EAAS,aAAc,EAAK,CAC9B,CANgBC,EAAAH,EAAA,cAQT,IAAMI,EAAc,CAAC,CAAC,aAAcJ,CAAU,CAAU,ECVxD,IAAMK,EAAiB,SACjBC,EAAyB,ICDtC,IAAAC,EAAA,GAAAC,EAAAD,EAAA,
|
|
6
|
-
"names": ["actions_exports", "__export", "canEagerConnect", "changeAccountSubscriber", "changeChainSubscriber", "connect", "recommended", "AccountId", "disconnect", "context", "setState", "__name", "recommended", "CAIP_NAMESPACE", "CAIP_ETHEREUM_CHAIN_ID", "utils_exports", "__export", "getAccounts", "isUserRejectionError", "suggestNetwork", "switchNetwork", "switchOrAddNetwork", "getAccounts", "provider", "accounts", "chainId", "__name", "suggestNetwork", "instance", "chain", "switchNetwork", "switchOrAddNetwork", "switchError", "error", "EIP_1193_USER_REJECTION_ERROR_CODE", "isUserRejectionError", "code", "causeCode", "recommended", "CHAIN_ID_RADIX", "connect", "instance", "options", "_context", "chain", "evmInstance", "switchOrAddNetwork", "result", "getAccounts", "chainId", "account", "AccountId", "CAIP_NAMESPACE", "__name", "changeAccountSubscriber", "eventCallback", "context", "err", "setState", "accounts", "formatAccounts", "_", "changeChainSubscriber", "canEagerConnect", "after_exports", "__export", "recommended", "intoConnectionFinished", "context", "setState", "__name", "recommended", "recommended", "and_exports", "__export", "recommended", "createZustandStore", "produce", "produce", "ActionBuilder", "__name", "#and", "#or", "#after", "#before", "#action", "name", "action", "CAIP", "AccountId", "isValidCaipAddress", "address", "AccountId", "__name", "connectAndUpdateStateForMultiNetworks", "context", "accounts", "isValidCaipAddress", "setState", "__name", "intoConnecting", "context", "setState", "__name", "recommended", "recommended", "connectAndUpdateStateForMultiNetworks", "before_exports", "__export", "recommended", "recommended", "builders_exports", "__export", "canEagerConnect", "connect", "connect", "__name", "ActionBuilder", "connectAndUpdateStateForMultiNetworks", "intoConnecting", "intoConnectionFinished", "canEagerConnect"]
|
|
4
|
+
"sourcesContent": ["import type { EIP1193EventMap } from './eip1193.js';\nimport type { ConnectOptions, EvmActions, ProviderAPI } from './types.js';\nimport type { Context, Subscriber } from '../../hub/namespaces/mod.js';\nimport type {\n CanEagerConnect,\n SubscriberCleanUp,\n} from '../../hub/namespaces/types.js';\nimport type { CaipAccount } from '../../types/accounts.js';\nimport type { FunctionWithContext } from '../../types/actions.js';\n\nimport { AccountId } from 'caip';\n\nimport { recommended as commonRecommended } from '../common/actions.js';\n\nimport { CAIP_NAMESPACE } from './constants.js';\nimport {\n filterAndGetEvmBlockchainNames,\n getAccounts,\n switchOrAddNetwork,\n} from './utils.js';\n\nexport const recommended = [...commonRecommended];\nconst CHAIN_ID_RADIX = 16;\nexport function connect(\n instance: () => ProviderAPI,\n options?: ConnectOptions\n): FunctionWithContext<EvmActions['connect'], Context> {\n return async (_context, chain) => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Do your wallet injected correctly and is evm compatible?'\n );\n }\n\n if (chain) {\n /*\n * The `switchOrAddNetwork` function can be optionally provided through `options`\n * to handle network switching or addition in a way that is compatible with the specific wallet provider.\n * This approach is necessary because not all providers follow the same conventions\u2014\n * for example, Rabby uses a different error code for \"chain not found\".\n */\n if (options?.switchOrAddNetwork) {\n await options.switchOrAddNetwork(evmInstance, chain);\n } else {\n await switchOrAddNetwork(evmInstance, chain);\n }\n }\n\n const result = await getAccounts(evmInstance);\n\n /*\n * Trust Wallet Compatibility Fix:\n * Trust Wallet's in-app browser has been observed to return the `chainId` as a\n * number (e.g., 1) rather than the standard hexadecimal string (e.g., \"0x1\").\n * This code block standardizes the `chainId` to the required hex format to\n * prevent downstream errors.\n */\n let chainId = result.chainId;\n if (typeof chainId === 'number') {\n chainId = `0x${Number(chainId).toString(CHAIN_ID_RADIX)}`;\n }\n\n const formatAccounts = result.accounts.map(\n (account) =>\n AccountId.format({\n address: account,\n chainId: {\n namespace: CAIP_NAMESPACE,\n reference: chainId,\n },\n }) as CaipAccount\n );\n\n return {\n accounts: formatAccounts,\n network: chainId,\n };\n };\n}\n\nexport function changeAccountSubscriber(\n instance: () => ProviderAPI\n): [Subscriber<EvmActions>, SubscriberCleanUp<EvmActions>] {\n let eventCallback: EIP1193EventMap['accountsChanged'];\n\n // subscriber can be passed to `or`, it will get the error and should rethrow error to pass the error to next `or` or throw error.\n return [\n (context, err) => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Trying to subscribe to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n const [, setState] = context.state();\n\n eventCallback = async (accounts) => {\n /*\n * In Phantom, when user is switching to an account which is not connected to dApp yet, it returns a null.\n * So null means we don't have access to account and we need to disconnect and let the user connect the account.\n *\n * This assumption may not work for other wallets, if that the case, we need to consider a new approach.\n */\n if (!accounts || accounts.length === 0) {\n context.action('disconnect');\n return;\n }\n\n const chainId = await evmInstance.request({ method: 'eth_chainId' });\n const formatAccounts = accounts.map((account) =>\n AccountId.format({\n address: account,\n chainId: {\n namespace: CAIP_NAMESPACE,\n reference: chainId,\n },\n })\n );\n\n setState('accounts', formatAccounts);\n };\n evmInstance.on('accountsChanged', eventCallback);\n\n if (err instanceof Error) {\n throw err;\n }\n },\n (_, err) => {\n const evmInstance = instance();\n\n if (eventCallback && evmInstance) {\n evmInstance.removeListener?.('accountsChanged', eventCallback);\n }\n\n return err;\n },\n ];\n}\n\nexport function changeChainSubscriber(\n instance: () => ProviderAPI\n): [Subscriber<EvmActions>, SubscriberCleanUp<EvmActions>] {\n let eventCallback: EIP1193EventMap['chainChanged'];\n\n return [\n (context) => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Trying to subscribe to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n const [, setState] = context.state();\n\n eventCallback = async (chainId: string) => {\n setState('network', chainId);\n };\n evmInstance.on('chainChanged', eventCallback);\n },\n () => {\n const evmInstance = instance();\n\n if (eventCallback && evmInstance) {\n evmInstance.removeListener('chainChanged', eventCallback);\n }\n },\n ];\n}\n\nexport function canEagerConnect(\n instance: () => ProviderAPI | undefined\n): CanEagerConnect<EvmActions> {\n return async () => {\n const evmInstance = instance();\n\n if (!evmInstance) {\n throw new Error(\n 'Trying to eagerly connect to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n try {\n const accounts: string[] = await evmInstance.request({\n method: 'eth_accounts',\n });\n if (accounts.length) {\n return true;\n }\n return false;\n } catch {\n return false;\n }\n };\n}\nexport function canSwitchNetwork(): FunctionWithContext<\n EvmActions['canSwitchNetwork'],\n Context\n> {\n return (context, params) => {\n const { network, supportedChains } = params;\n return filterAndGetEvmBlockchainNames(supportedChains).includes(network);\n };\n}\n", "import type { Context } from '../../hub/namespaces/mod.js';\n\nexport function disconnect(context: Context): void {\n const [, setState] = context.state();\n setState('network', null);\n setState('accounts', null);\n setState('connected', false);\n setState('connecting', false);\n}\n\nexport const recommended = [['disconnect', disconnect] as const];\n", "export const CAIP_NAMESPACE = 'eip155';\nexport const CAIP_ETHEREUM_CHAIN_ID = '1';\n", "import type { Chain, ChainId, ProviderAPI } from './types.js';\n\nimport { type BlockchainMeta, evmBlockchains } from 'rango-types';\n\nexport async function getAccounts(provider: ProviderAPI) {\n const [accounts, chainId] = await Promise.all([\n provider.request({ method: 'eth_requestAccounts' }),\n provider.request({ method: 'eth_chainId' }),\n ]);\n\n return {\n accounts,\n chainId,\n };\n}\n\nexport async function suggestNetwork(instance: ProviderAPI, chain: Chain) {\n return await instance.request({\n method: 'wallet_addEthereumChain',\n params: [chain],\n });\n}\n\nexport async function switchNetwork(instance: ProviderAPI, chainId: ChainId) {\n return await instance.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: chainId }],\n });\n}\nexport function filterAndGetEvmBlockchainNames(meta: BlockchainMeta[]) {\n return evmBlockchains(meta).map((blockchain) => blockchain.name);\n}\nexport async function switchOrAddNetwork(\n instance: ProviderAPI,\n chain: ChainId | Chain\n) {\n try {\n const chainId = typeof chain === 'string' ? chain : chain.chainId;\n await switchNetwork(instance, chainId);\n } catch (switchError) {\n const error = switchError as { code: number };\n\n /*\n * Error code 4902 is used by MetaMask to indicate that the requested chain has not been added to the wallet.\n * This code is not part of the official EIP-1193 spec (https://eips.ethereum.org/EIPS/eip-1193#supported-rpc-methods),\n * so other providers may use a different code or behavior for the same condition.\n */\n const NOT_FOUND_CHAIN_ERROR_CODE = 4902;\n if (\n typeof chain !== 'string' &&\n (error.code === NOT_FOUND_CHAIN_ERROR_CODE || !error.code)\n ) {\n /*\n * Note: on WalletConnect `code` is undefined so we have to use !switchError.code as fallback.\n * This error code indicates that the chain has not been added to wallet.\n */\n await suggestNetwork(instance, chain);\n return;\n }\n throw switchError;\n }\n}\n\nconst EIP_1193_USER_REJECTION_ERROR_CODE = 4001;\nexport function isUserRejectionError(error: unknown): boolean {\n // EIP-1193 user rejection error can be in error.code or error.cause.code\n if (typeof error === 'object' && error !== null) {\n const code = (error as { code?: number }).code;\n const causeCode = (error as { cause?: { code?: number } }).cause?.code;\n return (\n code === EIP_1193_USER_REJECTION_ERROR_CODE ||\n causeCode === EIP_1193_USER_REJECTION_ERROR_CODE\n );\n }\n return false;\n}\n", "import { recommended as commonRecommended } from '../common/after.js';\n\nexport const recommended = [...commonRecommended];\n", "import type { Context } from '../../hub/namespaces/mod.js';\n\nexport function intoConnectionFinished(context: Context) {\n const [, setState] = context.state();\n setState('connecting', false);\n}\n\nexport const recommended = [['connect', intoConnectionFinished] as const];\n", "import { connectAndUpdateStateForMultiNetworks } from '../common/mod.js';\n\nexport const recommended = [\n ['connect', connectAndUpdateStateForMultiNetworks] as const,\n];\n", "import type { StoreApi } from 'zustand/vanilla';\n\nimport { createStore as createZustandStore } from 'zustand/vanilla';\n\nimport { extend, type Store } from './extend.js';\nimport { hubStore, type HubStore } from './hub.js';\nimport { namespacesStore, type NamespaceStore } from './namespaces.js';\nimport { providersStore, type ProviderStore } from './providers.js';\n\n/************ State ************/\n\nexport interface State {\n hub: HubStore;\n providers: ProviderStore;\n namespaces: NamespaceStore;\n}\n\nexport type RawStore = StoreApi<State>;\n\nexport const createStore = (): Store => {\n const store = createZustandStore<State>((...api) => {\n return {\n hub: hubStore(...api),\n providers: providersStore(...api),\n namespaces: namespacesStore(...api),\n };\n });\n\n return extend(store);\n};\n", "/************ Namespace ************/\n\nimport type { StateCreator } from 'zustand';\n\nimport { produce } from 'immer';\n\nimport {\n ConsumableEvents,\n type NamespaceConnectedEvent,\n type NamespaceDisconnectedEvent,\n type NamespaceSwitchedAccountEvent,\n type NamespaceSwitchedNetworkEvent,\n} from './events.js';\nimport { namespaceStateSelector, type State } from './mod.js';\n\n// Currently, namespace doesn't has any config.\nexport type NamespaceConfig = object;\n\nexport interface NamespaceData {\n accounts: null | string[];\n network: null | string;\n connected: boolean;\n connecting: boolean;\n}\n\ninterface NamespaceInfo {\n providerId: string;\n namespaceId: string;\n}\n\ninterface NamespaceItem {\n info: NamespaceInfo;\n data: NamespaceData;\n error: unknown;\n}\n\ntype NamespaceState = {\n events: InstanceType<typeof ConsumableEvents>;\n list: Record<string, NamespaceItem>;\n};\n\ninterface NamespaceActions {\n addNamespace: (id: string, config: NamespaceInfo) => void;\n updateStatus: <K extends keyof NamespaceData>(\n id: string,\n key: K,\n value: NamespaceData[K]\n ) => void;\n\n _produceEventsWhenUpdatingStatus: <K extends keyof NamespaceData>(\n namespace: NamespaceItem,\n id: string,\n key: K,\n value: NamespaceData[K]\n ) => void;\n}\ninterface NamespaceSelectors {\n getNamespaceData(storeId: string): NamespaceData;\n}\n\nexport type NamespaceStore = NamespaceState &\n NamespaceActions &\n NamespaceSelectors;\ntype NamespaceStateCreator = StateCreator<State, [], [], NamespaceStore>;\n\nconst namespacesStore: NamespaceStateCreator = (set, get) => ({\n events: new ConsumableEvents(),\n\n list: {},\n addNamespace: (id, info) => {\n const data: NamespaceData = {\n accounts: null,\n network: null,\n connected: false,\n connecting: false,\n };\n\n const item = {\n data,\n error: '',\n info,\n };\n\n set(\n produce((state: State) => {\n state.namespaces.list[id] = item;\n })\n );\n },\n updateStatus: (id, key, value) => {\n const ns = get().namespaces.list[id];\n if (!ns) {\n throw new Error(`No namespace with '${id}' found.`);\n }\n\n get().namespaces._produceEventsWhenUpdatingStatus(ns, id, key, value);\n\n // Updating state\n set(\n produce((state: State) => {\n state.namespaces.list[id].data[key] = value;\n })\n );\n },\n getNamespaceData(storeId) {\n return namespaceStateSelector(get(), storeId);\n },\n\n _produceEventsWhenUpdatingStatus: (namespace, id, key, value) => {\n if (key === 'accounts') {\n // check for both null and empty array\n const isAccountsEmpty =\n Object.is(value, null) || (Array.isArray(value) && value.length === 0);\n\n if (isAccountsEmpty) {\n const currentConnectedStatus = get().namespaces.list[id].data.connected;\n if (currentConnectedStatus) {\n const event: NamespaceDisconnectedEvent = {\n type: 'namespace_disconnected',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n };\n\n get().namespaces.events.push(event);\n }\n // Skip emitting disconnect event, if the `connected` is false\n } else {\n const currentAccounts = get().namespaces.list[id].data.accounts;\n\n if (!currentAccounts) {\n const event: NamespaceConnectedEvent = {\n type: 'namespace_connected',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n accounts: value as string[],\n };\n\n get().namespaces.events.push(event);\n } else {\n const areSameAccounts =\n currentAccounts.sort().toString() ===\n (value as string[]).sort().toString();\n\n if (!areSameAccounts) {\n const event: NamespaceSwitchedAccountEvent = {\n type: 'namespace_account_switched',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n previousAccounts: currentAccounts,\n accounts: value as string[],\n };\n\n get().namespaces.events.push(event);\n }\n }\n }\n } else if (key === 'network') {\n const currentNetwork = get().namespaces.list[id].data.network;\n\n const event: NamespaceSwitchedNetworkEvent = {\n type: 'namespace_network_switched',\n provider: namespace.info.providerId,\n namespace: namespace.info.namespaceId,\n network: value as string,\n previousNetwork: currentNetwork,\n };\n\n get().namespaces.events.push(event);\n }\n },\n});\n\nexport { namespacesStore };\n", "import type { Namespace } from '../../namespaces/common/types.js';\nimport type { State as InternalProviderState } from '../provider/mod.js';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\nimport type { StateCreator } from 'zustand';\n\nimport { produce } from 'immer';\n\nimport { ConsumableEvents, type ProviderDetectedEvent } from './events.js';\nimport { guessProviderStateSelector, type State } from './mod.js';\n\ntype Browsers = 'firefox' | 'chrome' | 'edge' | 'brave' | 'homepage';\ntype Property<N extends string, V> = { name: N; value: V };\n\ntype NamespacesProperty = Property<\n 'namespaces',\n {\n selection: 'single' | 'multiple';\n data: {\n label: string;\n id: string;\n value: Namespace;\n unsupported?: boolean;\n getSupportedChains: (chains: BlockchainMeta[]) => BlockchainMeta[];\n }[];\n }\n>;\ntype DerivationPathProperty = Property<\n 'derivationPath',\n {\n data: {\n id: string;\n label: string;\n namespace: Namespace;\n generateDerivationPath: (index: string) => string;\n }[];\n }\n>;\ntype DetailsProperty = Property<\n 'details',\n {\n mobileWallet?: boolean;\n showOnMobile?: boolean;\n isContractWallet?: boolean;\n }\n>;\ntype SignersProperty = Property<\n 'signers',\n {\n getSigners: () => Promise<SignerFactory>;\n }\n>;\n\nexport type ProviderInfo = {\n name: string;\n icon: string;\n extensions: Partial<Record<Browsers, string>>;\n properties?: Array<\n | NamespacesProperty\n | DerivationPathProperty\n | DetailsProperty\n | SignersProperty\n >;\n};\n\nexport interface ProviderConfig {\n info: ProviderInfo;\n}\n\ninterface ProviderData {\n installed: boolean;\n}\n\ninterface ProviderItem {\n config: ProviderConfig;\n data: ProviderData;\n error: unknown;\n}\n\ntype ProviderState = {\n events: ConsumableEvents;\n list: Record<string, ProviderItem>;\n};\ninterface ProviderActions {\n addProvider: (id: string, config: ProviderConfig) => void;\n removeProvider: (id: string) => void;\n updateStatus: <K extends keyof ProviderData>(\n id: string,\n key: K,\n value: ProviderData[K]\n ) => void;\n\n _produceEventsWhenUpdatingStatus: <K extends keyof ProviderData>(\n provider: ProviderItem,\n id: string,\n key: K,\n value: ProviderData[K]\n ) => void;\n}\n\ninterface ProviderSelectors {\n /**\n * Provider has a limited state to itself, to be compatible with legacy, we try to produce same object as legacy\n * which includes namespace state as well.\n */\n guessNamespacesState: (id: string) => InternalProviderState;\n}\n\nexport type ProviderStore = ProviderState & ProviderActions & ProviderSelectors;\ntype ProvidersStateCreator = StateCreator<State, [], [], ProviderStore>;\n\nconst providersStore: ProvidersStateCreator = (set, get) => ({\n events: new ConsumableEvents(),\n\n list: {},\n addProvider: (id, config) => {\n const item = {\n data: {\n installed: false,\n },\n error: '',\n config,\n };\n\n set(\n produce((state: State) => {\n state.providers.list[id] = item;\n })\n );\n },\n removeProvider: (id) => {\n set(\n produce((state: State) => {\n delete state.providers.list[id];\n })\n );\n },\n updateStatus: (id, key, value) => {\n const provider = get().providers.list[id];\n if (!provider) {\n throw new Error(`No namespace namespace with '${id}' found.`);\n }\n\n get().providers._produceEventsWhenUpdatingStatus(provider, id, key, value);\n\n set(\n produce((state: State) => {\n state.providers.list[id].data[key] = value;\n })\n );\n },\n guessNamespacesState: (providerId: string): InternalProviderState => {\n return guessProviderStateSelector(get(), providerId);\n },\n\n _produceEventsWhenUpdatingStatus: (_provider, id, key, _value) => {\n if (key === 'installed') {\n const event: ProviderDetectedEvent = {\n type: 'provider_detected',\n provider: id,\n };\n\n get().providers.events.push(event);\n }\n },\n});\n\nexport { providersStore };\n", "import type { Actions, Context, Operators } from '../hub/namespaces/types.js';\nimport type { AnyFunction, FunctionWithContext } from '../types/actions.js';\n\nexport interface ActionByBuilder<T, Context> {\n actionName: keyof T;\n and: Operators<T>;\n or: Operators<T>;\n after: Operators<T>;\n before: Operators<T>;\n action: FunctionWithContext<T[keyof T], Context>;\n}\n\n/*\n * TODO:\n * Currently, to use this builder you will write something like this:\n * new ActionBuilder<EvmActions, 'disconnect'>('disconnect').after(....)\n *\n * I couldn't figure it out to be able typescript infer the constructor value as key of actions.\n * Ideal usage:\n * new ActionBuilder<EvmActions>('disconnect').after(....)\n *\n */\nexport class ActionBuilder<T extends Actions<T>, K extends keyof T> {\n readonly name: K;\n #and: Operators<T> = new Map();\n #or: Operators<T> = new Map();\n #after: Operators<T> = new Map();\n #before: Operators<T> = new Map();\n #action: FunctionWithContext<T[keyof T], Context<T>> | undefined;\n\n constructor(name: K) {\n this.name = name;\n }\n\n public and(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#and.has(this.name)) {\n this.#and.set(this.name, []);\n }\n this.#and.get(this.name)?.push(action);\n return this;\n }\n\n public or(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#or.has(this.name)) {\n this.#or.set(this.name, []);\n }\n this.#or.get(this.name)?.push(action);\n return this;\n }\n\n public before(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#before.has(this.name)) {\n this.#before.set(this.name, []);\n }\n this.#before.get(this.name)?.push(action);\n return this;\n }\n\n public after(action: FunctionWithContext<AnyFunction, Context<T>>) {\n if (!this.#after.has(this.name)) {\n this.#after.set(this.name, []);\n }\n this.#after.get(this.name)?.push(action);\n return this;\n }\n\n public action(action: FunctionWithContext<T[keyof T], Context<T>>) {\n this.#action = action;\n return this;\n }\n\n public build(): ActionByBuilder<T, Context<T>> {\n if (!this.#action) {\n throw new Error('Your action builder should includes an action.');\n }\n\n return {\n actionName: this.name,\n action: this.#action,\n before: this.#before,\n after: this.#after,\n and: this.#and,\n or: this.#or,\n };\n }\n}\n", "/*\n * It is not a good idea to re-export all of CAIP because if they have a breaking change, we will break as well.\n * It would be better to create an abstraction over them and export our own interface to ensure it is under our control.\n */\nexport * as CAIP from 'caip';\n\nexport { generateStoreId } from '../hub/helpers.js';\nexport * from './versions.js';\n", "import { AccountId } from 'caip';\n\nexport function isValidCaipAddress(address: string): boolean {\n try {\n AccountId.parse(address);\n return true;\n } catch {\n return false;\n }\n}\n", "import type {\n Accounts,\n AccountsWithActiveChain,\n} from './../../types/accounts.js';\nimport type { Context } from '../../hub/namespaces/mod.js';\n\nimport { isValidCaipAddress } from './helpers.js';\n\nexport function connectAndUpdateStateForSingleNetwork(\n context: Context,\n accounts: Accounts\n) {\n if (!accounts.every(isValidCaipAddress)) {\n throw new Error(\n `Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${accounts}`\n );\n }\n\n const [, setState] = context.state();\n setState('accounts', accounts);\n setState('connected', true);\n return accounts;\n}\n\nexport function connectAndUpdateStateForMultiNetworks(\n context: Context,\n accounts: AccountsWithActiveChain\n) {\n if (!accounts.accounts.every(isValidCaipAddress)) {\n throw new Error(\n `Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${accounts.accounts}`\n );\n }\n\n const [, setState] = context.state();\n setState('accounts', accounts.accounts);\n setState('network', accounts.network);\n setState('connected', true);\n return accounts;\n}\n\nexport const recommended = [];\n", "import type { Context } from '../../hub/namespaces/mod.js';\n\nexport function intoConnecting(context: Context) {\n const [, setState] = context.state();\n setState('connecting', true);\n}\n\n// Please consider if you are going to add something here, make sure it works on all namespaces.\nexport const recommended = [['connect', intoConnecting] as const];\n", "import { beforeRecommended } from '../common/mod.js';\n\nexport const recommended = [...beforeRecommended];\n", "import type { EvmActions } from './types.js';\n\nimport { ActionBuilder } from '../../mod.js';\nimport {\n connectAndUpdateStateForMultiNetworks,\n intoConnecting,\n intoConnectionFinished,\n} from '../common/mod.js';\n\nexport const connect = () =>\n new ActionBuilder<EvmActions, 'connect'>('connect')\n .and(connectAndUpdateStateForMultiNetworks)\n .before(intoConnecting)\n .after(intoConnectionFinished);\n\nexport const canEagerConnect = () =>\n new ActionBuilder<EvmActions, 'canEagerConnect'>('canEagerConnect');\nexport const canSwitchNetwork = () =>\n new ActionBuilder<EvmActions, 'canSwitchNetwork'>('canSwitchNetwork');\n"],
|
|
5
|
+
"mappings": "6IAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,qBAAAC,EAAA,4BAAAC,EAAA,0BAAAC,EAAA,YAAAC,EAAA,gBAAAC,IAUA,OAAS,aAAAC,MAAiB,OCRnB,SAASC,EAAWC,EAAwB,CACjD,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EACnCC,EAAS,UAAW,IAAI,EACxBA,EAAS,WAAY,IAAI,EACzBA,EAAS,YAAa,EAAK,EAC3BA,EAAS,aAAc,EAAK,CAC9B,CANgBC,EAAAH,EAAA,cAQT,IAAMI,EAAc,CAAC,CAAC,aAAcJ,CAAU,CAAU,ECVxD,IAAMK,EAAiB,SACjBC,EAAyB,ICDtC,IAAAC,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,EAAA,gBAAAC,EAAA,yBAAAC,EAAA,mBAAAC,EAAA,kBAAAC,EAAA,uBAAAC,IAEA,OAA8B,kBAAAC,MAAsB,cAEpD,eAAsBC,EAAYC,EAAuB,CACvD,GAAM,CAACC,EAAUC,CAAO,EAAI,MAAM,QAAQ,IAAI,CAC5CF,EAAS,QAAQ,CAAE,OAAQ,qBAAsB,CAAC,EAClDA,EAAS,QAAQ,CAAE,OAAQ,aAAc,CAAC,CAC5C,CAAC,EAED,MAAO,CACL,SAAAC,EACA,QAAAC,CACF,CACF,CAVsBC,EAAAJ,EAAA,eAYtB,eAAsBK,EAAeC,EAAuBC,EAAc,CACxE,OAAO,MAAMD,EAAS,QAAQ,CAC5B,OAAQ,0BACR,OAAQ,CAACC,CAAK,CAChB,CAAC,CACH,CALsBH,EAAAC,EAAA,kBAOtB,eAAsBG,EAAcF,EAAuBH,EAAkB,CAC3E,OAAO,MAAMG,EAAS,QAAQ,CAC5B,OAAQ,6BACR,OAAQ,CAAC,CAAE,QAASH,CAAQ,CAAC,CAC/B,CAAC,CACH,CALsBC,EAAAI,EAAA,iBAMf,SAASC,EAA+BC,EAAwB,CACrE,OAAOC,EAAeD,CAAI,EAAE,IAAKE,GAAeA,EAAW,IAAI,CACjE,CAFgBR,EAAAK,EAAA,kCAGhB,eAAsBI,EACpBP,EACAC,EACA,CACA,GAAI,CACF,IAAMJ,EAAU,OAAOI,GAAU,SAAWA,EAAQA,EAAM,QAC1D,MAAMC,EAAcF,EAAUH,CAAO,CACvC,OAASW,EAAa,CACpB,IAAMC,EAAQD,EAQd,GACE,OAAOP,GAAU,WAChBQ,EAAM,OAH0B,MAGa,CAACA,EAAM,MACrD,CAKA,MAAMV,EAAeC,EAAUC,CAAK,EACpC,MACF,CACA,MAAMO,CACR,CACF,CA7BsBV,EAAAS,EAAA,sBA+BtB,IAAMG,EAAqC,KACpC,SAASC,EAAqBF,EAAyB,CAE5D,GAAI,OAAOA,GAAU,UAAYA,IAAU,KAAM,CAC/C,IAAMG,EAAQH,EAA4B,KACpCI,EAAaJ,EAAwC,OAAO,KAClE,OACEG,IAASF,GACTG,IAAcH,CAElB,CACA,MAAO,EACT,CAXgBZ,EAAAa,EAAA,wBH3CT,IAAMG,EAAc,CAAC,GAAGA,CAAiB,EAC1CC,EAAiB,GAChB,SAASC,EACdC,EACAC,EACqD,CACrD,MAAO,OAAOC,EAAUC,IAAU,CAChC,IAAMC,EAAcJ,EAAS,EAE7B,GAAI,CAACI,EACH,MAAM,IAAI,MACR,0DACF,EAGED,IAOEF,GAAS,mBACX,MAAMA,EAAQ,mBAAmBG,EAAaD,CAAK,EAEnD,MAAME,EAAmBD,EAAaD,CAAK,GAI/C,IAAMG,EAAS,MAAMC,EAAYH,CAAW,EASxCI,EAAUF,EAAO,QACrB,OAAI,OAAOE,GAAY,WACrBA,EAAU,KAAK,OAAOA,CAAO,EAAE,SAASV,CAAc,CAAC,IAclD,CACL,SAZqBQ,EAAO,SAAS,IACpCG,GACCC,EAAU,OAAO,CACf,QAASD,EACT,QAAS,CACP,UAAWE,EACX,UAAWH,CACb,CACF,CAAC,CACL,EAIE,QAASA,CACX,CACF,CACF,CAzDgBI,EAAAb,EAAA,WA2DT,SAASc,EACdb,EACyD,CACzD,IAAIc,EAGJ,MAAO,CACL,CAACC,EAASC,IAAQ,CAChB,IAAMZ,EAAcJ,EAAS,EAE7B,GAAI,CAACI,EACH,MAAM,IAAI,MACR,kFACF,EAGF,GAAM,CAAC,CAAEa,CAAQ,EAAIF,EAAQ,MAAM,EA6BnC,GA3BAD,EAAgBF,EAAA,MAAOM,GAAa,CAOlC,GAAI,CAACA,GAAYA,EAAS,SAAW,EAAG,CACtCH,EAAQ,OAAO,YAAY,EAC3B,MACF,CAEA,IAAMP,EAAU,MAAMJ,EAAY,QAAQ,CAAE,OAAQ,aAAc,CAAC,EAC7De,EAAiBD,EAAS,IAAKT,GACnCC,EAAU,OAAO,CACf,QAASD,EACT,QAAS,CACP,UAAWE,EACX,UAAWH,CACb,CACF,CAAC,CACH,EAEAS,EAAS,WAAYE,CAAc,CACrC,EAxBgB,iBAyBhBf,EAAY,GAAG,kBAAmBU,CAAa,EAE3CE,aAAe,MACjB,MAAMA,CAEV,EACA,CAACI,EAAGJ,IAAQ,CACV,IAAMZ,EAAcJ,EAAS,EAE7B,OAAIc,GAAiBV,GACnBA,EAAY,iBAAiB,kBAAmBU,CAAa,EAGxDE,CACT,CACF,CACF,CA3DgBJ,EAAAC,EAAA,2BA6DT,SAASQ,EACdrB,EACyD,CACzD,IAAIc,EAEJ,MAAO,CACJC,GAAY,CACX,IAAMX,EAAcJ,EAAS,EAE7B,GAAI,CAACI,EACH,MAAM,IAAI,MACR,kFACF,EAGF,GAAM,CAAC,CAAEa,CAAQ,EAAIF,EAAQ,MAAM,EAEnCD,EAAgBF,EAAA,MAAOJ,GAAoB,CACzCS,EAAS,UAAWT,CAAO,CAC7B,EAFgB,iBAGhBJ,EAAY,GAAG,eAAgBU,CAAa,CAC9C,EACA,IAAM,CACJ,IAAMV,EAAcJ,EAAS,EAEzBc,GAAiBV,GACnBA,EAAY,eAAe,eAAgBU,CAAa,CAE5D,CACF,CACF,CA9BgBF,EAAAS,EAAA,yBAgCT,SAASC,EACdtB,EAC6B,CAC7B,MAAO,UAAY,CACjB,IAAMI,EAAcJ,EAAS,EAE7B,GAAI,CAACI,EACH,MAAM,IAAI,MACR,wFACF,EAGF,GAAI,CAIF,MAAI,GAHuB,MAAMA,EAAY,QAAQ,CACnD,OAAQ,cACV,CAAC,GACY,MAIf,MAAQ,CACN,MAAO,EACT,CACF,CACF,CAxBgBQ,EAAAU,EAAA,mBAyBT,SAASC,GAGd,CACA,MAAO,CAACR,EAASS,IAAW,CAC1B,GAAM,CAAE,QAAAC,EAAS,gBAAAC,CAAgB,EAAIF,EACrC,OAAOG,EAA+BD,CAAe,EAAE,SAASD,CAAO,CACzE,CACF,CARgBb,EAAAW,EAAA,oBIxMhB,IAAAK,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,ICEO,SAASC,EAAuBC,EAAkB,CACvD,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EACnCC,EAAS,aAAc,EAAK,CAC9B,CAHgBC,EAAAH,EAAA,0BAKT,IAAMI,EAAc,CAAC,CAAC,UAAWJ,CAAsB,CAAU,EDLjE,IAAMK,EAAc,CAAC,GAAGA,CAAiB,EEFhD,IAAAC,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,KCEA,OAAS,eAAeC,OAA0B,kBCElD,OAAS,WAAAC,OAAe,QCCxB,OAAS,WAAAC,OAAe,QCiBjB,IAAMC,EAAN,KAA6D,CAtBpE,MAsBoE,CAAAC,EAAA,sBACzD,KACTC,GAAqB,IAAI,IACzBC,GAAoB,IAAI,IACxBC,GAAuB,IAAI,IAC3BC,GAAwB,IAAI,IAC5BC,GAEA,YAAYC,EAAS,CACnB,KAAK,KAAOA,CACd,CAEO,IAAIC,EAAsD,CAC/D,OAAK,KAAKN,GAAK,IAAI,KAAK,IAAI,GAC1B,KAAKA,GAAK,IAAI,KAAK,KAAM,CAAC,CAAC,EAE7B,KAAKA,GAAK,IAAI,KAAK,IAAI,GAAG,KAAKM,CAAM,EAC9B,IACT,CAEO,GAAGA,EAAsD,CAC9D,OAAK,KAAKL,GAAI,IAAI,KAAK,IAAI,GACzB,KAAKA,GAAI,IAAI,KAAK,KAAM,CAAC,CAAC,EAE5B,KAAKA,GAAI,IAAI,KAAK,IAAI,GAAG,KAAKK,CAAM,EAC7B,IACT,CAEO,OAAOA,EAAsD,CAClE,OAAK,KAAKH,GAAQ,IAAI,KAAK,IAAI,GAC7B,KAAKA,GAAQ,IAAI,KAAK,KAAM,CAAC,CAAC,EAEhC,KAAKA,GAAQ,IAAI,KAAK,IAAI,GAAG,KAAKG,CAAM,EACjC,IACT,CAEO,MAAMA,EAAsD,CACjE,OAAK,KAAKJ,GAAO,IAAI,KAAK,IAAI,GAC5B,KAAKA,GAAO,IAAI,KAAK,KAAM,CAAC,CAAC,EAE/B,KAAKA,GAAO,IAAI,KAAK,IAAI,GAAG,KAAKI,CAAM,EAChC,IACT,CAEO,OAAOA,EAAqD,CACjE,YAAKF,GAAUE,EACR,IACT,CAEO,OAAwC,CAC7C,GAAI,CAAC,KAAKF,GACR,MAAM,IAAI,MAAM,gDAAgD,EAGlE,MAAO,CACL,WAAY,KAAK,KACjB,OAAQ,KAAKA,GACb,OAAQ,KAAKD,GACb,MAAO,KAAKD,GACZ,IAAK,KAAKF,GACV,GAAI,KAAKC,EACX,CACF,CACF,ECjFA,UAAYM,OAAU,OCJtB,OAAS,aAAAC,OAAiB,OAEnB,SAASC,EAAmBC,EAA0B,CAC3D,GAAI,CACF,OAAAC,GAAU,MAAMD,CAAO,EAChB,EACT,MAAQ,CACN,MAAO,EACT,CACF,CAPgBE,EAAAH,EAAA,sBCsBT,SAASI,EACdC,EACAC,EACA,CACA,GAAI,CAACA,EAAS,SAAS,MAAMC,CAAkB,EAC7C,MAAM,IAAI,MACR,4FAA4FD,EAAS,QAAQ,EAC/G,EAGF,GAAM,CAAC,CAAEE,CAAQ,EAAIH,EAAQ,MAAM,EACnC,OAAAG,EAAS,WAAYF,EAAS,QAAQ,EACtCE,EAAS,UAAWF,EAAS,OAAO,EACpCE,EAAS,YAAa,EAAI,EACnBF,CACT,CAfgBG,EAAAL,EAAA,yCCtBT,SAASM,EAAeC,EAAkB,CAC/C,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EACnCC,EAAS,aAAc,EAAI,CAC7B,CAHgBC,EAAAH,EAAA,kBAMT,IAAMI,EAAc,CAAC,CAAC,UAAWJ,CAAc,CAAU,ERNzD,IAAMK,GAAc,CACzB,CAAC,UAAWC,CAAqC,CACnD,ESJA,IAAAC,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,KAEO,IAAMC,GAAc,CAAC,GAAGA,CAAiB,ECFhD,IAAAC,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,GAAA,qBAAAC,GAAA,YAAAC,KASO,IAAMC,GAAUC,EAAA,IACrB,IAAIC,EAAqC,SAAS,EAC/C,IAAIC,CAAqC,EACzC,OAAOC,CAAc,EACrB,MAAMC,CAAsB,EAJV,WAMVC,GAAkBL,EAAA,IAC7B,IAAIC,EAA6C,iBAAiB,EADrC,mBAElBK,GAAmBN,EAAA,IAC9B,IAAIC,EAA8C,kBAAkB,EADtC",
|
|
6
|
+
"names": ["actions_exports", "__export", "canEagerConnect", "canSwitchNetwork", "changeAccountSubscriber", "changeChainSubscriber", "connect", "recommended", "AccountId", "disconnect", "context", "setState", "__name", "recommended", "CAIP_NAMESPACE", "CAIP_ETHEREUM_CHAIN_ID", "utils_exports", "__export", "filterAndGetEvmBlockchainNames", "getAccounts", "isUserRejectionError", "suggestNetwork", "switchNetwork", "switchOrAddNetwork", "evmBlockchains", "getAccounts", "provider", "accounts", "chainId", "__name", "suggestNetwork", "instance", "chain", "switchNetwork", "filterAndGetEvmBlockchainNames", "meta", "evmBlockchains", "blockchain", "switchOrAddNetwork", "switchError", "error", "EIP_1193_USER_REJECTION_ERROR_CODE", "isUserRejectionError", "code", "causeCode", "recommended", "CHAIN_ID_RADIX", "connect", "instance", "options", "_context", "chain", "evmInstance", "switchOrAddNetwork", "result", "getAccounts", "chainId", "account", "AccountId", "CAIP_NAMESPACE", "__name", "changeAccountSubscriber", "eventCallback", "context", "err", "setState", "accounts", "formatAccounts", "_", "changeChainSubscriber", "canEagerConnect", "canSwitchNetwork", "params", "network", "supportedChains", "filterAndGetEvmBlockchainNames", "after_exports", "__export", "recommended", "intoConnectionFinished", "context", "setState", "__name", "recommended", "recommended", "and_exports", "__export", "recommended", "createZustandStore", "produce", "produce", "ActionBuilder", "__name", "#and", "#or", "#after", "#before", "#action", "name", "action", "CAIP", "AccountId", "isValidCaipAddress", "address", "AccountId", "__name", "connectAndUpdateStateForMultiNetworks", "context", "accounts", "isValidCaipAddress", "setState", "__name", "intoConnecting", "context", "setState", "__name", "recommended", "recommended", "connectAndUpdateStateForMultiNetworks", "before_exports", "__export", "recommended", "recommended", "builders_exports", "__export", "canEagerConnect", "canSwitchNetwork", "connect", "connect", "__name", "ActionBuilder", "connectAndUpdateStateForMultiNetworks", "intoConnecting", "intoConnectionFinished", "canEagerConnect", "canSwitchNetwork"]
|
|
7
7
|
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import type { AddEthereumChainParameter, EIP1193Provider } from './eip1193.js';
|
|
2
2
|
import type { AccountsWithActiveChain } from '../../types/accounts.js';
|
|
3
3
|
import type { AutoImplementedActionsByRecommended, CommonActions } from '../common/types.js';
|
|
4
|
+
import type { BlockchainMeta } from 'rango-types';
|
|
4
5
|
export interface EvmActions extends AutoImplementedActionsByRecommended, CommonActions {
|
|
5
6
|
connect: (chain?: Chain | ChainId) => Promise<AccountsWithActiveChain>;
|
|
6
7
|
canEagerConnect: () => Promise<boolean>;
|
|
8
|
+
canSwitchNetwork: (params: CanSwitchNetworkParams) => boolean;
|
|
7
9
|
}
|
|
10
|
+
type CanSwitchNetworkParams = {
|
|
11
|
+
network: string;
|
|
12
|
+
supportedChains: BlockchainMeta[];
|
|
13
|
+
};
|
|
8
14
|
export type ProviderAPI = EIP1193Provider;
|
|
9
15
|
export type ChainId = string;
|
|
10
16
|
export type Chain = AddEthereumChainParameter;
|
|
11
17
|
export type ConnectOptions = {
|
|
12
18
|
switchOrAddNetwork?: (instance: ProviderAPI, chain: ChainId | Chain) => void;
|
|
13
19
|
};
|
|
20
|
+
export {};
|
|
14
21
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EACV,mCAAmC,EACnC,aAAa,EACd,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EACV,mCAAmC,EACnC,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,UACf,SAAQ,mCAAmC,EACzC,aAAa;IACf,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACvE,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,gBAAgB,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC;CAC/D;AACD,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,cAAc,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,KAAK,GAAG,yBAAyB,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC;CAC9E,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Chain, ChainId, ProviderAPI } from './types.js';
|
|
2
|
+
import { type BlockchainMeta } from 'rango-types';
|
|
2
3
|
export declare function getAccounts(provider: ProviderAPI): Promise<{
|
|
3
4
|
accounts: `0x${string}`[];
|
|
4
5
|
chainId: `0x${string}`;
|
|
5
6
|
}>;
|
|
6
7
|
export declare function suggestNetwork(instance: ProviderAPI, chain: Chain): Promise<null>;
|
|
7
8
|
export declare function switchNetwork(instance: ProviderAPI, chainId: ChainId): Promise<null>;
|
|
9
|
+
export declare function filterAndGetEvmBlockchainNames(meta: BlockchainMeta[]): string[];
|
|
8
10
|
export declare function switchOrAddNetwork(instance: ProviderAPI, chain: ChainId | Chain): Promise<void>;
|
|
9
11
|
export declare function isUserRejectionError(error: unknown): boolean;
|
|
10
12
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW;;;GAUtD;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,iBAKvE;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,iBAK1E;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/namespaces/evm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,aAAa,CAAC;AAElE,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW;;;GAUtD;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,iBAKvE;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,iBAK1E;AACD,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,cAAc,EAAE,YAEpE;AACD,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,WAAW,EACrB,KAAK,EAAE,OAAO,GAAG,KAAK,iBA2BvB;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAW5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/hub/helpers.ts":{"bytes":371,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/namespaces/errors.ts":{"bytes":455,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/namespaces/namespace.ts":{"bytes":13059,"imports":[{"path":"src/hub/helpers.ts","kind":"import-statement","original":"../helpers.js"},{"path":"src/hub/namespaces/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/namespaces/mod.ts":{"bytes":181,"imports":[{"path":"src/hub/namespaces/namespace.ts","kind":"import-statement","original":"./namespace.js"}],"format":"esm"},"src/hub/provider/provider.ts":{"bytes":9328,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/provider/mod.ts":{"bytes":196,"imports":[{"path":"src/hub/provider/provider.ts","kind":"import-statement","original":"./provider.js"}],"format":"esm"},"src/hub/hub.ts":{"bytes":3436,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/selectors.ts":{"bytes":2228,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/extend.ts":{"bytes":3898,"imports":[{"path":"src/hub/store/selectors.ts","kind":"import-statement","original":"./selectors.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/hub.ts":{"bytes":342,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/events.ts":{"bytes":1956,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/namespaces.ts":{"bytes":4638,"imports":[{"path":"immer","kind":"import-statement","external":true},{"path":"src/hub/store/events.ts","kind":"import-statement","original":"./events.js"},{"path":"src/hub/store/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/providers.ts":{"bytes":3987,"imports":[{"path":"immer","kind":"import-statement","external":true},{"path":"src/hub/store/events.ts","kind":"import-statement","original":"./events.js"},{"path":"src/hub/store/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/store.ts":{"bytes":808,"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"src/hub/store/extend.ts","kind":"import-statement","original":"./extend.js"},{"path":"src/hub/store/hub.ts","kind":"import-statement","original":"./hub.js"},{"path":"src/hub/store/namespaces.ts","kind":"import-statement","original":"./namespaces.js"},{"path":"src/hub/store/providers.ts","kind":"import-statement","original":"./providers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/mod.ts":{"bytes":627,"imports":[{"path":"src/hub/store/selectors.ts","kind":"import-statement","original":"./selectors.js"},{"path":"src/hub/store/store.ts","kind":"import-statement","original":"./store.js"}],"format":"esm"},"src/hub/mod.ts":{"bytes":518,"imports":[{"path":"src/hub/namespaces/mod.ts","kind":"import-statement","original":"./namespaces/mod.js"},{"path":"src/hub/provider/mod.ts","kind":"import-statement","original":"./provider/mod.js"},{"path":"src/hub/hub.ts","kind":"import-statement","original":"./hub.js"},{"path":"src/hub/store/mod.ts","kind":"import-statement","original":"./store/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"}],"format":"esm"},"src/builders/namespace.ts":{"bytes":7991,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"../hub/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/builders/provider.ts":{"bytes":1584,"imports":[{"path":"src/hub/provider/mod.ts","kind":"import-statement","original":"../hub/provider/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/builders/action.ts":{"bytes":2385,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/builders/mod.ts":{"bytes":220,"imports":[{"path":"src/builders/namespace.ts","kind":"import-statement","original":"./namespace.js"},{"path":"src/builders/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"src/builders/action.ts","kind":"import-statement","original":"./action.js"}],"format":"esm"},"src/utils/versions.ts":{"bytes":1851,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utils/mod.ts":{"bytes":356,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"../hub/helpers.js"},{"path":"src/utils/versions.ts","kind":"import-statement","original":"./versions.js"}],"format":"esm"},"src/mod.ts":{"bytes":1390,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"./hub/mod.js"},{"path":"src/builders/mod.ts","kind":"import-statement","original":"./builders/mod.js"},{"path":"src/utils/mod.ts","kind":"import-statement","original":"./utils/mod.js"}],"format":"esm"},"src/legacy/types.ts":{"bytes":6996,"imports":[],"format":"esm"},"src/legacy/persistor.ts":{"bytes":544,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":1855,"imports":[{"path":"src/legacy/types.ts","kind":"import-statement","original":"./types.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/utils.ts":{"bytes":645,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/wallet.ts":{"bytes":16229,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/mod.ts":{"bytes":1468,"imports":[{"path":"src/legacy/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/legacy/persistor.ts","kind":"import-statement","original":"./persistor.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/wallet.ts","kind":"import-statement","original":"./wallet.js"},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/namespaces/common/actions.ts":{"bytes":347,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/constants.ts":{"bytes":83,"imports":[],"format":"esm"},"src/namespaces/evm/utils.ts":{"bytes":2311,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/actions.ts":{"bytes":5785,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"../common/actions.js"},{"path":"src/namespaces/evm/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/evm/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/after.ts":{"bytes":271,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/after.ts":{"bytes":123,"imports":[{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"}],"format":"esm"},"src/namespaces/common/builders.ts":{"bytes":545,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/utils.ts":{"bytes":987,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/or.ts":{"bytes":734,"imports":[{"path":"src/namespaces/common/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/helpers.ts":{"bytes":189,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/and.ts":{"bytes":1144,"imports":[{"path":"src/namespaces/common/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/before.ts":{"bytes":351,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/mod.ts":{"bytes":664,"imports":[{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/common/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/common/or.ts","kind":"import-statement","original":"./or.js"},{"path":"src/namespaces/common/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/common/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"./before.js"}],"format":"esm"},"src/namespaces/evm/and.ts":{"bytes":170,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/evm/before.ts":{"bytes":106,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/evm/builders.ts":{"bytes":519,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/mod.ts":{"bytes":379,"imports":[{"path":"src/namespaces/evm/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/evm/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/evm/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/evm/before.ts","kind":"import-statement","original":"./before.js"},{"path":"src/namespaces/evm/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/namespaces/evm/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/evm/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"},"src/namespaces/solana/constants.ts":{"bytes":112,"imports":[],"format":"esm"},"src/namespaces/solana/utils.ts":{"bytes":347,"imports":[{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../../legacy/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/solana/actions.ts":{"bytes":2829,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"../common/actions.js"},{"path":"src/namespaces/solana/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/solana/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/solana/after.ts":{"bytes":123,"imports":[{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"}],"format":"esm"},"src/namespaces/solana/and.ts":{"bytes":170,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/solana/before.ts":{"bytes":124,"imports":[{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"../common/before.js"}],"format":"esm"},"src/namespaces/solana/builders.ts":{"bytes":416,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/solana/mod.ts":{"bytes":327,"imports":[{"path":"src/namespaces/solana/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/solana/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/solana/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/solana/before.ts","kind":"import-statement","original":"./before.js"},{"path":"src/namespaces/solana/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/solana/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"},"src/namespaces/cosmos/mod.ts":{"bytes":49,"imports":[],"format":"esm"},"src/namespaces/utxo/actions.ts":{"bytes":125,"imports":[{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"../common/actions.js"}],"format":"esm"},"src/namespaces/utxo/after.ts":{"bytes":123,"imports":[{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"}],"format":"esm"},"src/namespaces/utxo/and.ts":{"bytes":170,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/utxo/before.ts":{"bytes":124,"imports":[{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"../common/before.js"}],"format":"esm"},"src/namespaces/utxo/builders.ts":{"bytes":480,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"},{"path":"src/namespaces/common/and.ts","kind":"import-statement","original":"../common/and.js"},{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"../common/before.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/utxo/constants.ts":{"bytes":113,"imports":[],"format":"esm"},"src/namespaces/utxo/mod.ts":{"bytes":326,"imports":[{"path":"src/namespaces/utxo/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/utxo/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/utxo/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/utxo/before.ts","kind":"import-statement","original":"./before.js"},{"path":"src/namespaces/utxo/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/utxo/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"},"src/namespaces/sui/constants.ts":{"bytes":275,"imports":[],"format":"esm"},"src/namespaces/sui/actions.ts":{"bytes":2206,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/namespaces/sui/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/sui/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui/utils.ts":{"bytes":1129,"imports":[{"path":"@mysten/wallet-standard","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui/builders.ts":{"bytes":1277,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/utils/mod.ts","kind":"import-statement","original":"../../utils/mod.js"},{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"},{"path":"src/namespaces/sui/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/sui/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui/mod.ts":{"bytes":275,"imports":[{"path":"src/namespaces/sui/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/sui/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/sui/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/namespaces/sui/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"}},"outputs":{"dist/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":82232},"dist/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["ActionBuilder","Hub","Namespace","NamespaceBuilder","Provider","ProviderBuilder","createStore","defineVersions","guessProviderStateSelector","namespaceStateSelector","pickVersion"],"entryPoint":"src/mod.ts","inputs":{"src/hub/helpers.ts":{"bytesInOutput":131},"src/hub/namespaces/errors.ts":{"bytesInOutput":332},"src/hub/namespaces/namespace.ts":{"bytesInOutput":2633},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/provider.ts":{"bytesInOutput":1771},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/hub.ts":{"bytesInOutput":875},"src/hub/store/selectors.ts":{"bytesInOutput":386},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":157},"src/hub/store/extend.ts":{"bytesInOutput":833},"src/hub/store/hub.ts":{"bytesInOutput":38},"src/hub/store/namespaces.ts":{"bytesInOutput":1381},"src/hub/store/events.ts":{"bytesInOutput":188},"src/hub/store/providers.ts":{"bytesInOutput":637},"src/mod.ts":{"bytesInOutput":0},"src/builders/namespace.ts":{"bytesInOutput":1397},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/provider.ts":{"bytesInOutput":461},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/utils/versions.ts":{"bytesInOutput":356}},"bytes":12680},"dist/utils/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3724},"dist/utils/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP","defineVersions","generateStoreId","legacyProviderImportsToVersionsInterface","pickVersion"],"entryPoint":"src/utils/mod.ts","inputs":{"src/utils/mod.ts":{"bytesInOutput":23},"src/hub/helpers.ts":{"bytesInOutput":58},"src/utils/versions.ts":{"bytesInOutput":456}},"bytes":771},"dist/legacy/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":36883},"dist/legacy/mod.js":{"imports":[],"exports":["LegacyEvents","LegacyNetworks","LegacyWallet","Persistor","legacyEagerConnectHandler","legacyFormatAddressWithNetwork","legacyGetBlockChainNameFromId","legacyIsEvmNamespace","legacyReadAccountAddress"],"entryPoint":"src/legacy/mod.ts","inputs":{"src/legacy/types.ts":{"bytesInOutput":1375},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/persistor.ts":{"bytesInOutput":206},"src/legacy/helpers.ts":{"bytesInOutput":610},"src/legacy/utils.ts":{"bytesInOutput":238},"src/legacy/wallet.ts":{"bytesInOutput":6000}},"bytes":8778},"dist/hub/store/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":24913},"dist/hub/store/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true}],"exports":["createStore","guessProviderStateSelector","namespaceStateSelector"],"entryPoint":"src/hub/store/mod.ts","inputs":{"src/hub/store/selectors.ts":{"bytesInOutput":386},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":157},"src/hub/store/extend.ts":{"bytesInOutput":833},"src/hub/store/hub.ts":{"bytesInOutput":38},"src/hub/store/namespaces.ts":{"bytesInOutput":1381},"src/hub/store/events.ts":{"bytesInOutput":188},"src/hub/store/providers.ts":{"bytesInOutput":637}},"bytes":3817},"dist/namespaces/evm/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":32615},"dist/namespaces/evm/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP_ETHEREUM_CHAIN_ID","CAIP_NAMESPACE","actions","after","and","before","builders","utils"],"entryPoint":"src/namespaces/evm/mod.ts","inputs":{"src/namespaces/evm/actions.ts":{"bytesInOutput":1703},"src/namespaces/common/actions.ts":{"bytesInOutput":149},"src/namespaces/evm/constants.ts":{"bytesInOutput":21},"src/namespaces/evm/utils.ts":{"bytesInOutput":872},"src/namespaces/evm/mod.ts":{"bytesInOutput":0},"src/namespaces/evm/after.ts":{"bytesInOutput":47},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/evm/and.ts":{"bytesInOutput":58},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/helpers.ts":{"bytesInOutput":116},"src/namespaces/common/and.ts":{"bytesInOutput":300},"src/namespaces/common/before.ts":{"bytesInOutput":95},"src/namespaces/evm/before.ts":{"bytesInOutput":49},"src/namespaces/evm/builders.ts":{"bytesInOutput":174}},"bytes":4870},"dist/namespaces/solana/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":24973},"dist/namespaces/solana/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP_NAMESPACE","CAIP_SOLANA_CHAIN_ID","actions","after","and","before","builders"],"entryPoint":"src/namespaces/solana/mod.ts","inputs":{"src/namespaces/solana/actions.ts":{"bytesInOutput":822},"src/namespaces/common/actions.ts":{"bytesInOutput":149},"src/namespaces/solana/constants.ts":{"bytesInOutput":52},"src/legacy/mod.ts":{"bytesInOutput":0},"src/namespaces/solana/utils.ts":{"bytesInOutput":116},"src/namespaces/solana/mod.ts":{"bytesInOutput":0},"src/namespaces/solana/after.ts":{"bytesInOutput":47},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/solana/and.ts":{"bytesInOutput":56},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":250},"src/namespaces/common/before.ts":{"bytesInOutput":95},"src/namespaces/solana/before.ts":{"bytesInOutput":47},"src/namespaces/solana/builders.ts":{"bytesInOutput":96}},"bytes":3117},"dist/namespaces/cosmos/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/namespaces/cosmos/mod.js":{"imports":[],"exports":[],"entryPoint":"src/namespaces/cosmos/mod.ts","inputs":{"src/namespaces/cosmos/mod.ts":{"bytesInOutput":0}},"bytes":32},"dist/namespaces/utxo/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":20477},"dist/namespaces/utxo/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP_BITCOIN_CHAIN_ID","CAIP_NAMESPACE","actions","after","and","before","builders"],"entryPoint":"src/namespaces/utxo/mod.ts","inputs":{"src/namespaces/utxo/actions.ts":{"bytesInOutput":47},"src/namespaces/common/actions.ts":{"bytesInOutput":149},"src/namespaces/utxo/mod.ts":{"bytesInOutput":0},"src/namespaces/utxo/after.ts":{"bytesInOutput":47},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/utxo/and.ts":{"bytesInOutput":56},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":250},"src/namespaces/common/before.ts":{"bytesInOutput":95},"src/namespaces/utxo/before.ts":{"bytesInOutput":47},"src/namespaces/utxo/builders.ts":{"bytesInOutput":96},"src/namespaces/utxo/constants.ts":{"bytesInOutput":52}},"bytes":2227},"dist/namespaces/sui/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":24876},"dist/namespaces/sui/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"@mysten/wallet-standard","kind":"import-statement","external":true}],"exports":["CAIP_NAMESPACE","CAIP_SUI_CHAIN_ID","actions","builders","getInstance","getInstanceOrThrow"],"entryPoint":"src/namespaces/sui/mod.ts","inputs":{"src/namespaces/sui/actions.ts":{"bytesInOutput":652},"src/namespaces/sui/constants.ts":{"bytesInOutput":20},"src/namespaces/sui/mod.ts":{"bytesInOutput":0},"src/namespaces/sui/builders.ts":{"bytesInOutput":349},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":23},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/namespaces/common/after.ts":{"bytesInOutput":81},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":250},"src/namespaces/common/before.ts":{"bytesInOutput":73},"src/namespaces/sui/utils.ts":{"bytesInOutput":343}},"bytes":3057},"dist/namespaces/common/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":21794},"dist/namespaces/common/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["actions","afterRecommended","andRecommended","beforeRecommended","builders","connectAndUpdateStateForMultiNetworks","connectAndUpdateStateForSingleNetwork","intoConnecting","intoConnectionFinished","parseErrorAndThrowStandardizeError","standardizeAndThrowError"],"entryPoint":"src/namespaces/common/mod.ts","inputs":{"src/namespaces/common/actions.ts":{"bytesInOutput":200},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/namespaces/common/builders.ts":{"bytesInOutput":89},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/utils.ts":{"bytesInOutput":326},"src/namespaces/common/or.ts":{"bytesInOutput":53},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":559},"src/namespaces/common/before.ts":{"bytesInOutput":95}},"bytes":2900}}}
|
|
1
|
+
{"inputs":{"src/hub/helpers.ts":{"bytes":371,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/namespaces/errors.ts":{"bytes":455,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/namespaces/namespace.ts":{"bytes":13059,"imports":[{"path":"src/hub/helpers.ts","kind":"import-statement","original":"../helpers.js"},{"path":"src/hub/namespaces/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/namespaces/mod.ts":{"bytes":181,"imports":[{"path":"src/hub/namespaces/namespace.ts","kind":"import-statement","original":"./namespace.js"}],"format":"esm"},"src/hub/provider/provider.ts":{"bytes":9328,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/provider/mod.ts":{"bytes":196,"imports":[{"path":"src/hub/provider/provider.ts","kind":"import-statement","original":"./provider.js"}],"format":"esm"},"src/hub/hub.ts":{"bytes":3436,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/selectors.ts":{"bytes":2228,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/extend.ts":{"bytes":3898,"imports":[{"path":"src/hub/store/selectors.ts","kind":"import-statement","original":"./selectors.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/hub.ts":{"bytes":342,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/events.ts":{"bytes":1956,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/namespaces.ts":{"bytes":4638,"imports":[{"path":"immer","kind":"import-statement","external":true},{"path":"src/hub/store/events.ts","kind":"import-statement","original":"./events.js"},{"path":"src/hub/store/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/providers.ts":{"bytes":3987,"imports":[{"path":"immer","kind":"import-statement","external":true},{"path":"src/hub/store/events.ts","kind":"import-statement","original":"./events.js"},{"path":"src/hub/store/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/store.ts":{"bytes":808,"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"src/hub/store/extend.ts","kind":"import-statement","original":"./extend.js"},{"path":"src/hub/store/hub.ts","kind":"import-statement","original":"./hub.js"},{"path":"src/hub/store/namespaces.ts","kind":"import-statement","original":"./namespaces.js"},{"path":"src/hub/store/providers.ts","kind":"import-statement","original":"./providers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/store/mod.ts":{"bytes":627,"imports":[{"path":"src/hub/store/selectors.ts","kind":"import-statement","original":"./selectors.js"},{"path":"src/hub/store/store.ts","kind":"import-statement","original":"./store.js"}],"format":"esm"},"src/hub/mod.ts":{"bytes":518,"imports":[{"path":"src/hub/namespaces/mod.ts","kind":"import-statement","original":"./namespaces/mod.js"},{"path":"src/hub/provider/mod.ts","kind":"import-statement","original":"./provider/mod.js"},{"path":"src/hub/hub.ts","kind":"import-statement","original":"./hub.js"},{"path":"src/hub/store/mod.ts","kind":"import-statement","original":"./store/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"}],"format":"esm"},"src/builders/namespace.ts":{"bytes":7991,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"../hub/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/builders/provider.ts":{"bytes":1584,"imports":[{"path":"src/hub/provider/mod.ts","kind":"import-statement","original":"../hub/provider/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/builders/action.ts":{"bytes":2385,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/builders/mod.ts":{"bytes":220,"imports":[{"path":"src/builders/namespace.ts","kind":"import-statement","original":"./namespace.js"},{"path":"src/builders/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"src/builders/action.ts","kind":"import-statement","original":"./action.js"}],"format":"esm"},"src/utils/versions.ts":{"bytes":1851,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utils/mod.ts":{"bytes":356,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"../hub/helpers.js"},{"path":"src/utils/versions.ts","kind":"import-statement","original":"./versions.js"}],"format":"esm"},"src/mod.ts":{"bytes":1390,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"./hub/mod.js"},{"path":"src/builders/mod.ts","kind":"import-statement","original":"./builders/mod.js"},{"path":"src/utils/mod.ts","kind":"import-statement","original":"./utils/mod.js"}],"format":"esm"},"src/legacy/types.ts":{"bytes":6996,"imports":[],"format":"esm"},"src/legacy/persistor.ts":{"bytes":544,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":1855,"imports":[{"path":"src/legacy/types.ts","kind":"import-statement","original":"./types.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/utils.ts":{"bytes":645,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/wallet.ts":{"bytes":16229,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/mod.ts":{"bytes":1468,"imports":[{"path":"src/legacy/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/legacy/persistor.ts","kind":"import-statement","original":"./persistor.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/wallet.ts","kind":"import-statement","original":"./wallet.js"},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/namespaces/common/actions.ts":{"bytes":347,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/constants.ts":{"bytes":83,"imports":[],"format":"esm"},"src/namespaces/evm/utils.ts":{"bytes":2535,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/actions.ts":{"bytes":6095,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"../common/actions.js"},{"path":"src/namespaces/evm/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/evm/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/after.ts":{"bytes":271,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/after.ts":{"bytes":123,"imports":[{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"}],"format":"esm"},"src/namespaces/common/builders.ts":{"bytes":545,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/utils.ts":{"bytes":987,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/or.ts":{"bytes":734,"imports":[{"path":"src/namespaces/common/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/helpers.ts":{"bytes":189,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/and.ts":{"bytes":1144,"imports":[{"path":"src/namespaces/common/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/before.ts":{"bytes":351,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/common/mod.ts":{"bytes":664,"imports":[{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/common/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/common/or.ts","kind":"import-statement","original":"./or.js"},{"path":"src/namespaces/common/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/common/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"./before.js"}],"format":"esm"},"src/namespaces/evm/and.ts":{"bytes":170,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/evm/before.ts":{"bytes":106,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/evm/builders.ts":{"bytes":630,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/evm/mod.ts":{"bytes":379,"imports":[{"path":"src/namespaces/evm/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/evm/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/evm/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/evm/before.ts","kind":"import-statement","original":"./before.js"},{"path":"src/namespaces/evm/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/namespaces/evm/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/evm/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"},"src/namespaces/solana/constants.ts":{"bytes":112,"imports":[],"format":"esm"},"src/namespaces/solana/utils.ts":{"bytes":347,"imports":[{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../../legacy/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/solana/actions.ts":{"bytes":2829,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"../common/actions.js"},{"path":"src/namespaces/solana/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/solana/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/solana/after.ts":{"bytes":123,"imports":[{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"}],"format":"esm"},"src/namespaces/solana/and.ts":{"bytes":170,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/solana/before.ts":{"bytes":124,"imports":[{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"../common/before.js"}],"format":"esm"},"src/namespaces/solana/builders.ts":{"bytes":416,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/solana/mod.ts":{"bytes":327,"imports":[{"path":"src/namespaces/solana/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/solana/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/solana/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/solana/before.ts","kind":"import-statement","original":"./before.js"},{"path":"src/namespaces/solana/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/solana/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"},"src/namespaces/cosmos/mod.ts":{"bytes":49,"imports":[],"format":"esm"},"src/namespaces/utxo/actions.ts":{"bytes":125,"imports":[{"path":"src/namespaces/common/actions.ts","kind":"import-statement","original":"../common/actions.js"}],"format":"esm"},"src/namespaces/utxo/after.ts":{"bytes":123,"imports":[{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"}],"format":"esm"},"src/namespaces/utxo/and.ts":{"bytes":170,"imports":[{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"}],"format":"esm"},"src/namespaces/utxo/before.ts":{"bytes":124,"imports":[{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"../common/before.js"}],"format":"esm"},"src/namespaces/utxo/builders.ts":{"bytes":480,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/namespaces/common/after.ts","kind":"import-statement","original":"../common/after.js"},{"path":"src/namespaces/common/and.ts","kind":"import-statement","original":"../common/and.js"},{"path":"src/namespaces/common/before.ts","kind":"import-statement","original":"../common/before.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/utxo/constants.ts":{"bytes":113,"imports":[],"format":"esm"},"src/namespaces/utxo/mod.ts":{"bytes":326,"imports":[{"path":"src/namespaces/utxo/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/utxo/after.ts","kind":"import-statement","original":"./after.js"},{"path":"src/namespaces/utxo/and.ts","kind":"import-statement","original":"./and.js"},{"path":"src/namespaces/utxo/before.ts","kind":"import-statement","original":"./before.js"},{"path":"src/namespaces/utxo/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/utxo/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"},"src/namespaces/sui/constants.ts":{"bytes":275,"imports":[],"format":"esm"},"src/namespaces/sui/actions.ts":{"bytes":2206,"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"src/namespaces/sui/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/sui/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui/utils.ts":{"bytes":1129,"imports":[{"path":"@mysten/wallet-standard","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui/builders.ts":{"bytes":1277,"imports":[{"path":"src/mod.ts","kind":"import-statement","original":"../../mod.js"},{"path":"src/utils/mod.ts","kind":"import-statement","original":"../../utils/mod.js"},{"path":"src/namespaces/common/mod.ts","kind":"import-statement","original":"../common/mod.js"},{"path":"src/namespaces/sui/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/sui/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/namespaces/sui/mod.ts":{"bytes":275,"imports":[{"path":"src/namespaces/sui/actions.ts","kind":"import-statement","original":"./actions.js"},{"path":"src/namespaces/sui/builders.ts","kind":"import-statement","original":"./builders.js"},{"path":"src/namespaces/sui/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/namespaces/sui/constants.ts","kind":"import-statement","original":"./constants.js"}],"format":"esm"}},"outputs":{"dist/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":82232},"dist/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["ActionBuilder","Hub","Namespace","NamespaceBuilder","Provider","ProviderBuilder","createStore","defineVersions","guessProviderStateSelector","namespaceStateSelector","pickVersion"],"entryPoint":"src/mod.ts","inputs":{"src/hub/helpers.ts":{"bytesInOutput":131},"src/hub/namespaces/errors.ts":{"bytesInOutput":332},"src/hub/namespaces/namespace.ts":{"bytesInOutput":2633},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/provider.ts":{"bytesInOutput":1771},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/hub.ts":{"bytesInOutput":875},"src/hub/store/selectors.ts":{"bytesInOutput":386},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":157},"src/hub/store/extend.ts":{"bytesInOutput":833},"src/hub/store/hub.ts":{"bytesInOutput":38},"src/hub/store/namespaces.ts":{"bytesInOutput":1381},"src/hub/store/events.ts":{"bytesInOutput":188},"src/hub/store/providers.ts":{"bytesInOutput":637},"src/mod.ts":{"bytesInOutput":0},"src/builders/namespace.ts":{"bytesInOutput":1397},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/provider.ts":{"bytesInOutput":461},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/utils/versions.ts":{"bytesInOutput":356}},"bytes":12680},"dist/utils/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3724},"dist/utils/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP","defineVersions","generateStoreId","legacyProviderImportsToVersionsInterface","pickVersion"],"entryPoint":"src/utils/mod.ts","inputs":{"src/utils/mod.ts":{"bytesInOutput":23},"src/hub/helpers.ts":{"bytesInOutput":58},"src/utils/versions.ts":{"bytesInOutput":456}},"bytes":771},"dist/legacy/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":36883},"dist/legacy/mod.js":{"imports":[],"exports":["LegacyEvents","LegacyNetworks","LegacyWallet","Persistor","legacyEagerConnectHandler","legacyFormatAddressWithNetwork","legacyGetBlockChainNameFromId","legacyIsEvmNamespace","legacyReadAccountAddress"],"entryPoint":"src/legacy/mod.ts","inputs":{"src/legacy/types.ts":{"bytesInOutput":1375},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/persistor.ts":{"bytesInOutput":206},"src/legacy/helpers.ts":{"bytesInOutput":610},"src/legacy/utils.ts":{"bytesInOutput":238},"src/legacy/wallet.ts":{"bytesInOutput":6000}},"bytes":8778},"dist/hub/store/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":24913},"dist/hub/store/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true}],"exports":["createStore","guessProviderStateSelector","namespaceStateSelector"],"entryPoint":"src/hub/store/mod.ts","inputs":{"src/hub/store/selectors.ts":{"bytesInOutput":386},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":157},"src/hub/store/extend.ts":{"bytesInOutput":833},"src/hub/store/hub.ts":{"bytesInOutput":38},"src/hub/store/namespaces.ts":{"bytesInOutput":1381},"src/hub/store/events.ts":{"bytesInOutput":188},"src/hub/store/providers.ts":{"bytesInOutput":637}},"bytes":3817},"dist/namespaces/evm/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":33951},"dist/namespaces/evm/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP_ETHEREUM_CHAIN_ID","CAIP_NAMESPACE","actions","after","and","before","builders","utils"],"entryPoint":"src/namespaces/evm/mod.ts","inputs":{"src/namespaces/evm/actions.ts":{"bytesInOutput":1837},"src/namespaces/common/actions.ts":{"bytesInOutput":149},"src/namespaces/evm/constants.ts":{"bytesInOutput":21},"src/namespaces/evm/utils.ts":{"bytesInOutput":1043},"src/namespaces/evm/mod.ts":{"bytesInOutput":0},"src/namespaces/evm/after.ts":{"bytesInOutput":47},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/evm/and.ts":{"bytesInOutput":58},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/helpers.ts":{"bytesInOutput":116},"src/namespaces/common/and.ts":{"bytesInOutput":300},"src/namespaces/common/before.ts":{"bytesInOutput":95},"src/namespaces/evm/before.ts":{"bytesInOutput":49},"src/namespaces/evm/builders.ts":{"bytesInOutput":253}},"bytes":5254},"dist/namespaces/solana/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":24973},"dist/namespaces/solana/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP_NAMESPACE","CAIP_SOLANA_CHAIN_ID","actions","after","and","before","builders"],"entryPoint":"src/namespaces/solana/mod.ts","inputs":{"src/namespaces/solana/actions.ts":{"bytesInOutput":822},"src/namespaces/common/actions.ts":{"bytesInOutput":149},"src/namespaces/solana/constants.ts":{"bytesInOutput":52},"src/legacy/mod.ts":{"bytesInOutput":0},"src/namespaces/solana/utils.ts":{"bytesInOutput":116},"src/namespaces/solana/mod.ts":{"bytesInOutput":0},"src/namespaces/solana/after.ts":{"bytesInOutput":47},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/solana/and.ts":{"bytesInOutput":56},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":250},"src/namespaces/common/before.ts":{"bytesInOutput":95},"src/namespaces/solana/before.ts":{"bytesInOutput":47},"src/namespaces/solana/builders.ts":{"bytesInOutput":96}},"bytes":3117},"dist/namespaces/cosmos/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/namespaces/cosmos/mod.js":{"imports":[],"exports":[],"entryPoint":"src/namespaces/cosmos/mod.ts","inputs":{"src/namespaces/cosmos/mod.ts":{"bytesInOutput":0}},"bytes":32},"dist/namespaces/utxo/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":20477},"dist/namespaces/utxo/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["CAIP_BITCOIN_CHAIN_ID","CAIP_NAMESPACE","actions","after","and","before","builders"],"entryPoint":"src/namespaces/utxo/mod.ts","inputs":{"src/namespaces/utxo/actions.ts":{"bytesInOutput":47},"src/namespaces/common/actions.ts":{"bytesInOutput":149},"src/namespaces/utxo/mod.ts":{"bytesInOutput":0},"src/namespaces/utxo/after.ts":{"bytesInOutput":47},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/utxo/and.ts":{"bytesInOutput":56},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":250},"src/namespaces/common/before.ts":{"bytesInOutput":95},"src/namespaces/utxo/before.ts":{"bytesInOutput":47},"src/namespaces/utxo/builders.ts":{"bytesInOutput":96},"src/namespaces/utxo/constants.ts":{"bytesInOutput":52}},"bytes":2227},"dist/namespaces/sui/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":24876},"dist/namespaces/sui/mod.js":{"imports":[{"path":"caip","kind":"import-statement","external":true},{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"@mysten/wallet-standard","kind":"import-statement","external":true}],"exports":["CAIP_NAMESPACE","CAIP_SUI_CHAIN_ID","actions","builders","getInstance","getInstanceOrThrow"],"entryPoint":"src/namespaces/sui/mod.ts","inputs":{"src/namespaces/sui/actions.ts":{"bytesInOutput":652},"src/namespaces/sui/constants.ts":{"bytesInOutput":20},"src/namespaces/sui/mod.ts":{"bytesInOutput":0},"src/namespaces/sui/builders.ts":{"bytesInOutput":349},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":23},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/namespaces/common/after.ts":{"bytesInOutput":81},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":250},"src/namespaces/common/before.ts":{"bytesInOutput":73},"src/namespaces/sui/utils.ts":{"bytesInOutput":343}},"bytes":3057},"dist/namespaces/common/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":21794},"dist/namespaces/common/mod.js":{"imports":[{"path":"zustand/vanilla","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"immer","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true},{"path":"caip","kind":"import-statement","external":true}],"exports":["actions","afterRecommended","andRecommended","beforeRecommended","builders","connectAndUpdateStateForMultiNetworks","connectAndUpdateStateForSingleNetwork","intoConnecting","intoConnectionFinished","parseErrorAndThrowStandardizeError","standardizeAndThrowError"],"entryPoint":"src/namespaces/common/mod.ts","inputs":{"src/namespaces/common/actions.ts":{"bytesInOutput":200},"src/namespaces/common/mod.ts":{"bytesInOutput":0},"src/namespaces/common/builders.ts":{"bytesInOutput":89},"src/hub/namespaces/mod.ts":{"bytesInOutput":0},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/provider/mod.ts":{"bytesInOutput":0},"src/hub/store/mod.ts":{"bytesInOutput":0},"src/hub/store/store.ts":{"bytesInOutput":47},"src/hub/store/namespaces.ts":{"bytesInOutput":33},"src/hub/store/providers.ts":{"bytesInOutput":33},"src/mod.ts":{"bytesInOutput":0},"src/builders/mod.ts":{"bytesInOutput":0},"src/builders/action.ts":{"bytesInOutput":746},"src/utils/mod.ts":{"bytesInOutput":24},"src/namespaces/common/utils.ts":{"bytesInOutput":326},"src/namespaces/common/or.ts":{"bytesInOutput":53},"src/namespaces/common/after.ts":{"bytesInOutput":103},"src/namespaces/common/helpers.ts":{"bytesInOutput":114},"src/namespaces/common/and.ts":{"bytesInOutput":559},"src/namespaces/common/before.ts":{"bytesInOutput":95}},"bytes":2900}}}
|
package/package.json
CHANGED
|
@@ -13,7 +13,11 @@ import { AccountId } from 'caip';
|
|
|
13
13
|
import { recommended as commonRecommended } from '../common/actions.js';
|
|
14
14
|
|
|
15
15
|
import { CAIP_NAMESPACE } from './constants.js';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
filterAndGetEvmBlockchainNames,
|
|
18
|
+
getAccounts,
|
|
19
|
+
switchOrAddNetwork,
|
|
20
|
+
} from './utils.js';
|
|
17
21
|
|
|
18
22
|
export const recommended = [...commonRecommended];
|
|
19
23
|
const CHAIN_ID_RADIX = 16;
|
|
@@ -194,3 +198,12 @@ export function canEagerConnect(
|
|
|
194
198
|
}
|
|
195
199
|
};
|
|
196
200
|
}
|
|
201
|
+
export function canSwitchNetwork(): FunctionWithContext<
|
|
202
|
+
EvmActions['canSwitchNetwork'],
|
|
203
|
+
Context
|
|
204
|
+
> {
|
|
205
|
+
return (context, params) => {
|
|
206
|
+
const { network, supportedChains } = params;
|
|
207
|
+
return filterAndGetEvmBlockchainNames(supportedChains).includes(network);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -4,13 +4,19 @@ import type {
|
|
|
4
4
|
AutoImplementedActionsByRecommended,
|
|
5
5
|
CommonActions,
|
|
6
6
|
} from '../common/types.js';
|
|
7
|
+
import type { BlockchainMeta } from 'rango-types';
|
|
7
8
|
|
|
8
9
|
export interface EvmActions
|
|
9
10
|
extends AutoImplementedActionsByRecommended,
|
|
10
11
|
CommonActions {
|
|
11
12
|
connect: (chain?: Chain | ChainId) => Promise<AccountsWithActiveChain>;
|
|
12
13
|
canEagerConnect: () => Promise<boolean>;
|
|
14
|
+
canSwitchNetwork: (params: CanSwitchNetworkParams) => boolean;
|
|
13
15
|
}
|
|
16
|
+
type CanSwitchNetworkParams = {
|
|
17
|
+
network: string;
|
|
18
|
+
supportedChains: BlockchainMeta[];
|
|
19
|
+
};
|
|
14
20
|
|
|
15
21
|
export type ProviderAPI = EIP1193Provider;
|
|
16
22
|
// A 0x-prefixed hexadecimal string
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Chain, ChainId, ProviderAPI } from './types.js';
|
|
2
2
|
|
|
3
|
+
import { type BlockchainMeta, evmBlockchains } from 'rango-types';
|
|
4
|
+
|
|
3
5
|
export async function getAccounts(provider: ProviderAPI) {
|
|
4
6
|
const [accounts, chainId] = await Promise.all([
|
|
5
7
|
provider.request({ method: 'eth_requestAccounts' }),
|
|
@@ -25,7 +27,9 @@ export async function switchNetwork(instance: ProviderAPI, chainId: ChainId) {
|
|
|
25
27
|
params: [{ chainId: chainId }],
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
export function filterAndGetEvmBlockchainNames(meta: BlockchainMeta[]) {
|
|
31
|
+
return evmBlockchains(meta).map((blockchain) => blockchain.name);
|
|
32
|
+
}
|
|
29
33
|
export async function switchOrAddNetwork(
|
|
30
34
|
instance: ProviderAPI,
|
|
31
35
|
chain: ChainId | Chain
|
|
@@ -51,6 +55,7 @@ export async function switchOrAddNetwork(
|
|
|
51
55
|
* This error code indicates that the chain has not been added to wallet.
|
|
52
56
|
*/
|
|
53
57
|
await suggestNetwork(instance, chain);
|
|
58
|
+
return;
|
|
54
59
|
}
|
|
55
60
|
throw switchError;
|
|
56
61
|
}
|