@rango-dev/provider-phantom 0.63.1-next.1 → 0.63.1-next.3

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/mod.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  declare const versions: () => readonly [readonly ["1.0.0", import("@hub3js/core").Provider<Record<"solana", import("@hub3js/solana").SolanaActions> & Record<"evm", import("@hub3js/evm").EvmActions> & Record<"sui", import("@hub3js/sui").SuiActions>>]];
2
2
  export { versions };
3
+ export { WALLET_ID } from './constants.js';
3
4
  //# sourceMappingURL=mod.d.ts.map
package/dist/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,QAAQ,oOAC8C,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,QAAQ,oOAC8C,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/mod.js CHANGED
@@ -1,2 +1,2 @@
1
- var T=Object.defineProperty;var r=(o,n)=>T(o,"name",{value:n,configurable:!0});var H=(o,n)=>()=>(o&&(n=o(o=0)),n);var F=(o,n)=>{for(var t in n)T(o,t,{get:n[t],enumerable:!0})};var y={};F(y,{BTCSigner:()=>b});import*as z from"@bitcoinerlab/secp256k1";import{isBitcoinBlockchain as $}from"@rango-dev/wallets-shared";import*as h from"bitcoinjs-lib";import{SignerError as G}from"rango-types";function J(o){let n=atob(o),t=n.length,i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=n.charCodeAt(e);return i}var X,b,C=H(()=>{"use strict";X="https://go.getblock.io/f37bad28a991436483c0a3679a3acbee";r(J,"base64ToUint8Array");b=class{static{r(this,"BTCSigner")}provider;constructor(n){this.provider=n}async signMessage(){throw G.UnimplementedError("signMessage")}async signAndSendTx(n){let{asset:t,psbt:i}=n;if(!i)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");if(!$(t.blockchain))throw new Error(`Signing ${t.blockchain} transaction is not implemented by the signer.`);h.initEccLib(z);let e=await this.provider.signPSBT(J(i.unsignedPsbtBase64),{inputsToSign:i.inputsToSign}),a=h.Psbt.fromBuffer(Buffer.from(e));a.finalizeAllInputs();let P=a.extractTransaction().toHex(),d=await fetch(X,{method:"POST",body:JSON.stringify({method:"sendrawtransaction",params:[P]})});if(!d.ok){let c=await d.text();throw new Error(`Error broadcasting transaction: ${c}`)}let m=await d.json();if(!m.result)throw new Error(`Error broadcasting transaction. Error Code ${m.error.code}: ${m.error.message}`);return{hash:m.result}}}});import{defineVersions as Ro}from"@hub3js/core/utils";import{ProviderBuilder as Uo}from"@hub3js/core";import{CAIP_BASE_CHAIN_ID as to,CAIP_ETHEREUM_CHAIN_ID as ro,CAIP_POLYGON_CHAIN_ID as eo,isEvmNamespace as io}from"@hub3js/evm";import{isSolanaNamespace as ao}from"@hub3js/solana";import{getChainIdFromCaip2ChainId as so}from"@hub3js/std/utils";import{isSuiNamespace as co}from"@hub3js/sui";import{EVM_NAMESPACE as Y,SOLANA_NAMESPACE as q,UTXO_NAMESPACE as K}from"@hub3js/namespaces";import{getInstance as Q}from"@hub3js/sui";import{dynamicImportWithRefinedError as g,getNetworkInstance as w}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as Z,TransactionType as A}from"rango-types";async function v(o){let n=w(o,q),t=w(o,Y),i=w(o,K),e=Q(u),{DefaultEvmSigner:a}=await g(async()=>await import("@rango-dev/signer-evm")),{DefaultSolanaSigner:P}=await g(async()=>await import("@rango-dev/signer-solana")),{BTCSigner:d}=await g(async()=>await Promise.resolve().then(()=>(C(),y))),{DefaultSuiSigner:m}=await g(async()=>await import("@rango-dev/signer-sui")),c=new Z;return c.registerSigner(A.SOLANA,new P(n)),c.registerSigner(A.EVM,new a(t)),c.registerSigner(A.TRANSFER,new d(i)),e&&c.registerSigner(A.SUI,new m(e)),c}r(v,"getSigners");import{EVM_NAMESPACE as I,SOLANA_NAMESPACE as N,SUI_NAMESPACE as oo,UTXO_NAMESPACE as no}from"@hub3js/namespaces";function l(){let{phantom:o}=window;if(!o)return null;let{solana:n,ethereum:t,bitcoin:i,sui:e}=o,a=new Map;return t&&t.isPhantom&&a.set(I,t),n&&n.isPhantom&&a.set(N,n),i&&i.isPhantom&&a.set(no,i),e&&e.isPhantom&&a.set(oo,e),a}r(l,"phantom");function _(){let o=l();if(!o)throw new Error("Phantom is not injected. Please check your wallet.");return o}r(_,"getInstanceOrThrow");function f(){let n=l()?.get(I);if(!n)throw new Error("Phantom not injected or EVM not enabled. Please check your wallet.");return n}r(f,"evmPhantom");function p(){let n=l()?.get(N);if(!n)throw new Error("Phantom not injected or Solana not enabled. Please check your wallet.");return n}r(p,"solanaPhantom");var mo=[ro,eo,to],s="phantom",u="Phantom",x={name:"Phantom",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg",extensions:{chrome:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",homepage:"https://phantom.app/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",isChainSupported:o=>io(o)&&mo.includes(so(o))},{label:"Solana",value:"Solana",id:"SOLANA",isChainSupported:ao},{label:"Sui",value:"Sui",id:"SUI",isChainSupported:co}]}},{name:"signers",value:{getSigners:async()=>v(_())}}]};import{NamespaceBuilder as po}from"@hub3js/core";import{actions as S,builders as E,hooks as uo}from"@hub3js/evm";import*as L from"@hub3js/std/builders";import{standardizeAndThrowError as lo}from"@hub3js/std/operators";var[fo,B]=uo.changeAccountSubscriber(f),ho=E.connect().action(S.connect(f)).before(fo).or(B).or(lo).build(),go=L.disconnect().after(B).build(),Ao=E.canEagerConnect().action(S.canEagerConnect(f)).build(),So=E.canSwitchNetwork().action(S.canSwitchNetwork()).build(),Eo=E.getChainId().action(S.getChainId(f)).build(),M=new po("EVM",s).action(ho).action(go).action(Ao).action(So).action(Eo).build();import{ActionBuilder as Po,NamespaceBuilder as bo}from"@hub3js/core";import{actions as k,builders as wo,hooks as vo}from"@hub3js/solana";import*as D from"@hub3js/std/builders";import{standardizeAndThrowError as To}from"@hub3js/std/operators";var[yo,j]=vo.changeAccountSubscriber(p),Co=wo.connect().action(k.connect(p)).before(yo).or(j).or(To).build(),Io=D.disconnect().after(j).build(),No=new Po("canEagerConnect").action(k.canEagerConnect(p)).build(),O=new bo("Solana",s).action(Co).action(Io).action(No).build();import{ActionBuilder as _o,NamespaceBuilder as xo}from"@hub3js/core";import{actions as Lo}from"@hub3js/solana";import*as W from"@hub3js/std/builders";import{standardizeAndThrowError as Bo}from"@hub3js/std/operators";import{builders as Mo,hooks as ko}from"@hub3js/sui";var[Do,U]=ko.changeAccountSubscriber({name:u}),jo=Mo.connect({name:u}).before(Do).or(U).or(Bo).build(),Oo=W.disconnect().after(U).build(),Wo=new _o("canEagerConnect").action(Lo.canEagerConnect(p)).build(),R=new xo("Sui",s).action(jo).action(Oo).action(Wo).build();var V=r(()=>new Uo(s).init(function(o){let[,n]=o.state();l()&&(n("installed",!0),console.debug("[phantom] instance detected.",o))}).config("metadata",x).add("solana",O).add("evm",M).add("sui",R).build(),"buildProvider");var Wn=r(()=>Ro().version("1.0.0",V()).build(),"versions");export{Wn as versions};
1
+ var v=Object.defineProperty;var r=(n,o)=>v(n,"name",{value:o,configurable:!0});var V=(n,o)=>()=>(n&&(o=n(n=0)),o);var R=(n,o)=>{for(var t in o)v(n,t,{get:o[t],enumerable:!0})};var w={};R(w,{BTCSigner:()=>P});import*as H from"@bitcoinerlab/secp256k1";import{isBitcoinBlockchain as F}from"@rango-dev/internal-blockchains";import*as A from"bitcoinjs-lib";import{SignerError as z}from"rango-types";function G(n){let o=atob(n),t=o.length,e=new Uint8Array(t);for(let i=0;i<t;i++)e[i]=o.charCodeAt(i);return e}var $,P,T=V(()=>{"use strict";$="https://go.getblock.io/f37bad28a991436483c0a3679a3acbee";r(G,"base64ToUint8Array");P=class{static{r(this,"BTCSigner")}provider;constructor(o){this.provider=o}async signMessage(){throw z.UnimplementedError("signMessage")}async signAndSendTx(o){let{asset:t,psbt:e}=o;if(!e)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");if(!F(t.blockchain))throw new Error(`Signing ${t.blockchain} transaction is not implemented by the signer.`);A.initEccLib(H);let i=await this.provider.signPSBT(G(e.unsignedPsbtBase64),{inputsToSign:e.inputsToSign}),a=A.Psbt.fromBuffer(Buffer.from(i));a.finalizeAllInputs();let E=a.extractTransaction().toHex(),d=await fetch($,{method:"POST",body:JSON.stringify({method:"sendrawtransaction",params:[E]})});if(!d.ok){let c=await d.text();throw new Error(`Error broadcasting transaction: ${c}`)}let m=await d.json();if(!m.result)throw new Error(`Error broadcasting transaction. Error Code ${m.error.code}: ${m.error.message}`);return{hash:m.result}}}});import{defineVersions as Uo}from"@hub3js/core/utils";import{ProviderBuilder as Oo}from"@hub3js/core";import{CAIP_BASE_CHAIN_ID as oo,CAIP_ETHEREUM_CHAIN_ID as no,CAIP_POLYGON_CHAIN_ID as to,isEvmNamespace as ro}from"@hub3js/evm";import{isSolanaNamespace as eo}from"@hub3js/solana";import{getChainIdFromCaip2ChainId as io}from"@hub3js/std/utils";import{isSuiNamespace as ao}from"@hub3js/sui";import{EVM_NAMESPACE as X,SOLANA_NAMESPACE as J,UTXO_NAMESPACE as Y}from"@hub3js/namespaces";import{getInstance as q}from"@hub3js/sui";import{DefaultSignerFactory as K,TransactionType as h}from"rango-types";async function b(n){let o=n.get(J),t=n.get(X),e=n.get(Y),i=q(l),{DefaultEvmSigner:a}=await import("@rango-dev/signer-evm"),{DefaultSolanaSigner:E}=await import("@rango-dev/signer-solana"),{BTCSigner:d}=await Promise.resolve().then(()=>(T(),w)),{DefaultSuiSigner:m}=await import("@rango-dev/signer-sui"),c=new K;return o&&c.registerSigner(h.SOLANA,new E(o)),t&&c.registerSigner(h.EVM,new a(t)),e&&c.registerSigner(h.TRANSFER,new d(e)),i&&c.registerSigner(h.SUI,new m(i)),c}r(b,"getSigners");import{EVM_NAMESPACE as C,SOLANA_NAMESPACE as I,SUI_NAMESPACE as Q,UTXO_NAMESPACE as Z}from"@hub3js/namespaces";function u(){let{phantom:n}=window;if(!n)return null;let{solana:o,ethereum:t,bitcoin:e,sui:i}=n,a=new Map;return t&&t.isPhantom&&a.set(C,t),o&&o.isPhantom&&a.set(I,o),e&&e.isPhantom&&a.set(Z,e),i&&i.isPhantom&&a.set(Q,i),a}r(u,"phantom");function y(){let n=u();if(!n)throw new Error("Phantom is not injected. Please check your wallet.");return n}r(y,"getInstanceOrThrow");function f(){let o=u()?.get(C);if(!o)throw new Error("Phantom not injected or EVM not enabled. Please check your wallet.");return o}r(f,"evmPhantom");function p(){let o=u()?.get(I);if(!o)throw new Error("Phantom not injected or Solana not enabled. Please check your wallet.");return o}r(p,"solanaPhantom");var so=[no,to,oo],s="phantom",l="Phantom",N={name:"Phantom",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg",extensions:{chrome:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",homepage:"https://phantom.app/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",isChainSupported:n=>ro(n)&&so.includes(io(n))},{label:"Solana",value:"Solana",id:"SOLANA",isChainSupported:eo},{label:"Sui",value:"Sui",id:"SUI",isChainSupported:ao}]}},{name:"signers",value:{getSigners:async()=>b(y())}}]};import{NamespaceBuilder as co}from"@hub3js/core";import{actions as g,builders as S,hooks as mo}from"@hub3js/evm";import*as _ from"@hub3js/std/builders";import{standardizeAndThrowError as po}from"@hub3js/std/operators";var[lo,x]=mo.changeAccountSubscriber(f),uo=S.connect().action(g.connect(f)).before(lo).or(x).or(po).build(),fo=_.disconnect().after(x).build(),Ao=S.canEagerConnect().action(g.canEagerConnect(f)).build(),ho=S.canSwitchNetwork().action(g.canSwitchNetwork()).build(),go=S.getChainId().action(g.getChainId(f)).build(),L=new co("EVM",s).action(uo).action(fo).action(Ao).action(ho).action(go).build();import{ActionBuilder as So,NamespaceBuilder as Eo}from"@hub3js/core";import{actions as M,builders as Po,hooks as bo}from"@hub3js/solana";import*as B from"@hub3js/std/builders";import{standardizeAndThrowError as vo}from"@hub3js/std/operators";var[wo,j]=bo.changeAccountSubscriber(p),To=Po.connect().action(M.connect(p)).before(wo).or(j).or(vo).build(),Co=B.disconnect().after(j).build(),Io=new So("canEagerConnect").action(M.canEagerConnect(p)).build(),D=new Eo("Solana",s).action(To).action(Co).action(Io).build();import{ActionBuilder as yo,NamespaceBuilder as No}from"@hub3js/core";import{actions as _o}from"@hub3js/solana";import*as k from"@hub3js/std/builders";import{standardizeAndThrowError as xo}from"@hub3js/std/operators";import{builders as Lo,hooks as Mo}from"@hub3js/sui";var[Bo,O]=Mo.changeAccountSubscriber({name:l}),jo=Lo.connect({name:l}).before(Bo).or(O).or(xo).build(),Do=k.disconnect().after(O).build(),ko=new yo("canEagerConnect").action(_o.canEagerConnect(p)).build(),U=new No("Sui",s).action(jo).action(Do).action(ko).build();var W=r(()=>new Oo(s).init(function(n){let[,o]=n.state();u()&&(o("installed",!0),console.debug("[phantom] instance detected.",n))}).config("metadata",N).add("solana",D).add("evm",L).add("sui",U).build(),"buildProvider");var Dn=r(()=>Uo().version("1.0.0",W()).build(),"versions");export{s as WALLET_ID,Dn as versions};
2
2
  //# sourceMappingURL=mod.js.map
package/dist/mod.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/signers/utxoSigner.ts", "../src/mod.ts", "../src/provider.ts", "../src/constants.ts", "../src/signer.ts", "../src/utils.ts", "../src/namespaces/evm.ts", "../src/namespaces/solana.ts", "../src/namespaces/sui.ts"],
4
- "sourcesContent": ["import type { GenericSigner, Transfer } from 'rango-types';\n\nimport * as secp256k1 from '@bitcoinerlab/secp256k1';\nimport { isBitcoinBlockchain } from '@rango-dev/wallets-shared';\nimport * as bitcoin from 'bitcoinjs-lib';\nimport { SignerError } from 'rango-types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TransferExternalProvider = any;\n\nconst BTC_RPC_URL = 'https://go.getblock.io/f37bad28a991436483c0a3679a3acbee';\n\n// TODO: use Uint8Array.fromBase64() static method and use this function as a polyfill after updating TypeScript DOM lib\nfunction base64ToUint8Array(base64String: string) {\n const binaryString = atob(base64String);\n const length = binaryString.length;\n const uint8Array = new Uint8Array(length);\n\n for (let i = 0; i < length; i++) {\n uint8Array[i] = binaryString.charCodeAt(i);\n }\n\n return uint8Array;\n}\n\nexport class BTCSigner implements GenericSigner<Transfer> {\n private provider: TransferExternalProvider;\n constructor(provider: TransferExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: Transfer): Promise<{ hash: string }> {\n const { asset, psbt } = tx;\n\n if (!psbt) {\n throw new Error(\n 'No PSBT found to sign. Ensure a valid PSBT is provided.'\n );\n }\n\n if (!isBitcoinBlockchain(asset.blockchain)) {\n throw new Error(\n `Signing ${asset.blockchain} transaction is not implemented by the signer.`\n );\n }\n // Initialize ECC library\n bitcoin.initEccLib(secp256k1);\n\n const signedPSBTBytes = await this.provider.signPSBT(\n base64ToUint8Array(psbt.unsignedPsbtBase64),\n {\n inputsToSign: psbt.inputsToSign,\n }\n );\n\n // Finalize PSBT\n const finalPsbt = bitcoin.Psbt.fromBuffer(Buffer.from(signedPSBTBytes));\n finalPsbt.finalizeAllInputs();\n\n const finalPsbtBaseHex = finalPsbt.extractTransaction().toHex();\n\n // Broadcast PSBT to rpc node\n const response = await fetch(BTC_RPC_URL, {\n method: 'POST',\n body: JSON.stringify({\n method: 'sendrawtransaction',\n params: [finalPsbtBaseHex],\n }),\n });\n\n if (!response.ok) {\n // Handle network and fetch errors\n const errorText = await response.text();\n throw new Error(`Error broadcasting transaction: ${errorText}`);\n }\n\n const data = await response.json();\n\n if (!data.result) {\n // Handle Bitcoin specific errors\n throw new Error(\n `Error broadcasting transaction. Error Code ${data.error.code}: ${data.error.message}`\n );\n }\n\n return { hash: data.result };\n }\n}\n", "import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { solana } from './namespaces/solana.js';\nimport { sui } from './namespaces/sui.js';\nimport { phantom as phantomInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (phantomInstance()) {\n setState('installed', true);\n console.debug('[phantom] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('solana', solana)\n .add('evm', evm)\n .add('sui', sui)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_BASE_CHAIN_ID,\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n isEvmNamespace,\n} from '@hub3js/evm';\nimport { isSolanaNamespace } from '@hub3js/solana';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\nimport { isSuiNamespace } from '@hub3js/sui';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const EVM_SUPPORTED_CHAINS = [\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n CAIP_BASE_CHAIN_ID,\n];\n\nexport const WALLET_ID = 'phantom';\nexport const WALLET_NAME_IN_WALLET_STANDARD = 'Phantom';\n\nexport const metadata: ProviderMetadata = {\n name: 'Phantom',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n homepage: 'https://phantom.app/',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'multiple',\n data: [\n {\n label: 'EVM',\n value: 'EVM',\n id: 'ETH',\n isChainSupported: (chainId: string) =>\n isEvmNamespace(chainId) &&\n EVM_SUPPORTED_CHAINS.includes(\n getChainIdFromCaip2ChainId(chainId)\n ),\n },\n {\n label: 'Solana',\n value: 'Solana',\n id: 'SOLANA',\n isChainSupported: isSolanaNamespace,\n },\n {\n label: 'Sui',\n value: 'Sui',\n id: 'SUI',\n isChainSupported: isSuiNamespace,\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners(getInstanceOrThrow()) },\n },\n ],\n};\n", "import type { Provider } from './utils.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\nimport { getInstance as getSuiInstance } from '@hub3js/sui';\nimport {\n dynamicImportWithRefinedError,\n getNetworkInstance,\n} from '@rango-dev/wallets-shared';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const solProvider = getNetworkInstance(provider, SOLANA_NAMESPACE);\n const evmProvider = getNetworkInstance(provider, EVM_NAMESPACE);\n const bitcoinInstance = getNetworkInstance(provider, UTXO_NAMESPACE);\n\n const suiProvider = getSuiInstance(WALLET_NAME_IN_WALLET_STANDARD);\n\n const { DefaultEvmSigner } = await dynamicImportWithRefinedError(\n async () => await import('@rango-dev/signer-evm')\n );\n const { DefaultSolanaSigner } = await dynamicImportWithRefinedError(\n async () => await import('@rango-dev/signer-solana')\n );\n const { BTCSigner } = await dynamicImportWithRefinedError(\n async () => await import('./signers/utxoSigner.js')\n );\n const { DefaultSuiSigner } = await dynamicImportWithRefinedError(\n async () => await import('@rango-dev/signer-sui')\n );\n const signers = new DefaultSignerFactory();\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));\n signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));\n if (!!suiProvider) {\n signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiProvider));\n }\n return signers;\n}\n", "import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';\nimport type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n SUI_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\n\nexport type Provider = Map<string, unknown>;\n\nexport function phantom(): Provider | null {\n const { phantom } = window;\n\n if (!phantom) {\n return null;\n }\n\n const { solana, ethereum, bitcoin, sui } = phantom;\n\n const instances: Provider = new Map();\n\n if (ethereum && ethereum.isPhantom) {\n instances.set(EVM_NAMESPACE, ethereum);\n }\n\n if (solana && solana.isPhantom) {\n instances.set(SOLANA_NAMESPACE, solana);\n }\n\n if (bitcoin && bitcoin.isPhantom) {\n instances.set(UTXO_NAMESPACE, bitcoin);\n }\n if (sui && sui.isPhantom) {\n instances.set(SUI_NAMESPACE, sui);\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = phantom();\n\n if (!instances) {\n throw new Error('Phantom is not injected. Please check your wallet.');\n }\n\n return instances;\n}\n\nexport function evmPhantom(): EvmProviderApi {\n const instances = phantom();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Phantom not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance as EvmProviderApi;\n}\n\nexport function solanaPhantom(): SolanaProviderApi {\n const instance = phantom();\n const solanaInstance = instance?.get(SOLANA_NAMESPACE);\n\n if (!solanaInstance) {\n throw new Error(\n 'Phantom not injected or Solana not enabled. Please check your wallet.'\n );\n }\n\n return solanaInstance;\n}\n\nexport function bitcoinPhantom(): SolanaProviderApi {\n const instance = phantom();\n const bitcoinInstance = instance?.get(UTXO_NAMESPACE);\n\n if (!bitcoinInstance) {\n throw new Error(\n 'Phantom not injected or Bitcoin not enabled. Please check your wallet.'\n );\n }\n\n return bitcoinInstance;\n}\nexport function suiPhantom(): SuiProviderApi {\n const instance = phantom();\n const suiInstance = instance?.get(SUI_NAMESPACE);\n\n if (!suiInstance) {\n throw new Error(\n 'Phantom not injected or Sui not enabled. Please check your wallet.'\n );\n }\n\n return suiInstance as SuiProviderApi;\n}\n", "import type { EvmActions } from '@hub3js/evm';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/evm';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { evmPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(evmPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<EvmActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(actions.canEagerConnect(evmPhantom))\n .build();\n\nconst canSwitchNetwork = builders\n .canSwitchNetwork()\n .action(actions.canSwitchNetwork())\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmPhantom))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .action(canSwitchNetwork)\n .action(getChainId)\n .build();\n\nexport { evm };\n", "import type { SolanaActions } from '@hub3js/solana';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(solanaPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(solanaPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SolanaActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(actions.canEagerConnect(solanaPhantom))\n .build();\n\nconst solana = new NamespaceBuilder<SolanaActions>('Solana', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { solana };\n", "import type { SolanaActions } from '@hub3js/solana';\nimport type { SuiActions } from '@hub3js/sui';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions as solanaActions } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport { builders, hooks } from '@hub3js/sui';\n\nimport { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n });\n\nconst connect = builders\n .connect({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n })\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SuiActions>()\n .after(changeAccountCleanup)\n .build();\n\n/*\n * TODO: We are currently using `solanaCanEagerConnectAction` to establish an eager connection to the Sui instance.\n * This is a temporary workaround due to Phantom's limitation in silently connecting to a Sui account.\n * Once Phantom introduces support for silent Sui connections, this implementation should be updated accordingly.\n */\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(solanaActions.canEagerConnect(solanaPhantom))\n .build();\n\nconst sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { sui };\n"],
5
- "mappings": "gLAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAEA,UAAYC,MAAe,0BAC3B,OAAS,uBAAAC,MAA2B,4BACpC,UAAYC,MAAa,gBACzB,OAAS,eAAAC,MAAmB,cAQ5B,SAASC,EAAmBC,EAAsB,CAChD,IAAMC,EAAe,KAAKD,CAAY,EAChCE,EAASD,EAAa,OACtBE,EAAa,IAAI,WAAWD,CAAM,EAExC,QAASE,EAAI,EAAGA,EAAIF,EAAQE,IAC1BD,EAAWC,CAAC,EAAIH,EAAa,WAAWG,CAAC,EAG3C,OAAOD,CACT,CAvBA,IAUME,EAeOX,EAzBbY,EAAAC,EAAA,kBAUMF,EAAc,0DAGXG,EAAAT,EAAA,sBAYIL,EAAN,KAAmD,CAzB1D,MAyB0D,CAAAc,EAAA,kBAChD,SACR,YAAYC,EA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"__export", "BTCSigner", "secp256k1", "isBitcoinBlockchain", "bitcoin", "SignerError", "base64ToUint8Array", "base64String", "binaryString", "length", "uint8Array", "i", "BTC_RPC_URL", "init_utxoSigner", "__esmMin", "__name", "provider", "tx", "asset", "psbt", "signedPSBTBytes", "finalPsbt", "finalPsbtBaseHex", "response", "errorText", "data", "defineVersions", "ProviderBuilder", "CAIP_BASE_CHAIN_ID", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "isEvmNamespace", "isSolanaNamespace", "getChainIdFromCaip2ChainId", "isSuiNamespace", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "getSuiInstance", "dynamicImportWithRefinedError", "getNetworkInstance", "DefaultSignerFactory", "TxType", "getSigners", "provider", "solProvider", "getNetworkInstance", "SOLANA_NAMESPACE", "evmProvider", "EVM_NAMESPACE", "bitcoinInstance", "UTXO_NAMESPACE", "suiProvider", "getSuiInstance", "WALLET_NAME_IN_WALLET_STANDARD", "DefaultEvmSigner", "dynamicImportWithRefinedError", "DefaultSolanaSigner", "BTCSigner", "DefaultSuiSigner", "signers", "DefaultSignerFactory", "TxType", "__name", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "SUI_NAMESPACE", "UTXO_NAMESPACE", "phantom", "solana", "ethereum", "bitcoin", "sui", "instances", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "SUI_NAMESPACE", "__name", "getInstanceOrThrow", "evmPhantom", "evmInstance", "solanaPhantom", "solanaInstance", "EVM_SUPPORTED_CHAINS", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "CAIP_BASE_CHAIN_ID", "WALLET_ID", "WALLET_NAME_IN_WALLET_STANDARD", "metadata", "chainId", "isEvmNamespace", "getChainIdFromCaip2ChainId", "isSolanaNamespace", "isSuiNamespace", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "evmPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "canSwitchNetwork", "getChainId", "evm", "NamespaceBuilder", "WALLET_ID", "ActionBuilder", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "solanaPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "ActionBuilder", "solana", "NamespaceBuilder", "WALLET_ID", "ActionBuilder", "NamespaceBuilder", "solanaActions", "commonBuilders", "standardizeAndThrowError", "builders", "hooks", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "WALLET_NAME_IN_WALLET_STANDARD", "connect", "builders", "standardizeAndThrowError", "disconnect", "canEagerConnect", "ActionBuilder", "solanaActions", "solanaPhantom", "sui", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "phantom", "metadata", "solana", "evm", "sui", "versions", "__name", "defineVersions", "buildProvider"]
4
+ "sourcesContent": ["import type { GenericSigner, Transfer } from 'rango-types';\n\nimport * as secp256k1 from '@bitcoinerlab/secp256k1';\nimport { isBitcoinBlockchain } from '@rango-dev/internal-blockchains';\nimport * as bitcoin from 'bitcoinjs-lib';\nimport { SignerError } from 'rango-types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TransferExternalProvider = any;\n\nconst BTC_RPC_URL = 'https://go.getblock.io/f37bad28a991436483c0a3679a3acbee';\n\n// TODO: use Uint8Array.fromBase64() static method and use this function as a polyfill after updating TypeScript DOM lib\nfunction base64ToUint8Array(base64String: string) {\n const binaryString = atob(base64String);\n const length = binaryString.length;\n const uint8Array = new Uint8Array(length);\n\n for (let i = 0; i < length; i++) {\n uint8Array[i] = binaryString.charCodeAt(i);\n }\n\n return uint8Array;\n}\n\nexport class BTCSigner implements GenericSigner<Transfer> {\n private provider: TransferExternalProvider;\n constructor(provider: TransferExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: Transfer): Promise<{ hash: string }> {\n const { asset, psbt } = tx;\n\n if (!psbt) {\n throw new Error(\n 'No PSBT found to sign. Ensure a valid PSBT is provided.'\n );\n }\n\n if (!isBitcoinBlockchain(asset.blockchain)) {\n throw new Error(\n `Signing ${asset.blockchain} transaction is not implemented by the signer.`\n );\n }\n // Initialize ECC library\n bitcoin.initEccLib(secp256k1);\n\n const signedPSBTBytes = await this.provider.signPSBT(\n base64ToUint8Array(psbt.unsignedPsbtBase64),\n {\n inputsToSign: psbt.inputsToSign,\n }\n );\n\n // Finalize PSBT\n const finalPsbt = bitcoin.Psbt.fromBuffer(Buffer.from(signedPSBTBytes));\n finalPsbt.finalizeAllInputs();\n\n const finalPsbtBaseHex = finalPsbt.extractTransaction().toHex();\n\n // Broadcast PSBT to rpc node\n const response = await fetch(BTC_RPC_URL, {\n method: 'POST',\n body: JSON.stringify({\n method: 'sendrawtransaction',\n params: [finalPsbtBaseHex],\n }),\n });\n\n if (!response.ok) {\n // Handle network and fetch errors\n const errorText = await response.text();\n throw new Error(`Error broadcasting transaction: ${errorText}`);\n }\n\n const data = await response.json();\n\n if (!data.result) {\n // Handle Bitcoin specific errors\n throw new Error(\n `Error broadcasting transaction. Error Code ${data.error.code}: ${data.error.message}`\n );\n }\n\n return { hash: data.result };\n }\n}\n", "import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\nexport { WALLET_ID } from './constants.js';\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { solana } from './namespaces/solana.js';\nimport { sui } from './namespaces/sui.js';\nimport { phantom as phantomInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (phantomInstance()) {\n setState('installed', true);\n console.debug('[phantom] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('solana', solana)\n .add('evm', evm)\n .add('sui', sui)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_BASE_CHAIN_ID,\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n isEvmNamespace,\n} from '@hub3js/evm';\nimport { isSolanaNamespace } from '@hub3js/solana';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\nimport { isSuiNamespace } from '@hub3js/sui';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const EVM_SUPPORTED_CHAINS = [\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n CAIP_BASE_CHAIN_ID,\n];\n\nexport const WALLET_ID = 'phantom';\nexport const WALLET_NAME_IN_WALLET_STANDARD = 'Phantom';\n\nexport const metadata: ProviderMetadata = {\n name: 'Phantom',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n homepage: 'https://phantom.app/',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'multiple',\n data: [\n {\n label: 'EVM',\n value: 'EVM',\n id: 'ETH',\n isChainSupported: (chainId: string) =>\n isEvmNamespace(chainId) &&\n EVM_SUPPORTED_CHAINS.includes(\n getChainIdFromCaip2ChainId(chainId)\n ),\n },\n {\n label: 'Solana',\n value: 'Solana',\n id: 'SOLANA',\n isChainSupported: isSolanaNamespace,\n },\n {\n label: 'Sui',\n value: 'Sui',\n id: 'SUI',\n isChainSupported: isSuiNamespace,\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners(getInstanceOrThrow()) },\n },\n ],\n};\n", "import type { Provider } from './utils.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\nimport { getInstance as getSuiInstance } from '@hub3js/sui';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const solProvider = provider.get(SOLANA_NAMESPACE);\n const evmProvider = provider.get(EVM_NAMESPACE);\n const bitcoinInstance = provider.get(UTXO_NAMESPACE);\n\n const suiProvider = getSuiInstance(WALLET_NAME_IN_WALLET_STANDARD);\n\n const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');\n const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana');\n const { BTCSigner } = await import('./signers/utxoSigner.js');\n const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');\n const signers = new DefaultSignerFactory();\n if (!!solProvider) {\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n }\n if (!!evmProvider) {\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));\n }\n if (!!bitcoinInstance) {\n signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));\n }\n if (!!suiProvider) {\n signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiProvider));\n }\n return signers;\n}\n", "import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';\nimport type { InstanceMap } from '@hub3js/std/types';\nimport type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';\nimport type { SolanaExternalProvider } from '@rango-dev/signer-solana';\nimport type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n SUI_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\n\nexport type ProviderObject = {\n [EVM_NAMESPACE]: EvmProviderApi;\n [SOLANA_NAMESPACE]: SolanaExternalProvider;\n [UTXO_NAMESPACE]: UtxoProviderApi;\n [SUI_NAMESPACE]: SuiProviderApi;\n};\nexport type Provider = InstanceMap<ProviderObject>;\n\nexport function phantom(): Provider | null {\n const { phantom } = window;\n\n if (!phantom) {\n return null;\n }\n\n const { solana, ethereum, bitcoin, sui } = phantom;\n\n const instances: Provider = new Map();\n\n if (ethereum && ethereum.isPhantom) {\n instances.set(EVM_NAMESPACE, ethereum);\n }\n\n if (solana && solana.isPhantom) {\n instances.set(SOLANA_NAMESPACE, solana);\n }\n\n if (bitcoin && bitcoin.isPhantom) {\n instances.set(UTXO_NAMESPACE, bitcoin);\n }\n if (sui && sui.isPhantom) {\n instances.set(SUI_NAMESPACE, sui);\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = phantom();\n\n if (!instances) {\n throw new Error('Phantom is not injected. Please check your wallet.');\n }\n\n return instances;\n}\n\nexport function evmPhantom(): EvmProviderApi {\n const instances = phantom();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Phantom not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\n}\n\nexport function solanaPhantom(): SolanaProviderApi {\n const instance = phantom();\n const solanaInstance = instance?.get(SOLANA_NAMESPACE);\n\n if (!solanaInstance) {\n throw new Error(\n 'Phantom not injected or Solana not enabled. Please check your wallet.'\n );\n }\n\n return solanaInstance;\n}\n\nexport function bitcoinPhantom(): SolanaProviderApi {\n const instance = phantom();\n const bitcoinInstance = instance?.get(UTXO_NAMESPACE);\n\n if (!bitcoinInstance) {\n throw new Error(\n 'Phantom not injected or Bitcoin not enabled. Please check your wallet.'\n );\n }\n\n return bitcoinInstance;\n}\nexport function suiPhantom(): SuiProviderApi {\n const instance = phantom();\n const suiInstance = instance?.get(SUI_NAMESPACE);\n\n if (!suiInstance) {\n throw new Error(\n 'Phantom not injected or Sui not enabled. Please check your wallet.'\n );\n }\n\n return suiInstance;\n}\n", "import type { EvmActions } from '@hub3js/evm';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/evm';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { evmPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(evmPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<EvmActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(actions.canEagerConnect(evmPhantom))\n .build();\n\nconst canSwitchNetwork = builders\n .canSwitchNetwork()\n .action(actions.canSwitchNetwork())\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmPhantom))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .action(canSwitchNetwork)\n .action(getChainId)\n .build();\n\nexport { evm };\n", "import type { SolanaActions } from '@hub3js/solana';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(solanaPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(solanaPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SolanaActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(actions.canEagerConnect(solanaPhantom))\n .build();\n\nconst solana = new NamespaceBuilder<SolanaActions>('Solana', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { solana };\n", "import type { SolanaActions } from '@hub3js/solana';\nimport type { SuiActions } from '@hub3js/sui';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions as solanaActions } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport { builders, hooks } from '@hub3js/sui';\n\nimport { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n });\n\nconst connect = builders\n .connect({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n })\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SuiActions>()\n .after(changeAccountCleanup)\n .build();\n\n/*\n * TODO: We are currently using `solanaCanEagerConnectAction` to establish an eager connection to the Sui instance.\n * This is a temporary workaround due to Phantom's limitation in silently connecting to a Sui account.\n * Once Phantom introduces support for silent Sui connections, this implementation should be updated accordingly.\n */\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(solanaActions.canEagerConnect(solanaPhantom))\n .build();\n\nconst sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { sui };\n"],
5
+ "mappings": "gLAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAEA,UAAYC,MAAe,0BAC3B,OAAS,uBAAAC,MAA2B,kCACpC,UAAYC,MAAa,gBACzB,OAAS,eAAAC,MAAmB,cAQ5B,SAASC,EAAmBC,EAAsB,CAChD,IAAMC,EAAe,KAAKD,CAAY,EAChCE,EAASD,EAAa,OACtBE,EAAa,IAAI,WAAWD,CAAM,EAExC,QAAS,EAAI,EAAG,EAAIA,EAAQ,IAC1BC,EAAW,CAAC,EAAIF,EAAa,WAAW,CAAC,EAG3C,OAAOE,CACT,CAvBA,IAUMC,EAeOV,EAzBbW,EAAAC,EAAA,kBAUMF,EAAc,0DAGXG,EAAAR,EAAA,sBAYIL,EAAN,KAAmD,CAzB1D,MAyB0D,CAAAa,EAAA,kBAChD,SACR,YAAYC,EAAoC,CAC9C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMV,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcW,EAAyC,CAC3D,GAAM,CAAE,MAAAC,EAAO,KAAAC,CAAK,EAAIF,EAExB,GAAI,CAACE,EACH,MAAM,IAAI,MACR,yDACF,EAGF,GAAI,CAACf,EAAoBc,EAAM,UAAU,EACvC,MAAM,IAAI,MACR,WAAWA,EAAM,UAAU,gDAC7B,EAGM,aAAWf,CAAS,EAE5B,IAAMiB,EAAkB,MAAM,KAAK,SAAS,SAC1Cb,EAAmBY,EAAK,kBAAkB,EAC1C,CACE,aAAcA,EAAK,YACrB,C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AAoB,EAC1B,MAAM,EAOHO,GAAkB,IAAIC,GAC1B,iBACF,EACG,OAAOC,GAAc,gBAAgBC,CAAa,CAAC,EACnD,MAAM,EAEHC,EAAM,IAAIC,GAA6B,MAAOC,CAAS,EAC1D,OAAOV,EAAO,EACd,OAAOG,EAAU,EACjB,OAAOC,EAAe,EACtB,MAAM,ENtCT,IAAMO,EAAgBC,EAAA,IACpB,IAAIC,GAAgBC,CAAS,EAC1B,KAAK,SAAUC,EAAS,CACvB,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EAE/BE,EAAgB,IAClBD,EAAS,YAAa,EAAI,EAC1B,QAAQ,MAAM,+BAAgCD,CAAO,EAEzD,CAAC,EACA,OAAO,WAAYG,CAAQ,EAC3B,IAAI,SAAUC,CAAM,EACpB,IAAI,MAAOC,CAAG,EACd,IAAI,MAAOC,CAAG,EACd,MAAM,EAdW,iBDJtB,IAAMC,GAAWC,EAAA,IACfC,GAAe,EAAE,QAAQ,QAASC,EAAc,CAAC,EAAE,MAAM,EAD1C",
6
+ "names": ["utxoSigner_exports", "__export", "BTCSigner", "secp256k1", "isBitcoinBlockchain", "bitcoin", "SignerError", "base64ToUint8Array", "base64String", "binaryString", "length", "uint8Array", "BTC_RPC_URL", "init_utxoSigner", "__esmMin", "__name", "provider", "tx", "asset", "psbt", "signedPSBTBytes", "finalPsbt", "finalPsbtBaseHex", "response", "errorText", "data", "defineVersions", "ProviderBuilder", "CAIP_BASE_CHAIN_ID", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "isEvmNamespace", "isSolanaNamespace", "getChainIdFromCaip2ChainId", "isSuiNamespace", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "getSuiInstance", "DefaultSignerFactory", "TxType", "getSigners", "provider", "solProvider", "SOLANA_NAMESPACE", "evmProvider", "EVM_NAMESPACE", "bitcoinInstance", "UTXO_NAMESPACE", "suiProvider", "getSuiInstance", "WALLET_NAME_IN_WALLET_STANDARD", "DefaultEvmSigner", "DefaultSolanaSigner", "BTCSigner", "DefaultSuiSigner", "signers", "DefaultSignerFactory", "TxType", "__name", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "SUI_NAMESPACE", "UTXO_NAMESPACE", "phantom", "solana", "ethereum", "bitcoin", "sui", "instances", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "SUI_NAMESPACE", "__name", "getInstanceOrThrow", "evmPhantom", "evmInstance", "solanaPhantom", "solanaInstance", "EVM_SUPPORTED_CHAINS", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "CAIP_BASE_CHAIN_ID", "WALLET_ID", "WALLET_NAME_IN_WALLET_STANDARD", "metadata", "chainId", "isEvmNamespace", "getChainIdFromCaip2ChainId", "isSolanaNamespace", "isSuiNamespace", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "evmPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "canSwitchNetwork", "getChainId", "evm", "NamespaceBuilder", "WALLET_ID", "ActionBuilder", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "solanaPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "ActionBuilder", "solana", "NamespaceBuilder", "WALLET_ID", "ActionBuilder", "NamespaceBuilder", "solanaActions", "commonBuilders", "standardizeAndThrowError", "builders", "hooks", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "WALLET_NAME_IN_WALLET_STANDARD", "connect", "builders", "standardizeAndThrowError", "disconnect", "canEagerConnect", "ActionBuilder", "solanaActions", "solanaPhantom", "sui", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "phantom", "metadata", "solana", "evm", "sui", "versions", "__name", "defineVersions", "buildProvider"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/namespaces/utxo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,yCAAyC,CAAC;AAwJjD,QAAA,MAAM,IAAI,sDAIA,CAAC;AAEX,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/namespaces/utxo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,yCAAyC,CAAC;AA0JjD,QAAA,MAAM,IAAI,sDAIA,CAAC;AAEX,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAgBjD,wBAA8B,UAAU,CACtC,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,aAAa,CAAC,CA2BxB"}
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYjD,wBAA8B,UAAU,CACtC,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,aAAa,CAAC,CAyBxB"}
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,17 @@
1
1
  import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
2
2
  import type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';
3
+ import type { InstanceMap } from '@hub3js/std/types';
3
4
  import type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';
4
- export type Provider = Map<string, unknown>;
5
+ import type { SolanaExternalProvider } from '@rango-dev/signer-solana';
6
+ import type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';
7
+ import { EVM_NAMESPACE, SOLANA_NAMESPACE, SUI_NAMESPACE, UTXO_NAMESPACE } from '@hub3js/namespaces';
8
+ export type ProviderObject = {
9
+ [EVM_NAMESPACE]: EvmProviderApi;
10
+ [SOLANA_NAMESPACE]: SolanaExternalProvider;
11
+ [UTXO_NAMESPACE]: UtxoProviderApi;
12
+ [SUI_NAMESPACE]: SuiProviderApi;
13
+ };
14
+ export type Provider = InstanceMap<ProviderObject>;
5
15
  export declare function phantom(): Provider | null;
6
16
  export declare function getInstanceOrThrow(): Provider;
7
17
  export declare function evmPhantom(): EvmProviderApi;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AASjE,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C,wBAAgB,OAAO,IAAI,QAAQ,GAAG,IAAI,CA2BzC;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAQ7C;AAED,wBAAgB,UAAU,IAAI,cAAc,CAY3C;AAED,wBAAgB,aAAa,IAAI,iBAAiB,CAWjD;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAWlD;AACD,wBAAgB,UAAU,IAAI,cAAc,CAW3C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE9F,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC;IAChC,CAAC,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,CAAC,cAAc,CAAC,EAAE,eAAe,CAAC;IAClC,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;AAEnD,wBAAgB,OAAO,IAAI,QAAQ,GAAG,IAAI,CA2BzC;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAQ7C;AAED,wBAAgB,UAAU,IAAI,cAAc,CAY3C;AAED,wBAAgB,aAAa,IAAI,iBAAiB,CAWjD;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAWlD;AACD,wBAAgB,UAAU,IAAI,cAAc,CAW3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-phantom",
3
- "version": "0.63.1-next.1",
3
+ "version": "0.63.1-next.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/mod.ts",
@@ -23,17 +23,17 @@
23
23
  "dependencies": {
24
24
  "@bitcoinerlab/secp256k1": "^1.2.0",
25
25
  "@hub3js/core": "^0.61.1",
26
- "@hub3js/evm": "^0.3.3",
27
- "@hub3js/namespaces": "^0.2.5",
28
- "@hub3js/solana": "^0.3.3",
29
- "@hub3js/std": "^0.2.3",
30
- "@hub3js/sui": "^0.2.3",
26
+ "@hub3js/evm": "^0.4.0",
27
+ "@hub3js/namespaces": "^0.3.0",
28
+ "@hub3js/solana": "^0.4.0",
29
+ "@hub3js/std": "^0.3.0",
30
+ "@hub3js/sui": "^0.3.0",
31
31
  "@mysten/sui": "^1.21.2",
32
32
  "@mysten/wallet-standard": "^0.13.26",
33
+ "@rango-dev/internal-blockchains": "^0.1.1-next.0",
33
34
  "@rango-dev/signer-solana": "^0.49.0",
34
35
  "@rango-dev/signer-sui": "^0.11.0",
35
- "@rango-dev/wallets-core": "^0.61.0",
36
- "@rango-dev/wallets-shared": "^0.62.1-next.1",
36
+ "@rango-dev/wallets-core": "^0.61.1-next.0",
37
37
  "bitcoinjs-lib": "^6.1.7",
38
38
  "caip": "^1.1.1",
39
39
  "rango-types": "^0.5.0"
package/src/mod.ts CHANGED
@@ -6,3 +6,4 @@ const versions = () =>
6
6
  defineVersions().version('1.0.0', buildProvider()).build();
7
7
 
8
8
  export { versions };
9
+ export { WALLET_ID } from './constants.js';
@@ -18,7 +18,6 @@ import {
18
18
  CAIP_BITCOIN_CHAIN_ID,
19
19
  CAIP_NAMESPACE,
20
20
  } from '@rango-dev/wallets-core/namespaces/utxo';
21
- import { type ProviderConnectResult } from '@rango-dev/wallets-shared';
22
21
  import { AccountId } from 'caip';
23
22
 
24
23
  import { WALLET_ID } from '../constants.js';
@@ -34,7 +33,10 @@ type BtcAccount = {
34
33
  purpose: 'payment' | 'ordinals';
35
34
  };
36
35
 
37
- const getBitcoinAccounts: () => Promise<ProviderConnectResult> = async () => {
36
+ const getBitcoinAccounts: () => Promise<{
37
+ accounts: string[];
38
+ chainId: string;
39
+ }> = async () => {
38
40
  const instance = bitcoinPhantom();
39
41
  const accounts = await instance.requestAccounts();
40
42
 
package/src/signer.ts CHANGED
@@ -7,10 +7,6 @@ import {
7
7
  UTXO_NAMESPACE,
8
8
  } from '@hub3js/namespaces';
9
9
  import { getInstance as getSuiInstance } from '@hub3js/sui';
10
- import {
11
- dynamicImportWithRefinedError,
12
- getNetworkInstance,
13
- } from '@rango-dev/wallets-shared';
14
10
  import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
15
11
 
16
12
  import { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';
@@ -18,28 +14,26 @@ import { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';
18
14
  export default async function getSigners(
19
15
  provider: Provider
20
16
  ): Promise<SignerFactory> {
21
- const solProvider = getNetworkInstance(provider, SOLANA_NAMESPACE);
22
- const evmProvider = getNetworkInstance(provider, EVM_NAMESPACE);
23
- const bitcoinInstance = getNetworkInstance(provider, UTXO_NAMESPACE);
17
+ const solProvider = provider.get(SOLANA_NAMESPACE);
18
+ const evmProvider = provider.get(EVM_NAMESPACE);
19
+ const bitcoinInstance = provider.get(UTXO_NAMESPACE);
24
20
 
25
21
  const suiProvider = getSuiInstance(WALLET_NAME_IN_WALLET_STANDARD);
26
22
 
27
- const { DefaultEvmSigner } = await dynamicImportWithRefinedError(
28
- async () => await import('@rango-dev/signer-evm')
29
- );
30
- const { DefaultSolanaSigner } = await dynamicImportWithRefinedError(
31
- async () => await import('@rango-dev/signer-solana')
32
- );
33
- const { BTCSigner } = await dynamicImportWithRefinedError(
34
- async () => await import('./signers/utxoSigner.js')
35
- );
36
- const { DefaultSuiSigner } = await dynamicImportWithRefinedError(
37
- async () => await import('@rango-dev/signer-sui')
38
- );
23
+ const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');
24
+ const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana');
25
+ const { BTCSigner } = await import('./signers/utxoSigner.js');
26
+ const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');
39
27
  const signers = new DefaultSignerFactory();
40
- signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));
41
- signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));
42
- signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));
28
+ if (!!solProvider) {
29
+ signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));
30
+ }
31
+ if (!!evmProvider) {
32
+ signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));
33
+ }
34
+ if (!!bitcoinInstance) {
35
+ signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));
36
+ }
43
37
  if (!!suiProvider) {
44
38
  signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiProvider));
45
39
  }
@@ -1,7 +1,7 @@
1
1
  import type { GenericSigner, Transfer } from 'rango-types';
2
2
 
3
3
  import * as secp256k1 from '@bitcoinerlab/secp256k1';
4
- import { isBitcoinBlockchain } from '@rango-dev/wallets-shared';
4
+ import { isBitcoinBlockchain } from '@rango-dev/internal-blockchains';
5
5
  import * as bitcoin from 'bitcoinjs-lib';
6
6
  import { SignerError } from 'rango-types';
7
7
 
package/src/utils.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
2
2
  import type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';
3
+ import type { InstanceMap } from '@hub3js/std/types';
3
4
  import type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';
5
+ import type { SolanaExternalProvider } from '@rango-dev/signer-solana';
6
+ import type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';
4
7
 
5
8
  import {
6
9
  EVM_NAMESPACE,
@@ -9,7 +12,13 @@ import {
9
12
  UTXO_NAMESPACE,
10
13
  } from '@hub3js/namespaces';
11
14
 
12
- export type Provider = Map<string, unknown>;
15
+ export type ProviderObject = {
16
+ [EVM_NAMESPACE]: EvmProviderApi;
17
+ [SOLANA_NAMESPACE]: SolanaExternalProvider;
18
+ [UTXO_NAMESPACE]: UtxoProviderApi;
19
+ [SUI_NAMESPACE]: SuiProviderApi;
20
+ };
21
+ export type Provider = InstanceMap<ProviderObject>;
13
22
 
14
23
  export function phantom(): Provider | null {
15
24
  const { phantom } = window;
@@ -61,7 +70,7 @@ export function evmPhantom(): EvmProviderApi {
61
70
  );
62
71
  }
63
72
 
64
- return evmInstance as EvmProviderApi;
73
+ return evmInstance;
65
74
  }
66
75
 
67
76
  export function solanaPhantom(): SolanaProviderApi {
@@ -99,5 +108,5 @@ export function suiPhantom(): SuiProviderApi {
99
108
  );
100
109
  }
101
110
 
102
- return suiInstance as SuiProviderApi;
111
+ return suiInstance;
103
112
  }