@luno-kit/react 0.0.12-beta.2 → 0.0.12
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/chunk-7BEPQQMD.cjs +2 -0
- package/dist/chunk-7BEPQQMD.cjs.map +1 -0
- package/dist/{chunk-JJEEWE3N.cjs → chunk-NNF3FZ3W.cjs} +2 -2
- package/dist/chunk-NNF3FZ3W.cjs.map +1 -0
- package/dist/chunk-QCEMRLYF.js +2 -0
- package/dist/chunk-QCEMRLYF.js.map +1 -0
- package/dist/{chunk-62JXEP3B.js → chunk-ZBVBO5KX.js} +2 -2
- package/dist/chunk-ZBVBO5KX.js.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/state-BFuwUpY4.d.cts +34 -0
- package/dist/state-BFuwUpY4.d.ts +34 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +3 -30
- package/dist/types/index.d.ts +3 -30
- package/dist/types/index.js +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +3 -2
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-62JXEP3B.js.map +0 -1
- package/dist/chunk-A6LYVRYZ.js +0 -2
- package/dist/chunk-A6LYVRYZ.js.map +0 -1
- package/dist/chunk-CMKLBFDC.cjs +0 -2
- package/dist/chunk-CMKLBFDC.cjs.map +0 -1
- package/dist/chunk-JJEEWE3N.cjs.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var utils=require('@luno-kit/core/utils'),core=require('@luno-kit/core'),dedot=require('dedot');var l=async({config:r,chainId:e})=>{let t=r.chains.find(n=>n.genesisHash===e),i=r.transports[e];if(!t||!i)throw new Error(`Configuration missing for chainId: ${e}`);let a={provider:core.wsProvider(i),cacheMetadata:r.cacheMetadata,metadata:r.metadata,scaledResponses:{...r.scaledResponses,...r.customTypes},runtimeApis:r.runtimeApis,cacheStorage:r.cacheStorage},o=new dedot.LegacyClient(a);try{await o.connect();let n=await o.rpc.chain_getBlockHash(0);if(n!==e)throw await o.disconnect(),new Error(`Chain genesis hash mismatch. Expected: ${e}, Got: ${n}. This might indicate connecting to the wrong network or incorrect chain configuration.`);let c=await o.rpc.system_properties();return o.isEthereum=!!c.isEthereum,o}catch(n){throw new Error(`Failed to connect to ${t.name}: ${n?.message||n}`)}};function y(r,e){if(e.type==="Module")try{let t=r.registry.findErrorMeta(e);if(t){let{docs:i,name:s,pallet:a,fields:o,fieldCodecs:n}=t;return `[useSendTransaction]: ${a}.${s} error, ${i.join(" ")}`}return `[useSendTransaction]: Module Error (index: ${e.value.index}, error: ${e.value.error})`}catch(t){let{value:{error:i,index:s}}=e;return `[useSendTransaction]: Module Error (index: ${s}, error: ${i}) - Failed to decode: ${t instanceof Error?t.message:"Unknown error"}`}else if(e.type==="Token")return `[useSendTransaction]: Token Error: ${e.value}`;return "value"in e?`[useSendTransaction]: ${e.type} Error: ${e.value}`:`[useSendTransaction]: Error: ${e.type}`}var h=(r=1e3)=>new Promise(e=>setTimeout(e,r));Object.defineProperty(exports,"d",{enumerable:true,get:function(){return utils.convertAddress}});Object.defineProperty(exports,"e",{enumerable:true,get:function(){return utils.defineChain}});Object.defineProperty(exports,"f",{enumerable:true,get:function(){return utils.formatAddress}});Object.defineProperty(exports,"g",{enumerable:true,get:function(){return utils.formatBalance}});Object.defineProperty(exports,"h",{enumerable:true,get:function(){return utils.formatBalanceWithUnit}});Object.defineProperty(exports,"i",{enumerable:true,get:function(){return utils.getChainToken}});Object.defineProperty(exports,"j",{enumerable:true,get:function(){return utils.getExplorerUrl}});Object.defineProperty(exports,"k",{enumerable:true,get:function(){return utils.getPublicKey}});Object.defineProperty(exports,"l",{enumerable:true,get:function(){return utils.isMobileDevice}});Object.defineProperty(exports,"m",{enumerable:true,get:function(){return utils.isSameAddress}});Object.defineProperty(exports,"n",{enumerable:true,get:function(){return utils.isValidAddress}});exports.a=l;exports.b=y;exports.c=h;//# sourceMappingURL=chunk-7BEPQQMD.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-7BEPQQMD.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/createApi.ts","../src/utils/dispatchError.ts","../src/utils/sleep.ts"],"names":["createApi","config","chainId","chainConfig","c","transportConfig","apiOptions","wsProvider","newApi","LegacyClient","actualGenesisHash","properties","error","getReadableDispatchError","api","dispatchError","errorMeta","docs","name","pallet","fields","fieldCodecs","e","index","sleep","ms","resolve"],"mappings":"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","file":"chunk-7BEPQQMD.cjs","sourcesContent":["import { wsProvider } from '@luno-kit/core';\nimport { type ApiOptions, LegacyClient } from 'dedot';\nimport type { Config } from '../types';\nimport type { LunoClient } from '../types/state';\n\ninterface CreateApiOptions {\n config: Config;\n chainId: string;\n}\n\nexport const createApi = async ({ config, chainId }: CreateApiOptions): Promise<LunoClient> => {\n const chainConfig = config.chains.find((c) => c.genesisHash === chainId);\n const transportConfig = config.transports[chainId];\n\n if (!chainConfig || !transportConfig) {\n throw new Error(`Configuration missing for chainId: ${chainId}`);\n }\n\n const provider = wsProvider(transportConfig);\n\n const apiOptions: ApiOptions = {\n provider,\n cacheMetadata: config.cacheMetadata,\n metadata: config.metadata,\n scaledResponses: {\n ...config.scaledResponses,\n ...config.customTypes,\n },\n runtimeApis: config.runtimeApis,\n cacheStorage: config.cacheStorage,\n };\n\n const newApi = new LegacyClient(apiOptions);\n\n try {\n await newApi.connect();\n\n const actualGenesisHash = await newApi.rpc.chain_getBlockHash(0);\n\n if (actualGenesisHash !== chainId) {\n await newApi.disconnect();\n throw new Error(\n `Chain genesis hash mismatch. Expected: ${chainId}, Got: ${actualGenesisHash}. ` +\n 'This might indicate connecting to the wrong network or incorrect chain configuration.'\n );\n }\n\n const properties = await newApi.rpc.system_properties();\n\n (newApi as any).isEthereum = !!properties.isEthereum;\n\n return newApi as LunoClient;\n } catch (error: any) {\n throw new Error(`Failed to connect to ${chainConfig.name}: ${error?.message || error}`);\n }\n};\n","import type { LegacyClient } from 'dedot';\nimport type { DispatchError } from 'dedot/codecs';\n\nexport function getReadableDispatchError(api: LegacyClient, dispatchError: DispatchError): string {\n if (dispatchError.type === 'Module') {\n try {\n const errorMeta = api.registry.findErrorMeta(dispatchError);\n if (errorMeta) {\n const { docs, name, pallet, fields, fieldCodecs } = errorMeta;\n return `[useSendTransaction]: ${pallet}.${name} error, ${docs.join(' ')}`;\n }\n\n return `[useSendTransaction]: Module Error (index: ${dispatchError.value.index}, error: ${dispatchError.value.error})`;\n } catch (e) {\n const {\n value: { error, index },\n } = dispatchError;\n\n return `[useSendTransaction]: Module Error (index: ${index}, error: ${error}) - Failed to decode: ${e instanceof Error ? e.message : 'Unknown error'}`;\n }\n } else if (dispatchError.type === 'Token') {\n return `[useSendTransaction]: Token Error: ${dispatchError.value}`;\n }\n\n if ('value' in dispatchError) {\n return `[useSendTransaction]: ${dispatchError.type} Error: ${dispatchError.value}`;\n }\n\n return `[useSendTransaction]: Error: ${dispatchError.type}`;\n}\n","export const sleep = (ms = 1000): Promise<void> => {\n return new Promise((resolve) => setTimeout(resolve, ms));\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var types=require('@luno-kit/core/types');var o=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Disconnecting="disconnecting",n.Connected="connected",n))(o||{});exports.a=o;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});//# sourceMappingURL=chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var types=require('@luno-kit/core/types');var o=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Disconnecting="disconnecting",n.Connected="connected",n))(o||{});exports.a=o;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});//# sourceMappingURL=chunk-NNF3FZ3W.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-NNF3FZ3W.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/state.ts"],"names":["ConnectionStatus"],"mappings":"uDAIO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,aAAe,cAAA,CACfA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,EAAA,aAAA,CAAgB,eAAA,CAChBA,CAAAA,CAAA,SAAA,CAAY,YAJFA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"chunk-NNF3FZ3W.cjs","sourcesContent":["import type { HexString } from '@luno-kit/core/types';\nimport type { LegacyClient } from 'dedot';\nimport type { Account, Chain, Config, Connector } from '.';\n\nexport enum ConnectionStatus {\n Disconnected = 'disconnected',\n Connecting = 'connecting',\n Disconnecting = 'disconnecting',\n Connected = 'connected',\n}\n\nexport type LunoClient = LegacyClient & {\n isEthereum: boolean;\n};\n\nexport interface LunoState {\n config?: Config;\n\n status: ConnectionStatus;\n\n activeConnector?: Connector;\n\n accounts: Account[];\n account?: Account;\n setAccount: (accountOrPubkey?: Account | HexString) => Promise<void>;\n\n currentChainId?: string;\n currentChain?: Chain;\n currentApi?: LunoClient;\n isApiReady: boolean;\n apiError: Error | null;\n\n _setConfig: (config: Config) => Promise<void>;\n\n connect: (connectorId: string, targetChainId?: string) => Promise<void>;\n disconnect: () => Promise<void>;\n\n switchChain: (newChainId: string) => Promise<void>;\n\n _setApi: (api?: LegacyClient) => void;\n\n _setIsApiReady: (isApiReady: boolean) => void;\n _setApiError: (error: Error | null) => void;\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{convertAddress as d,defineChain as e,formatAddress as f,formatBalance as g,formatBalanceWithUnit as h,getChainToken as i,getExplorerUrl as j,getPublicKey as k,isMobileDevice as l,isSameAddress as m,isValidAddress as n}from'@luno-kit/core/utils';import {wsProvider}from'@luno-kit/core';import {LegacyClient}from'dedot';var l=async({config:r,chainId:e})=>{let t=r.chains.find(n=>n.genesisHash===e),i=r.transports[e];if(!t||!i)throw new Error(`Configuration missing for chainId: ${e}`);let a={provider:wsProvider(i),cacheMetadata:r.cacheMetadata,metadata:r.metadata,scaledResponses:{...r.scaledResponses,...r.customTypes},runtimeApis:r.runtimeApis,cacheStorage:r.cacheStorage},o=new LegacyClient(a);try{await o.connect();let n=await o.rpc.chain_getBlockHash(0);if(n!==e)throw await o.disconnect(),new Error(`Chain genesis hash mismatch. Expected: ${e}, Got: ${n}. This might indicate connecting to the wrong network or incorrect chain configuration.`);let c=await o.rpc.system_properties();return o.isEthereum=!!c.isEthereum,o}catch(n){throw new Error(`Failed to connect to ${t.name}: ${n?.message||n}`)}};function y(r,e){if(e.type==="Module")try{let t=r.registry.findErrorMeta(e);if(t){let{docs:i,name:s,pallet:a,fields:o,fieldCodecs:n}=t;return `[useSendTransaction]: ${a}.${s} error, ${i.join(" ")}`}return `[useSendTransaction]: Module Error (index: ${e.value.index}, error: ${e.value.error})`}catch(t){let{value:{error:i,index:s}}=e;return `[useSendTransaction]: Module Error (index: ${s}, error: ${i}) - Failed to decode: ${t instanceof Error?t.message:"Unknown error"}`}else if(e.type==="Token")return `[useSendTransaction]: Token Error: ${e.value}`;return "value"in e?`[useSendTransaction]: ${e.type} Error: ${e.value}`:`[useSendTransaction]: Error: ${e.type}`}var h=(r=1e3)=>new Promise(e=>setTimeout(e,r));export{l as a,y as b,h as c};//# sourceMappingURL=chunk-QCEMRLYF.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-QCEMRLYF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/createApi.ts","../src/utils/dispatchError.ts","../src/utils/sleep.ts"],"names":["createApi","config","chainId","chainConfig","c","transportConfig","apiOptions","wsProvider","newApi","LegacyClient","actualGenesisHash","properties","error","getReadableDispatchError","api","dispatchError","errorMeta","docs","name","pallet","fields","fieldCodecs","e","index","sleep","ms","resolve"],"mappings":"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","file":"chunk-QCEMRLYF.js","sourcesContent":["import { wsProvider } from '@luno-kit/core';\nimport { type ApiOptions, LegacyClient } from 'dedot';\nimport type { Config } from '../types';\nimport type { LunoClient } from '../types/state';\n\ninterface CreateApiOptions {\n config: Config;\n chainId: string;\n}\n\nexport const createApi = async ({ config, chainId }: CreateApiOptions): Promise<LunoClient> => {\n const chainConfig = config.chains.find((c) => c.genesisHash === chainId);\n const transportConfig = config.transports[chainId];\n\n if (!chainConfig || !transportConfig) {\n throw new Error(`Configuration missing for chainId: ${chainId}`);\n }\n\n const provider = wsProvider(transportConfig);\n\n const apiOptions: ApiOptions = {\n provider,\n cacheMetadata: config.cacheMetadata,\n metadata: config.metadata,\n scaledResponses: {\n ...config.scaledResponses,\n ...config.customTypes,\n },\n runtimeApis: config.runtimeApis,\n cacheStorage: config.cacheStorage,\n };\n\n const newApi = new LegacyClient(apiOptions);\n\n try {\n await newApi.connect();\n\n const actualGenesisHash = await newApi.rpc.chain_getBlockHash(0);\n\n if (actualGenesisHash !== chainId) {\n await newApi.disconnect();\n throw new Error(\n `Chain genesis hash mismatch. Expected: ${chainId}, Got: ${actualGenesisHash}. ` +\n 'This might indicate connecting to the wrong network or incorrect chain configuration.'\n );\n }\n\n const properties = await newApi.rpc.system_properties();\n\n (newApi as any).isEthereum = !!properties.isEthereum;\n\n return newApi as LunoClient;\n } catch (error: any) {\n throw new Error(`Failed to connect to ${chainConfig.name}: ${error?.message || error}`);\n }\n};\n","import type { LegacyClient } from 'dedot';\nimport type { DispatchError } from 'dedot/codecs';\n\nexport function getReadableDispatchError(api: LegacyClient, dispatchError: DispatchError): string {\n if (dispatchError.type === 'Module') {\n try {\n const errorMeta = api.registry.findErrorMeta(dispatchError);\n if (errorMeta) {\n const { docs, name, pallet, fields, fieldCodecs } = errorMeta;\n return `[useSendTransaction]: ${pallet}.${name} error, ${docs.join(' ')}`;\n }\n\n return `[useSendTransaction]: Module Error (index: ${dispatchError.value.index}, error: ${dispatchError.value.error})`;\n } catch (e) {\n const {\n value: { error, index },\n } = dispatchError;\n\n return `[useSendTransaction]: Module Error (index: ${index}, error: ${error}) - Failed to decode: ${e instanceof Error ? e.message : 'Unknown error'}`;\n }\n } else if (dispatchError.type === 'Token') {\n return `[useSendTransaction]: Token Error: ${dispatchError.value}`;\n }\n\n if ('value' in dispatchError) {\n return `[useSendTransaction]: ${dispatchError.type} Error: ${dispatchError.value}`;\n }\n\n return `[useSendTransaction]: Error: ${dispatchError.type}`;\n}\n","export const sleep = (ms = 1000): Promise<void> => {\n return new Promise((resolve) => setTimeout(resolve, ms));\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from'@luno-kit/core/types';var o=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Disconnecting="disconnecting",n.Connected="connected",n))(o||{});export{o as a};//# sourceMappingURL=chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
export*from'@luno-kit/core/types';var o=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Disconnecting="disconnecting",n.Connected="connected",n))(o||{});export{o as a};//# sourceMappingURL=chunk-ZBVBO5KX.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ZBVBO5KX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/state.ts"],"names":["ConnectionStatus"],"mappings":"kCAIO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,aAAe,cAAA,CACfA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,EAAA,aAAA,CAAgB,eAAA,CAChBA,CAAAA,CAAA,SAAA,CAAY,YAJFA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"chunk-ZBVBO5KX.js","sourcesContent":["import type { HexString } from '@luno-kit/core/types';\nimport type { LegacyClient } from 'dedot';\nimport type { Account, Chain, Config, Connector } from '.';\n\nexport enum ConnectionStatus {\n Disconnected = 'disconnected',\n Connecting = 'connecting',\n Disconnecting = 'disconnecting',\n Connected = 'connected',\n}\n\nexport type LunoClient = LegacyClient & {\n isEthereum: boolean;\n};\n\nexport interface LunoState {\n config?: Config;\n\n status: ConnectionStatus;\n\n activeConnector?: Connector;\n\n accounts: Account[];\n account?: Account;\n setAccount: (accountOrPubkey?: Account | HexString) => Promise<void>;\n\n currentChainId?: string;\n currentChain?: Chain;\n currentApi?: LunoClient;\n isApiReady: boolean;\n apiError: Error | null;\n\n _setConfig: (config: Config) => Promise<void>;\n\n connect: (connectorId: string, targetChainId?: string) => Promise<void>;\n disconnect: () => Promise<void>;\n\n switchChain: (newChainId: string) => Promise<void>;\n\n _setApi: (api?: LegacyClient) => void;\n\n _setIsApiReady: (isApiReady: boolean) => void;\n _setApiError: (error: Error | null) => void;\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk7BEPQQMD_cjs=require('./chunk-7BEPQQMD.cjs'),chunkNNF3FZ3W_cjs=require('./chunk-NNF3FZ3W.cjs'),core=require('@luno-kit/core'),re=require('react'),utils=require('@luno-kit/core/utils'),zustand=require('zustand'),jsxRuntime=require('react/jsx-runtime'),utils$1=require('dedot/utils'),reactQuery=require('@tanstack/react-query');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var re__default=/*#__PURE__*/_interopDefault(re);var C={LAST_CONNECTOR_ID:"lastConnectorId",LAST_CHAIN_ID:"lastChainId",LAST_SELECTED_ACCOUNT_INFO:"lastSelectedAccountInfo",RECENT_SELECTED_ACCOUNT_INFO:"recentSelectedAccountInfo",RECENT_CONNECTOR_ID:"recentConnectorId"};var q=()=>{let e=re.useRef(false);return {isInitialized:e.current,markAsInitialized:()=>{e.current=true;}}};var _=[],D=()=>{_.forEach(e=>{try{e();}catch(r){console.warn("[LunoStore] Error during listener cleanup:",r);}}),_=[];},G=zustand.create((e,r)=>({config:void 0,status:"disconnected",activeConnector:void 0,accounts:[],account:void 0,currentChainId:void 0,currentChain:void 0,currentApi:void 0,isApiReady:false,apiError:null,_setConfig:async n=>{D();let i=null;try{i=await n.storage.getItem(C.LAST_CHAIN_ID);}catch(a){console.warn("[LunoStore] Failed to read stored chain ID from storage:",a);}let t=i?.toLowerCase(),o=t&&n.chains.some(a=>a.genesisHash.toLowerCase()===t)?t:n.chains[0]?.genesisHash,s=o?n.chains.find(a=>a.genesisHash.toLowerCase()===o):void 0;e({config:n,status:"disconnected",activeConnector:void 0,accounts:[],currentChainId:o,currentChain:s});},_setApi:n=>{e({currentApi:n});},_setIsApiReady:n=>{e({isApiReady:n});},setAccount:async n=>{if(!n)return;let{accounts:i,config:t}=r(),o=typeof n=="string"?n.toLowerCase():n.publicKey?.toLowerCase(),s=i.find(a=>a.publicKey?.toLowerCase()===o);if(!s)throw new Error("[LunoStore] setAccount: The provided account or address is not in the current accounts list. Ignored.");if(e({account:s}),t)try{let a={publicKey:s.publicKey,address:s.address,name:s.name,source:s.meta?.source};await t.storage.setItem(C.LAST_SELECTED_ACCOUNT_INFO,JSON.stringify(a)),await t.storage.setItem(C.RECENT_SELECTED_ACCOUNT_INFO,JSON.stringify(a));}catch(a){console.error("[LunoStore] Failed to persist selected account:",a);}},connect:async(n,i)=>{let t=r().config;if(!t)throw e({status:"disconnected"}),new Error("[LunoStore] LunoConfig has not been initialized. Cannot connect.");let o=t.connectors.find(a=>a.id===n);if(!o)throw e({status:"disconnected"}),new Error(`[LunoStore] Connector with ID "${n}" not found in LunoConfig.`);e({status:"connecting"});let s=r().activeConnector;(s&&s.id!==o.id||s&&s.id===o.id)&&D();try{let a=async l=>{if(l.length===0){await r().disconnect();return}l.forEach(h=>{h.publicKey||console.warn(`[LunoStore] Account ${h.address} (from ${o.name}) is missing publicKey.`);});let b=l[0];try{let h=await t.storage.getItem(C.LAST_SELECTED_ACCOUNT_INFO),E=await t.storage.getItem(C.RECENT_SELECTED_ACCOUNT_INFO),g=h||E;if(g){let T=JSON.parse(g),L=l.find(v=>utils.isSameAddress(v.address,T.address));L&&(b=L);}}catch(h){console.warn("[LunoStore] Failed to restore account during accountsChanged:",h);}e({accounts:l,account:b});},d=()=>{if(r().activeConnector?.id===o.id){D();try{t.storage.removeItem(C.LAST_CONNECTOR_ID),t.storage.removeItem(C.LAST_CHAIN_ID);}catch(l){console.error("[LunoStore] Failed to remove connection info from storage:",l);}e({status:"disconnected",activeConnector:void 0,accounts:[]});}else console.warn(`[LunoStore] Received disconnect event from an inactive connector ${o.name}. Ignored.`);};o.on("accountsChanged",a),_.push(()=>o.off("accountsChanged",a)),o.on("disconnect",d),_.push(()=>o.off("disconnect",d));let u=i||r().currentChainId||t.chains[0]?.genesisHash,f=await o.connect(t.appName,t.chains,u);if(!f||f?.length===0)throw new Error("[LunoStore] No accounts found from wallet");let m=f[0];try{let l=await t.storage.getItem(C.LAST_SELECTED_ACCOUNT_INFO),b=await t.storage.getItem(C.RECENT_SELECTED_ACCOUNT_INFO),h=l||b;if(h){let E=JSON.parse(h),g=f.find(T=>utils.isSameAddress(T.address,E.address));g&&(m=g);}}catch(l){console.warn("[LunoStore] Failed to restore selected account from storage:",l);}e({activeConnector:o,accounts:f,status:"connected",account:m});let S={publicKey:m.publicKey,address:m.address,name:m.name,source:m.meta?.source};try{t.storage.setItem(C.LAST_CONNECTOR_ID,o.id),t.storage.setItem(C.RECENT_CONNECTOR_ID,o.id),t.storage.setItem(C.LAST_SELECTED_ACCOUNT_INFO,JSON.stringify(S)),t.storage.setItem(C.RECENT_SELECTED_ACCOUNT_INFO,JSON.stringify(S));}catch(l){console.error("[LunoStore] Failed to persist connectorId to storage:",l);}let p=r().currentChainId,y=i||p||t.chains[0]?.genesisHash;if(y){let l=t.chains.find(b=>b.genesisHash===y);if(l){(y!==p||!r().currentApi)&&e({currentChainId:y,currentChain:l,currentApi:void 0});try{t.storage.setItem(C.LAST_CHAIN_ID,y);}catch(b){console.error("[LunoStore] Failed to persist chainId to storage:",b);}}else console.warn(`[LunoStore] After connection, target chain ID "${y}" was not found in config. Current chain state might not have changed. Not persisting chainId.`);}}catch(a){throw D(),e({status:"disconnected",activeConnector:void 0,accounts:[]}),new Error(`${o.name}: ${a?.message||a}`)}},disconnect:async()=>{let{activeConnector:n,status:i,config:t}=r();if(!(!n||i==="disconnecting"||i==="disconnected")){e({status:"disconnecting"});try{if(await n.disconnect(),t)try{await t.storage.removeItem(C.LAST_CONNECTOR_ID),await t.storage.removeItem(C.LAST_CHAIN_ID),await t.storage.removeItem(C.LAST_SELECTED_ACCOUNT_INFO);}catch(o){console.error("[LunoStore] Failed to remove connection info from storage during disconnect action:",o);}D(),e({status:"disconnected",activeConnector:void 0,accounts:[],account:void 0}),r().status!=="disconnected"&&console.warn("[LunoStore] disconnect method called, but status is not yet 'disconnected' (event handler might be delayed or did not fire). Check connector events.");}catch(o){throw e({status:"connected"}),new Error(`[LunoStore] Error disconnecting from ${n.name}: ${o?.message||o}`)}}},switchChain:async n=>{let{config:i,currentChainId:t,currentApi:o,activeConnector:s,account:a,accounts:d}=r();if(!i)throw new Error("[LunoStore] LunoConfig has not been initialized. Cannot switch chain.");if(n===t)return;let u=i.chains.find(f=>f.genesisHash===n);if(!u)throw new Error(`[LunoStore] Chain with ID "${n}" not found in LunoConfig.`);try{try{o&&o.status==="connected"&&await o.disconnect();}catch(m){console.warn("[LunoStore] Failed to disconnect from previous chain:",m);}e({currentChainId:n,currentChain:u,currentApi:void 0,isApiReady:!1,apiError:null});let f=await chunk7BEPQQMD_cjs.a({config:i,chainId:n});e({currentApi:f,isApiReady:!0}),await i.storage.setItem(C.LAST_CHAIN_ID,n);}catch(f){e({apiError:f,isApiReady:false});}},_setApiError:n=>{e({apiError:n});}}));var k=re__default.default.createContext({});var ae=({config:e,children:r})=>{let{_setConfig:n,_setApi:i,_setIsApiReady:t,_setApiError:o,setAccount:s,currentChainId:a,config:d,currentApi:u,connect:f,status:m,activeConnector:S,accounts:p,account:y,currentChain:l,isApiReady:b,apiError:h,disconnect:E,switchChain:g}=G(),{markAsInitialized:T,isInitialized:L}=q(),v=re.useCallback(()=>{i(void 0),t(false);},[i,t]);re.useEffect(()=>{e&&n(e);},[e]),re.useEffect(()=>{if(L)return;if(!e||!a){u&&u.status==="connected"&&u.disconnect().catch(console.error),v();return}let A=e.chains.find(x=>x.genesisHash===a),w=e.transports[a];if(!A||!w){u&&u.status==="connected"&&u.disconnect().catch(console.error),v();return}u&&u.status==="connected"&&u.disconnect().catch(x=>console.error("[LunoProvider] Error disconnecting previous API:",x)),v(),chunk7BEPQQMD_cjs.a({config:e,chainId:a}).then(x=>{i(x),t(true);}).catch(x=>{v(),o(x);}).finally(()=>T());},[e,a]),re.useEffect(()=>{e&&(async()=>{if(await chunk7BEPQQMD_cjs.c(500),!!e.autoConnect){if(!e.storage){console.warn("[LunoProvider]: AutoConnect Storage not available, cannot auto-connect.");return}try{let w=await e.storage.getItem(C.LAST_CONNECTOR_ID),x=await e.storage.getItem(C.LAST_CHAIN_ID);w?await f(w,x||void 0):console.warn("[LunoProvider]: AutoConnect No persisted session found or missing data.");}catch(w){console.error("[LunoProvider]: AutoConnect Error during auto-connect process:",w);}}})();},[e]),re.useEffect(()=>{if(b&&u&&l&&l.ss58Format!==void 0&&l.ss58Format!==null)try{let A=u.consts.system.ss58Prefix;A!=null&&A!==l.ss58Format?console.error(`[LunoProvider]: SS58 Format Mismatch for chain "${l.name}" (genesisHash: ${l.genesisHash}):
|
|
2
2
|
- Configured SS58Format: ${l.ss58Format}
|
|
3
3
|
- Node Runtime SS58Format: ${A}
|
|
4
|
-
Please verify your Luno configuration for this chain to ensure correct address display and interaction.`):A==null&&console.warn(`[LunoProvider]: Could not determine SS58 format from the API for chain "${l.name}". Cannot validate configured SS58Format (${l.ss58Format}). The application will use the configured value.`);}catch(A){console.error(`[LunoProvider]: Error retrieving SS58 format from API for chain "${l.name}" while attempting validation:`,A);}},[b,u,l]);let O=oe.useMemo(()=>({config:d,status:m,activeConnector:S,accounts:p,account:h,setAccount:i,currentChainId:a,currentChain:l,currentApi:u,isApiReady:b,connect:f,disconnect:E,switchChain:g,apiError:C}),[d,m,S,p,h,a,l,u,b,C,f,E,g,i]);return jsxRuntime.jsx(k.Provider,{value:O,children:r})};var c=()=>{let e=oe.useContext(k);if(e===void 0)throw new Error("useLuno must be used within a LunoProvider");return e};var U=()=>{let{account:e,currentChain:r}=c(),n=oe.useMemo(()=>{if(e){if(!r||r?.ss58Format===void 0)return e;try{let s=utils.convertAddress(e.address,r.ss58Format);return {...e,address:s}}catch(s){return console.error(`[useAccount]: Failed to re-format address for account ${e.address}:`,s),{...e}}}},[e,r,r?.ss58Format]);return {account:n,address:n?.address}};var Sn=()=>{let{accounts:e,setAccount:r,currentChain:n}=c();return {accounts:oe.useMemo(()=>!n||n?.ss58Format===void 0?e??[]:(e||[]).map(t=>{try{let o=utils.convertAddress(t.address,n.ss58Format);return {...t,address:o}}catch(o){return console.error(`[useAccounts]: Failed to re-format address for account ${t.address}:`,o),{...t}}}),[e,n,n?.ss58Format]),selectAccount:r}};var hn=()=>{let{activeConnector:e}=c();return e};var En=()=>{let{currentApi:e,isApiReady:r,apiError:n}=c();return {api:e,isApiReady:r,apiError:n}};var Ce=e=>e,V=({queryKey:e,factory:r,params:n,options:s={}})=>{let[t,o]=oe.useState(void 0),{currentApi:i,isApiReady:a}=c(),d=reactQuery.useQueryClient(),{enabled:u=true,transform:f=Ce,defaultValue:m}=s,S=oe.useRef(null),p=oe.useMemo(()=>{if(!(!n||!i||!a))return typeof n=="function"?[n(i)]:n},[n,i,a]),h=oe.useMemo(()=>[e,p,i?.genesisHash],[e,p,i?.genesisHash]);oe.useEffect(()=>{if(S.current&&(S.current(),S.current=null),!(!u||!r||!i||!p||!a)){try{let C=r(i),E=typeof C=="function"?C.bind(i):C,g=T=>{try{let L=f(T);d.setQueryData(h,L),o(void 0);}catch(L){o(new Error(`[useSubscription]: ${L}`));}};E(...p,g).then(T=>{S.current=T;}).catch(T=>{o(new Error(`[useSubscription]: ${T}`));});}catch(C){o(new Error(`[useSubscription]: ${C}`));}return ()=>{S.current&&(S.current(),S.current=null,o(void 0));}}},[JSON.stringify(h),u,d]);let{data:l,isLoading:b}=reactQuery.useQuery({queryKey:h,queryFn:()=>Promise.resolve(m),enabled:false,initialData:m});return {data:l,error:t,isLoading:!!(u&&a&&!l)}};var he=10,Te=(e,r)=>{let n=e[0],s=e[1],t=n.data.free,o=n.data.reserved,i=n.data.frozen,a=BigInt(t)+BigInt(o),d=t>i?BigInt(t)-BigInt(i):0n;return {free:t,total:a,reserved:o,transferable:d,formattedTransferable:utils.formatBalance(d,r.tokenDecimals),formattedTotal:utils.formatBalance(a,r.tokenDecimals),locks:s.map(u=>({id:u.id,amount:u.amount,reason:u.reasons,lockHuman:utils.formatBalance(u.amount,r.tokenDecimals)}))}},Dn=({address:e})=>{let{currentApi:r,isApiReady:n,currentChain:s}=c();return V({queryKey:"/native-balance",factory:t=>t.queryMulti,params:t=>[{fn:t.query.system.account,args:[e]},{fn:t.query.balances.locks,args:[e]}],options:{enabled:!!r&&n&&!!e,transform:t=>{let o={tokenDecimals:s?.nativeCurrency?.decimals??he,tokenSymbol:s?.nativeCurrency?.symbol,ss58Format:s?.ss58Format};return Te(t,o)}}})};var Mn=()=>{let{currentApi:e,isApiReady:r}=c();return V({queryKey:"/block-number",factory:s=>s.query.system.number,params:[],options:{enabled:!!e&&r,transform:s=>s}})};var Fn=()=>{let{currentChain:e,currentChainId:r}=c();return {chain:e,chainId:r}};var Bn=()=>{let{config:e}=c();return e?.chains?[...e.chains]:[]};var Kn=()=>{let{config:e}=c();return e};function I(e,r){let n={};r?.onSuccess&&(n.onSuccess=r.onSuccess),r?.onError&&(n.onError=r.onError),r?.onSettled&&(n.onSettled=r.onSettled);let s=reactQuery.useMutation({mutationFn:e,retry:false,throwOnError:false,...n});return {mutate:(t,o)=>{s.mutate(t,o);},mutateAsync:(t,o)=>s.mutateAsync(t,o),data:s.data,error:s.error,isError:s.isError,isIdle:s.isIdle,isPending:s.isPending,isSuccess:s.isSuccess,reset:s.reset,status:s.status,variables:s.variables}}var Wn=e=>{let{connect:r,config:n,activeConnector:s,status:t}=c(),i=I(async a=>{await r(a.connectorId,a.targetChainId),await chunkCMKLBFDC_cjs.c();},e);return {connect:i.mutate,connectAsync:i.mutateAsync,connectors:n?.connectors?[...n.connectors]:[],activeConnector:s,status:t,data:i.data,error:i.error,isError:i.isError,isIdle:i.isIdle,isPending:i.isPending,isSuccess:i.isSuccess,reset:i.reset,variables:i.variables}};var et=()=>{let{config:e}=c();return e?.connectors?[...e.connectors]:[]};var rt=e=>{let{disconnect:r,status:n}=c(),t=I(async()=>{await r();},e);return {disconnect:o=>t.mutate(void 0,o),disconnectAsync:o=>t.mutateAsync(void 0,o),status:n,data:t.data,error:t.error,isError:t.isError,isIdle:t.isIdle,isPending:t.isPending,isSuccess:t.isSuccess,reset:t.reset}};function ut(){let{account:e,currentChain:r}=c(),[n,s]=oe.useState(null),[t,o]=oe.useState(false),[i,a]=oe.useState(null),d=oe.useCallback(async(u,f)=>{let m=f||e?.address;if(!(!u||!m||!r)){o(true),a(null);try{let S=await u.paymentInfo(m),p=r.nativeCurrency.decimals,h={...S,partialFeeFormatted:utils.formatBalance(S.partialFee,p)};return s(h),h}catch(S){let p=S instanceof Error?S:new Error("Failed to estimate payment info");a(p);}finally{o(false);}}},[e?.address,r]);return {data:n,isLoading:t,error:i,estimate:d}}var ft=()=>{let{currentApi:e,currentChainId:r,isApiReady:n}=c(),{data:s,isLoading:t,error:o}=reactQuery.useQuery({queryKey:["/genesis-hash",r],queryFn:async()=>await e.rpc.chain_getBlockHash(0),enabled:!!e&&n&&!!r,staleTime:1/0,gcTime:1/0,retry:false});return {data:s,isLoading:t,error:o}};var W=()=>{let{activeConnector:e}=c(),{account:r}=U(),[n,s]=oe.useState(void 0),[t,o]=oe.useState(false);return oe.useEffect(()=>{if(!e||!r?.address){s(void 0),o(false);return}o(true),e.getSigner().then(i=>s(i)).catch(()=>s(void 0)).finally(()=>o(false));},[e,r?.address]),{data:n,isLoading:t}};function At(){let{data:e}=W(),{address:r}=U(),[n,s]=oe.useState(false),[t,o]=oe.useState(void 0);return oe.useEffect(()=>{if(!e||!r){o(void 0),s(false);return}s(true),utils.createPapiSigner(r,e).then(i=>o(i)).catch(()=>o(void 0)).finally(()=>s(false));},[e,r]),{data:t,isLoading:n}}var wt=()=>{let{currentApi:e,isApiReady:r,currentChainId:n}=c();return reactQuery.useQuery({queryKey:["luno","runtimeVersion",n],queryFn:async()=>await e.getRuntimeVersion(),enabled:!!e&&r&&!!n})};function Nt(e){let{activeConnector:r,currentApi:n,isApiReady:s}=c(),{account:t}=U(),[o,i]=oe.useState("idle"),[a,d]=oe.useState("idle"),[u,f]=oe.useState(null),m=e?.waitFor??"finalized",S=oe.useCallback(async h=>{if(i("idle"),d("idle"),!n||!s)throw new Error("[useSendTransaction]: Polkadot API is not ready.");if(!r)throw new Error("[useSendTransaction]: No active connector found.");if(!t||!t.address||!t.meta?.source)throw new Error("[useSendTransaction]: No active account, address, or account metadata (source) found.");if(!h.extrinsic)throw new Error("[useSendTransaction]: No extrinsic provided to send.");let l=await r.getSigner();if(!l)throw new Error("[useSendTransaction]: Could not retrieve signer from the injector.");return i("signing"),new Promise((b,C)=>{let E;h.extrinsic.signAndSend(t.address,{signer:l},({status:g,dispatchError:T,events:L,dispatchInfo:w,txHash:O,...A})=>{let v=R=>{E&&E(),b(R);},x=R=>{E&&E(),f(R),C(R);},z=(R,ee,P)=>({transactionHash:O,blockHash:R,blockNumber:ee,events:L,status:!!P?"failed":"success",dispatchError:P||void 0,errorMessage:P?chunkCMKLBFDC_cjs.b(n,P):void 0,dispatchInfo:w,rawReceipt:{status:g,dispatchError:T,events:L,dispatchInfo:w,txHash:O,...A}});switch(g.type){case "Broadcasting":i("pending"),d("broadcasting");break;case "BestChainBlockIncluded":i("pending"),d("inBlock"),m==="inBlock"&&(i(T?"failed":"success"),v(z(g.value?.blockHash,g.value?.blockNumber,T)));break;case "Finalized":d("finalized"),m==="finalized"&&(i(T?"failed":"success"),v(z(g.value?.blockHash,g.value?.blockNumber,T)));break;case "Invalid":i("failed"),d("invalid"),x(new Error(`Transaction invalid: ${O}`));break;case "Drop":i("failed"),d("dropped"),x(new Error(`Transaction dropped: ${O}`));break}}).then(g=>{E=g;}).catch(g=>{i("failed"),console.error("[useSendTransaction]: Error in signAndSend promise:",g?.message||g),f(g),C(g);});})},[n,s,r,t,i,d,m]),p=I(S,e);return {sendTransaction:p.mutate,sendTransactionAsync:p.mutateAsync,data:p.data,error:u||p.error,isError:!!u||p.isError,isIdle:p.isIdle,isPending:p.isPending,isSuccess:p.isSuccess,reset:p.reset,status:p.status,variables:p.variables,txStatus:o,detailedStatus:a}}function Vt(e){let{account:r,activeConnector:n,currentApi:s,isApiReady:t}=c(),[o,i]=oe.useState(null),a=oe.useCallback(async u=>{if(!s||!t)throw new Error("[useSendTransactionHash]: Polkadot API is not ready.");if(!n)throw new Error("[useSendTransactionHash]: No active connector found.");if(!r||!r.address||!r.meta?.source)throw new Error("[useSendTransactionHash]: No active account, address, or account metadata (source) found.");if(!u.extrinsic)throw new Error("[useSendTransactionHash]: No extrinsic provided to send.");let f=await n.getSigner();if(!f)throw new Error("[useSendTransactionHash]: Could not retrieve signer from the injector.");try{return await u.extrinsic.signAndSend(r.address,{signer:f}).catch(S=>{throw S})}catch(m){throw i(m),m}},[s,t,n,r]),d=I(a,e);return {sendTransaction:d.mutate,sendTransactionAsync:d.mutateAsync,data:d.data,error:o||d.error,isError:!!o||d.isError,isIdle:d.isIdle,isPending:d.isPending,isSuccess:d.isSuccess,reset:d.reset,status:d.status,variables:d.variables}}function Kt(e){let{activeConnector:r,account:n,accounts:s}=c(),o=I(async i=>{if(!r)throw new Error("[useSignMessage]: No active connector found to sign the message.");if(!n||!n.address||!n.meta?.source)throw new Error("[useSignMessage]: No address provided for signing.");if(!s.some(u=>u.address===n.address))throw new Error(`[useSignMessage]: Address ${n.address} is not managed by ${r.id}.`);if(!i.message)throw new Error("[useSignMessage]: No message provided for signing.");let a=s.find(u=>utils.isSameAddress(u.address,n.address));if(!a)throw new Error("[useSignMessage]: Invalid account address.");let d=await r.signMessage(i.message,a.address);if(!d)throw new Error("[useSignMessage]: Signature was not obtained. The user may have cancelled the request or the connector failed.");return {signature:d,rawMessage:i.message,addressUsed:n.address}},e);return {signMessage:o.mutate,signMessageAsync:o.mutateAsync,data:o.data,error:o.error,isError:o.isError,isIdle:o.isIdle,isPending:o.isPending,isSuccess:o.isSuccess,reset:o.reset,status:o.status,variables:o.variables}}var Z=42,Yt=()=>{let{currentApi:e,isApiReady:r,currentChain:n}=c(),s=n?.ss58Format!==void 0?n.ss58Format:Z;return oe.useMemo(()=>{if(e&&r){let t;try{let o=e.consts.system.ss58Prefix;t=utils$1.isNumber(o)?o:Z;}catch(o){console.error("[useSs58Format] Error fetching chainSS58:",o),t=s;}return {data:t,isLoading:false}}else return {data:void 0,isLoading:true}},[e,r,s])};var Xt=()=>{let{status:e}=c();return e};var to=e=>{let{switchChain:r,config:n,currentChain:s,currentChainId:t}=c(),i=I(async a=>{await r(a.chainId);},e);return {switchChain:i.mutate,switchChainAsync:i.mutateAsync,chains:n?.chains?[...n.chains]:[],currentChain:s,currentChainId:t,data:i.data,error:i.error,isError:i.isError,isIdle:i.isIdle,isPending:i.isPending,isSuccess:i.isSuccess,reset:i.reset,variables:i.variables}};Object.defineProperty(exports,"ConnectionStatus",{enumerable:true,get:function(){return chunkJJEEWE3N_cjs.a}});exports.LunoProvider=ie;exports.useAccount=U;exports.useAccounts=Sn;exports.useActiveConnector=hn;exports.useApi=En;exports.useBalance=Dn;exports.useBlockNumber=Mn;exports.useChain=Fn;exports.useChains=Bn;exports.useConfig=Kn;exports.useConnect=Wn;exports.useConnectors=et;exports.useDisconnect=rt;exports.useEstimatePaymentInfo=ut;exports.useGenesisHash=ft;exports.usePapiSigner=At;exports.useRuntimeVersion=wt;exports.useSendTransaction=Nt;exports.useSendTransactionHash=Vt;exports.useSignMessage=Kt;exports.useSigner=W;exports.useSs58Format=Yt;exports.useStatus=Xt;exports.useSubscription=V;exports.useSwitchChain=to;Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});//# sourceMappingURL=index.cjs.map
|
|
4
|
+
Please verify your Luno configuration for this chain to ensure correct address display and interaction.`):A==null&&console.warn(`[LunoProvider]: Could not determine SS58 format from the API for chain "${l.name}". Cannot validate configured SS58Format (${l.ss58Format}). The application will use the configured value.`);}catch(A){console.error(`[LunoProvider]: Error retrieving SS58 format from API for chain "${l.name}" while attempting validation:`,A);}},[b,u,l]);let O=re.useMemo(()=>({config:d,status:m,activeConnector:S,accounts:p,account:y,setAccount:s,currentChainId:a,currentChain:l,currentApi:u,isApiReady:b,connect:f,disconnect:E,switchChain:g,apiError:h}),[d,m,S,p,y,a,l,u,b,h,f,E,g,s]);return jsxRuntime.jsx(k.Provider,{value:O,children:r})};var c=()=>{let e=re.useContext(k);if(e===void 0)throw new Error("useLuno must be used within a LunoProvider");return e};var U=()=>{let{account:e,currentChain:r}=c(),n=re.useMemo(()=>{if(e){if(!r||r?.ss58Format===void 0)return e;try{let i=utils.convertAddress(e.address,r.ss58Format);return {...e,address:i}}catch(i){return console.error(`[useAccount]: Failed to re-format address for account ${e.address}:`,i),{...e}}}},[e,r,r?.ss58Format]);return {account:n,address:n?.address}};var hn=()=>{let{accounts:e,setAccount:r,currentChain:n}=c();return {accounts:re.useMemo(()=>!n||n?.ss58Format===void 0?e??[]:(e||[]).map(t=>{try{let o=utils.convertAddress(t.address,n.ss58Format);return {...t,address:o}}catch(o){return console.error(`[useAccounts]: Failed to re-format address for account ${t.address}:`,o),{...t}}}),[e,n,n?.ss58Format]),selectAccount:r}};var bn=()=>{let{activeConnector:e}=c();return e};var xn=()=>{let{currentApi:e,isApiReady:r,apiError:n}=c();return {api:e,isApiReady:r,apiError:n}};var ye=e=>e,V=({queryKey:e,factory:r,params:n,options:i={}})=>{let[t,o]=re.useState(void 0),{currentApi:s,isApiReady:a}=c(),d=reactQuery.useQueryClient(),{enabled:u=true,transform:f=ye,defaultValue:m}=i,S=re.useRef(null),p=re.useMemo(()=>{if(!(!n||!s||!a))return typeof n=="function"?[n(s)]:n},[n,s,a]),y=re.useMemo(()=>[e,p,s?.genesisHash],[e,p,s?.genesisHash]);re.useEffect(()=>{if(S.current&&(S.current(),S.current=null),!(!u||!r||!s||!p||!a)){try{let h=r(s),E=typeof h=="function"?h.bind(s):h,g=T=>{try{let L=f(T);d.setQueryData(y,L),o(void 0);}catch(L){o(new Error(`[useSubscription]: ${L}`));}};E(...p,g).then(T=>{S.current=T;}).catch(T=>{o(new Error(`[useSubscription]: ${T}`));});}catch(h){o(new Error(`[useSubscription]: ${h}`));}return ()=>{S.current&&(S.current(),S.current=null,o(void 0));}}},[JSON.stringify(y),u,d]);let{data:l,isLoading:b}=reactQuery.useQuery({queryKey:y,queryFn:()=>Promise.resolve(m),enabled:false,initialData:m});return {data:l,error:t,isLoading:!!(u&&a&&!l)}};var be=10,Ee=(e,r)=>{let n=e[0],i=e[1],t=n.data.free,o=n.data.reserved,s=n.data.frozen,a=BigInt(t)+BigInt(o),d=t>s?BigInt(t)-BigInt(s):0n;return {free:t,total:a,reserved:o,transferable:d,formattedTransferable:utils.formatBalance(d,r.tokenDecimals),formattedTotal:utils.formatBalance(a,r.tokenDecimals),locks:i.map(u=>({id:u.id,amount:u.amount,reason:u.reasons,lockHuman:utils.formatBalance(u.amount,r.tokenDecimals)}))}},Mn=({address:e})=>{let{currentApi:r,isApiReady:n,currentChain:i}=c(),t=re.useMemo(()=>!r||!n||!e?false:r.isEthereum?utils$1.isEvmAddress(e):!utils$1.isEvmAddress(e),[r,n,e]),o=V({queryKey:"/native-balance",factory:s=>s.queryMulti,params:s=>[{fn:s.query.system.account,args:[e]},{fn:s.query.balances.locks,args:[e]}],options:{enabled:t,transform:s=>{let a={tokenDecimals:i?.nativeCurrency?.decimals??be,tokenSymbol:i?.nativeCurrency?.symbol,ss58Format:i?.ss58Format};return Ee(s,a)}}});return r&&n&&e&&!t?{isLoading:false,data:{free:0n,reserved:0n,total:0n,transferable:0n,formattedTransferable:"0",formattedTotal:"0",locks:[]},error:void 0}:o};var Vn=()=>{let{currentApi:e,isApiReady:r}=c();return V({queryKey:"/block-number",factory:i=>i.query.system.number,params:[],options:{enabled:!!e&&r,transform:i=>i}})};var $n=()=>{let{currentChain:e,currentChainId:r}=c();return {chain:e,chainId:r}};var Qn=()=>{let{config:e}=c();return e?.chains?[...e.chains]:[]};var Gn=()=>{let{config:e}=c();return e};function I(e,r){let n={};r?.onSuccess&&(n.onSuccess=r.onSuccess),r?.onError&&(n.onError=r.onError),r?.onSettled&&(n.onSettled=r.onSettled);let i=reactQuery.useMutation({mutationFn:e,retry:false,throwOnError:false,...n});return {mutate:(t,o)=>{i.mutate(t,o);},mutateAsync:(t,o)=>i.mutateAsync(t,o),data:i.data,error:i.error,isError:i.isError,isIdle:i.isIdle,isPending:i.isPending,isSuccess:i.isSuccess,reset:i.reset,status:i.status,variables:i.variables}}var nt=e=>{let{connect:r,config:n,activeConnector:i,status:t}=c(),s=I(async a=>{await r(a.connectorId,a.targetChainId),await chunk7BEPQQMD_cjs.c();},e);return {connect:s.mutate,connectAsync:s.mutateAsync,connectors:n?.connectors?[...n.connectors]:[],activeConnector:i,status:t,data:s.data,error:s.error,isError:s.isError,isIdle:s.isIdle,isPending:s.isPending,isSuccess:s.isSuccess,reset:s.reset,variables:s.variables}};var rt=()=>{let{config:e}=c();return e?.connectors?[...e.connectors]:[]};var ct=e=>{let{disconnect:r,status:n}=c(),t=I(async()=>{await r();},e);return {disconnect:o=>t.mutate(void 0,o),disconnectAsync:o=>t.mutateAsync(void 0,o),status:n,data:t.data,error:t.error,isError:t.isError,isIdle:t.isIdle,isPending:t.isPending,isSuccess:t.isSuccess,reset:t.reset}};function ft(){let{account:e,currentChain:r}=c(),[n,i]=re.useState(null),[t,o]=re.useState(false),[s,a]=re.useState(null),d=re.useCallback(async(u,f)=>{let m=f||e?.address;if(!(!u||!m||!r)){o(true),a(null);try{let S=await u.paymentInfo(m),p=r.nativeCurrency.decimals,y={...S,partialFeeFormatted:utils.formatBalance(S.partialFee,p)};return i(y),y}catch(S){let p=S instanceof Error?S:new Error("Failed to estimate payment info");a(p);}finally{o(false);}}},[e?.address,r]);return {data:n,isLoading:t,error:s,estimate:d}}var Ct=()=>{let{currentApi:e,currentChainId:r,isApiReady:n}=c(),{data:i,isLoading:t,error:o}=reactQuery.useQuery({queryKey:["/genesis-hash",r],queryFn:async()=>await e.rpc.chain_getBlockHash(0),enabled:!!e&&n&&!!r,staleTime:1/0,gcTime:1/0,retry:false});return {data:i,isLoading:t,error:o}};var X=()=>{let{activeConnector:e}=c(),{account:r}=U(),[n,i]=re.useState(void 0),[t,o]=re.useState(false);return re.useEffect(()=>{if(!e||!r?.address){i(void 0),o(false);return}o(true),e.getSigner().then(s=>i(s)).catch(()=>i(void 0)).finally(()=>o(false));},[e,r?.address]),{data:n,isLoading:t}};function vt(){let{data:e}=X(),{address:r}=U(),[n,i]=re.useState(false),[t,o]=re.useState(void 0);return re.useEffect(()=>{if(!e||!r){o(void 0),i(false);return}i(true),utils.createPapiSigner(r,e).then(s=>o(s)).catch(()=>o(void 0)).finally(()=>i(false));},[e,r]),{data:t,isLoading:n}}var Dt=()=>{let{currentApi:e,isApiReady:r,currentChainId:n}=c();return reactQuery.useQuery({queryKey:["luno","runtimeVersion",n],queryFn:async()=>await e.getRuntimeVersion(),enabled:!!e&&r&&!!n})};function Ft(e){let{activeConnector:r,currentApi:n,isApiReady:i}=c(),{account:t}=U(),[o,s]=re.useState("idle"),[a,d]=re.useState("idle"),[u,f]=re.useState(null),m=e?.waitFor??"finalized",S=re.useCallback(async y=>{if(s("idle"),d("idle"),!n||!i)throw new Error("[useSendTransaction]: Polkadot API is not ready.");if(!r)throw new Error("[useSendTransaction]: No active connector found.");if(!t||!t.address||!t.meta?.source)throw new Error("[useSendTransaction]: No active account, address, or account metadata (source) found.");if(!y.extrinsic)throw new Error("[useSendTransaction]: No extrinsic provided to send.");let l=await r.getSigner();if(!l)throw new Error("[useSendTransaction]: Could not retrieve signer from the injector.");return s("signing"),new Promise((b,h)=>{let E;y.extrinsic.signAndSend(t.address,{signer:l},({status:g,dispatchError:T,events:L,dispatchInfo:v,txHash:O,...A})=>{let w=R=>{E&&E(),b(R);},x=R=>{E&&E(),f(R),h(R);},z=(R,ne,P)=>({transactionHash:O,blockHash:R,blockNumber:ne,events:L,status:!!P?"failed":"success",dispatchError:P||void 0,errorMessage:P?chunk7BEPQQMD_cjs.b(n,P):void 0,dispatchInfo:v,rawReceipt:{status:g,dispatchError:T,events:L,dispatchInfo:v,txHash:O,...A}});switch(g.type){case "Broadcasting":s("pending"),d("broadcasting");break;case "BestChainBlockIncluded":s("pending"),d("inBlock"),m==="inBlock"&&(s(T?"failed":"success"),w(z(g.value?.blockHash,g.value?.blockNumber,T)));break;case "Finalized":d("finalized"),m==="finalized"&&(s(T?"failed":"success"),w(z(g.value?.blockHash,g.value?.blockNumber,T)));break;case "Invalid":s("failed"),d("invalid"),x(new Error(`Transaction invalid: ${O}`));break;case "Drop":s("failed"),d("dropped"),x(new Error(`Transaction dropped: ${O}`));break}}).then(g=>{E=g;}).catch(g=>{s("failed"),console.error("[useSendTransaction]: Error in signAndSend promise:",g?.message||g),f(g),h(g);});})},[n,i,r,t,s,d,m]),p=I(S,e);return {sendTransaction:p.mutate,sendTransactionAsync:p.mutateAsync,data:p.data,error:u||p.error,isError:!!u||p.isError,isIdle:p.isIdle,isPending:p.isPending,isSuccess:p.isSuccess,reset:p.reset,status:p.status,variables:p.variables,txStatus:o,detailedStatus:a}}function zt(e){let{account:r,activeConnector:n,currentApi:i,isApiReady:t}=c(),[o,s]=re.useState(null),a=re.useCallback(async u=>{if(!i||!t)throw new Error("[useSendTransactionHash]: Polkadot API is not ready.");if(!n)throw new Error("[useSendTransactionHash]: No active connector found.");if(!r||!r.address||!r.meta?.source)throw new Error("[useSendTransactionHash]: No active account, address, or account metadata (source) found.");if(!u.extrinsic)throw new Error("[useSendTransactionHash]: No extrinsic provided to send.");let f=await n.getSigner();if(!f)throw new Error("[useSendTransactionHash]: Could not retrieve signer from the injector.");try{return await u.extrinsic.signAndSend(r.address,{signer:f}).catch(S=>{throw S})}catch(m){throw s(m),m}},[i,t,n,r]),d=I(a,e);return {sendTransaction:d.mutate,sendTransactionAsync:d.mutateAsync,data:d.data,error:o||d.error,isError:!!o||d.isError,isIdle:d.isIdle,isPending:d.isPending,isSuccess:d.isSuccess,reset:d.reset,status:d.status,variables:d.variables}}function Gt(e){let{activeConnector:r,account:n,accounts:i}=c(),o=I(async s=>{if(!r)throw new Error("[useSignMessage]: No active connector found to sign the message.");if(!n||!n.address||!n.meta?.source)throw new Error("[useSignMessage]: No address provided for signing.");if(!i.some(u=>u.address===n.address))throw new Error(`[useSignMessage]: Address ${n.address} is not managed by ${r.id}.`);if(!s.message)throw new Error("[useSignMessage]: No message provided for signing.");let a=i.find(u=>utils.isSameAddress(u.address,n.address));if(!a)throw new Error("[useSignMessage]: Invalid account address.");let d=await r.signMessage(s.message,a.address);if(!d)throw new Error("[useSignMessage]: Signature was not obtained. The user may have cancelled the request or the connector failed.");return {signature:d,rawMessage:s.message,addressUsed:n.address}},e);return {signMessage:o.mutate,signMessageAsync:o.mutateAsync,data:o.data,error:o.error,isError:o.isError,isIdle:o.isIdle,isPending:o.isPending,isSuccess:o.isSuccess,reset:o.reset,status:o.status,variables:o.variables}}var ee=42,Zt=()=>{let{currentApi:e,isApiReady:r,currentChain:n}=c(),i=n?.ss58Format!==void 0?n.ss58Format:ee;return re.useMemo(()=>{if(e&&r){let t;try{let o=e.consts.system.ss58Prefix;t=utils$1.isNumber(o)?o:ee;}catch(o){console.error("[useSs58Format] Error fetching chainSS58:",o),t=i;}return {data:t,isLoading:false}}else return {data:void 0,isLoading:true}},[e,r,i])};var to=()=>{let{status:e}=c();return e};var io=e=>{let{switchChain:r,config:n,currentChain:i,currentChainId:t}=c(),s=I(async a=>{await r(a.chainId);},e);return {switchChain:s.mutate,switchChainAsync:s.mutateAsync,chains:n?.chains?[...n.chains]:[],currentChain:i,currentChainId:t,data:s.data,error:s.error,isError:s.isError,isIdle:s.isIdle,isPending:s.isPending,isSuccess:s.isSuccess,reset:s.reset,variables:s.variables}};Object.defineProperty(exports,"ConnectionStatus",{enumerable:true,get:function(){return chunkNNF3FZ3W_cjs.a}});exports.LunoProvider=ae;exports.useAccount=U;exports.useAccounts=hn;exports.useActiveConnector=bn;exports.useApi=xn;exports.useBalance=Mn;exports.useBlockNumber=Vn;exports.useChain=$n;exports.useChains=Qn;exports.useConfig=Gn;exports.useConnect=nt;exports.useConnectors=rt;exports.useDisconnect=ct;exports.useEstimatePaymentInfo=ft;exports.useGenesisHash=Ct;exports.usePapiSigner=vt;exports.useRuntimeVersion=Dt;exports.useSendTransaction=Ft;exports.useSendTransactionHash=zt;exports.useSignMessage=Gt;exports.useSigner=X;exports.useSs58Format=Zt;exports.useStatus=to;exports.useSubscription=V;exports.useSwitchChain=io;Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});//# sourceMappingURL=index.cjs.map
|
|
5
5
|
//# sourceMappingURL=index.cjs.map
|