@rango-dev/provider-phantom 0.64.3-next.3 → 0.64.3-next.5

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.
@@ -1,6 +1,5 @@
1
1
  import type { ProviderMetadata } from '@hub3js/core';
2
2
  export declare const EVM_SUPPORTED_CHAINS: string[];
3
3
  export declare const WALLET_ID = "phantom";
4
- export declare const WALLET_NAME_IN_WALLET_STANDARD = "Phantom";
5
4
  export declare const metadata: ProviderMetadata;
6
5
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAerD,eAAO,MAAM,oBAAoB,UAIhC,CAAC;AAEF,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,8BAA8B,YAAY,CAAC;AAExD,eAAO,MAAM,QAAQ,EAAE,gBA4CtB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAcrD,eAAO,MAAM,oBAAoB,UAIhC,CAAC;AAEF,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,gBAsCtB,CAAC"}
package/dist/mod.js CHANGED
@@ -1,2 +1,2 @@
1
- var w=Object.defineProperty;var i=(n,o)=>w(n,"name",{value:o,configurable:!0});var R=(n,o)=>()=>(n&&(o=n(n=0)),o);var W=(n,o)=>{for(var t in o)w(n,t,{get:o[t],enumerable:!0})};var v={};W(v,{BTCSigner:()=>P});import*as V from"@bitcoinerlab/secp256k1";import{isBitcoinBlockchain as H}from"@rango-dev/internal-blockchains";import*as g from"bitcoinjs-lib";import{SignerError as F}from"rango-types";function $(n){let o=atob(n),t=o.length,e=new Uint8Array(t);for(let r=0;r<t;r++)e[r]=o.charCodeAt(r);return e}var z,P,T=R(()=>{"use strict";z="https://go.getblock.io/f37bad28a991436483c0a3679a3acbee";i($,"base64ToUint8Array");P=class{static{i(this,"BTCSigner")}provider;constructor(o){this.provider=o}async signMessage(){throw F.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(!H(t.blockchain))throw new Error(`Signing ${t.blockchain} transaction is not implemented by the signer.`);g.initEccLib(V);let r=await this.provider.signPSBT($(e.unsignedPsbtBase64),{inputsToSign:e.inputsToSign}),a=g.Psbt.fromBuffer(Buffer.from(r));a.finalizeAllInputs();let E=a.extractTransaction().toHex(),f=await fetch(z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"sendrawtransaction",params:[E]})});if(!f.ok){let c=await f.text();throw new Error(`Error broadcasting transaction: ${c}`)}let p=await f.json();if(!p.result)throw new Error(`Error broadcasting transaction. Error Code ${p.error.code}: ${p.error.message}`);return{hash:p.result}}}});import{ProviderBuilder as Uo}from"@hub3js/core";import{CAIP_BASE_CHAIN_ID as Z,CAIP_ETHEREUM_CHAIN_ID as oo,CAIP_POLYGON_CHAIN_ID as no,isEvmNamespace as to}from"@hub3js/evm";import{isSolanaNamespace as eo}from"@hub3js/solana";import{getChainIdFromCaip2ChainId as ro}from"@hub3js/std/utils";import{isSuiNamespace as io}from"@hub3js/sui";import{EVM_NAMESPACE as G,SOLANA_NAMESPACE as X,UTXO_NAMESPACE as J}from"@hub3js/namespaces";import{getInstance as K}from"@hub3js/sui";import{DefaultSignerFactory as Y,TransactionType as S}from"rango-types";async function b(n){let o=n.get(X),t=n.get(G),e=n.get(J),r=K(A),{DefaultEvmSigner:a}=await import("@rango-dev/signer-evm"),{DefaultSolanaSigner:E}=await import("@rango-dev/signer-solana"),{BTCSigner:f}=await Promise.resolve().then(()=>(T(),v)),{DefaultSuiSigner:p}=await import("@rango-dev/signer-sui"),c=new Y;return o&&c.registerSigner(S.SOLANA,new E(o)),t&&c.registerSigner(S.EVM,new a(t)),e&&c.registerSigner(S.TRANSFER,new f(e)),r&&c.registerSigner(S.SUI,new p(r)),c}i(b,"getSigners");import{EVM_NAMESPACE as y,SOLANA_NAMESPACE as C,SUI_NAMESPACE as q,UTXO_NAMESPACE as Q}from"@hub3js/namespaces";function h(){let{phantom:n}=window;if(!n)return null;let{solana:o,ethereum:t,bitcoin:e,sui:r}=n,a=new Map;return t&&t.isPhantom&&a.set(y,t),o&&o.isPhantom&&a.set(C,o),e&&e.isPhantom&&a.set(Q,e),r&&r.isPhantom&&a.set(q,r),a}i(h,"phantom");function I(){let n=h();if(!n)throw new Error("Phantom is not injected. Please check your wallet.");return n}i(I,"getInstanceOrThrow");function m(){let o=h()?.get(y);if(!o)throw new Error("Phantom not injected or EVM not enabled. Please check your wallet.");return o}i(m,"evmPhantom");function d(){let o=h()?.get(C);if(!o)throw new Error("Phantom not injected or Solana not enabled. Please check your wallet.");return o}i(d,"solanaPhantom");var ao=[oo,no,Z],s="phantom",A="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=>to(n)&&ao.includes(ro(n))},{label:"Solana",value:"Solana",id:"SOLANA",isChainSupported:eo},{label:"Sui",value:"Sui",id:"SUI",isChainSupported:io}]}},{name:"signers",value:{getSigners:async()=>b(I())}}]};import{NamespaceBuilder as so}from"@hub3js/core";import{actions as l,builders as u,hooks as co}from"@hub3js/evm";import*as _ from"@hub3js/std/builders";import{standardizeAndThrowError as mo}from"@hub3js/std/operators";var[po,x]=co.changeAccountSubscriber(m),lo=u.connect().action(l.connect(m)).before(po).or(x).or(mo).build(),uo=_.disconnect().after(x).build(),fo=u.canEagerConnect().action(l.canEagerConnect(m)).build(),Ao=u.canSwitchNetwork().action(l.canSwitchNetwork()).build(),ho=u.getChainId().action(l.getChainId(m)).build(),go=u.getAllowance().action(l.getAllowance(m)).build(),So=u.getTransactionReceipt().action(l.getTransactionReceipt(m)).build(),L=new so("EVM",s).action(lo).action(uo).action(fo).action(Ao).action(ho).action(go).action(So).build();import{ActionBuilder as Eo,NamespaceBuilder as Po}from"@hub3js/core";import{actions as M,builders as bo,hooks as wo}from"@hub3js/solana";import*as B from"@hub3js/std/builders";import{standardizeAndThrowError as vo}from"@hub3js/std/operators";var[To,j]=wo.changeAccountSubscriber(d),yo=bo.connect().action(M.connect(d)).before(To).or(j).or(vo).build(),Co=B.disconnect().after(j).build(),Io=new Eo("canEagerConnect").action(M.canEagerConnect(d)).build(),k=new Po("Solana",s).action(yo).action(Co).action(Io).build();import{ActionBuilder as No,NamespaceBuilder as _o}from"@hub3js/core";import{actions as xo}from"@hub3js/solana";import*as D from"@hub3js/std/builders";import{standardizeAndThrowError as Lo}from"@hub3js/std/operators";import{builders as Mo,hooks as Bo}from"@hub3js/sui";var[jo,O]=Bo.changeAccountSubscriber({name:A}),ko=Mo.connect({name:A}).before(jo).or(O).or(Lo).build(),Do=D.disconnect().after(O).build(),Oo=new No("canEagerConnect").action(xo.canEagerConnect(d)).build(),U=new _o("Sui",s).action(ko).action(Do).action(Oo).build();var Ro=i(()=>new Uo(s).init(function(n){let[,o]=n.state();h()&&(o("installed",!0),console.debug("[phantom] instance detected.",n))}).config("metadata",N).add("solana",k).add("evm",L).add("sui",U).build(),"buildProvider");export{s as WALLET_ID,Ro as buildProvider};
1
+ var b=Object.defineProperty;var i=(t,o)=>b(t,"name",{value:o,configurable:!0});var L=(t,o)=>()=>(t&&(o=t(t=0)),o);var O=(t,o)=>{for(var n in o)b(t,n,{get:o[n],enumerable:!0})};var S={};O(S,{BTCSigner:()=>A});import*as D from"@bitcoinerlab/secp256k1";import{isBitcoinBlockchain as U}from"@rango-dev/internal-blockchains";import*as f from"bitcoinjs-lib";import{SignerError as R}from"rango-types";function H(t){let o=atob(t),n=o.length,e=new Uint8Array(n);for(let r=0;r<n;r++)e[r]=o.charCodeAt(r);return e}var V,A,v=L(()=>{"use strict";V="https://go.getblock.io/f37bad28a991436483c0a3679a3acbee";i(H,"base64ToUint8Array");A=class{static{i(this,"BTCSigner")}provider;constructor(o){this.provider=o}async signMessage(){throw R.UnimplementedError("signMessage")}async signAndSendTx(o){let{asset:n,psbt:e}=o;if(!e)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");if(!U(n.blockchain))throw new Error(`Signing ${n.blockchain} transaction is not implemented by the signer.`);f.initEccLib(D);let r=await this.provider.signPSBT(H(e.unsignedPsbtBase64),{inputsToSign:e.inputsToSign}),d=f.Psbt.fromBuffer(Buffer.from(r));d.finalizeAllInputs();let h=d.extractTransaction().toHex(),a=await fetch(V,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"sendrawtransaction",params:[h]})});if(!a.ok){let k=await a.text();throw new Error(`Error broadcasting transaction: ${k}`)}let u=await a.json();if(!u.result)throw new Error(`Error broadcasting transaction. Error Code ${u.error.code}: ${u.error.message}`);return{hash:u.result}}}});import{ProviderBuilder as So}from"@hub3js/core";import{CAIP_BASE_CHAIN_ID as X,CAIP_ETHEREUM_CHAIN_ID as J,CAIP_POLYGON_CHAIN_ID as K,isEvmNamespace as Y}from"@hub3js/evm";import{isSolanaNamespace as q}from"@hub3js/solana";import{getChainIdFromCaip2ChainId as Q}from"@hub3js/std/utils";import{EVM_NAMESPACE as F,SOLANA_NAMESPACE as W,UTXO_NAMESPACE as $}from"@hub3js/namespaces";import{DefaultSignerFactory as z,TransactionType as P}from"rango-types";async function E(t){let o=t.get(W),n=t.get(F),e=t.get($),{DefaultEvmSigner:r}=await import("@rango-dev/signer-evm"),{DefaultSolanaSigner:d}=await import("@rango-dev/signer-solana"),{BTCSigner:h}=await Promise.resolve().then(()=>(v(),S)),a=new z;return o&&a.registerSigner(P.SOLANA,new d(o)),n&&a.registerSigner(P.EVM,new r(n)),e&&a.registerSigner(P.TRANSFER,new h(e)),a}i(E,"getSigners");import{EVM_NAMESPACE as w,SOLANA_NAMESPACE as y,UTXO_NAMESPACE as G}from"@hub3js/namespaces";function l(){let{phantom:t}=window;if(!t)return null;let{solana:o,ethereum:n,bitcoin:e}=t,r=new Map;return n&&n.isPhantom&&r.set(w,n),o&&o.isPhantom&&r.set(y,o),e&&e.isPhantom&&r.set(G,e),r}i(l,"phantom");function T(){let t=l();if(!t)throw new Error("Phantom is not injected. Please check your wallet.");return t}i(T,"getInstanceOrThrow");function s(){let o=l()?.get(w);if(!o)throw new Error("Phantom not injected or EVM not enabled. Please check your wallet.");return o}i(s,"evmPhantom");function g(){let o=l()?.get(y);if(!o)throw new Error("Phantom not injected or Solana not enabled. Please check your wallet.");return o}i(g,"solanaPhantom");var Z=[J,K,X],c="phantom",C={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:t=>Y(t)&&Z.includes(Q(t))},{label:"Solana",value:"Solana",id:"SOLANA",isChainSupported:q}]}},{name:"signers",value:{getSigners:async()=>E(T())}}]};import{NamespaceBuilder as oo}from"@hub3js/core";import{actions as m,builders as p,hooks as to}from"@hub3js/evm";import*as x from"@hub3js/std/builders";import{standardizeAndThrowError as no}from"@hub3js/std/operators";var[eo,I]=to.changeAccountSubscriber(s),ro=p.connect().action(m.connect(s)).before(eo).or(I).or(no).build(),io=x.disconnect().after(I).build(),ao=p.canEagerConnect().action(m.canEagerConnect(s)).build(),so=p.canSwitchNetwork().action(m.canSwitchNetwork()).build(),co=p.getChainId().action(m.getChainId(s)).build(),mo=p.getAllowance().action(m.getAllowance(s)).build(),po=p.getTransactionReceipt().action(m.getTransactionReceipt(s)).build(),N=new oo("EVM",c).action(ro).action(io).action(ao).action(so).action(co).action(mo).action(po).build();import{ActionBuilder as lo,NamespaceBuilder as uo}from"@hub3js/core";import{actions as _,builders as fo,hooks as go}from"@hub3js/solana";import*as M from"@hub3js/std/builders";import{standardizeAndThrowError as ho}from"@hub3js/std/operators";var[Ao,B]=go.changeAccountSubscriber(g),Po=fo.connect().action(_.connect(g)).before(Ao).or(B).or(ho).build(),Eo=M.disconnect().after(B).build(),bo=new lo("canEagerConnect").action(_.canEagerConnect(g)).build(),j=new uo("Solana",c).action(Po).action(Eo).action(bo).build();var vo=i(()=>new So(c).init(function(t){let[,o]=t.state();l()&&(o("installed",!0),console.debug("[phantom] instance detected.",t))}).config("metadata",C).add("solana",j).add("evm",N).build(),"buildProvider");export{c as WALLET_ID,vo as buildProvider};
2
2
  //# sourceMappingURL=mod.js.map
package/dist/mod.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/signers/utxoSigner.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/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 headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\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 { 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 UtxoProviderApi } from '@hub3js/bip122';\nimport 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';\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\nexport type BtcAccount = {\n address: string;\n publicKey: string;\n addressType: 'p2tr' | 'p2wpkh' | 'p2sh' | 'p2pkh';\n purpose: 'payment' | 'ordinals';\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 getAllowance = builders\n .getAllowance()\n .action(actions.getAllowance(evmPhantom))\n .build();\n\nconst getTransactionReceipt = builders\n .getTransactionReceipt()\n .action(actions.getTransactionReceipt(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 .action(getAllowance)\n .action(getTransactionReceipt)\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,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,EAAoC,CAC9C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMX,EAAY,mBAAmB,aAA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"base64String", "binaryString", "length", "uint8Array", "i", "BTC_RPC_URL", "init_utxoSigner", "__esmMin", "__name", "provider", "tx", "asset", "psbt", "signedPSBTBytes", "finalPsbt", "finalPsbtBaseHex", "response", "errorText", "data", "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", "getAllowance", "getTransactionReceipt", "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"]
3
+ "sources": ["../src/signers/utxoSigner.ts", "../src/provider.ts", "../src/constants.ts", "../src/signer.ts", "../src/utils.ts", "../src/namespaces/evm.ts", "../src/namespaces/solana.ts"],
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 headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\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 { 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 { 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 .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';\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';\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 },\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 { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\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 { 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 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\n return signers;\n}\n", "import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';\nimport type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';\nimport type { InstanceMap } from '@hub3js/std/types';\nimport type { SolanaExternalProvider } from '@rango-dev/signer-solana';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_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};\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 } = 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\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}\n\nexport type BtcAccount = {\n address: string;\n publicKey: string;\n addressType: 'p2tr' | 'p2wpkh' | 'p2sh' | 'p2pkh';\n purpose: 'payment' | 'ordinals';\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 getAllowance = builders\n .getAllowance()\n .action(actions.getAllowance(evmPhantom))\n .build();\n\nconst getTransactionReceipt = builders\n .getTransactionReceipt()\n .action(actions.getTransactionReceipt(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 .action(getAllowance)\n .action(getTransactionReceipt)\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(canEagerConn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AKzC,GAAM,CAACC,GAAyBC,CAAoB,EAClDC,GAAM,wBAAwBC,CAAa,EAQvCC,GAAUC,GACb,QAAQ,EACR,OAAOC,EAAQ,QAAQH,CAAa,CAAC,EACrC,OAAOH,EAAuB,EAC9B,GAAGC,CAAoB,EACvB,GAAGM,EAAwB,EAC3B,MAAM,EAEHC,GACH,aAA0B,EAC1B,MAAMP,CAAoB,EAC1B,MAAM,EAEHQ,GAAkB,IAAIC,GAC1B,iBACF,EACG,OAAOJ,EAAQ,gBAAgBH,CAAa,CAAC,EAC7C,MAAM,EAEHQ,EAAS,IAAIC,GAAgC,SAAUC,CAAS,EACnE,OAAOT,EAAO,EACd,OAAOI,EAAU,EACjB,OAAOC,EAAe,EACtB,MAAM,ELnCT,IAAMK,GAAgBC,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,MAAM,EAbW",
6
+ "names": ["utxoSigner_exports", "__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", "ProviderBuilder", "CAIP_BASE_CHAIN_ID", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "isEvmNamespace", "isSolanaNamespace", "getChainIdFromCaip2ChainId", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "DefaultSignerFactory", "TxType", "getSigners", "provider", "solProvider", "SOLANA_NAMESPACE", "evmProvider", "EVM_NAMESPACE", "bitcoinInstance", "UTXO_NAMESPACE", "DefaultEvmSigner", "DefaultSolanaSigner", "BTCSigner", "signers", "DefaultSignerFactory", "TxType", "__name", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "phantom", "solana", "ethereum", "bitcoin", "instances", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "__name", "getInstanceOrThrow", "evmPhantom", "evmInstance", "solanaPhantom", "solanaInstance", "EVM_SUPPORTED_CHAINS", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "CAIP_BASE_CHAIN_ID", "WALLET_ID", "metadata", "chainId", "isEvmNamespace", "getChainIdFromCaip2ChainId", "isSolanaNamespace", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "evmPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "canSwitchNetwork", "getChainId", "getAllowance", "getTransactionReceipt", "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", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "phantom", "metadata", "solana", "evm"]
7
7
  }
@@ -1,3 +1,3 @@
1
- declare const buildProvider: () => import("@hub3js/core").Provider<Record<"solana", import("@hub3js/solana").SolanaActions> & Record<"evm", import("@hub3js/evm").EvmActions> & Record<"sui", import("@hub3js/sui").SuiActions>>;
1
+ declare const buildProvider: () => import("@hub3js/core").Provider<Record<"solana", import("@hub3js/solana").SolanaActions> & Record<"evm", import("@hub3js/evm").EvmActions>>;
2
2
  export { buildProvider };
3
3
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,aAAa,qMAcP,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,aAAa,mJAaP,CAAC;AAEb,OAAO,EAAE,aAAa,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;AAYjD,wBAA8B,UAAU,CACtC,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,aAAa,CAAC,CAyBxB"}
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;AASjD,wBAA8B,UAAU,CACtC,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,aAAa,CAAC,CAoBxB"}
package/dist/utils.d.ts CHANGED
@@ -2,14 +2,12 @@ import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';
2
2
  import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
3
3
  import type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';
4
4
  import type { InstanceMap } from '@hub3js/std/types';
5
- import type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';
6
5
  import type { SolanaExternalProvider } from '@rango-dev/signer-solana';
7
- import { EVM_NAMESPACE, SOLANA_NAMESPACE, SUI_NAMESPACE, UTXO_NAMESPACE } from '@hub3js/namespaces';
6
+ import { EVM_NAMESPACE, SOLANA_NAMESPACE, UTXO_NAMESPACE } from '@hub3js/namespaces';
8
7
  export type ProviderObject = {
9
8
  [EVM_NAMESPACE]: EvmProviderApi;
10
9
  [SOLANA_NAMESPACE]: SolanaExternalProvider;
11
10
  [UTXO_NAMESPACE]: UtxoProviderApi;
12
- [SUI_NAMESPACE]: SuiProviderApi;
13
11
  };
14
12
  export type Provider = InstanceMap<ProviderObject>;
15
13
  export declare function phantom(): Provider | null;
@@ -17,7 +15,6 @@ export declare function getInstanceOrThrow(): Provider;
17
15
  export declare function evmPhantom(): EvmProviderApi;
18
16
  export declare function solanaPhantom(): SolanaProviderApi;
19
17
  export declare function bitcoinPhantom(): SolanaProviderApi;
20
- export declare function suiPhantom(): SuiProviderApi;
21
18
  export type BtcAccount = {
22
19
  address: string;
23
20
  publicKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACrE,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;AAEvE,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,gBAAg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sB,CAAC;IAC3C,CAAC,cAAc,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;AAEnD,wBAAgB,OAAO,IAAI,QAAQ,GAAG,IAAI,CAwBzC;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAQ7C;AAED,wBAAgB,UAAU,IAAI,cAAc,CAY3C;AAED,wBAAgB,aAAa,IAAI,iBAAiB,CAWjD;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAWlD;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAClD,OAAO,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-phantom",
3
- "version": "0.64.3-next.3",
3
+ "version": "0.64.3-next.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/mod.ts",
@@ -23,22 +23,29 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@bitcoinerlab/secp256k1": "^1.2.0",
26
- "@hub3js/bip122": "^0.3.0",
27
- "@hub3js/core": "^0.63.0",
28
- "@hub3js/evm": "^0.6.0",
29
- "@hub3js/namespaces": "^0.7.0",
30
- "@hub3js/solana": "^0.6.0",
31
- "@hub3js/std": "^0.5.0",
32
- "@hub3js/sui": "^0.5.0",
33
- "@mysten/sui": "^1.21.2",
34
26
  "@mysten/wallet-standard": "^0.13.26",
35
- "@rango-dev/internal-blockchains": "^0.2.2-next.2",
27
+ "@rango-dev/internal-blockchains": "^0.2.2-next.3",
36
28
  "@rango-dev/signer-solana": "^0.50.1-next.1",
37
- "@rango-dev/signer-sui": "^0.12.1-next.1",
38
29
  "bitcoinjs-lib": "^6.1.7",
39
30
  "caip": "^1.1.1",
40
31
  "rango-types": "^0.6.0"
41
32
  },
33
+ "devDependencies": {
34
+ "@hub3js/bip122": "^0.3.0",
35
+ "@hub3js/core": "^0.63.0",
36
+ "@hub3js/evm": "^0.6.0",
37
+ "@hub3js/namespaces": "^0.7.0",
38
+ "@hub3js/solana": "^0.6.0",
39
+ "@hub3js/std": "^0.5.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@hub3js/bip122": "^0.3.0",
43
+ "@hub3js/core": "^0.63.0",
44
+ "@hub3js/evm": "^0.6.0",
45
+ "@hub3js/namespaces": "^0.7.0",
46
+ "@hub3js/solana": "^0.6.0",
47
+ "@hub3js/std": "^0.5.0"
48
+ },
42
49
  "publishConfig": {
43
50
  "access": "public"
44
51
  }
package/readme.md CHANGED
@@ -14,11 +14,7 @@ Bitcoin support is temporarily disabled because Phantom no longer injects a Bitc
14
14
  #### ⚠️ EVM
15
15
  Only supports Ethereum, Base, and Polygon.
16
16
 
17
- ### Feature
18
17
 
19
- #### ⚠️ Auto Connect
20
- On Sui, Phantom uses Solana's auto-connect mechanism.
21
- This means if Solana is not connected simultaneously, the auto-connect feature on Sui will not work properly.
22
18
 
23
19
  ---
24
20
 
package/src/constants.ts CHANGED
@@ -8,7 +8,6 @@ import {
8
8
  } from '@hub3js/evm';
9
9
  import { isSolanaNamespace } from '@hub3js/solana';
10
10
  import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';
11
- import { isSuiNamespace } from '@hub3js/sui';
12
11
 
13
12
  import getSigners from './signer.js';
14
13
  import { getInstanceOrThrow } from './utils.js';
@@ -20,7 +19,6 @@ export const EVM_SUPPORTED_CHAINS = [
20
19
  ];
21
20
 
22
21
  export const WALLET_ID = 'phantom';
23
- export const WALLET_NAME_IN_WALLET_STANDARD = 'Phantom';
24
22
 
25
23
  export const metadata: ProviderMetadata = {
26
24
  name: 'Phantom',
@@ -52,12 +50,6 @@ export const metadata: ProviderMetadata = {
52
50
  id: 'SOLANA',
53
51
  isChainSupported: isSolanaNamespace,
54
52
  },
55
- {
56
- label: 'Sui',
57
- value: 'Sui',
58
- id: 'SUI',
59
- isChainSupported: isSuiNamespace,
60
- },
61
53
  ],
62
54
  },
63
55
  },
package/src/provider.ts CHANGED
@@ -3,7 +3,6 @@ import { ProviderBuilder } from '@hub3js/core';
3
3
  import { metadata, WALLET_ID } from './constants.js';
4
4
  import { evm } from './namespaces/evm.js';
5
5
  import { solana } from './namespaces/solana.js';
6
- import { sui } from './namespaces/sui.js';
7
6
  import { phantom as phantomInstance } from './utils.js';
8
7
 
9
8
  const buildProvider = () =>
@@ -19,7 +18,6 @@ const buildProvider = () =>
19
18
  .config('metadata', metadata)
20
19
  .add('solana', solana)
21
20
  .add('evm', evm)
22
- .add('sui', sui)
23
21
  .build();
24
22
 
25
23
  export { buildProvider };
package/src/signer.ts CHANGED
@@ -6,11 +6,8 @@ import {
6
6
  SOLANA_NAMESPACE,
7
7
  UTXO_NAMESPACE,
8
8
  } from '@hub3js/namespaces';
9
- import { getInstance as getSuiInstance } from '@hub3js/sui';
10
9
  import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
11
10
 
12
- import { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';
13
-
14
11
  export default async function getSigners(
15
12
  provider: Provider
16
13
  ): Promise<SignerFactory> {
@@ -18,12 +15,9 @@ export default async function getSigners(
18
15
  const evmProvider = provider.get(EVM_NAMESPACE);
19
16
  const bitcoinInstance = provider.get(UTXO_NAMESPACE);
20
17
 
21
- const suiProvider = getSuiInstance(WALLET_NAME_IN_WALLET_STANDARD);
22
-
23
18
  const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');
24
19
  const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana');
25
20
  const { BTCSigner } = await import('./signers/utxoSigner.js');
26
- const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');
27
21
  const signers = new DefaultSignerFactory();
28
22
  if (!!solProvider) {
29
23
  signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));
@@ -34,8 +28,6 @@ export default async function getSigners(
34
28
  if (!!bitcoinInstance) {
35
29
  signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));
36
30
  }
37
- if (!!suiProvider) {
38
- signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiProvider));
39
- }
31
+
40
32
  return signers;
41
33
  }
package/src/utils.ts CHANGED
@@ -2,13 +2,11 @@ import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';
2
2
  import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
3
3
  import type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';
4
4
  import type { InstanceMap } from '@hub3js/std/types';
5
- import type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';
6
5
  import type { SolanaExternalProvider } from '@rango-dev/signer-solana';
7
6
 
8
7
  import {
9
8
  EVM_NAMESPACE,
10
9
  SOLANA_NAMESPACE,
11
- SUI_NAMESPACE,
12
10
  UTXO_NAMESPACE,
13
11
  } from '@hub3js/namespaces';
14
12
 
@@ -16,7 +14,6 @@ export type ProviderObject = {
16
14
  [EVM_NAMESPACE]: EvmProviderApi;
17
15
  [SOLANA_NAMESPACE]: SolanaExternalProvider;
18
16
  [UTXO_NAMESPACE]: UtxoProviderApi;
19
- [SUI_NAMESPACE]: SuiProviderApi;
20
17
  };
21
18
  export type Provider = InstanceMap<ProviderObject>;
22
19
 
@@ -27,7 +24,7 @@ export function phantom(): Provider | null {
27
24
  return null;
28
25
  }
29
26
 
30
- const { solana, ethereum, bitcoin, sui } = phantom;
27
+ const { solana, ethereum, bitcoin } = phantom;
31
28
 
32
29
  const instances: Provider = new Map();
33
30
 
@@ -42,9 +39,6 @@ export function phantom(): Provider | null {
42
39
  if (bitcoin && bitcoin.isPhantom) {
43
40
  instances.set(UTXO_NAMESPACE, bitcoin);
44
41
  }
45
- if (sui && sui.isPhantom) {
46
- instances.set(SUI_NAMESPACE, sui);
47
- }
48
42
 
49
43
  return instances;
50
44
  }
@@ -98,18 +92,6 @@ export function bitcoinPhantom(): SolanaProviderApi {
98
92
 
99
93
  return bitcoinInstance;
100
94
  }
101
- export function suiPhantom(): SuiProviderApi {
102
- const instance = phantom();
103
- const suiInstance = instance?.get(SUI_NAMESPACE);
104
-
105
- if (!suiInstance) {
106
- throw new Error(
107
- 'Phantom not injected or Sui not enabled. Please check your wallet.'
108
- );
109
- }
110
-
111
- return suiInstance;
112
- }
113
95
 
114
96
  export type BtcAccount = {
115
97
  address: string;
@@ -1,4 +0,0 @@
1
- import type { SuiActions } from '@hub3js/sui';
2
- declare const sui: import("@hub3js/core").ProxiedNamespace<SuiActions>;
3
- export { sui };
4
- //# sourceMappingURL=sui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../src/namespaces/sui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAyC9C,QAAA,MAAM,GAAG,qDAIC,CAAC;AAEX,OAAO,EAAE,GAAG,EAAE,CAAC"}
@@ -1,49 +0,0 @@
1
- import type { SolanaActions } from '@hub3js/solana';
2
- import type { SuiActions } from '@hub3js/sui';
3
-
4
- import { ActionBuilder, NamespaceBuilder } from '@hub3js/core';
5
- import { actions as solanaActions } from '@hub3js/solana';
6
- import * as commonBuilders from '@hub3js/std/builders';
7
- import { standardizeAndThrowError } from '@hub3js/std/operators';
8
- import { builders, hooks } from '@hub3js/sui';
9
-
10
- import { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';
11
- import { solanaPhantom } from '../utils.js';
12
-
13
- const [changeAccountSubscriber, changeAccountCleanup] =
14
- hooks.changeAccountSubscriber({
15
- name: WALLET_NAME_IN_WALLET_STANDARD,
16
- });
17
-
18
- const connect = builders
19
- .connect({
20
- name: WALLET_NAME_IN_WALLET_STANDARD,
21
- })
22
- .before(changeAccountSubscriber)
23
- .or(changeAccountCleanup)
24
- .or(standardizeAndThrowError)
25
- .build();
26
-
27
- const disconnect = commonBuilders
28
- .disconnect<SuiActions>()
29
- .after(changeAccountCleanup)
30
- .build();
31
-
32
- /*
33
- * TODO: We are currently using `solanaCanEagerConnectAction` to establish an eager connection to the Sui instance.
34
- * This is a temporary workaround due to Phantom's limitation in silently connecting to a Sui account.
35
- * Once Phantom introduces support for silent Sui connections, this implementation should be updated accordingly.
36
- */
37
- const canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(
38
- 'canEagerConnect'
39
- )
40
- .action(solanaActions.canEagerConnect(solanaPhantom))
41
- .build();
42
-
43
- const sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)
44
- .action(connect)
45
- .action(disconnect)
46
- .action(canEagerConnect)
47
- .build();
48
-
49
- export { sui };