@rango-dev/wallets-core 0.61.1-next.2 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hub/provider/types.d.ts +5 -2
- package/dist/hub/provider/types.d.ts.map +1 -1
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +2 -2
- package/dist/namespaces/common/mod.js +1 -1
- package/dist/namespaces/evm/mod.js +1 -1
- package/dist/namespaces/solana/mod.js +1 -1
- package/dist/namespaces/starknet/mod.js +1 -1
- package/dist/namespaces/tron/mod.js +1 -1
- package/dist/namespaces/utxo/mod.js +1 -1
- package/dist/utils/mod.js +1 -1
- package/dist/utils/mod.js.map +3 -3
- package/dist/utils/versions.d.ts +4 -8
- package/dist/utils/versions.d.ts.map +1 -1
- package/package.json +3 -8
- package/readme.md +1 -1
- package/src/hub/provider/types.ts +5 -5
- package/src/mod.ts +1 -1
- package/src/utils/versions.test.ts +3 -2
- package/src/utils/versions.ts +4 -13
- package/CHANGELOG.md +0 -406
- package/dist/legacy/helpers.d.ts +0 -12
- package/dist/legacy/helpers.d.ts.map +0 -1
- package/dist/legacy/mod.d.ts +0 -8
- package/dist/legacy/mod.d.ts.map +0 -1
- package/dist/legacy/mod.js +0 -2
- package/dist/legacy/mod.js.map +0 -7
- package/dist/legacy/persistor.d.ts +0 -11
- package/dist/legacy/persistor.d.ts.map +0 -1
- package/dist/legacy/types.d.ts +0 -229
- package/dist/legacy/types.d.ts.map +0 -1
- package/dist/legacy/utils.d.ts +0 -8
- package/dist/legacy/utils.d.ts.map +0 -1
- package/dist/legacy/wallet.d.ts +0 -65
- package/dist/legacy/wallet.d.ts.map +0 -1
- package/legacy/package.json +0 -8
- package/src/legacy/helpers.ts +0 -75
- package/src/legacy/mod.ts +0 -44
- package/src/legacy/persistor.ts +0 -19
- package/src/legacy/types.ts +0 -274
- package/src/legacy/utils.ts +0 -20
- package/src/legacy/wallet.ts +0 -552
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var I=Object.defineProperty;var t=(o,e)=>I(o,"name",{value:e,configurable:!0});var n=(o,e)=>{for(var r in e)I(o,r,{get:e[r],enumerable:!0})};var j={};n(j,{canEagerConnect:()=>z,connect:()=>Y,recommended:()=>$});function T(o){let[,e]=o.state();e("network",null),e("accounts",null),e("connected",!1),e("connecting",!1),e("connectArgs",null)}t(T,"disconnect");var k=[["disconnect",T]];var R={};n(R,{formatAccountsToCAIP:()=>a,getAccounts:()=>x});import{AccountId as B}from"caip";var S="solana",g="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";async function x(o){let e=await o.connect();return{accounts:[e?e.publicKey.toString():o.publicKey.toString()],chainId:"SOLANA"}}t(x,"getAccounts");function a(o){return o.map(e=>B.format({address:e.toString(),chainId:{namespace:S,reference:g}}))}t(a,"formatAccountsToCAIP");var $=[...k];function Y(o){return async()=>{let e=o(),r=await x(e);if(Array.isArray(r))throw new Error("Expecting solana response to be a single value, not an array.");return a(r.accounts)}}t(Y,"connect");function z(o){return async()=>{let e=o();if(!e)throw new Error("Trying to eagerly connect to your Solana wallet, but seems its instance is not available.");try{return!!await e.connect({onlyIfTrusted:!0})}catch{return!1}}}t(z,"canEagerConnect");var K={};n(K,{changeAccountSubscriber:()=>G});function G(o){return u.changeAccountSubscriber(o).build()}t(G,"changeAccountSubscriber");var O={};n(O,{recommended:()=>q});function m(o){let[,e]=o.state();e("connecting",!1)}t(m,"intoConnectionFinished");var A=[["connect",m]];var q=[...A];var V={};n(V,{recommended:()=>re});import{createStore as ht}from"zustand/vanilla";import{produce as Qe}from"immer";import{produce as nt}from"immer";var s=class{static{t(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#r=new Map;#o=new Map;#n;constructor(e){this.name=e}and(e){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(e),this}or(e){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(e),this}before(e){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(e),this}after(e){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(e),this}action(e){return this.#n=e,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#o,after:this.#r,and:this.#e,or:this.#t}}};import*as $t from"caip";var c=class{static{t(this,"ChangeAccountSubscriberBuilder")}#e=null;#t=null;#r=null;#o=null;#n=null;getInstance(e){return this.#e=e,this}format(e){return this.#t=e,this}onSwitchAccount(e){return this.#r=e,this}addEventListener(e){return this.#o=e,this}removeEventListener(e){return this.#n=e,this}build(){if(this.#e===null)throw new Error(this.#s("getInstance"));if(this.#t===null)throw new Error(this.#s("format"));if(this.#o===null)throw new Error(this.#s("addEventListener"));if(this.#n===null)throw new Error(this.#s("removeEventListener"));let e=this.#e,r=this.#t,M=this.#o,
|
|
1
|
+
var I=Object.defineProperty;var t=(o,e)=>I(o,"name",{value:e,configurable:!0});var n=(o,e)=>{for(var r in e)I(o,r,{get:e[r],enumerable:!0})};var j={};n(j,{canEagerConnect:()=>z,connect:()=>Y,recommended:()=>$});function T(o){let[,e]=o.state();e("network",null),e("accounts",null),e("connected",!1),e("connecting",!1),e("connectArgs",null)}t(T,"disconnect");var k=[["disconnect",T]];var R={};n(R,{formatAccountsToCAIP:()=>a,getAccounts:()=>x});import{AccountId as B}from"caip";var S="solana",g="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";async function x(o){let e=await o.connect();return{accounts:[e?e.publicKey.toString():o.publicKey.toString()],chainId:"SOLANA"}}t(x,"getAccounts");function a(o){return o.map(e=>B.format({address:e.toString(),chainId:{namespace:S,reference:g}}))}t(a,"formatAccountsToCAIP");var $=[...k];function Y(o){return async()=>{let e=o(),r=await x(e);if(Array.isArray(r))throw new Error("Expecting solana response to be a single value, not an array.");return a(r.accounts)}}t(Y,"connect");function z(o){return async()=>{let e=o();if(!e)throw new Error("Trying to eagerly connect to your Solana wallet, but seems its instance is not available.");try{return!!await e.connect({onlyIfTrusted:!0})}catch{return!1}}}t(z,"canEagerConnect");var K={};n(K,{changeAccountSubscriber:()=>G});function G(o){return u.changeAccountSubscriber(o).build()}t(G,"changeAccountSubscriber");var O={};n(O,{recommended:()=>q});function m(o){let[,e]=o.state();e("connecting",!1)}t(m,"intoConnectionFinished");var A=[["connect",m]];var q=[...A];var V={};n(V,{recommended:()=>re});import{createStore as ht}from"zustand/vanilla";import{produce as Qe}from"immer";import{produce as nt}from"immer";var s=class{static{t(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#r=new Map;#o=new Map;#n;constructor(e){this.name=e}and(e){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(e),this}or(e){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(e),this}before(e){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(e),this}after(e){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(e),this}action(e){return this.#n=e,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#o,after:this.#r,and:this.#e,or:this.#t}}};import*as $t from"caip";var c=class{static{t(this,"ChangeAccountSubscriberBuilder")}#e=null;#t=null;#r=null;#o=null;#n=null;getInstance(e){return this.#e=e,this}format(e){return this.#t=e,this}onSwitchAccount(e){return this.#r=e,this}addEventListener(e){return this.#o=e,this}removeEventListener(e){return this.#n=e,this}build(){if(this.#e===null)throw new Error(this.#s("getInstance"));if(this.#t===null)throw new Error(this.#s("format"));if(this.#o===null)throw new Error(this.#s("addEventListener"));if(this.#n===null)throw new Error(this.#s("removeEventListener"));let e=this.#e,r=this.#t,M=this.#o,H=this.#n,U=this.#r,l,d;return[async v=>{let[,y]=v.state(),i=e();if(!i)throw new Error("Trying to subscribe to your wallet, but seems its instance is not available.");l=t(async E=>{let N=!0;U?.({payload:E,preventDefault:()=>{N=!1}},v),N&&y("accounts",await r(i,E))},"subscriber"),d=M(i,l)},(v,y)=>{d&&typeof d=="function"&&d();let i=e();return H(i,l),y}]}#s(e){return`Required "${e}" operation has not been set for "changeAccountSubscriber"`}};import{AccountId as oe}from"caip";function D(o){try{return oe.parse(o),!0}catch{return!1}}t(D,"isValidCaipAddress");function p(o,e){if(!e.every(D))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${e}`);let[,r]=o.state();return r("accounts",e),r("connected",!0),e}t(p,"connectAndUpdateStateForSingleNetwork");function h(o){let[,e]=o.state();e("connecting",!0)}t(h,"intoConnecting");var w=[["connect",h]];var re=[["connect",p]];var W={};n(W,{recommended:()=>ne});var ne=[...w];var u={};n(u,{changeAccountSubscriber:()=>ie,connect:()=>se});var se=t(()=>new s("connect").and(p).before(h).after(m),"connect"),ie=t(o=>new c().getInstance(o).onSwitchAccount((e,r)=>{e.payload||(r.action("disconnect"),e.preventDefault())}).format(async(e,r)=>a([r])).addEventListener((e,r)=>{e.on("accountChanged",r)}).removeEventListener((e,r)=>{e.off("accountChanged",r)}),"changeAccountSubscriber");export{S as CAIP_NAMESPACE,g as CAIP_SOLANA_CHAIN_ID,j as actions,O as after,V as and,W as before,u as builders,K as hooks,R as utils};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var t=(
|
|
1
|
+
var y=Object.defineProperty;var t=(o,e)=>y(o,"name",{value:e,configurable:!0});var s=(o,e)=>{for(var n in e)y(o,n,{get:e[n],enumerable:!0})};var x={};s(x,{canEagerConnect:()=>R,recommended:()=>k});function S(o){let[,e]=o.state();e("network",null),e("accounts",null),e("connected",!1),e("connecting",!1),e("connectArgs",null)}t(S,"disconnect");var g=[["disconnect",S]];var k=[...g];function R(o){return async()=>{let e=o();if(!e)throw new Error("Trying to eagerly connect to your Starknet wallet, but seems its instance is not available.");return e.isPreauthorized()}}t(R,"canEagerConnect");var A={};s(A,{recommended:()=>K});function a(o){let[,e]=o.state();e("connecting",!1)}t(a,"intoConnectionFinished");var d=[["connect",a]];var K=[...d];var E={};s(E,{recommended:()=>M});import{createStore as ze}from"zustand/vanilla";import{produce as Re}from"immer";import{produce as De}from"immer";var r=class{static{t(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#o=new Map;#r=new Map;#n;constructor(e){this.name=e}and(e){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(e),this}or(e){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(e),this}before(e){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(e),this}after(e){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(e),this}action(e){return this.#n=e,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#r,after:this.#o,and:this.#e,or:this.#t}}};import*as Ct from"caip";import{AccountId as W}from"caip";function C(o){try{return W.parse(o),!0}catch{return!1}}t(C,"isValidCaipAddress");function i(o,e){if(!e.every(C))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${e}`);let[,n]=o.state();return n("accounts",e),n("connected",!0),e}t(i,"connectAndUpdateStateForSingleNetwork");function p(o){let[,e]=o.state();e("connecting",!0)}t(p,"intoConnecting");var h=[["connect",p]];var M=[["connect",i]];var w={};s(w,{recommended:()=>H});var H=[...h];var N={};s(N,{canEagerConnect:()=>B,connect:()=>U});var U=t(()=>new r("connect").and(i).before(p).after(a),"connect"),B=t(()=>new r("canEagerConnect"),"canEagerConnect");var T={};s(T,{formatAccountsToCAIP:()=>Y,getAccounts:()=>$});import{AccountId as L}from"caip";var l="starknet",v="SN_MAIN";async function $(o){let e=await o.connect();return{accounts:[e?e.publicKey.toString():o.publicKey.toString()],chainId:"STARKNET"}}t($,"getAccounts");function Y(o){return o.map(e=>L.format({address:e.toString(),chainId:{namespace:l,reference:v}}))}t(Y,"formatAccountsToCAIP");export{l as CAIP_NAMESPACE,v as CAIP_STARKNET_CHAIN_ID,x as actions,A as after,E as and,w as before,N as builders,T as utils};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var e=(o,t)=>y(o,"name",{value:t,configurable:!0});var n=(o,t)=>{for(var s in t)y(o,s,{get:t[s],enumerable:!0})};var S={};n(S,{recommended:()=>R});function g(o){let[,t]=o.state();t("network",null),t("accounts",null),t("connected",!1),t("connecting",!1),t("connectArgs",null)}e(g,"disconnect");var x=[["disconnect",g]];var R=[...x];var A={};n(A,{recommended:()=>O});function a(o){let[,t]=o.state();t("connecting",!1)}e(a,"intoConnectionFinished");var m=[["connect",a]];var O=[...m];var w={};n(w,{recommended:()=>M});import{createStore as Ye}from"zustand/vanilla";import{produce as ke}from"immer";import{produce as je}from"immer";var r=class{static{e(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#o=new Map;#r=new Map;#n;constructor(t){this.name=t}and(t){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(t),this}or(t){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(t),this}before(t){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(t),this}after(t){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(t),this}action(t){return this.#n=t,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#r,after:this.#o,and:this.#e,or:this.#t}}};import*as Ct from"caip";import{AccountId as W}from"caip";function P(o){try{return W.parse(o),!0}catch{return!1}}e(P,"isValidCaipAddress");function i(o,t){if(!t.every(P))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${t}`);let[,s]=o.state();return s("accounts",t),s("connected",!0),t}e(i,"connectAndUpdateStateForSingleNetwork");function p(o){let[,t]=o.state();t("connecting",!0)}e(p,"intoConnecting");var l=[["connect",p]];var M=[["connect",i]];var E={};n(E,{recommended:()=>H});var H=[...l];var N={};n(N,{canEagerConnect:()=>
|
|
1
|
+
var y=Object.defineProperty;var e=(o,t)=>y(o,"name",{value:t,configurable:!0});var n=(o,t)=>{for(var s in t)y(o,s,{get:t[s],enumerable:!0})};var S={};n(S,{recommended:()=>R});function g(o){let[,t]=o.state();t("network",null),t("accounts",null),t("connected",!1),t("connecting",!1),t("connectArgs",null)}e(g,"disconnect");var x=[["disconnect",g]];var R=[...x];var A={};n(A,{recommended:()=>O});function a(o){let[,t]=o.state();t("connecting",!1)}e(a,"intoConnectionFinished");var m=[["connect",a]];var O=[...m];var w={};n(w,{recommended:()=>M});import{createStore as Ye}from"zustand/vanilla";import{produce as ke}from"immer";import{produce as je}from"immer";var r=class{static{e(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#o=new Map;#r=new Map;#n;constructor(t){this.name=t}and(t){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(t),this}or(t){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(t),this}before(t){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(t),this}after(t){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(t),this}action(t){return this.#n=t,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#r,after:this.#o,and:this.#e,or:this.#t}}};import*as Ct from"caip";import{AccountId as W}from"caip";function P(o){try{return W.parse(o),!0}catch{return!1}}e(P,"isValidCaipAddress");function i(o,t){if(!t.every(P))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${t}`);let[,s]=o.state();return s("accounts",t),s("connected",!0),t}e(i,"connectAndUpdateStateForSingleNetwork");function p(o){let[,t]=o.state();t("connecting",!0)}e(p,"intoConnecting");var l=[["connect",p]];var M=[["connect",i]];var E={};n(E,{recommended:()=>H});var H=[...l];var N={};n(N,{canEagerConnect:()=>B,connect:()=>U});var U=e(()=>new r("connect").and(i).before(p).after(a),"connect"),B=e(()=>new r("canEagerConnect"),"canEagerConnect");var I={};n(I,{formatAccountsToCAIP:()=>Y,isTronNamespace:()=>T});import{getNamespaceFromCaip2ChainId as L}from"@hub3js/std/utils";import{AccountId as $}from"caip";var d="tron",v="tron";function T(o){return L(o)===d}e(T,"isTronNamespace");function Y(o){return o.map(t=>$.format({address:t.toString(),chainId:{namespace:d,reference:v}}))}e(Y,"formatAccountsToCAIP");export{d as CAIP_NAMESPACE,v as CAIP_TRON_CHAIN_ID,S as actions,A as after,w as and,E as before,N as builders,T as isTronNamespace,I as utils};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=Object.defineProperty;var e=(o,t)=>v(o,"name",{value:t,configurable:!0});var s=(o,t)=>{for(var r in t)v(o,r,{get:t[r],enumerable:!0})};var
|
|
1
|
+
var v=Object.defineProperty;var e=(o,t)=>v(o,"name",{value:t,configurable:!0});var s=(o,t)=>{for(var r in t)v(o,r,{get:t[r],enumerable:!0})};var S={};s(S,{recommended:()=>k});function y(o){let[,t]=o.state();t("network",null),t("accounts",null),t("connected",!1),t("connecting",!1),t("connectArgs",null)}e(y,"disconnect");var x=[["disconnect",y]];var k=[...x];var g={};s(g,{recommended:()=>_});function a(o){let[,t]=o.state();t("connecting",!1)}e(a,"intoConnectionFinished");var m=[["connect",a]];var _=[...m];var P={};s(P,{recommended:()=>H});import{createStore as Ze}from"zustand/vanilla";import{produce as Re}from"immer";import{produce as He}from"immer";var n=class{static{e(this,"ActionBuilder")}name;#e=new Map;#t=new Map;#o=new Map;#r=new Map;#n;constructor(t){this.name=t}and(t){return this.#e.has(this.name)||this.#e.set(this.name,[]),this.#e.get(this.name)?.push(t),this}or(t){return this.#t.has(this.name)||this.#t.set(this.name,[]),this.#t.get(this.name)?.push(t),this}before(t){return this.#r.has(this.name)||this.#r.set(this.name,[]),this.#r.get(this.name)?.push(t),this}after(t){return this.#o.has(this.name)||this.#o.set(this.name,[]),this.#o.get(this.name)?.push(t),this}action(t){return this.#n=t,this}build(){if(!this.#n)throw new Error("Your action builder should includes an action.");return{actionName:this.name,action:this.#n,before:this.#r,after:this.#o,and:this.#e,or:this.#t}}};import*as wt from"caip";import{AccountId as V}from"caip";function b(o){try{return V.parse(o),!0}catch{return!1}}e(b,"isValidCaipAddress");function i(o,t){if(!t.every(b))throw new Error(`Your provider should format account addresses in CAIP-10 format. Your provided accounts: ${t}`);let[,r]=o.state();return r("accounts",t),r("connected",!0),t}e(i,"connectAndUpdateStateForSingleNetwork");function p(o){let[,t]=o.state();t("connecting",!0)}e(p,"intoConnecting");var l=[["connect",p]];var H=[["connect",i]];var E={};s(E,{recommended:()=>W});var W=[...l];var w={};s(w,{connect:()=>M});var M=e(()=>new n("connect").and(i).before(p).after(a),"connect");var I={};s(I,{formatAccountsToCAIP:()=>Z,isUtxoNamespace:()=>N});import{getNamespaceFromCaip2ChainId as z}from"@hub3js/std/utils";import{AccountId as G}from"caip";var d="bip122",U="000000000019d6689c085ae165831e93",B="zcash",L="12a765e31ffd4059bada1e25190f6e98",$="1a91e3dace36e2be3bf030a65679fe82",Y="000000000000000000651ef99cb9fcbe";function N(o){return z(o)===d}e(N,"isUtxoNamespace");function Z(o,t){return o.map(r=>G.format({address:r.toString(),chainId:{namespace:d,reference:t}}))}e(Z,"formatAccountsToCAIP");export{Y as CAIP_BITCOINCASH_CHAIN_ID,U as CAIP_BITCOIN_CHAIN_ID,$ as CAIP_DOGECOIN_CHAIN_ID,L as CAIP_LITECOIN_CHAIN_ID,d as CAIP_NAMESPACE,B as CAIP_ZCASH_CHAIN_ID,S as actions,g as after,P as and,E as before,w as builders,N as isUtxoNamespace,I as utils};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
package/dist/utils/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var s=Object.defineProperty;var n=(e,r)=>s(e,"name",{value:r,configurable:!0});import*as
|
|
1
|
+
var s=Object.defineProperty;var n=(e,r)=>s(e,"name",{value:r,configurable:!0});import*as l from"caip";function t(e,r){return`${e}$$${r}`}n(t,"generateStoreId");function v(e,r){if(!r)throw new Error("You should provide a valid semver, e.g 1.0.0.");let o=e.find(([i])=>i===r);if(!o)throw new Error(`You target version hasn't been found. Available versions: ${Object.keys(e).join(", ")}`);return o}n(v,"pickVersion");function u(){let e=[],r={version:(o,i)=>(e.push([o,i]),r),build:()=>e};return r}n(u,"defineVersions");export{l as CAIP,u as defineVersions,t as generateStoreId,v as pickVersion};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
package/dist/utils/mod.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/mod.ts", "../../src/hub/helpers.ts", "../../src/utils/versions.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * It is not a good idea to re-export all of CAIP because if they have a breaking change, we will break as well.\n * It would be better to create an abstraction over them and export our own interface to ensure it is under our control.\n */\nexport * as CAIP from 'caip';\n\nexport { generateStoreId } from '../hub/helpers.js';\nexport * from './versions.js';\n", "/**\n * Note: This only works native async, if we are going to support for old transpilers like Babel.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isAsync(fn: Function) {\n return fn.constructor.name === 'AsyncFunction';\n}\n\nexport function generateStoreId(providerId: string, namespace: string) {\n return `${providerId}$$${namespace}`;\n}\n", "import type { Provider } from '../hub/mod.js';\
|
|
5
|
-
"mappings": "+EAIA,UAAYA,MAAU,OCIf,SAASC,EAAgBC,EAAoBC,EAAmB,CACrE,MAAO,GAAGD,CAAU,KAAKC,CAAS,EACpC,CAFgBC,EAAAH,EAAA,
|
|
6
|
-
"names": ["CAIP", "generateStoreId", "providerId", "namespace", "__name", "pickVersion", "list", "targetVersion", "target", "version", "__name", "defineVersions", "versions", "api", "semver", "value"
|
|
4
|
+
"sourcesContent": ["/*\n * It is not a good idea to re-export all of CAIP because if they have a breaking change, we will break as well.\n * It would be better to create an abstraction over them and export our own interface to ensure it is under our control.\n */\nexport * as CAIP from 'caip';\n\nexport { generateStoreId } from '../hub/helpers.js';\nexport * from './versions.js';\n", "/**\n * Note: This only works native async, if we are going to support for old transpilers like Babel.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isAsync(fn: Function) {\n return fn.constructor.name === 'AsyncFunction';\n}\n\nexport function generateStoreId(providerId: string, namespace: string) {\n return `${providerId}$$${namespace}`;\n}\n", "import type { Provider } from '../hub/mod.js';\n\ntype AvailableVersionedProviders = ['1.0.0', Provider];\nexport type VersionedProviders = AvailableVersionedProviders[];\nexport type VersionInterface<T extends AvailableVersionedProviders> = T[1];\n\ntype SemVer<T extends AvailableVersionedProviders> = T[0];\ntype MatchVersion<T extends VersionedProviders, Version> = Extract<\n T[number],\n [Version, AvailableVersionedProviders[1]]\n>;\n\nexport function pickVersion<\n L extends VersionedProviders,\n V extends SemVer<VersionedProviders[number]>\n>(list: L, targetVersion: V): MatchVersion<L, V> {\n if (!targetVersion) {\n throw new Error(`You should provide a valid semver, e.g 1.0.0.`);\n }\n\n const target = list.find(([version]) => version === targetVersion);\n\n if (!target) {\n throw new Error(\n `You target version hasn't been found. Available versions: ${Object.keys(\n list\n ).join(', ')}`\n );\n }\n return target as MatchVersion<L, V>;\n}\n\ninterface DefineVersionsApi {\n version: <T extends SemVer<VersionedProviders[number]>>(\n semver: T,\n value: VersionInterface<MatchVersion<VersionedProviders, T>>\n ) => DefineVersionsApi;\n build: () => VersionedProviders;\n}\n\nexport function defineVersions(): DefineVersionsApi {\n const versions: VersionedProviders = [];\n const api: DefineVersionsApi = {\n version: (semver, value) => {\n versions.push([semver, value]);\n return api;\n },\n build: () => {\n return versions;\n },\n };\n return api;\n}\n"],
|
|
5
|
+
"mappings": "+EAIA,UAAYA,MAAU,OCIf,SAASC,EAAgBC,EAAoBC,EAAmB,CACrE,MAAO,GAAGD,CAAU,KAAKC,CAAS,EACpC,CAFgBC,EAAAH,EAAA,mBCIT,SAASI,EAGdC,EAASC,EAAsC,CAC/C,GAAI,CAACA,EACH,MAAM,IAAI,MAAM,+CAA+C,EAGjE,IAAMC,EAASF,EAAK,KAAK,CAAC,CAACG,CAAO,IAAMA,IAAYF,CAAa,EAEjE,GAAI,CAACC,EACH,MAAM,IAAI,MACR,6DAA6D,OAAO,KAClEF,CACF,EAAE,KAAK,IAAI,CAAC,EACd,EAEF,OAAOE,CACT,CAlBgBE,EAAAL,EAAA,eA4BT,SAASM,GAAoC,CAClD,IAAMC,EAA+B,CAAC,EAChCC,EAAyB,CAC7B,QAAS,CAACC,EAAQC,KAChBH,EAAS,KAAK,CAACE,EAAQC,CAAK,CAAC,EACtBF,GAET,MAAO,IACED,CAEX,EACA,OAAOC,CACT,CAZgBH,EAAAC,EAAA",
|
|
6
|
+
"names": ["CAIP", "generateStoreId", "providerId", "namespace", "__name", "pickVersion", "list", "targetVersion", "target", "version", "__name", "defineVersions", "versions", "api", "semver", "value"]
|
|
7
7
|
}
|
package/dist/utils/versions.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { Provider } from '../hub/mod.js';
|
|
2
|
-
|
|
3
|
-
type LegacyVersioned = ['0.0.0', LegacyProviderInterface];
|
|
4
|
-
type HubVersioned = ['1.0.0', Provider];
|
|
5
|
-
type AvailableVersionedProviders = LegacyVersioned | HubVersioned;
|
|
2
|
+
type AvailableVersionedProviders = ['1.0.0', Provider];
|
|
6
3
|
export type VersionedProviders = AvailableVersionedProviders[];
|
|
7
|
-
export type VersionInterface<T extends AvailableVersionedProviders
|
|
8
|
-
type SemVer<T extends
|
|
4
|
+
export type VersionInterface<T extends AvailableVersionedProviders> = T[1];
|
|
5
|
+
type SemVer<T extends AvailableVersionedProviders> = T[0];
|
|
9
6
|
type MatchVersion<T extends VersionedProviders, Version> = Extract<T[number], [
|
|
10
7
|
Version,
|
|
11
|
-
|
|
8
|
+
AvailableVersionedProviders[1]
|
|
12
9
|
]>;
|
|
13
10
|
export declare function pickVersion<L extends VersionedProviders, V extends SemVer<VersionedProviders[number]>>(list: L, targetVersion: V): MatchVersion<L, V>;
|
|
14
11
|
interface DefineVersionsApi {
|
|
@@ -16,6 +13,5 @@ interface DefineVersionsApi {
|
|
|
16
13
|
build: () => VersionedProviders;
|
|
17
14
|
}
|
|
18
15
|
export declare function defineVersions(): DefineVersionsApi;
|
|
19
|
-
export declare function legacyProviderImportsToVersionsInterface(provider: LegacyProviderInterface): VersionedProviders;
|
|
20
16
|
export {};
|
|
21
17
|
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/utils/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/utils/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,KAAK,2BAA2B,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACvD,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,EAAE,CAAC;AAC/D,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,2BAA2B,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3E,KAAK,MAAM,CAAC,CAAC,SAAS,2BAA2B,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D,KAAK,YAAY,CAAC,CAAC,SAAS,kBAAkB,EAAE,OAAO,IAAI,OAAO,CAChE,CAAC,CAAC,MAAM,CAAC,EACT;IAAC,OAAO;IAAE,2BAA2B,CAAC,CAAC,CAAC;CAAC,CAC1C,CAAC;AAEF,wBAAgB,WAAW,CACzB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,EAC5C,IAAI,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAe/C;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,EACpD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,gBAAgB,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,KACzD,iBAAiB,CAAC;IACvB,KAAK,EAAE,MAAM,kBAAkB,CAAC;CACjC;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAYlD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/wallets-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"types": "./dist/mod.d.ts",
|
|
12
12
|
"default": "./dist/mod.js"
|
|
13
13
|
},
|
|
14
|
-
"./legacy": {
|
|
15
|
-
"types": "./dist/legacy/mod.d.ts",
|
|
16
|
-
"default": "./dist/legacy/mod.js"
|
|
17
|
-
},
|
|
18
14
|
"./utils": {
|
|
19
15
|
"types": "./dist/utils/mod.d.ts",
|
|
20
16
|
"default": "./dist/utils/mod.js"
|
|
@@ -66,11 +62,10 @@
|
|
|
66
62
|
},
|
|
67
63
|
"files": [
|
|
68
64
|
"dist",
|
|
69
|
-
"src"
|
|
70
|
-
"legacy"
|
|
65
|
+
"src"
|
|
71
66
|
],
|
|
72
67
|
"scripts": {
|
|
73
|
-
"build": "yarn run rangutopia library build --inputs src/mod.ts,src/utils/mod.ts,src/
|
|
68
|
+
"build": "yarn run rangutopia library build --inputs src/mod.ts,src/utils/mod.ts,src/hub/store/mod.ts,src/namespaces/evm/mod.ts,src/namespaces/solana/mod.ts,src/namespaces/utxo/mod.ts,src/namespaces/sui/mod.ts,src/namespaces/tron/mod.ts,src/namespaces/starknet/mod.ts,src/namespaces/stellar/mod.ts,src/namespaces/xrpl/mod.ts,src/namespaces/common/mod.ts,src/namespaces/ton/mod.ts",
|
|
74
69
|
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
75
70
|
"clean": "rimraf dist",
|
|
76
71
|
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|
package/readme.md
CHANGED
|
@@ -24,7 +24,7 @@ Core package for handling web3 wallets supported by Rango
|
|
|
24
24
|
| `.../namespaces/ton` | `@hub3js/tvm` |
|
|
25
25
|
| `.../namespaces/xrpl` | `@hub3js/xrpl` |
|
|
26
26
|
| `.../namespaces/utxo` | `@hub3js/bip122` |
|
|
27
|
-
| `.../namespaces/tron
|
|
27
|
+
| `.../namespaces/tron` | Not migrated yet — still served from this package |
|
|
28
28
|
|
|
29
29
|
A couple of things worth noting:
|
|
30
30
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FindProxiedNamespace } from '../../builders/mod.js';
|
|
2
2
|
import type { Store } from '../../hub/mod.js';
|
|
3
|
-
import type { LegacyState } from '../../legacy/mod.js';
|
|
4
3
|
import type { EvmActions } from '../../namespaces/evm/mod.js';
|
|
5
4
|
import type { SolanaActions } from '../../namespaces/solana/mod.js';
|
|
6
5
|
import type { StarknetActions } from '../../namespaces/starknet/types.js';
|
|
@@ -17,10 +16,11 @@ export type Context = {
|
|
|
17
16
|
state: () => [GetState, SetState];
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
export type State =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
export type State = {
|
|
20
|
+
connected: boolean;
|
|
21
|
+
connecting: boolean;
|
|
22
|
+
installed: boolean;
|
|
23
|
+
};
|
|
24
24
|
export type SetState = <K extends keyof Pick<State, 'installed'>>(
|
|
25
25
|
name: K,
|
|
26
26
|
value: State[K]
|
package/src/mod.ts
CHANGED
|
@@ -29,7 +29,7 @@ export {
|
|
|
29
29
|
* Our `embedded` hasn't been migrated to NodeNext yet so it doesn't support `exports` field.
|
|
30
30
|
* There are two approach to make `NodeNext` which is used for our libs with old moduleResolution:
|
|
31
31
|
*
|
|
32
|
-
* 1. Use direct paths, e.g. '@rango-dev/wallets-core/dist/
|
|
32
|
+
* 1. Use direct paths, e.g. '@rango-dev/wallets-core/dist/utils/mod'
|
|
33
33
|
* 2. Add types and function that are using in `embedded` to package entry point (this file).
|
|
34
34
|
*
|
|
35
35
|
* The first one is better since we don't need to deprecate or having a breaking change in future,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Provider } from '../hub/mod.js';
|
|
2
|
+
|
|
1
3
|
import { describe, expect, test } from 'vitest';
|
|
2
4
|
|
|
3
5
|
import { defineVersions, pickVersion } from './versions.js';
|
|
@@ -11,8 +13,7 @@ describe('Picking versions should work correctly', () => {
|
|
|
11
13
|
|
|
12
14
|
test('Pick the correct version if it exist', () => {
|
|
13
15
|
const versions = defineVersions()
|
|
14
|
-
.version('
|
|
15
|
-
.version('1.0.0', {} as any)
|
|
16
|
+
.version('1.0.0', {} as Provider)
|
|
16
17
|
.build();
|
|
17
18
|
|
|
18
19
|
const target = pickVersion(versions, '1.0.0');
|
package/src/utils/versions.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { Provider } from '../hub/mod.js';
|
|
2
|
-
import type { LegacyProviderInterface } from '../legacy/mod.js';
|
|
3
2
|
|
|
4
|
-
type
|
|
5
|
-
type HubVersioned = ['1.0.0', Provider];
|
|
6
|
-
type AvailableVersionedProviders = LegacyVersioned | HubVersioned;
|
|
3
|
+
type AvailableVersionedProviders = ['1.0.0', Provider];
|
|
7
4
|
export type VersionedProviders = AvailableVersionedProviders[];
|
|
8
|
-
export type VersionInterface<T extends AvailableVersionedProviders
|
|
5
|
+
export type VersionInterface<T extends AvailableVersionedProviders> = T[1];
|
|
9
6
|
|
|
10
|
-
type SemVer<T extends
|
|
7
|
+
type SemVer<T extends AvailableVersionedProviders> = T[0];
|
|
11
8
|
type MatchVersion<T extends VersionedProviders, Version> = Extract<
|
|
12
9
|
T[number],
|
|
13
|
-
[Version,
|
|
10
|
+
[Version, AvailableVersionedProviders[1]]
|
|
14
11
|
>;
|
|
15
12
|
|
|
16
13
|
export function pickVersion<
|
|
@@ -54,9 +51,3 @@ export function defineVersions(): DefineVersionsApi {
|
|
|
54
51
|
};
|
|
55
52
|
return api;
|
|
56
53
|
}
|
|
57
|
-
|
|
58
|
-
export function legacyProviderImportsToVersionsInterface(
|
|
59
|
-
provider: LegacyProviderInterface
|
|
60
|
-
): VersionedProviders {
|
|
61
|
-
return defineVersions().version('0.0.0', provider).build();
|
|
62
|
-
}
|