@rango-dev/provider-ledger 0.21.1-next.0 → 0.21.1-next.2
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-I25CJMQS.js +2 -0
- package/dist/{chunk-L3UWJBD6.js.map → chunk-I25CJMQS.js.map} +4 -4
- package/dist/{ethereum-4K63WN6K.js → ethereum-J6U6B3NU.js} +2 -2
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +4 -4
- package/dist/provider-ledger.build.json +1 -1
- package/dist/{solana-KIPRMAWD.js → solana-Q7LP23TP.js} +2 -2
- package/package.json +2 -2
- package/dist/chunk-L3UWJBD6.js +0 -2
- /package/dist/{ethereum-4K63WN6K.js.map → ethereum-J6U6B3NU.js.map} +0 -0
- /package/dist/{solana-KIPRMAWD.js.map → solana-Q7LP23TP.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-OOX2UCLJ.js";import{d as e,l,p as c,q as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=solana-
|
|
1
|
+
import{a as o}from"./chunk-OOX2UCLJ.js";import{d as e,l,p as c,q as f}from"./chunk-I25CJMQS.js";import{a}from"./chunk-CVKDPNYM.js";import{generalSolanaTransactionExecutor as w}from"@rango-dev/signer-solana";import{PublicKey as T}from"@solana/web3.js";import{SignerError as h,SignerErrorCode as y}from"rango-types";function x(g){return"version"in g}a(x,"isVersionedTransaction");var m=class{static{a(this,"SolanaSigner")}async signMessage(t){try{let r=await c();return(await new o(r).signOffchainMessage(e(),Buffer.from(t))).signature.toString()}catch(r){throw new h(y.SIGN_TX_ERROR,void 0,r)}}async signAndSendTx(t){try{return{hash:await w(t,a(async n=>{let p=await c(),i=new o(p),s;x(n)?s=await i.signTransaction(e(),n.message.serialize()):s=await i.signTransaction(e(),n.serialize());let u=await i.getAddress(e()),S=new T(u.address);return n.addSignature(S,Buffer.from(s.signature)),n.serialize()},"DefaultSolanaSigner"))}}catch(r){throw l(r)}finally{await f()}}};export{m as SolanaSigner,x as isVersionedTransaction};
|
|
2
|
+
//# sourceMappingURL=solana-Q7LP23TP.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-ledger",
|
|
3
|
-
"version": "0.21.1-next.
|
|
3
|
+
"version": "0.21.1-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@ledgerhq/types-cryptoassets": "^7.11.0",
|
|
29
29
|
"@ledgerhq/types-devices": "^6.24.0",
|
|
30
30
|
"@rango-dev/signer-solana": "^0.44.0",
|
|
31
|
-
"@rango-dev/wallets-shared": "^0.50.1-next.
|
|
31
|
+
"@rango-dev/wallets-shared": "^0.50.1-next.2",
|
|
32
32
|
"@solana/web3.js": "^1.91.4",
|
|
33
33
|
"@types/w3c-web-hid": "^1.0.2",
|
|
34
34
|
"bs58": "^5.0.0",
|
package/dist/chunk-L3UWJBD6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i,d as he,m as X}from"./chunk-CVKDPNYM.js";var St="";function rn(t){St=t}i(rn,"setDerivationPath");function q(){return St}i(q,"getDerivationPath");var de=Object.defineProperty,S=i((t,e)=>de(t,"name",{value:e,configurable:!0}),"r"),v=(t=>(t.BTC="BTC",t.BSC="BSC",t.LTC="LTC",t.THORCHAIN="THOR",t.BCH="BCH",t.BINANCE="BNB",t.ETHEREUM="ETH",t.POLYGON="POLYGON",t.TERRA="TERRA",t.POLKADOT="",t.TRON="TRON",t.DOGE="DOGE",t.HARMONY="HARMONY",t.AVAX_CCHAIN="AVAX_CCHAIN",t.FANTOM="FANTOM",t.MOONBEAM="MOONBEAM",t.ARBITRUM="ARBITRUM",t.BOBA="BOBA",t.OPTIMISM="OPTIMISM",t.FUSE="FUSE",t.CRONOS="CRONOS",t.SOLANA="SOLANA",t.MOONRIVER="MOONRIVER",t.GNOSIS="GNOSIS",t.COSMOS="COSMOS",t.OSMOSIS="OSMOSIS",t.AXELAR="AXELAR",t.MARS="MARS",t.STRIDE="STRIDE",t.MAYA="MAYA",t.AKASH="AKASH",t.IRIS="IRIS",t.PERSISTENCE="PERSISTENCE",t.SENTINEL="SENTINEL",t.REGEN="REGEN",t.CRYPTO_ORG="CRYPTO_ORG",t.SIF="SIF",t.CHIHUAHUA="CHIHUAHUA",t.JUNO="JUNO",t.KUJIRA="KUJIRA",t.STARNAME="STARNAME",t.COMDEX="COMDEX",t.STARGAZE="STARGAZE",t.DESMOS="DESMOS",t.BITCANNA="BITCANNA",t.SECRET="SECRET",t.INJECTIVE="INJECTIVE",t.LUMNETWORK="LUMNETWORK",t.BANDCHAIN="BANDCHAIN",t.EMONEY="EMONEY",t.BITSONG="BITSONG",t.KI="KI",t.MEDIBLOC="MEDIBLOC",t.KONSTELLATION="KONSTELLATION",t.UMEE="UMEE",t.STARKNET="STARKNET",t.TON="TON",t.BASE="BASE",t.SUI="SUI",t.Unknown="Unkown",t))(v||{}),le=(t=>(t.CONNECTED="connected",t.CONNECTING="connecting",t.REACHABLE="reachable",t.INSTALLED="installed",t.ACCOUNTS="accounts",t.NETWORK="network",t.NAMESPACE_DISCONNECTED="namespace_disconnected",t.PROVIDER_DISCONNECTED="provider_disconnected",t))(le||{}),an=class{static{i(this,"E")}static{S(this,"Persistor")}getItem(t){let e=localStorage.getItem(t);return e?JSON.parse(e):null}setItem(t,e){localStorage.setItem(t,JSON.stringify(e))}removeItem(t){localStorage.removeItem(t)}};function _t(t,e){return`${e||""}:${t}`}i(_t,"w");S(_t,"formatAddressWithNetwork");function F(t,e){return t?t.map(n=>_t(n,e)):[]}i(F,"y");S(F,"accountAddressesWithNetwork");function fe(t){let[e,n]=t.split(":");return{network:e,address:n}}i(fe,"b");S(fe,"readAccountAddress");function U(t){let{checkInstallation:e=!0}=t.config;return e}i(U,"S");S(U,"needsCheckInstallation");var L=S((t,e)=>(t=typeof t=="string"&&t.startsWith("0x")?parseInt(t):t,Object.values(v).includes(String(t))?t:t==="Binance-Chain-Tigris"?"BNB":e.filter(n=>!!n.chainId).find(n=>(n.chainId?.startsWith("0x")?parseInt(n.chainId):n.chainId)==t)?.name||null),"getBlockChainNameFromId");async function Et(t){if(await t.canEagerConnect())return await t.connectHandler();throw new Error(`can't restore connection for ${t.providerName}.`)}i(Et,"T");S(Et,"eagerConnectHandler");function pe(t){return t.namespace==="EVM"}i(pe,"B");S(pe,"isEvmNamespace");var cn=class{static{i(this,"A")}static{S(this,"Wallet")}provider;actions;state;options;info;cleanupSubscribe;constructor(t,e){this.actions=e,this.options=t,this.provider=null,this.info={supportedBlockchains:[],isContractWallet:!1,isHub:!1},this.state={connected:!1,connecting:!1,reachable:!1,installed:!1,accounts:null,network:null},U(t)||this.setInstalledAs(!0)}async suggestAndConnect(t){return this.actions.suggest&&await this.actions.suggest({instance:this.provider,meta:this.info.supportedBlockchains,network:t}),await this.connect(t)}async connect(t,e){if(this.state.connecting)throw new Error("Connecting...");let n=await this.getConnectionFromState(),r=this.state.network,s=t||r||this.options.config.defaultNetwork;if(n){let d=r!==s&&!!s;if(r===s)return n;let l=!0;if(this.actions.canSwitchNetworkTo&&(l=this.actions.canSwitchNetworkTo({provider:this.provider,meta:this.info.supportedBlockchains,network:s||""})),d&&l&&this.actions.switchNetwork)return await this.actions.switchNetwork({instance:this.provider,meta:this.info.supportedBlockchains,network:s,newInstance:this.tryGetInstance.bind(this),getState:this.getState.bind(this),updateChainId:this.updateChainId.bind(this)}),s!==this.state.network&&!this.options.config.isAsyncSwitchNetwork&&this.updateState({network:t}),{accounts:n.accounts,network:s,provider:this.provider}}let o=await this.tryGetInstance({network:t});this.updateState({connecting:!0}),this.setInstalledAs(!0);try{var a=await this.actions.connect({instance:o,network:s||void 0,meta:this.info.supportedBlockchains||[],namespaces:e})}catch(d){throw this.resetState(),d}this.updateState({connected:!0,reachable:!0,connecting:!1});let c=[],h=null,y;if(Array.isArray(a)){let d=null;c=a.flatMap(l=>{let w=l.chainId||"Unkown",O=L(w,this.info.supportedBlockchains)||"Unkown";return y=l.derivationPath?l.derivationPath:y,!d&&O!=="Unkown"&&this.info.supportedBlockchains.find(Z=>Z.name===O)?.info?.infoType==="EvmMetaInfo"&&(d=O),F(l.accounts,O)}).filter(Boolean),h=d||s||this.options.config.defaultNetwork}else{let d=a.chainId||"Unkown",l=L(d,this.info.supportedBlockchains)||"Unkown",w=a.derivationPath;c=F(a.accounts,l),h=l,y=w}return c.length>0&&this.updateState({accounts:c,network:h,derivationPath:y}),{accounts:this.state.accounts,network:this.state.network,provider:this.provider}}async disconnect(){this.resetState(),this.actions.disconnect&&this.actions.disconnect({instance:this.provider,destroyInstance:()=>{this.setProvider(null)}})}async eagerConnect(){let t=await this.tryGetInstance({network:void 0}),{canEagerConnect:e}=this.actions,n=this.options.config.type;return await Et({canEagerConnect:async()=>{if(!e)throw new Error(`${n} provider hasn't implemented canEagerConnect.`);return await e({instance:t,meta:this.info.supportedBlockchains})},connectHandler:async()=>await this.connect(),providerName:n})}async getSigners(t){return await this.actions.getSigners(t)}getWalletInfo(t){return this.actions.getWalletInfo(t)}canSwitchNetworkTo(t,e){let n=this.actions.canSwitchNetworkTo;return n?n({network:t,meta:this.info.supportedBlockchains,provider:e}):!1}onInit(){if(!this.actions.getInstance)throw new Error(`Provider hasn't defined how to get wallet's instance. provider: ${this.options.config.type} on: onInit`);this.options.config.isAsyncInstance?U(this.options)&&this.actions.getInstance().then(t=>{t&&this.setInstalledAs(!0)}):this.actions.getInstance()&&!this.state.installed&&this.setInstalledAs(!0)}setProvider(t){if(this.provider=t,t&&this.actions.subscribe){let e=this.actions.subscribe({instance:t,state:this.state,meta:this.info.supportedBlockchains,connect:this.connect.bind(this),disconnect:this.disconnect.bind(this),updateAccounts:(n,r)=>{let s=this.state.network;r&&(s=L(r,this.info.supportedBlockchains)||"Unkown");let o=F(n,s);o.length>0&&this.updateState({accounts:o})},updateChainId:this.updateChainId.bind(this)});this.cleanupSubscribe=e}else!t&&this.cleanupSubscribe&&this.cleanupSubscribe()}setInfo(t){typeof t.supportedBlockchains<"u"&&(this.info.supportedBlockchains=t.supportedBlockchains),typeof t.isContractWallet<"u"&&(this.info.isContractWallet=t.isContractWallet)}setHandler(t){this.options.handler=t}getState(){return this.state}updateState(t){let e=[];typeof t.connected<"u"&&(this.state.connected=t.connected,e.push(["connected",t.connected])),typeof t.connecting<"u"&&(this.state.connecting=t.connecting,e.push(["connecting",t.connecting])),typeof t.reachable<"u"&&(this.state.reachable=t.reachable,e.push(["reachable",t.reachable])),typeof t.installed<"u"&&(this.state.installed=t.installed,e.push(["installed",t.installed])),typeof t.accounts<"u"&&(this.state.accounts=t.accounts,this.state.derivationPath=t.derivationPath,e.push(["accounts",t.accounts])),typeof t.network<"u"&&(this.state.network=t.network,e.push(["network",t.network]));let n=this.getState();e.forEach(([r,s])=>{let o={supportedBlockchains:this.info.supportedBlockchains,isContractWallet:this.info.isContractWallet,isHub:!1};this.options.handler(this.options.config.type,r,s,n,o)})}resetState(){this.updateState({connected:!1,connecting:!1,reachable:!1,accounts:null,network:null})}async getConnectionFromState(){return this.state.connected&&this.provider?{accounts:this.state.accounts,network:this.state.network,provider:this.provider}:null}updateChainId(t){let e=t?L(t,this.info.supportedBlockchains):"Unkown";this.updateState({network:e})}setInstalledAs(t){!U(this.options)&&t===!1||this.updateState({installed:t})}async tryGetInstance({network:t,force:e}){let n=null;if(this.setProvider(null),this.options.config.isAsyncInstance){let r={currentProvider:this.provider,meta:this.info.supportedBlockchains,force:e||!1,updateChainId:this.updateChainId.bind(this),getState:this.getState.bind(this)};t&&(r.network=t),n=await this.actions.getInstance(r)}else n=this.actions.getInstance();if(!n){this.setInstalledAs(!1),this.resetState();let r=`It seems your selected wallet (${this.options.config.type}) isn't installed.`;throw new Error(r)}return this.setProvider(n),n}};var ve={};he(ve,{AccountId:()=>E,AssetId:()=>Nt,AssetType:()=>At,ChainId:()=>_});function Q(){return Q=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Q.apply(this,arguments)}i(Q,"_extends");var tt={name:"chainId",regex:"[-:a-zA-Z0-9]{5,41}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"}}}},me={name:"accountId",regex:"[-:a-zA-Z0-9]{7,106}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"},2:{name:"address",regex:"[a-zA-Z0-9]{1,64}"}}}},et={name:"assetName",regex:"[-:a-zA-Z0-9]{5,73}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,64}"}}}},ge={name:"assetType",regex:"[-:a-zA-Z0-9]{11,115}",parameters:{delimiter:"/",values:{0:tt,1:et}}},ye={name:"assetId",regex:"[-:a-zA-Z0-9]{13,148}",parameters:{delimiter:"/",values:{0:tt,1:et,2:{name:"tokenId",regex:"[-a-zA-Z0-9]{1,32}"}}}},M={2:tt,10:me,19:{assetName:et,assetType:ge,assetId:ye}};function It(t,e){return t.split(e.parameters.delimiter)}i(It,"splitParams");function T(t,e){var n=It(t,e),r={};return n.forEach(function(s,o){r[e.parameters.values[o].name]=s}),r}i(T,"getParams");function C(t,e){return Object.values(e.parameters.values).map(function(n){var r=t[n.name];return typeof r=="string"?r:C(r,n)}).join(e.parameters.delimiter)}i(C,"joinParams");function R(t,e){if(!new RegExp(e.regex).test(t))return!1;var n=It(t,e);if(n.length!==Object.keys(e.parameters.values).length)return!1;var r=n.map(function(s,o){return new RegExp(e.parameters.values[o].regex).test(s)}).filter(function(s){return!!s});return r.length===n.length}i(R,"isValidId");var _=function(){function t(n){typeof n=="string"&&(n=t.parse(n)),this.namespace=n.namespace,this.reference=n.reference}i(t,"ChainId"),t.parse=i(function(r){if(!R(r,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+r);return new t(T(r,this.spec)).toJSON()},"parse"),t.format=i(function(r){return C(r,this.spec)},"format");var e=t.prototype;return e.toString=i(function(){return t.format(this.toJSON())},"toString"),e.toJSON=i(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),t}();_.spec=M[2];var E=function(){function t(n){typeof n=="string"&&(n=t.parse(n)),this.chainId=new _(n.chainId),this.address=n.address}i(t,"AccountId"),t.parse=i(function(r){if(!R(r,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+r);var s=T(r,this.spec),o=s.namespace,a=s.reference,c=s.address,h=new _({namespace:o,reference:a});return new t({chainId:h,address:c}).toJSON()},"parse"),t.format=i(function(r){var s=new _(r.chainId),o=Q({},s.toJSON(),{address:r.address});return C(o,this.spec)},"format");var e=t.prototype;return e.toString=i(function(){return t.format(this.toJSON())},"toString"),e.toJSON=i(function(){return{chainId:this.chainId.toJSON(),address:this.address}},"toJSON"),t}();E.spec=M[10];var nt=function(){function t(n){typeof n=="string"&&(n=t.parse(n)),this.namespace=n.namespace,this.reference=n.reference}i(t,"AssetName"),t.parse=i(function(r){if(!R(r,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+r);return new t(T(r,this.spec)).toJSON()},"parse"),t.format=i(function(r){return C(r,this.spec)},"format");var e=t.prototype;return e.toString=i(function(){return t.format(this.toJSON())},"toString"),e.toJSON=i(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),t}();nt.spec=M[19].assetName;var At=function(){function t(n){typeof n=="string"&&(n=t.parse(n)),this.chainId=new _(n.chainId),this.assetName=new nt(n.assetName)}i(t,"AssetType"),t.parse=i(function(r){if(!R(r,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+r);return new t(T(r,this.spec)).toJSON()},"parse"),t.format=i(function(r){return C(r,this.spec)},"format");var e=t.prototype;return e.toString=i(function(){return t.format(this.toJSON())},"toString"),e.toJSON=i(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName}},"toJSON"),t}();At.spec=M[19].assetType;var Nt=function(){function t(n){typeof n=="string"&&(n=t.parse(n)),this.chainId=new _(n.chainId),this.assetName=new nt(n.assetName),this.tokenId=n.tokenId}i(t,"AssetId"),t.parse=i(function(r){if(!R(r,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+r);return new t(T(r,this.spec)).toJSON()},"parse"),t.format=i(function(r){return C(r,this.spec)},"format");var e=t.prototype;return e.toString=i(function(){return t.format(this.toJSON())},"toString"),e.toJSON=i(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName.toJSON(),tokenId:this.tokenId}},"toJSON"),t}();Nt.spec=M[19].assetId;var bt=i(t=>{let e,n=new Set,r=i((d,l)=>{let w=typeof d=="function"?d(e):d;if(!Object.is(w,e)){let O=e;e=l??(typeof w!="object"||w===null)?w:Object.assign({},e,w),n.forEach(Z=>Z(e,O))}},"setState"),s=i(()=>e,"getState"),h={setState:r,getState:s,getInitialState:i(()=>y,"getInitialState"),subscribe:i(d=>(n.add(d),()=>n.delete(d)),"subscribe"),destroy:i(()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},"destroy")},y=e=t(r,s,h);return h},"createStoreImpl"),Ot=i(t=>t?bt(t):bt,"createStore");var Rt=Symbol.for("immer-nothing"),Ct=Symbol.for("immer-draftable"),f=Symbol.for("immer-state");function m(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}i(m,"die");var P=Object.getPrototypeOf;function k(t){return!!t&&!!t[f]}i(k,"isDraft");function A(t){return t?xt(t)||Array.isArray(t)||!!t[Ct]||!!t.constructor?.[Ct]||Y(t)||V(t):!1}i(A,"isDraftable");var we=Object.prototype.constructor.toString();function xt(t){if(!t||typeof t!="object")return!1;let e=P(t);if(e===null)return!0;let n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===we}i(xt,"isPlainObject");function H(t,e){W(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}i(H,"each");function W(t){let e=t[f];return e?e.type_:Array.isArray(t)?1:Y(t)?2:V(t)?3:0}i(W,"getArchtype");function it(t,e){return W(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}i(it,"has");function Dt(t,e,n){let r=W(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}i(Dt,"set");function Se(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}i(Se,"is");function Y(t){return t instanceof Map}i(Y,"isMap");function V(t){return t instanceof Set}i(V,"isSet");function I(t){return t.copy_||t.base_}i(I,"latest");function ot(t,e){if(Y(t))return new Map(t);if(V(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);let n=xt(t);if(e===!0||e==="class_only"&&!n){let r=Object.getOwnPropertyDescriptors(t);delete r[f];let s=Reflect.ownKeys(r);for(let o=0;o<s.length;o++){let a=s[o],c=r[a];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(r[a]={configurable:!0,writable:!0,enumerable:c.enumerable,value:t[a]})}return Object.create(P(t),r)}else{let r=P(t);if(r!==null&&n)return{...t};let s=Object.create(r);return Object.assign(s,t)}}i(ot,"shallowCopy");function dt(t,e=!1){return G(t)||k(t)||!A(t)||(W(t)>1&&(t.set=t.add=t.clear=t.delete=_e),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>dt(r,!0))),t}i(dt,"freeze");function _e(){m(2)}i(_e,"dontMutateFrozenCollections");function G(t){return Object.isFrozen(t)}i(G,"isFrozen");var Ee={};function N(t){let e=Ee[t];return e||m(0,t),e}i(N,"getPlugin");var x;function Bt(){return x}i(Bt,"getCurrentScope");function Ie(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}i(Ie,"createScope");function Pt(t,e){e&&(N("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}i(Pt,"usePatchesInScope");function at(t){ct(t),t.drafts_.forEach(Ae),t.drafts_=null}i(at,"revokeScope");function ct(t){t===x&&(x=t.parent_)}i(ct,"leaveScope");function kt(t){return x=Ie(x,t)}i(kt,"enterScope");function Ae(t){let e=t[f];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}i(Ae,"revokeDraft");function Mt(t,e){e.unfinalizedDrafts_=e.drafts_.length;let n=e.drafts_[0];return t!==void 0&&t!==n?(n[f].modified_&&(at(e),m(4)),A(t)&&(t=$(e,t),e.parent_||J(e,t)),e.patches_&&N("Patches").generateReplacementPatches_(n[f].base_,t,e.patches_,e.inversePatches_)):t=$(e,n,[]),at(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Rt?t:void 0}i(Mt,"processResult");function $(t,e,n){if(G(e))return e;let r=e[f];if(!r)return H(e,(s,o)=>Tt(t,r,e,s,o,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return J(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;let s=r.copy_,o=s,a=!1;r.type_===3&&(o=new Set(s),s.clear(),a=!0),H(o,(c,h)=>Tt(t,r,s,c,h,n,a)),J(t,s,!1),n&&t.patches_&&N("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}i($,"finalize");function Tt(t,e,n,r,s,o,a){if(k(s)){let c=o&&e&&e.type_!==3&&!it(e.assigned_,r)?o.concat(r):void 0,h=$(t,s,c);if(Dt(n,r,h),k(h))t.canAutoFreeze_=!1;else return}else a&&n.add(s);if(A(s)&&!G(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;$(t,s),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&J(t,s)}}i(Tt,"finalizeProperty");function J(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&dt(e,n)}i(J,"maybeFreeze");function Ne(t,e){let n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:Bt(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1},s=r,o=lt;n&&(s=[r],o=D);let{revoke:a,proxy:c}=Proxy.revocable(s,o);return r.draft_=c,r.revoke_=a,c}i(Ne,"createProxyProxy");var lt={get(t,e){if(e===f)return t;let n=I(t);if(!it(n,e))return be(t,n,e);let r=n[e];return t.finalized_||!A(r)?r:r===rt(t.base_,e)?(st(t),t.copy_[e]=ht(r,t)):r},has(t,e){return e in I(t)},ownKeys(t){return Reflect.ownKeys(I(t))},set(t,e,n){let r=zt(I(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){let s=rt(I(t),e),o=s?.[f];if(o&&o.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Se(n,s)&&(n!==void 0||it(t.base_,e)))return!0;st(t),ut(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return rt(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,st(t),ut(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){let n=I(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){m(11)},getPrototypeOf(t){return P(t.base_)},setPrototypeOf(){m(12)}},D={};H(lt,(t,e)=>{D[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});D.deleteProperty=function(t,e){return D.set.call(this,t,e,void 0)};D.set=function(t,e,n){return lt.set.call(this,t[0],e,n,t[0])};function rt(t,e){let n=t[f];return(n?I(n):t)[e]}i(rt,"peek");function be(t,e,n){let r=zt(e,n);return r?"value"in r?r.value:r.get?.call(t.draft_):void 0}i(be,"readPropFromProto");function zt(t,e){if(!(e in t))return;let n=P(t);for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=P(n)}}i(zt,"getDescriptorFromProto");function ut(t){t.modified_||(t.modified_=!0,t.parent_&&ut(t.parent_))}i(ut,"markChanged");function st(t){t.copy_||(t.copy_=ot(t.base_,t.scope_.immer_.useStrictShallowCopy_))}i(st,"prepareCopy");var Oe=class{static{i(this,"Immer2")}constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){let o=n;n=e;let a=this;return i(function(h=o,...y){return a.produce(h,d=>n.call(this,d,...y))},"curriedProduce")}typeof n!="function"&&m(6),r!==void 0&&typeof r!="function"&&m(7);let s;if(A(e)){let o=kt(this),a=ht(e,void 0),c=!0;try{s=n(a),c=!1}finally{c?at(o):ct(o)}return Pt(o,r),Mt(s,o)}else if(!e||typeof e!="object"){if(s=n(e),s===void 0&&(s=e),s===Rt&&(s=void 0),this.autoFreeze_&&dt(s,!0),r){let o=[],a=[];N("Patches").generateReplacementPatches_(e,s,o,a),r(o,a)}return s}else m(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(a,...c)=>this.produceWithPatches(a,h=>e(h,...c));let r,s;return[this.produce(e,n,(a,c)=>{r=a,s=c}),r,s]},typeof t?.autoFreeze=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof t?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){A(t)||m(8),k(t)&&(t=Ce(t));let e=kt(this),n=ht(t,void 0);return n[f].isManual_=!0,ct(e),n}finishDraft(t,e){let n=t&&t[f];(!n||!n.isManual_)&&m(9);let{scope_:r}=n;return Pt(r,e),Mt(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){let s=e[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));let r=N("Patches").applyPatches_;return k(t)?r(t,e):this.produce(t,s=>r(s,e))}};function ht(t,e){let n=Y(t)?N("MapSet").proxyMap_(t,e):V(t)?N("MapSet").proxySet_(t,e):Ne(t,e);return(e?e.scope_:Bt()).drafts_.push(n),n}i(ht,"createProxy");function Ce(t){return k(t)||m(10,t),Lt(t)}i(Ce,"current");function Lt(t){if(!A(t)||G(t))return t;let e=t[f],n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=ot(t,e.scope_.immer_.useStrictShallowCopy_)}else n=ot(t,!0);return H(n,(r,s)=>{Dt(n,r,Lt(s))}),e&&(e.finalized_=!1),n}i(Lt,"currentImpl");var p=new Oe,b=p.produce,gn=p.produceWithPatches.bind(p),yn=p.setAutoFreeze.bind(p),vn=p.setUseStrictShallowCopy.bind(p),wn=p.applyPatches.bind(p),Sn=p.createDraft.bind(p),_n=p.finishDraft.bind(p);var Ft=Object.defineProperty,g=i((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"e"),B=i((t,e)=>{for(var n in e)Ft(t,n,{get:e[n],enumerable:!0})},"a"),Pe={};B(Pe,{changeAccountSubscriber:()=>Jt,connect:()=>Wt,recommended:()=>Me});function Ut(t){let[,e]=t.state();e("network",null),e("accounts",null),e("connected",!1),e("connecting",!1)}i(Ut,"A");g(Ut,"disconnect");var ke=[["disconnect",Ut]],Ht="solana",j="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";async function $t(t){return{accounts:[(await t.connect()).publicKey.toString()],chainId:"SOLANA"}}i($t,"N");g($t,"getAccounts");var Me=[...ke];function Jt(t){let e;return[(n,r)=>{let s=t();if(!s)throw new Error("Trying to subscribe to your Solana wallet, but seems its instance is not available.");let[,o]=n.state();return e=g(a=>{if(!a){n.action("disconnect");return}o("accounts",[E.format({address:a.toString(),chainId:{namespace:Ht,reference:j}})])},"eventCallback"),s.on("accountChanged",e),r},(n,r)=>{let s=t();return e&&s&&s.off("accountChanged",e),r}]}i(Jt,"j");g(Jt,"changeAccountSubscriber");function Wt(t){return async()=>{let e=t(),n=await $t(e);if(Array.isArray(n))throw new Error("Expecting solana response to be a single value, not an array.");return n.accounts.map(r=>E.format({address:r,chainId:{namespace:Ht,reference:j}}))}}i(Wt,"_");g(Wt,"connect");var Te={};B(Te,{recommended:()=>xe});function ft(t){let[,e]=t.state();e("connecting",!1)}i(ft,"u");g(ft,"intoConnectionFinished");var Re=[["connect",ft]],xe=[...Re],De={};B(De,{recommended:()=>Le});var Be=class{static{i(this,"r")}static{g(this,"ActionBuilder")}name;#t=new Map;#n=new Map;#s=new Map;#e=new Map;#r;constructor(t){this.name=t}and(t){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(t),this}or(t){return this.#n.has(this.name)||this.#n.set(this.name,[]),this.#n.get(this.name)?.push(t),this}before(t){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(t),this}after(t){return this.#s.has(this.name)||this.#s.set(this.name,[]),this.#s.get(this.name)?.push(t),this}action(t){return this.#r=t,this}build(){if(!this.#r)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#r,before:this.#e,after:this.#s,and:this.#t,or:this.#n}}};function Yt(t){try{return E.parse(t),!0}catch{return!1}}i(Yt,"T");g(Yt,"isValidCaipAddress");function pt(t,e){if(!e.every(Yt))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${e}`);let[,n]=t.state();return n("accounts",e),n("connected",!0),e}i(pt,"c");g(pt,"connectAndUpdateStateForSingleNetwork");function mt(t){let[,e]=t.state();e("connecting",!0)}i(mt,"l");g(mt,"intoConnecting");var ze=[["connect",mt]],Le=[["connect",pt]],Fe={};B(Fe,{recommended:()=>Ue});var Ue=[...ze],He={};B(He,{connect:()=>$e});var $e=g(()=>new Be("connect").and(pt).before(mt).after(ft),"connect");import{dynamicImportWithRefinedError as oe,ETHEREUM_CHAIN_ID as ae}from"@rango-dev/wallets-shared";import en from"bs58";var Je=Object.defineProperty,u=i((t,e)=>Je(t,"name",{value:e,configurable:!0}),"a");function Kt(t){return t.constructor.name==="AsyncFunction"}i(Kt,"w");u(Kt,"isAsync");function Zt(t,e){return`${t}$$${e}`}i(Zt,"l");u(Zt,"generateStoreId");var gt=u(t=>`Couldn't find "${t}" action. Are you sure you've added the action?`,"ACTION_NOT_FOUND_ERROR"),We=u(t=>`An error occurred during running ${t}`,"OR_ELSE_ACTION_FAILED_ERROR"),Vt=u(t=>`An error occurred during running before for "${t}" action`,"BEFORE_ACTION_FAILED_ERROR"),Ye="For setup store, you should set `store` first.",Ve=class{static{i(this,"u")}static{u(this,"Namespace")}namespaceId;providerId;#t;#n=new Map;#s=new Map;#e=new Map;#r=new Map;#i=!1;#o;#c;constructor(t,e,n){let{configs:r,actions:s}=n;this.namespaceId=t,this.providerId=e,this.#c=r||new Map,this.#t=s,n.store&&this.store(n.store)}init(){if(this.#i)return;let t=this.#t.get("init");t&&t(this.#a()),this.#i=!0}state(){let t=this.#o;if(!t)throw new Error("You need to set your store using `.store` method first.");let e=this.#p();return[u(n=>{let r=t.getState().namespaces.getNamespaceData(e);return n?r[n]:r},"getState"),u((n,r)=>{t.getState().namespaces.updateStatus(e,n,r)},"setState")]}store(t){return this.#o&&console.warn("You've already set an store for your Namespace. Old store will be replaced by the new one."),this.#o=t,this.#g(),this}and_then(t,e){let n=this.#n.get(t)||[];return this.#n.set(t,n.concat(e)),this}or_else(t,e){let n=this.#s.get(t)||[];return this.#s.set(t,n.concat(e)),this}after(t,e,n){let r=this.#r.get(t)||[],s={hook:e,options:{context:n?.context}};return this.#r.set(t,r.concat(s)),this}before(t,e,n){let r=this.#e.get(t)||[],s={hook:e,options:{context:n?.context}};return this.#e.set(t,r.concat(s)),this}has(t){return!!this.#t.get(t)}run(t,...e){let n=this.#t.get(t);if(!n)throw new Error(gt(t.toString()));return Kt(n)?this.#m(t,e):this.#h(t,e)}#h(t,e){try{this.#d(t)}catch(o){throw this.#u(t),new Error(Vt(t.toString()),{cause:o})}let n=this.#t.get(t);if(!n)throw new Error(gt(t.toString()));let r=this.#a(),s;try{s=n(r,...e),s=this.#l(t,s)}catch(o){s=this.#f(t,o)}finally{this.#u(t)}return s}async#m(t,e){try{this.#d(t)}catch(s){throw this.#u(t),new Error(Vt(t.toString()),{cause:s})}let n=this.#t.get(t);if(!n)throw new Error(gt(t.toString()));let r=this.#a();return await n(r,...e).then(s=>this.#l(t,s)).catch(s=>this.#f(t,s)).finally(()=>this.#u(t))}#u(t){let e=this.#r.get(t);e&&e.forEach(n=>{let r=n.options?.context||this.#a();n.hook(r)})}#d(t){let e=this.#e.get(t);e&&e.forEach(n=>{let r=n.options?.context||this.#a();n.hook(r)})}#l(t,e){let n=this.#n.get(t);if(n){let r=this.#a();e=n.reduce((s,o)=>o(r,s),e)}return e}#f(t,e){let n=this.#s.get(t);if(n)try{let r=this.#a();return n.reduce((s,o)=>o(r,s),e)}catch(r){if(r instanceof Error)throw r.cause=e,r;let s=We(`${t.toString()} for ${this.namespaceId} namespace.`),o=new Error(String(r),{cause:e});throw new Error(s,{cause:o})}else throw e}#g(){let t=this.#o;if(!t)throw new Error(Ye);let e=this.#p();t.getState().namespaces.addNamespace(e,{namespaceId:this.namespaceId,providerId:this.providerId})}#p(){return Zt(this.providerId,this.namespaceId)}#a(){return{state:this.state.bind(this),action:this.run.bind(this)}}},Ge="1.0",je=class{static{i(this,"m")}static{u(this,"Provider")}id;version=Ge;#t;#n=!1;#s={};#e;#r;constructor(t,e,n,r){this.id=t,this.#r=n,this.#s=r?.extendInternalActions||{},this.#t=e,r?.store&&(this.#e=r.store,this.#o())}init(){if(this.#n)return;let t=this.#s.init;t&&t(this.#c()),this.#n=!0}state(){let t=this.#e;if(!t)throw new Error(`Any store detected for ${this.id}. You need to set your store using '.store' method first.`);return[u(e=>{let n=t.getState().providers.guessNamespacesState(this.id);if(!e)return n;switch(e){case"installed":case"connected":case"connecting":return n[e];default:throw new Error("Unhandled state for provider")}},"getState"),u((e,n)=>{switch(e){case"installed":return t.getState().providers.updateStatus(this.id,e,n);default:throw new Error(`Unhandled state update for provider. (provider id: ${this.id}, state name: ${e})`)}},"setState")]}store(t){return this.#e&&console.warn("You've already set an store for your Provider. Old store will be replaced by the new one."),this.#e=t,this.#o(),this}info(){let t=this.#e;if(!t)return this.#r;let e=t.getState().providers.list[this.id].config;return{metadata:e.metadata,deepLink:e.deepLink}}getAll(){return this.#t}get(t){return this.#t.get(t)}findByNamespace(t){let e;return this.#t.forEach(n=>{n.namespaceId===t&&(e=n)}),e}before(t,e){return this.#i("before",t,e),this}after(t,e){return this.#i("after",t,e),this}#i(t,e,n){let r={state:this.state.bind(this)};return this.#t.forEach(s=>{if(t==="after")s.after(e,n,{context:r});else if(t==="before")s.before(e,n,{context:r});else throw new Error(`You hook name is invalid: ${t}`)}),this}#o(){let t=this.#e;if(!t)throw new Error("For setup store, you should set `store` first.");t.getState().providers.addProvider(this.id,this.#r),this.#t.forEach(e=>{e.store(t)})}#c(){return{state:this.state.bind(this)}}},Mn=class{static{i(this,"g")}static{u(this,"Hub")}#t=new Map;#n;constructor(t){this.#n=t??{}}init(){this.runAll("init")}runAll(t){let e=[],n=this.#t.values();for(let r of n){let s={id:r.id,provider:void 0,namespaces:[]},o=r[t];typeof o=="function"&&(s.provider=o.call(r));let a=r.getAll().values();for(let c of a){let h=c[t];if(typeof h=="function"){let y=h();s.namespaces.push(y)}}e.push(s)}return e}add(t,e){return this.#n.store&&e.store(this.#n.store),this.#t.set(t,e),this}remove(t){if(!this.#t.get(t))throw new Error(`Provider not found: No provider exists with ID "${t}"`);return this.#n.store?.getState().providers.removeProvider(t),this.#t.delete(t),this}get(t){return this.#t.get(t)}getAll(){return this.#t}state(){let t=this.runAll("state"),e={};return t.forEach(n=>{let r=[];n.namespaces.forEach(o=>{let[a]=o;r.push(a())});let[s]=n.provider;e[n.id]={...s()||{},namespaces:r}}),e}};function K(t,e){let n=t.namespaces.list,r=Object.keys(n).filter(c=>n[c].info.providerId===e),s=!!t.providers.list[e]?.data.installed,o=r.length>0?r.some(c=>n[c].data.connected):!1,a=r.length>0?r.some(c=>n[c].data.connecting):!1;return{installed:s,connected:o,connecting:a}}i(K,"d");u(K,"guessProviderStateSelector");function Xt(t,e){return t.namespaces.list[e].data}i(Xt,"v");u(Xt,"namespaceStateSelector");function qt(t){let e=u(n=>r=>{let s=u((o,a,c)=>{for(let h of o)r(h,a,c)},"executeListener");return n.subscribe((o,a)=>{let c=Qt(o,a),h=[...yt(o),...c];s(h,o,a)}),{flushEvents:()=>{let o=n.getState(),a=yt(o);s(a,o,o)}}},"extendedSubscribe");return new Proxy(t,{get:function(n,r,s){return r==="subscribe"?e(n):Reflect.get(n,r,s)}})}i(qt,"T");u(qt,"extend");function yt(t){return[...t.providers.events,...t.namespaces.events]}i(yt,"k");u(yt,"tryConsumeEvents");function Qt(t,e){let n=[];for(let r of Object.keys(t.providers.list)){let s=K(t,r),o=K(e,r);if(o.connecting!==s.connecting){let a={type:"provider_connecting",provider:r,value:s.connecting};n.push(a)}if(!o.connected&&s.connected){let a={type:"provider_connected",provider:r};n.push(a)}if(o.connected&&!s.connected){let a={type:"provider_disconnected",provider:r};n.push(a)}}return n}i(Qt,"W");u(Qt,"getEventsLike");var Ke=u(()=>({config:{}}),"hubStore"),te=class{static{i(this,"h")}static{u(this,"ConsumableEvents")}#t=[];push(t){this.#t.push(t)}[Symbol.iterator](){return{next:()=>this.#t.length==0?{done:!0,value:void 0}:{done:!1,value:this.#t.shift()}}}},Ze=u((t,e)=>({events:new te,list:{},addNamespace:(n,r)=>{let s={data:{accounts:null,network:null,connected:!1,connecting:!1},error:"",info:r};t(b(o=>{o.namespaces.list[n]=s}))},updateStatus:(n,r,s)=>{let o=e().namespaces.list[n];if(!o)throw new Error(`No namespace with '${n}' found.`);e().namespaces._produceEventsWhenUpdatingStatus(o,n,r,s),t(b(a=>{a.namespaces.list[n].data[r]=s}))},getNamespaceData(n){return Xt(e(),n)},_produceEventsWhenUpdatingStatus:(n,r,s,o)=>{if(s==="accounts")if(Object.is(o,null)||Array.isArray(o)&&o.length===0){if(e().namespaces.list[r].data.connected){let a={type:"namespace_disconnected",provider:n.info.providerId,namespace:n.info.namespaceId};e().namespaces.events.push(a)}}else{let a=e().namespaces.list[r].data.accounts;if(a){if(a.sort().toString()!==o.sort().toString()){let c={type:"namespace_account_switched",provider:n.info.providerId,namespace:n.info.namespaceId,previousAccounts:a,accounts:o};e().namespaces.events.push(c)}}else{let c={type:"namespace_connected",provider:n.info.providerId,namespace:n.info.namespaceId,accounts:o};e().namespaces.events.push(c)}}else if(s==="network"){let a=e().namespaces.list[r].data.network,c={type:"namespace_network_switched",provider:n.info.providerId,namespace:n.info.namespaceId,network:o,previousNetwork:a};e().namespaces.events.push(c)}}}),"namespacesStore"),Xe=u((t,e)=>({events:new te,list:{},addProvider:(n,r)=>{let s={data:{installed:!1},error:"",config:r};t(b(o=>{o.providers.list[n]=s}))},removeProvider:n=>{t(b(r=>{delete r.providers.list[n]}))},updateStatus:(n,r,s)=>{let o=e().providers.list[n];if(!o)throw new Error(`No namespace namespace with '${n}' found.`);e().providers._produceEventsWhenUpdatingStatus(o,n,r,s),t(b(a=>{a.providers.list[n].data[r]=s}))},guessNamespacesState:n=>K(e(),n),_produceEventsWhenUpdatingStatus:(n,r,s,o)=>{if(s==="installed"){let a={type:"provider_detected",provider:r};e().providers.events.push(a)}}}),"providersStore"),Dn=u(()=>{let t=Ot((...e)=>({hub:Ke(...e),providers:Xe(...e),namespaces:Ze(...e)}));return qt(t)},"createStore"),Gt=["init","state","after","before","and_then","or_else","store"],jt=["string","number"],Bn=class{static{i(this,"S")}static{u(this,"NamespaceBuilder")}#t;#n;#s=new Map;#e=[];#r;constructor(t,e){this.#t=t,this.#n=e,this.#r={}}config(t,e){return this.#r[t]=e,this}action(t,e){return Array.isArray(t)?(t.forEach(([n,r])=>{this.#s.set(n,r)}),this):typeof t=="object"&&t?.actionName?(this.#e.push(t),this):(e&&this.#s.set(t,e),this)}build(){if(this.#i(this.#r))return this.#h(this.#r);throw new Error("You namespace config isn't valid.")}#i(t){return!0}#o(t){this.#e.forEach(e=>{e.after.forEach(n=>{n.map(r=>{t.after(e.actionName,r)})}),e.before.forEach(n=>{n.map(r=>{t.before(e.actionName,r)})}),e.and.forEach(n=>{n.map(r=>{t.and_then(e.actionName,r)})}),e.or.forEach(n=>{n.map(r=>{t.or_else(e.actionName,r)})})})}#c(){this.#e.forEach(t=>{this.#s.set(t.actionName,t.action)})}#h(t){this.#c();let e=new Ve(this.#t,this.#n,{configs:t,actions:this.#s});return this.#o(e),new Proxy(e,{has:(n,r)=>{if(typeof r!="string")throw new Error("You can use string as your property on Namespace instance.");return Gt.includes(r)||jt.includes(typeof e[r])?!0:e.has(r)},get:(n,r)=>{if(typeof r!="string")throw new Error("You can use string as your property on Namespace instance.");let s=e[r];return Gt.includes(r)?s.bind(e):jt.includes(typeof s)?s:e.run.bind(e,r)},set:()=>{throw new Error("You can not set anything on this object.")}})}},zn=class{static{i(this,"x")}static{u(this,"ProviderBuilder")}#t;#n=new Map;#s={};#e={};#r;constructor(t,e){this.#t=t,this.#r=e||{}}add(t,e){return this.#r.store&&e.store(this.#r.store),this.#n.set(t,e),this}config(t,e){return this.#e[t]=e,this}init(t){return this.#s.init=t,this}build(){if(this.#i(this.#e))return new je(this.#t,this.#n,this.#e,{extendInternalActions:this.#s,store:this.#r.store});throw new Error("You need to set all required configs.")}#i(t){return!!t.metadata}},Ln=class{static{i(this,"b")}static{u(this,"ActionBuilder")}name;#t=new Map;#n=new Map;#s=new Map;#e=new Map;#r;constructor(t){this.name=t}and(t){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(t),this}or(t){return this.#n.has(this.name)||this.#n.set(this.name,[]),this.#n.get(this.name)?.push(t),this}before(t){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(t),this}after(t){return this.#s.has(this.name)||this.#s.set(this.name,[]),this.#s.get(this.name)?.push(t),this}action(t){return this.#r=t,this}build(){if(!this.#r)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#r,before:this.#e,after:this.#s,and:this.#t,or:this.#n}}};function qe(t,e){if(!e)throw new Error("You should provide a valid semver, e.g 1.0.0.");let n=t.find(([r])=>r===e);if(!n)throw new Error(`You target version hasn't been found. Available versions: ${Object.keys(t).join(", ")}`);return n}i(qe,"L");u(qe,"pickVersion");function Qe(){let t=[],e={version:(n,r)=>(t.push([n,r]),e),build:()=>t};return e}i(Qe,"H");u(Qe,"defineVersions");import{Networks as re}from"@rango-dev/wallets-shared";import"rango-types";import{dynamicImportWithRefinedError as ee}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as tn,TransactionType as ne}from"rango-types";async function vt(){let t=new tn,{EthereumSigner:e}=await ee(async()=>await import("./ethereum-4K63WN6K.js")),{SolanaSigner:n}=await ee(async()=>await import("./solana-KIPRMAWD.js"));return t.registerSigner(ne.EVM,new e),t.registerSigner(ne.SOLANA,new n),t}i(vt,"getSigners");var sr=[v.ETHEREUM,v.POLYGON,v.BASE],se=16,ir="ledger",or={name:"Ledger",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/ledger/icon.svg",extensions:{homepage:"https://support.ledger.com/hc/en-us/articles/4404389606417-Download-and-install-Ledger-Live?docs=true"},properties:[{name:"namespaces",value:{selection:"single",data:[{label:"Ethereum",value:"EVM",id:"ETH",getSupportedChains:t=>t.filter(e=>e.name===re.ETHEREUM)},{label:"Solana",value:"Solana",id:"SOLANA",getSupportedChains:t=>t.filter(e=>e.name===re.SOLANA)}]}},{name:"derivationPath",value:{data:[{id:"metamask",label:"Metamask (m/44'/60'/0'/0/index)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/0'/0/${t}`},{id:"ledgerLive",label:"LedgerLive (m/44'/60'/index'/0/0)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/${t}'/0/0`},{id:"legacy",label:"Legacy (m/44'/60'/0'/index)",namespace:"EVM",generateDerivationPath:t=>`44'/60'/0'/${t}`},{id:"(m/44'/501'/index')",label:"(m/44'/501'/index')",namespace:"Solana",generateDerivationPath:t=>`44'/501'/${t}'`},{id:"(m/44'/501'/0'/index)",label:"(m/44'/501'/0'/index)",namespace:"Solana",generateDerivationPath:t=>`44'/501'/0'/${t}`}]}},{name:"signers",value:{getSigners:async()=>vt()}}]};function mr(){let t=new Map;return t.set(v.ETHEREUM,{chainId:ae}),t.set(v.SOLANA,{chainId:v.SOLANA}),t}i(mr,"ledger");var ie={21781:"The device is locked",25871:"Related application is not ready on your device",27013:"Action denied by user"};function nn(t){return ie[t]?ie[t]:X(t)?X(t):`Ledger device unknown error 0x${t.toString(se)}`}i(nn,"getLedgerErrorMessage");function wt(t){return t?.statusCode?new Error(nn(t.statusCode)):t?.code==="INSUFFICIENT_FUNDS"?new Error("Insufficient funds for transaction"):t}i(wt,"getLedgerError");function gr(t,e){throw wt(e)}i(gr,"standardizeAndThrowLedgerError");async function yr(){try{let t=await ce(),e=q(),n=new(await oe(async()=>await import("./Eth-5PCPPYSI.js"))).default(t),r=[],s=await n.getAddress(e,!1,!0);return r.push(s.address),{accounts:r,chainId:ae,derivationPath:e}}catch(t){throw wt(t)}finally{await ue()}}i(yr,"getEthereumAccounts");async function vr(){try{let t=await ce(),e=q(),n=new(await oe(async()=>await import("./Solana-NJS3LWGA.js"))).default(t),r=[],s=await n.getAddress(e);return r.push(en.encode(s.address)),{accounts:r,chainId:j,derivationPath:e}}catch(t){throw wt(t)}finally{await ue()}}i(vr,"getSolanaAccounts");var z=null;async function ce(){return z=await(await import("./TransportWebHID-HV53OYSS.js")).default.create(),z}i(ce,"transportConnect");async function ue(){z&&(await z.close(),z=null)}i(ue,"transportDisconnect");export{E as a,ve as b,rn as c,q as d,Ht as e,He as f,Bn as g,zn as h,ir as i,or as j,mr as k,wt as l,gr as m,yr as n,vr as o,ce as p,ue as q,vt as r};
|
|
2
|
-
//# sourceMappingURL=chunk-L3UWJBD6.js.map
|
|
File without changes
|
|
File without changes
|