@rango-dev/provider-bitget 0.60.1-next.4 → 0.60.1-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.
- package/dist/actions/utxo.d.ts +4 -2
- package/dist/actions/utxo.d.ts.map +1 -1
- package/dist/builders/utxo.d.ts +3 -8
- package/dist/builders/utxo.d.ts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/hooks/utxo.d.ts +1 -1
- package/dist/hooks/utxo.d.ts.map +1 -1
- package/dist/mod.d.ts +1 -1
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +3 -3
- package/dist/namespaces/utxo.d.ts +1 -1
- package/dist/namespaces/utxo.d.ts.map +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/signers/utxo.d.ts +1 -1
- package/dist/signers/utxo.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/actions/utxo.ts +17 -8
- package/src/builders/utxo.ts +8 -21
- package/src/constants.ts +6 -8
- package/src/hooks/utxo.ts +1 -4
- package/src/namespaces/utxo.ts +6 -3
- package/src/signers/utxo.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils.ts +1 -1
package/dist/actions/utxo.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { ProviderAPI, UtxoActions } from '@hub3js/bip122';
|
|
2
|
+
import type { CanEagerConnect, Context, FunctionWithContext } from '@hub3js/core';
|
|
3
3
|
export declare function connect(instance: () => ProviderAPI): FunctionWithContext<UtxoActions['connect'], Context>;
|
|
4
|
+
export declare function canEagerConnect(instance: () => ProviderAPI): CanEagerConnect<UtxoActions>;
|
|
4
5
|
export declare const utxoActions: {
|
|
5
6
|
connect: typeof connect;
|
|
7
|
+
canEagerConnect: typeof canEagerConnect;
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=utxo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/actions/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/actions/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,OAAO,EACP,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAItB,wBAAgB,OAAO,CACrB,QAAQ,EAAE,MAAM,WAAW,GAC1B,mBAAmB,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAatD;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,WAAW,GAC1B,eAAe,CAAC,WAAW,CAAC,CAK9B;AAED,eAAO,MAAM,WAAW;;;CAA+B,CAAC"}
|
package/dist/builders/utxo.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { type ProviderAPI, type UtxoActions } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
4
|
-
export declare const changeAccountSubscriber: (getInstance: () => ProviderAPI) => ChangeAccountSubscriberBuilder<string, ProviderAPI, UtxoActions>;
|
|
5
|
-
declare function canEagerConnect(getInstance: () => ProviderAPI): ActionBuilder<UtxoActions, "canEagerConnect">;
|
|
1
|
+
import type { ProviderAPI } from '@hub3js/bip122';
|
|
2
|
+
export declare const changeAccountSubscriber: (getInstance: () => ProviderAPI) => import("@hub3js/std/hooks").ChangeAccountSubscriberBuilder<string, ProviderAPI, import("@hub3js/bip122").UtxoActions>;
|
|
6
3
|
export declare const utxoBuilders: {
|
|
7
|
-
changeAccountSubscriber: (getInstance: () => ProviderAPI) => ChangeAccountSubscriberBuilder<string, ProviderAPI, UtxoActions>;
|
|
8
|
-
canEagerConnect: typeof canEagerConnect;
|
|
4
|
+
changeAccountSubscriber: (getInstance: () => ProviderAPI) => import("@hub3js/std/hooks").ChangeAccountSubscriberBuilder<string, ProviderAPI, import("@hub3js/bip122").UtxoActions>;
|
|
9
5
|
};
|
|
10
|
-
export {};
|
|
11
6
|
//# sourceMappingURL=utxo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/builders/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/builders/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,eAAO,MAAM,uBAAuB,gBAAiB,MAAM,WAAW,0HAuBhE,CAAC;AAEP,eAAO,MAAM,YAAY;2CAzB4B,MAAM,WAAW;CAyBf,CAAC"}
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYrD,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,QAAQ,EAAE,gBA0CtB,CAAC"}
|
package/dist/hooks/utxo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ProviderAPI, UtxoActions } from '@hub3js/bip122';
|
|
1
2
|
import type { Subscriber, SubscriberCleanUp } from '@hub3js/core';
|
|
2
|
-
import type { ProviderAPI, UtxoActions } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
3
3
|
declare function disconnectSubscriber(instance: () => ProviderAPI): [Subscriber<UtxoActions>, SubscriberCleanUp<UtxoActions>];
|
|
4
4
|
export declare const utxoHooks: {
|
|
5
5
|
disconnectSubscriber: typeof disconnectSubscriber;
|
package/dist/hooks/utxo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/hooks/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/hooks/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAe,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE/E,iBAAS,oBAAoB,CAC3B,QAAQ,EAAE,MAAM,WAAW,GAC1B,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAiC3D;AACD,eAAO,MAAM,SAAS;;CAA2B,CAAC"}
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const versions: () => readonly [readonly ["1.0.0", import("@hub3js/core").Provider<Record<"tron", import("@rango-dev/wallets-core/namespaces/tron").TronActions> & Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@
|
|
1
|
+
declare const versions: () => readonly [readonly ["1.0.0", import("@hub3js/core").Provider<Record<"tron", import("@rango-dev/wallets-core/namespaces/tron").TronActions> & Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@hub3js/bip122").UtxoActions>>]];
|
|
2
2
|
export { versions };
|
|
3
3
|
export { WALLET_ID } from './constants.js';
|
|
4
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,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,QAAQ,8PAC8C,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
|
|
1
|
+
var z=Object.defineProperty;var r=(o,t)=>z(o,"name",{value:t,configurable:!0});import{defineVersions as Ot}from"@hub3js/core/utils";import{ProviderBuilder as Dt}from"@hub3js/core";import{CAIP_BITCOIN_CHAIN_ID as Y,isChainSupported as Z}from"@hub3js/bip122";import{isEvmNamespace as tt}from"@hub3js/evm";import{isTronNamespace as ot}from"@rango-dev/wallets-core/namespaces/tron";import{EVM_NAMESPACE as K,TRON_NAMESPACE as $,UTXO_NAMESPACE as J}from"@hub3js/namespaces";import{DefaultSignerFactory as Q,TransactionType as b}from"rango-types";import{isBitcoinBlockchain as X}from"@rango-dev/internal-blockchains";import{SignerError as G}from"rango-types";var p=class{static{r(this,"BitgetUTXOSigner")}provider;constructor(t){this.provider=t}async signMessage(){throw G.UnimplementedError("signMessage")}async signAndSendTx(t){let{asset:e,psbt:i}=t;if(!i)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");if(!X(e.blockchain))throw new Error(`Signing ${e.blockchain} transaction is not implemented by the signer.`);let n=Buffer.from(i.unsignedPsbtBase64,"base64").toString("hex"),g=i.inputsToSign.flatMap(({address:s,signingIndexes:v})=>v.map(q=>({index:q,address:s})));try{let s=await this.provider.signPsbt(n,{autoFinalized:!0,toSignInputs:g});return{hash:await this.provider.pushPsbt(s)}}catch(s){throw new Error(s?.message||"Error during signing transaction")}}};async function h(o){let t=o.get(K),e=o.get($),i=o.get(J),n=new Q,{DefaultEvmSigner:g}=await import("@rango-dev/signer-evm"),{DefaultTronSigner:s}=await import("@rango-dev/signer-tron");return t&&n.registerSigner(b.EVM,new g(t)),e&&n.registerSigner(b.TRON,new s(e)),i&&n.registerSigner(b.TRANSFER,new p(i)),n}r(h,"getSigners");import{EVM_NAMESPACE as w,TRON_NAMESPACE as P,UTXO_NAMESPACE as E}from"@hub3js/namespaces";function m(){let o=new Map,{bitkeep:t}=window;return!t||(t.ethereum&&o.set(w,t.ethereum),t.tronLink&&o.set(P,t.tronLink),t.unisat&&o.set(E,t.unisat),o.size===0)?null:o}r(m,"bitget");function y(){let o=m();if(!o)throw new Error("Bitget is not injected. Please check your wallet.");return o}r(y,"getInstanceOrThrow");function a(){let t=m()?.get(w);if(!t)throw new Error("Bitget not injected or EVM not enabled. Please check your wallet.");return t}r(a,"evmBitget");function u(){let t=m()?.get(P);if(!t)throw new Error("Bitget not injected or Tron not enabled. Please check your wallet.");return t}r(u,"tronBitget");function d(){let t=m()?.get(E);if(!t)throw new Error("Bitget not injected or BTC not enabled. Please check your wallet.");return t}r(d,"utxoBitget");var c="bitget",C=200,x={name:"Bitget",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/bitget/icon.svg",extensions:{chrome:"https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak",brave:"https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak",homepage:"https://web3.bitget.com/en/wallet-download?type=1"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",isChainSupported:tt},{label:"Tron",value:"Tron",id:"TRON",isChainSupported:ot},{label:"BTC",value:"UTXO",id:"BTC",isChainSupported:Z([Y])}]}},{name:"signers",value:{getSigners:async()=>h(y())}}]};import{NamespaceBuilder as et}from"@hub3js/core";import{actions as l,builders as f,hooks as rt}from"@hub3js/evm";import*as T from"@hub3js/std/builders";import{standardizeAndThrowError as nt}from"@hub3js/std/operators";var[it,I]=rt.changeAccountSubscriber(a),ct=f.connect().action(l.connect(a)).before(it).or(I).or(nt).build(),st=T.disconnect().after(I).build(),at=f.canSwitchNetwork().action(l.canSwitchNetwork()).build(),mt=f.canEagerConnect().action(l.canEagerConnect(a)).build(),ut=f.getChainId().action(l.getChainId(a)).build(),S=new et("EVM",c).action(ct).action(st).action(ut).action(mt).action(at).build();import{NamespaceBuilder as gt}from"@hub3js/core";import*as N from"@hub3js/std/builders";import{standardizeAndThrowError as bt}from"@hub3js/std/operators";import{utils as ht}from"@rango-dev/wallets-core/namespaces/tron";import{builders as k}from"@rango-dev/wallets-core/namespaces/tron";var dt=r(async()=>{let o=a();if(!u())throw new Error("Trying to eagerly connect to your wallet, but seems its tron instance is not available.");if(!o)throw new Error("Trying to eagerly connect to your EVM wallet, but seems its instance is not available.");try{return!!(await o.request({method:"eth_accounts"})).length}catch{return!1}},"canEagerConnectAction"),B={canEagerConnectAction:dt};import{ChangeAccountSubscriberBuilder as pt}from"@hub3js/std/hooks";import{utils as lt}from"@rango-dev/wallets-core/namespaces/tron";var ft=r(o=>new pt().getInstance(o).onSwitchAccount((t,e)=>{if(!t.payload.data.isBitkeep||t.payload.data.message?.action!=="accountsChanged"){t.preventDefault();return}t.payload.data.message.data.address||(t.preventDefault(),e.action("disconnect"))}).format(async(t,e)=>lt.formatAccountsToCAIP([e.data.message.data.address])).addEventListener((t,e)=>{window.addEventListener("message",e)}).removeEventListener((t,e)=>{window.removeEventListener("message",e)}),"changeAccountSubscriber"),_={changeAccountSubscriber:ft};var[At,j]=_.changeAccountSubscriber(u).build(),vt=k.connect().action(async()=>{let o=u(),t=await o.request({method:"tron_requestAccounts"});if(!t)throw new Error("Please unlock your Bitget extension first.");if(t?.code&&t.message&&t.code!==C)throw new Error(t.message);return ht.formatAccountsToCAIP([o.tronWeb.defaultAddress.base58])}).before(At).or(bt).or(j).build(),wt=N.disconnect().after(j).build(),Pt=k.canEagerConnect().action(B.canEagerConnectAction).build(),L=new gt("Tron",c).action(vt).action(wt).action(Pt).build();import{builders as O}from"@hub3js/bip122";import{NamespaceBuilder as _t}from"@hub3js/core";import*as H from"@hub3js/std/builders";import{standardizeAndThrowError as Nt}from"@hub3js/std/operators";import{CAIP_BITCOIN_CHAIN_ID as Et,utils as yt}from"@hub3js/bip122";function Ct(o){return async()=>{let t=o();if(!t)throw new Error("Do your wallet injected correctly and is utxo compatible?");let e=await t.requestAccounts();return yt.formatAccountsToCAIP(e,Et)}}r(Ct,"connect");function xt(o){return async()=>!!(await o().getAccounts()).length}r(xt,"canEagerConnect");var A={connect:Ct,canEagerConnect:xt};import{builders as Tt,CAIP_BITCOIN_CHAIN_ID as M,utils as It}from"@hub3js/bip122";var St=r(o=>Tt.changeAccountSubscriber(o,{network:M}).onSwitchAccount((t,e)=>{t.payload||(t.preventDefault(),e.action("disconnect"))}).format(async(t,e)=>It.formatAccountsToCAIP(e?[e]:[],M)).addEventListener((t,e)=>t.addListener("accountChanged",e)).removeEventListener((t,e)=>t.removeListener("accountChanged",e)),"changeAccountSubscriber"),U={changeAccountSubscriber:St};function Bt(o){let t;return[(e,i)=>{let n=o();if(!n)throw new Error("Trying to subscribe to your BTC wallet, but seems its instance is not available.");if(t=r(()=>{e.action("disconnect")},"eventCallback"),n.on("disconnect",t),i instanceof Error)throw i},(e,i)=>{let n=o();return t&&n&&n.removeListener("disconnect",t),i}]}r(Bt,"disconnectSubscriber");var D={disconnectSubscriber:Bt};var[kt,F]=U.changeAccountSubscriber(d).build(),[jt,R]=D.disconnectSubscriber(d),Lt=O.connect().action(A.connect(d)).before(kt).before(jt).or(F).or(R).or(Nt).build(),Mt=H.disconnect().after(F).after(R).build(),Ut=O.canEagerConnect().action(A.canEagerConnect(d)).build(),V=new _t("UTXO",c).action(Lt).action(Mt).action(Ut).build();var W=r(()=>new Dt(c).init(function(o){let[,t]=o.state();m()&&(t("installed",!0),console.debug("[bitget] instance detected.",o))}).config("metadata",x).add("tron",L).add("evm",S).add("utxo",V).build(),"buildProvider");var te=r(()=>Ot().version("1.0.0",W()).build(),"versions");export{c as WALLET_ID,te 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/mod.ts", "../src/provider.ts", "../src/constants.ts", "../src/signer.ts", "../src/signers/utxo.ts", "../src/utils.ts", "../src/namespaces/evm.ts", "../src/namespaces/tron.ts", "../src/actions/tron.ts", "../src/builders/tron.ts", "../src/namespaces/utxo.ts", "../src/actions/utxo.ts", "../src/builders/utxo.ts", "../src/hooks/utxo.ts"],
|
|
4
|
-
"sourcesContent": ["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 { tron } from './namespaces/tron.js';\nimport { utxo } from './namespaces/utxo.js';\nimport { bitget } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (bitget()) {\n setState('installed', true);\n console.debug('[bitget] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('tron', tron)\n .add('evm', evm)\n .add('utxo', utxo)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport { isEvmNamespace } from '@hub3js/evm';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\nimport { isTronNamespace } from '@rango-dev/wallets-core/namespaces/tron';\nimport {\n CAIP_BITCOIN_CHAIN_ID,\n isUtxoNamespace,\n} from '@rango-dev/wallets-core/namespaces/utxo';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const WALLET_ID = 'bitget';\nexport const TronOKRequestCode = 200;\nexport const metadata: ProviderMetadata = {\n name: 'Bitget',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/bitget/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak',\n brave:\n 'https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak',\n homepage: 'https://web3.bitget.com/en/wallet-download?type=1',\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: isEvmNamespace,\n },\n {\n label: 'Tron',\n value: 'Tron',\n id: 'TRON',\n isChainSupported: isTronNamespace,\n },\n {\n label: 'BTC',\n value: 'UTXO',\n id: 'BTC',\n isChainSupported: (chainId: string) =>\n isUtxoNamespace(chainId) &&\n getChainIdFromCaip2ChainId(chainId) === CAIP_BITCOIN_CHAIN_ID,\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners(getInstanceOrThrow()) },\n },\n ],\n};\n", "import type { Provider } from './types.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n EVM_NAMESPACE,\n TRON_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { BitgetUTXOSigner } from './signers/utxo.js';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const ethProvider = provider.get(EVM_NAMESPACE);\n const tronProvider = provider.get(TRON_NAMESPACE);\n const utxoProvider = provider.get(UTXO_NAMESPACE);\n\n const signers = new DefaultSignerFactory();\n const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');\n const { DefaultTronSigner } = await import('@rango-dev/signer-tron');\n if (!!ethProvider) {\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider));\n }\n if (!!tronProvider) {\n signers.registerSigner(TxType.TRON, new DefaultTronSigner(tronProvider));\n }\n if (!!utxoProvider) {\n signers.registerSigner(TxType.TRANSFER, new BitgetUTXOSigner(utxoProvider));\n }\n\n return signers;\n}\n", "import type { ProviderAPI } from '@rango-dev/wallets-core/namespaces/utxo';\nimport type { GenericSigner, Transfer } from 'rango-types';\n\nimport { isBitcoinBlockchain } from '@rango-dev/internal-blockchains';\nimport { SignerError } from 'rango-types';\n\nexport class BitgetUTXOSigner implements GenericSigner<Transfer> {\n private provider: ProviderAPI;\n constructor(provider: ProviderAPI) {\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 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 // 1. Decode Base64 to hex\n const psbtHex = Buffer.from(psbt.unsignedPsbtBase64, 'base64').toString(\n 'hex'\n );\n\n // 2. Build UniSat inputs\n const toSignInputs = psbt.inputsToSign.flatMap(\n ({ address, signingIndexes }) =>\n signingIndexes.map((index) => ({ index, address }))\n );\n\n try {\n // 3. Sign (& auto-finalize)\n const signedPsbtHex = await this.provider.signPsbt(psbtHex, {\n autoFinalized: true,\n toSignInputs,\n });\n\n // 4. Push signed psbt\n const transactionHash = await this.provider.pushPsbt(signedPsbtHex);\n\n return { hash: transactionHash };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n throw new Error(error?.message || 'Error during signing transaction');\n }\n }\n}\n", "import type { Provider } from './types.js';\nimport type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as TronProviderApi } from '@rango-dev/wallets-core/namespaces/tron';\nimport type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';\n\nimport {\n EVM_NAMESPACE,\n TRON_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\n\nexport function bitget(): Provider | null {\n const instances: Provider = new Map();\n const { bitkeep } = window;\n\n if (!bitkeep) {\n return null;\n }\n\n if (bitkeep.ethereum) {\n instances.set(EVM_NAMESPACE, bitkeep.ethereum);\n }\n\n if (bitkeep.tronLink) {\n instances.set(TRON_NAMESPACE, bitkeep.tronLink);\n }\n if (bitkeep.unisat) {\n instances.set(UTXO_NAMESPACE, bitkeep.unisat);\n }\n\n if (instances.size === 0) {\n return null;\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = bitget();\n\n if (!instances) {\n throw new Error('Bitget is not injected. Please check your wallet.');\n }\n\n return instances;\n}\n\nexport function evmBitget(): EvmProviderApi {\n const instances = bitget();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Bitget not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\n}\n\nexport function tronBitget(): TronProviderApi {\n const instance = bitget();\n const tronInstance = instance?.get(TRON_NAMESPACE);\n\n if (!tronInstance) {\n throw new Error(\n 'Bitget not injected or Tron not enabled. Please check your wallet.'\n );\n }\n\n return tronInstance;\n}\nexport function utxoBitget(): UtxoProviderApi {\n const instance = bitget();\n const utxoInstance = instance?.get(UTXO_NAMESPACE);\n\n if (!utxoInstance) {\n throw new Error(\n 'Bitget not injected or BTC not enabled. Please check your wallet.'\n );\n }\n\n return utxoInstance;\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 { evmBitget } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmBitget);\nconst connect = builders\n .connect()\n .action(actions.connect(evmBitget))\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 canSwitchNetwork = builders\n .canSwitchNetwork()\n .action(actions.canSwitchNetwork())\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(actions.canEagerConnect(evmBitget))\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmBitget))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(getChainId)\n .action(canEagerConnect)\n .action(canSwitchNetwork)\n .build();\n\nexport { evm };\n", "import { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport {\n type TronActions,\n utils,\n} from '@rango-dev/wallets-core/namespaces/tron';\nimport { builders } from '@rango-dev/wallets-core/namespaces/tron';\n\nimport { tronActions } from '../actions/tron.js';\nimport { tronBuilders } from '../builders/tron.js';\nimport { TronOKRequestCode, WALLET_ID } from '../constants.js';\nimport { tronBitget } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] = tronBuilders\n .changeAccountSubscriber(tronBitget)\n .build();\n\nconst connect = builders\n .connect()\n .action(async () => {\n const instance = tronBitget();\n const accountsResult = await instance.request({\n method: 'tron_requestAccounts',\n });\n if (!accountsResult) {\n throw new Error('Please unlock your Bitget extension first.');\n }\n\n if (\n !!accountsResult?.code &&\n !!accountsResult.message &&\n accountsResult.code !== TronOKRequestCode\n ) {\n throw new Error(accountsResult.message);\n }\n return utils.formatAccountsToCAIP([instance.tronWeb.defaultAddress.base58]);\n })\n .before(changeAccountSubscriber)\n .or(standardizeAndThrowError)\n .or(changeAccountCleanup)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<TronActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(tronActions.canEagerConnectAction)\n .build();\n\nconst tron = new NamespaceBuilder<TronActions>('Tron', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { tron };\n", "import { evmBitget, tronBitget } from '../utils.js';\n\n/*\n * Bitget does not provide an eager connection mechanism for its Tron wallet.\n * The only workaround is to use the EVM-based eager connect approach.\n * However, this will only work if the EVM namespace has been connected at least once before.\n * If either wallet instance is unavailable, we throw an error.\n */\nconst canEagerConnectAction = async () => {\n const evmInstance = evmBitget();\n const tronInstance = tronBitget();\n // Making sure that the Tron instance is available first to prevent errors.\n if (!tronInstance) {\n throw new Error(\n 'Trying to eagerly connect to your wallet, but seems its tron instance is not available.'\n );\n }\n if (!evmInstance) {\n throw new Error(\n 'Trying to eagerly connect to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n try {\n const accounts: string[] = await evmInstance.request({\n method: 'eth_accounts',\n });\n if (accounts.length) {\n return true;\n }\n return false;\n } catch {\n return false;\n }\n};\nexport const tronActions = { canEagerConnectAction };\n", "import type { TronChangeAccountEvent } from '../types.js';\n\nimport { ChangeAccountSubscriberBuilder } from '@hub3js/std/hooks';\nimport {\n type ProviderAPI,\n type TronActions,\n utils,\n} from '@rango-dev/wallets-core/namespaces/tron';\n\nexport const changeAccountSubscriber = (getInstance: () => ProviderAPI) =>\n new ChangeAccountSubscriberBuilder<\n MessageEvent<TronChangeAccountEvent>,\n ProviderAPI,\n TronActions\n >()\n .getInstance(getInstance)\n .onSwitchAccount((event, context) => {\n if (\n !event.payload.data.isBitkeep ||\n event.payload.data.message?.action !== 'accountsChanged'\n ) {\n event.preventDefault();\n return;\n }\n if (!event.payload.data.message.data.address) {\n event.preventDefault();\n context.action('disconnect');\n }\n })\n .format(async (_, accounts) =>\n utils.formatAccountsToCAIP([accounts.data.message.data.address])\n )\n .addEventListener((_, callback) => {\n window.addEventListener('message', callback);\n })\n .removeEventListener((_, callback) => {\n window.removeEventListener('message', callback);\n });\n\nexport const tronBuilders = { changeAccountSubscriber };\n", "import type { UtxoActions } from '@rango-dev/wallets-core/namespaces/utxo';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport { builders } from '@rango-dev/wallets-core/namespaces/utxo';\n\nimport { utxoActions } from '../actions/utxo.js';\nimport { utxoBuilders } from '../builders/utxo.js';\nimport { WALLET_ID } from '../constants.js';\nimport { utxoHooks } from '../hooks/utxo.js';\nimport { utxoBitget } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] = utxoBuilders\n .changeAccountSubscriber(utxoBitget)\n .build();\nconst [disconnectSubscriber, disconnectSubscriberCleanup] =\n utxoHooks.disconnectSubscriber(utxoBitget);\nconst connect = builders\n .connect()\n .action(utxoActions.connect(utxoBitget))\n .before(changeAccountSubscriber)\n .before(disconnectSubscriber)\n .or(changeAccountCleanup)\n .or(disconnectSubscriberCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<UtxoActions>()\n .after(changeAccountCleanup)\n .after(disconnectSubscriberCleanup)\n .build();\n\nconst canEagerConnect = utxoBuilders.canEagerConnect(utxoBitget).build();\n\nconst utxo = new NamespaceBuilder<UtxoActions>('UTXO', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { utxo };\n", "import type { Context, FunctionWithContext } from '@hub3js/core';\n\nimport {\n CAIP_BITCOIN_CHAIN_ID,\n type ProviderAPI,\n utils,\n type UtxoActions,\n} from '@rango-dev/wallets-core/namespaces/utxo';\n\nexport function connect(\n instance: () => ProviderAPI\n): FunctionWithContext<UtxoActions['connect'], Context> {\n return async () => {\n const utxoInstance = instance();\n\n if (!utxoInstance) {\n throw new Error(\n 'Do your wallet injected correctly and is utxo compatible?'\n );\n }\n const accounts = await utxoInstance.requestAccounts();\n\n return utils.formatAccountsToCAIP(accounts, CAIP_BITCOIN_CHAIN_ID);\n };\n}\n\nexport const utxoActions = { connect };\n", "import { ActionBuilder } from '@hub3js/core';\nimport { ChangeAccountSubscriberBuilder } from '@hub3js/std/hooks';\nimport {\n CAIP_BITCOIN_CHAIN_ID,\n type ProviderAPI,\n utils,\n type UtxoActions,\n} from '@rango-dev/wallets-core/namespaces/utxo';\n\nexport const changeAccountSubscriber = (getInstance: () => ProviderAPI) =>\n new ChangeAccountSubscriberBuilder<string, ProviderAPI, UtxoActions>()\n .getInstance(getInstance)\n .onSwitchAccount((event, context) => {\n if (!event.payload) {\n event.preventDefault();\n context.action('disconnect');\n }\n })\n\n .format(async (_, address) => {\n return utils.formatAccountsToCAIP(\n address ? [address] : [],\n CAIP_BITCOIN_CHAIN_ID\n );\n })\n .addEventListener((instance, callback) => {\n return instance.addListener('accountChanged', callback);\n })\n .removeEventListener((instance, callback) => {\n return instance.removeListener('accountChanged', callback);\n });\n\nfunction canEagerConnect(getInstance: () => ProviderAPI) {\n return new ActionBuilder<UtxoActions, 'canEagerConnect'>(\n 'canEagerConnect'\n ).action(async () => {\n const instance = getInstance();\n const accounts = await instance.getAccounts();\n return !!accounts.length;\n });\n}\n\nexport const utxoBuilders = { changeAccountSubscriber, canEagerConnect };\n", "import type { AnyFunction, Subscriber, SubscriberCleanUp } from '@hub3js/core';\nimport type {\n ProviderAPI,\n UtxoActions,\n} from '@rango-dev/wallets-core/namespaces/utxo';\n\nfunction disconnectSubscriber(\n instance: () => ProviderAPI\n): [Subscriber<UtxoActions>, SubscriberCleanUp<UtxoActions>] {\n let eventCallback: AnyFunction;\n\n // subscriber can be passed to `or`, it will get the error and should rethrow error to pass the error to next `or` or throw error.\n return [\n (context, err) => {\n const bitcoinInstance = instance();\n\n if (!bitcoinInstance) {\n throw new Error(\n 'Trying to subscribe to your BTC wallet, but seems its instance is not available.'\n );\n }\n\n eventCallback = () => {\n context.action('disconnect');\n };\n bitcoinInstance.on('disconnect', eventCallback);\n\n if (err instanceof Error) {\n throw err;\n }\n },\n (_context, err) => {\n const bitcoinInstance = instance();\n\n if (eventCallback && bitcoinInstance) {\n bitcoinInstance.removeListener('disconnect', eventCallback);\n }\n\n return err;\n },\n ];\n}\nexport const utxoHooks = { disconnectSubscriber };\n"],
|
|
5
|
-
"mappings": "+EAAA,OAAS,kBAAAA,OAAsB,qBCA/B,OAAS,mBAAAC,OAAuB,eCEhC,
|
|
6
|
-
"names": ["defineVersions", "ProviderBuilder", "
|
|
4
|
+
"sourcesContent": ["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 { tron } from './namespaces/tron.js';\nimport { utxo } from './namespaces/utxo.js';\nimport { bitget } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (bitget()) {\n setState('installed', true);\n console.debug('[bitget] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('tron', tron)\n .add('evm', evm)\n .add('utxo', utxo)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_BITCOIN_CHAIN_ID,\n isChainSupported as isBip122ChainSupported,\n} from '@hub3js/bip122';\nimport { isEvmNamespace } from '@hub3js/evm';\nimport { isTronNamespace } from '@rango-dev/wallets-core/namespaces/tron';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const WALLET_ID = 'bitget';\nexport const TronOKRequestCode = 200;\n\nexport const metadata: ProviderMetadata = {\n name: 'Bitget',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/bitget/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak',\n brave:\n 'https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak',\n homepage: 'https://web3.bitget.com/en/wallet-download?type=1',\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: isEvmNamespace,\n },\n {\n label: 'Tron',\n value: 'Tron',\n id: 'TRON',\n isChainSupported: isTronNamespace,\n },\n {\n label: 'BTC',\n value: 'UTXO',\n id: 'BTC',\n isChainSupported: isBip122ChainSupported([CAIP_BITCOIN_CHAIN_ID]),\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners(getInstanceOrThrow()) },\n },\n ],\n};\n", "import type { Provider } from './types.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n EVM_NAMESPACE,\n TRON_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { BitgetUTXOSigner } from './signers/utxo.js';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const ethProvider = provider.get(EVM_NAMESPACE);\n const tronProvider = provider.get(TRON_NAMESPACE);\n const utxoProvider = provider.get(UTXO_NAMESPACE);\n\n const signers = new DefaultSignerFactory();\n const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');\n const { DefaultTronSigner } = await import('@rango-dev/signer-tron');\n if (!!ethProvider) {\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider));\n }\n if (!!tronProvider) {\n signers.registerSigner(TxType.TRON, new DefaultTronSigner(tronProvider));\n }\n if (!!utxoProvider) {\n signers.registerSigner(TxType.TRANSFER, new BitgetUTXOSigner(utxoProvider));\n }\n\n return signers;\n}\n", "import type { ProviderAPI } from '@hub3js/bip122';\nimport type { GenericSigner, Transfer } from 'rango-types';\n\nimport { isBitcoinBlockchain } from '@rango-dev/internal-blockchains';\nimport { SignerError } from 'rango-types';\n\nexport class BitgetUTXOSigner implements GenericSigner<Transfer> {\n private provider: ProviderAPI;\n constructor(provider: ProviderAPI) {\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 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 // 1. Decode Base64 to hex\n const psbtHex = Buffer.from(psbt.unsignedPsbtBase64, 'base64').toString(\n 'hex'\n );\n\n // 2. Build UniSat inputs\n const toSignInputs = psbt.inputsToSign.flatMap(\n ({ address, signingIndexes }) =>\n signingIndexes.map((index) => ({ index, address }))\n );\n\n try {\n // 3. Sign (& auto-finalize)\n const signedPsbtHex = await this.provider.signPsbt(psbtHex, {\n autoFinalized: true,\n toSignInputs,\n });\n\n // 4. Push signed psbt\n const transactionHash = await this.provider.pushPsbt(signedPsbtHex);\n\n return { hash: transactionHash };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n throw new Error(error?.message || 'Error during signing transaction');\n }\n }\n}\n", "import type { Provider } from './types.js';\nimport type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';\nimport type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as TronProviderApi } from '@rango-dev/wallets-core/namespaces/tron';\n\nimport {\n EVM_NAMESPACE,\n TRON_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\n\nexport function bitget(): Provider | null {\n const instances: Provider = new Map();\n const { bitkeep } = window;\n\n if (!bitkeep) {\n return null;\n }\n\n if (bitkeep.ethereum) {\n instances.set(EVM_NAMESPACE, bitkeep.ethereum);\n }\n\n if (bitkeep.tronLink) {\n instances.set(TRON_NAMESPACE, bitkeep.tronLink);\n }\n if (bitkeep.unisat) {\n instances.set(UTXO_NAMESPACE, bitkeep.unisat);\n }\n\n if (instances.size === 0) {\n return null;\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = bitget();\n\n if (!instances) {\n throw new Error('Bitget is not injected. Please check your wallet.');\n }\n\n return instances;\n}\n\nexport function evmBitget(): EvmProviderApi {\n const instances = bitget();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Bitget not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\n}\n\nexport function tronBitget(): TronProviderApi {\n const instance = bitget();\n const tronInstance = instance?.get(TRON_NAMESPACE);\n\n if (!tronInstance) {\n throw new Error(\n 'Bitget not injected or Tron not enabled. Please check your wallet.'\n );\n }\n\n return tronInstance;\n}\nexport function utxoBitget(): UtxoProviderApi {\n const instance = bitget();\n const utxoInstance = instance?.get(UTXO_NAMESPACE);\n\n if (!utxoInstance) {\n throw new Error(\n 'Bitget not injected or BTC not enabled. Please check your wallet.'\n );\n }\n\n return utxoInstance;\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 { evmBitget } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmBitget);\nconst connect = builders\n .connect()\n .action(actions.connect(evmBitget))\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 canSwitchNetwork = builders\n .canSwitchNetwork()\n .action(actions.canSwitchNetwork())\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(actions.canEagerConnect(evmBitget))\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmBitget))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(getChainId)\n .action(canEagerConnect)\n .action(canSwitchNetwork)\n .build();\n\nexport { evm };\n", "import { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport {\n type TronActions,\n utils,\n} from '@rango-dev/wallets-core/namespaces/tron';\nimport { builders } from '@rango-dev/wallets-core/namespaces/tron';\n\nimport { tronActions } from '../actions/tron.js';\nimport { tronBuilders } from '../builders/tron.js';\nimport { TronOKRequestCode, WALLET_ID } from '../constants.js';\nimport { tronBitget } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] = tronBuilders\n .changeAccountSubscriber(tronBitget)\n .build();\n\nconst connect = builders\n .connect()\n .action(async () => {\n const instance = tronBitget();\n const accountsResult = await instance.request({\n method: 'tron_requestAccounts',\n });\n if (!accountsResult) {\n throw new Error('Please unlock your Bitget extension first.');\n }\n\n if (\n !!accountsResult?.code &&\n !!accountsResult.message &&\n accountsResult.code !== TronOKRequestCode\n ) {\n throw new Error(accountsResult.message);\n }\n return utils.formatAccountsToCAIP([instance.tronWeb.defaultAddress.base58]);\n })\n .before(changeAccountSubscriber)\n .or(standardizeAndThrowError)\n .or(changeAccountCleanup)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<TronActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(tronActions.canEagerConnectAction)\n .build();\n\nconst tron = new NamespaceBuilder<TronActions>('Tron', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { tron };\n", "import { evmBitget, tronBitget } from '../utils.js';\n\n/*\n * Bitget does not provide an eager connection mechanism for its Tron wallet.\n * The only workaround is to use the EVM-based eager connect approach.\n * However, this will only work if the EVM namespace has been connected at least once before.\n * If either wallet instance is unavailable, we throw an error.\n */\nconst canEagerConnectAction = async () => {\n const evmInstance = evmBitget();\n const tronInstance = tronBitget();\n // Making sure that the Tron instance is available first to prevent errors.\n if (!tronInstance) {\n throw new Error(\n 'Trying to eagerly connect to your wallet, but seems its tron instance is not available.'\n );\n }\n if (!evmInstance) {\n throw new Error(\n 'Trying to eagerly connect to your EVM wallet, but seems its instance is not available.'\n );\n }\n\n try {\n const accounts: string[] = await evmInstance.request({\n method: 'eth_accounts',\n });\n if (accounts.length) {\n return true;\n }\n return false;\n } catch {\n return false;\n }\n};\nexport const tronActions = { canEagerConnectAction };\n", "import type { TronChangeAccountEvent } from '../types.js';\n\nimport { ChangeAccountSubscriberBuilder } from '@hub3js/std/hooks';\nimport {\n type ProviderAPI,\n type TronActions,\n utils,\n} from '@rango-dev/wallets-core/namespaces/tron';\n\nexport const changeAccountSubscriber = (getInstance: () => ProviderAPI) =>\n new ChangeAccountSubscriberBuilder<\n MessageEvent<TronChangeAccountEvent>,\n ProviderAPI,\n TronActions\n >()\n .getInstance(getInstance)\n .onSwitchAccount((event, context) => {\n if (\n !event.payload.data.isBitkeep ||\n event.payload.data.message?.action !== 'accountsChanged'\n ) {\n event.preventDefault();\n return;\n }\n if (!event.payload.data.message.data.address) {\n event.preventDefault();\n context.action('disconnect');\n }\n })\n .format(async (_, accounts) =>\n utils.formatAccountsToCAIP([accounts.data.message.data.address])\n )\n .addEventListener((_, callback) => {\n window.addEventListener('message', callback);\n })\n .removeEventListener((_, callback) => {\n window.removeEventListener('message', callback);\n });\n\nexport const tronBuilders = { changeAccountSubscriber };\n", "import type { UtxoActions } from '@hub3js/bip122';\n\nimport { builders } from '@hub3js/bip122';\nimport { NamespaceBuilder } from '@hub3js/core';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { utxoActions } from '../actions/utxo.js';\nimport { utxoBuilders } from '../builders/utxo.js';\nimport { WALLET_ID } from '../constants.js';\nimport { utxoHooks } from '../hooks/utxo.js';\nimport { utxoBitget } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] = utxoBuilders\n .changeAccountSubscriber(utxoBitget)\n .build();\nconst [disconnectSubscriber, disconnectSubscriberCleanup] =\n utxoHooks.disconnectSubscriber(utxoBitget);\nconst connect = builders\n .connect()\n .action(utxoActions.connect(utxoBitget))\n .before(changeAccountSubscriber)\n .before(disconnectSubscriber)\n .or(changeAccountCleanup)\n .or(disconnectSubscriberCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<UtxoActions>()\n .after(changeAccountCleanup)\n .after(disconnectSubscriberCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(utxoActions.canEagerConnect(utxoBitget))\n .build();\n\nconst utxo = new NamespaceBuilder<UtxoActions>('UTXO', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { utxo };\n", "import type { ProviderAPI, UtxoActions } from '@hub3js/bip122';\nimport type {\n CanEagerConnect,\n Context,\n FunctionWithContext,\n} from '@hub3js/core';\n\nimport { CAIP_BITCOIN_CHAIN_ID, utils } from '@hub3js/bip122';\n\nexport function connect(\n instance: () => ProviderAPI\n): FunctionWithContext<UtxoActions['connect'], Context> {\n return async () => {\n const utxoInstance = instance();\n\n if (!utxoInstance) {\n throw new Error(\n 'Do your wallet injected correctly and is utxo compatible?'\n );\n }\n const accounts = await utxoInstance.requestAccounts();\n\n return utils.formatAccountsToCAIP(accounts, CAIP_BITCOIN_CHAIN_ID);\n };\n}\n\nexport function canEagerConnect(\n instance: () => ProviderAPI\n): CanEagerConnect<UtxoActions> {\n return async () => {\n const accounts = await instance().getAccounts();\n return !!accounts.length;\n };\n}\n\nexport const utxoActions = { connect, canEagerConnect };\n", "import type { ProviderAPI } from '@hub3js/bip122';\n\nimport { builders, CAIP_BITCOIN_CHAIN_ID, utils } from '@hub3js/bip122';\n\nexport const changeAccountSubscriber = (getInstance: () => ProviderAPI) =>\n builders\n .changeAccountSubscriber<string>(getInstance, {\n network: CAIP_BITCOIN_CHAIN_ID,\n })\n .onSwitchAccount((event, context) => {\n if (!event.payload) {\n event.preventDefault();\n context.action('disconnect');\n }\n })\n\n .format(async (_, address) => {\n return utils.formatAccountsToCAIP(\n address ? [address] : [],\n CAIP_BITCOIN_CHAIN_ID\n );\n })\n .addEventListener((instance, callback) => {\n return instance.addListener('accountChanged', callback);\n })\n .removeEventListener((instance, callback) => {\n return instance.removeListener('accountChanged', callback);\n });\n\nexport const utxoBuilders = { changeAccountSubscriber };\n", "import type { ProviderAPI, UtxoActions } from '@hub3js/bip122';\nimport type { AnyFunction, Subscriber, SubscriberCleanUp } from '@hub3js/core';\n\nfunction disconnectSubscriber(\n instance: () => ProviderAPI\n): [Subscriber<UtxoActions>, SubscriberCleanUp<UtxoActions>] {\n let eventCallback: AnyFunction;\n\n // subscriber can be passed to `or`, it will get the error and should rethrow error to pass the error to next `or` or throw error.\n return [\n (context, err) => {\n const bitcoinInstance = instance();\n\n if (!bitcoinInstance) {\n throw new Error(\n 'Trying to subscribe to your BTC wallet, but seems its instance is not available.'\n );\n }\n\n eventCallback = () => {\n context.action('disconnect');\n };\n bitcoinInstance.on('disconnect', eventCallback);\n\n if (err instanceof Error) {\n throw err;\n }\n },\n (_context, err) => {\n const bitcoinInstance = instance();\n\n if (eventCallback && bitcoinInstance) {\n bitcoinInstance.removeListener('disconnect', eventCallback);\n }\n\n return err;\n },\n ];\n}\nexport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,CAACS,GAAyBC,CAAoB,EAAIC,EACrD,wBAAwBC,CAAU,EAClC,MAAM,EACH,CAACC,GAAsBC,CAA2B,EACtDC,EAAU,qBAAqBH,CAAU,EACrCI,GAAUC,EACb,QAAQ,EACR,OAAOC,EAAY,QAAQN,CAAU,CAAC,EACtC,OAAOH,EAAuB,EAC9B,OAAOI,EAAoB,EAC3B,GAAGH,CAAoB,EACvB,GAAGI,CAA2B,EAC9B,GAAGK,EAAwB,EAC3B,MAAM,EAEHC,GACH,aAAwB,EACxB,MAAMV,CAAoB,EAC1B,MAAMI,CAA2B,EACjC,MAAM,EAEHO,GAAkBJ,EACrB,gBAAgB,EAChB,OAAOC,EAAY,gBAAgBN,CAAU,CAAC,EAC9C,MAAM,EAEHU,EAAO,IAAIC,GAA8B,OAAQC,CAAS,EAC7D,OAAOR,EAAO,EACd,OAAOI,EAAU,EACjB,OAAOC,EAAe,EACtB,MAAM,ETnCT,IAAMI,EAAgBC,EAAA,IACpB,IAAIC,GAAgBC,CAAS,EAC1B,KAAK,SAAUC,EAAS,CACvB,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EAE/BE,EAAO,IACTD,EAAS,YAAa,EAAI,EAC1B,QAAQ,MAAM,8BAA+BD,CAAO,EAExD,CAAC,EACA,OAAO,WAAYG,CAAQ,EAC3B,IAAI,OAAQC,CAAI,EAChB,IAAI,MAAOC,CAAG,EACd,IAAI,OAAQC,CAAI,EAChB,MAAM,EAdW,iBDJtB,IAAMC,GAAWC,EAAA,IACfC,GAAe,EAAE,QAAQ,QAASC,EAAc,CAAC,EAAE,MAAM,EAD1C",
|
|
6
|
+
"names": ["defineVersions", "ProviderBuilder", "CAIP_BITCOIN_CHAIN_ID", "isBip122ChainSupported", "isEvmNamespace", "isTronNamespace", "EVM_NAMESPACE", "TRON_NAMESPACE", "UTXO_NAMESPACE", "DefaultSignerFactory", "TxType", "isBitcoinBlockchain", "SignerError", "BitgetUTXOSigner", "__name", "provider", "SignerError", "tx", "asset", "psbt", "isBitcoinBlockchain", "psbtHex", "toSignInputs", "address", "signingIndexes", "index", "signedPsbtHex", "error", "getSigners", "provider", "ethProvider", "EVM_NAMESPACE", "tronProvider", "TRON_NAMESPACE", "utxoProvider", "UTXO_NAMESPACE", "signers", "DefaultSignerFactory", "DefaultEvmSigner", "DefaultTronSigner", "TxType", "BitgetUTXOSigner", "__name", "EVM_NAMESPACE", "TRON_NAMESPACE", "UTXO_NAMESPACE", "bitget", "instances", "bitkeep", "EVM_NAMESPACE", "TRON_NAMESPACE", "UTXO_NAMESPACE", "__name", "getInstanceOrThrow", "evmBitget", "evmInstance", "tronBitget", "tronInstance", "utxoBitget", "utxoInstance", "WALLET_ID", "TronOKRequestCode", "metadata", "isEvmNamespace", "isTronNamespace", "isBip122ChainSupported", "CAIP_BITCOIN_CHAIN_ID", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "evmBitget", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canSwitchNetwork", "canEagerConnect", "getChainId", "evm", "NamespaceBuilder", "WALLET_ID", "NamespaceBuilder", "commonBuilders", "standardizeAndThrowError", "utils", "builders", "canEagerConnectAction", "__name", "evmInstance", "evmBitget", "tronBitget", "tronActions", "ChangeAccountSubscriberBuilder", "utils", "changeAccountSubscriber", "__name", "getInstance", "ChangeAccountSubscriberBuilder", "event", "context", "_", "accounts", "utils", "callback", "tronBuilders", "changeAccountSubscriber", "changeAccountCleanup", "tronBuilders", "tronBitget", "connect", "builders", "instance", "accountsResult", "TronOKRequestCode", "utils", "standardizeAndThrowError", "disconnect", "canEagerConnect", "tronActions", "tron", "NamespaceBuilder", "WALLET_ID", "builders", "NamespaceBuilder", "commonBuilders", "standardizeAndThrowError", "CAIP_BITCOIN_CHAIN_ID", "utils", "connect", "instance", "utxoInstance", "accounts", "utils", "CAIP_BITCOIN_CHAIN_ID", "__name", "canEagerConnect", "utxoActions", "builders", "CAIP_BITCOIN_CHAIN_ID", "utils", "changeAccountSubscriber", "__name", "getInstance", "builders", "CAIP_BITCOIN_CHAIN_ID", "event", "context", "_", "address", "utils", "instance", "callback", "utxoBuilders", "disconnectSubscriber", "instance", "eventCallback", "context", "err", "bitcoinInstance", "__name", "_context", "utxoHooks", "changeAccountSubscriber", "changeAccountCleanup", "utxoBuilders", "utxoBitget", "disconnectSubscriber", "disconnectSubscriberCleanup", "utxoHooks", "connect", "builders", "utxoActions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "utxo", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "bitget", "metadata", "tron", "evm", "utxo", "versions", "__name", "defineVersions", "buildProvider"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/namespaces/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/namespaces/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuClD,QAAA,MAAM,IAAI,sDAIA,CAAC;AAEX,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const buildProvider: () => import("@hub3js/core").Provider<Record<"tron", import("@rango-dev/wallets-core/namespaces/tron").TronActions> & Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@
|
|
1
|
+
declare const buildProvider: () => import("@hub3js/core").Provider<Record<"tron", import("@rango-dev/wallets-core/namespaces/tron").TronActions> & Record<"evm", import("@hub3js/evm").EvmActions> & Record<"utxo", import("@hub3js/bip122").UtxoActions>>;
|
|
2
2
|
export { buildProvider };
|
|
3
3
|
//# sourceMappingURL=provider.d.ts.map
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,aAAa,+NAcP,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/signers/utxo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProviderAPI } from '@
|
|
1
|
+
import type { ProviderAPI } from '@hub3js/bip122';
|
|
2
2
|
import type { GenericSigner, Transfer } from 'rango-types';
|
|
3
3
|
export declare class BitgetUTXOSigner implements GenericSigner<Transfer> {
|
|
4
4
|
private provider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/signers/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../src/signers/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK3D,qBAAa,gBAAiB,YAAW,aAAa,CAAC,QAAQ,CAAC;IAC9D,OAAO,CAAC,QAAQ,CAAc;gBAClB,QAAQ,EAAE,WAAW;IAI3B,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAwC7D"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';
|
|
1
2
|
import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
2
3
|
import type { EVM_NAMESPACE, TRON_NAMESPACE, UTXO_NAMESPACE } from '@hub3js/namespaces';
|
|
3
4
|
import type { InstanceMap } from '@hub3js/std/types';
|
|
4
5
|
import type { ProviderAPI as TronProviderApi } from '@rango-dev/wallets-core/namespaces/tron';
|
|
5
|
-
import type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
6
6
|
export type ProviderObject = {
|
|
7
7
|
[EVM_NAMESPACE]: EvmProviderApi;
|
|
8
8
|
[TRON_NAMESPACE]: TronProviderApi;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE9F,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC;IAChC,CAAC,cAAc,CAAC,EAAE,eAAe,CAAC;IAClC,CAAC,cAAc,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;AAEnD,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Provider } from './types.js';
|
|
2
|
+
import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';
|
|
2
3
|
import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
3
4
|
import type { ProviderAPI as TronProviderApi } from '@rango-dev/wallets-core/namespaces/tron';
|
|
4
|
-
import type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
5
5
|
export declare function bitget(): Provider | null;
|
|
6
6
|
export declare function getInstanceOrThrow(): Provider;
|
|
7
7
|
export declare function evmBitget(): EvmProviderApi;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,IAAI,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,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,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAQ9F,wBAAgB,MAAM,IAAI,QAAQ,GAAG,IAAI,CAwBxC;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAQ7C;AAED,wBAAgB,SAAS,IAAI,cAAc,CAY1C;AAED,wBAAgB,UAAU,IAAI,eAAe,CAW5C;AACD,wBAAgB,UAAU,IAAI,eAAe,CAW5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-bitget",
|
|
3
|
-
"version": "0.60.1-next.
|
|
3
|
+
"version": "0.60.1-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -21,14 +21,15 @@
|
|
|
21
21
|
"lint": "eslint \"**/*.{ts,tsx}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@hub3js/bip122": "^0.2.1",
|
|
24
25
|
"@hub3js/core": "^0.62.0",
|
|
25
26
|
"@hub3js/evm": "^0.5.0",
|
|
26
|
-
"@hub3js/namespaces": "^0.
|
|
27
|
+
"@hub3js/namespaces": "^0.5.1",
|
|
27
28
|
"@hub3js/std": "^0.4.0",
|
|
28
|
-
"@rango-dev/internal-blockchains": "^0.1.1-next.
|
|
29
|
+
"@rango-dev/internal-blockchains": "^0.1.1-next.2",
|
|
29
30
|
"@rango-dev/signer-evm": "^0.45.1-next.1",
|
|
30
31
|
"@rango-dev/signer-tron": "^0.42.0",
|
|
31
|
-
"@rango-dev/wallets-core": "^0.61.1-next.
|
|
32
|
+
"@rango-dev/wallets-core": "^0.61.1-next.2",
|
|
32
33
|
"rango-types": "^0.5.0"
|
|
33
34
|
},
|
|
34
35
|
"publishConfig": {
|
package/src/actions/utxo.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ProviderAPI, UtxoActions } from '@hub3js/bip122';
|
|
2
|
+
import type {
|
|
3
|
+
CanEagerConnect,
|
|
4
|
+
Context,
|
|
5
|
+
FunctionWithContext,
|
|
6
|
+
} from '@hub3js/core';
|
|
2
7
|
|
|
3
|
-
import {
|
|
4
|
-
CAIP_BITCOIN_CHAIN_ID,
|
|
5
|
-
type ProviderAPI,
|
|
6
|
-
utils,
|
|
7
|
-
type UtxoActions,
|
|
8
|
-
} from '@rango-dev/wallets-core/namespaces/utxo';
|
|
8
|
+
import { CAIP_BITCOIN_CHAIN_ID, utils } from '@hub3js/bip122';
|
|
9
9
|
|
|
10
10
|
export function connect(
|
|
11
11
|
instance: () => ProviderAPI
|
|
@@ -24,4 +24,13 @@ export function connect(
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export
|
|
27
|
+
export function canEagerConnect(
|
|
28
|
+
instance: () => ProviderAPI
|
|
29
|
+
): CanEagerConnect<UtxoActions> {
|
|
30
|
+
return async () => {
|
|
31
|
+
const accounts = await instance().getAccounts();
|
|
32
|
+
return !!accounts.length;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const utxoActions = { connect, canEagerConnect };
|
package/src/builders/utxo.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
CAIP_BITCOIN_CHAIN_ID,
|
|
5
|
-
type ProviderAPI,
|
|
6
|
-
utils,
|
|
7
|
-
type UtxoActions,
|
|
8
|
-
} from '@rango-dev/wallets-core/namespaces/utxo';
|
|
1
|
+
import type { ProviderAPI } from '@hub3js/bip122';
|
|
2
|
+
|
|
3
|
+
import { builders, CAIP_BITCOIN_CHAIN_ID, utils } from '@hub3js/bip122';
|
|
9
4
|
|
|
10
5
|
export const changeAccountSubscriber = (getInstance: () => ProviderAPI) =>
|
|
11
|
-
|
|
12
|
-
.
|
|
6
|
+
builders
|
|
7
|
+
.changeAccountSubscriber<string>(getInstance, {
|
|
8
|
+
network: CAIP_BITCOIN_CHAIN_ID,
|
|
9
|
+
})
|
|
13
10
|
.onSwitchAccount((event, context) => {
|
|
14
11
|
if (!event.payload) {
|
|
15
12
|
event.preventDefault();
|
|
@@ -30,14 +27,4 @@ export const changeAccountSubscriber = (getInstance: () => ProviderAPI) =>
|
|
|
30
27
|
return instance.removeListener('accountChanged', callback);
|
|
31
28
|
});
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
return new ActionBuilder<UtxoActions, 'canEagerConnect'>(
|
|
35
|
-
'canEagerConnect'
|
|
36
|
-
).action(async () => {
|
|
37
|
-
const instance = getInstance();
|
|
38
|
-
const accounts = await instance.getAccounts();
|
|
39
|
-
return !!accounts.length;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const utxoBuilders = { changeAccountSubscriber, canEagerConnect };
|
|
30
|
+
export const utxoBuilders = { changeAccountSubscriber };
|
package/src/constants.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ProviderMetadata } from '@hub3js/core';
|
|
2
2
|
|
|
3
|
-
import { isEvmNamespace } from '@hub3js/evm';
|
|
4
|
-
import { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';
|
|
5
|
-
import { isTronNamespace } from '@rango-dev/wallets-core/namespaces/tron';
|
|
6
3
|
import {
|
|
7
4
|
CAIP_BITCOIN_CHAIN_ID,
|
|
8
|
-
|
|
9
|
-
} from '@
|
|
5
|
+
isChainSupported as isBip122ChainSupported,
|
|
6
|
+
} from '@hub3js/bip122';
|
|
7
|
+
import { isEvmNamespace } from '@hub3js/evm';
|
|
8
|
+
import { isTronNamespace } from '@rango-dev/wallets-core/namespaces/tron';
|
|
10
9
|
|
|
11
10
|
import getSigners from './signer.js';
|
|
12
11
|
import { getInstanceOrThrow } from './utils.js';
|
|
13
12
|
|
|
14
13
|
export const WALLET_ID = 'bitget';
|
|
15
14
|
export const TronOKRequestCode = 200;
|
|
15
|
+
|
|
16
16
|
export const metadata: ProviderMetadata = {
|
|
17
17
|
name: 'Bitget',
|
|
18
18
|
icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/bitget/icon.svg',
|
|
@@ -45,9 +45,7 @@ export const metadata: ProviderMetadata = {
|
|
|
45
45
|
label: 'BTC',
|
|
46
46
|
value: 'UTXO',
|
|
47
47
|
id: 'BTC',
|
|
48
|
-
isChainSupported: (
|
|
49
|
-
isUtxoNamespace(chainId) &&
|
|
50
|
-
getChainIdFromCaip2ChainId(chainId) === CAIP_BITCOIN_CHAIN_ID,
|
|
48
|
+
isChainSupported: isBip122ChainSupported([CAIP_BITCOIN_CHAIN_ID]),
|
|
51
49
|
},
|
|
52
50
|
],
|
|
53
51
|
},
|
package/src/hooks/utxo.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import type { ProviderAPI, UtxoActions } from '@hub3js/bip122';
|
|
1
2
|
import type { AnyFunction, Subscriber, SubscriberCleanUp } from '@hub3js/core';
|
|
2
|
-
import type {
|
|
3
|
-
ProviderAPI,
|
|
4
|
-
UtxoActions,
|
|
5
|
-
} from '@rango-dev/wallets-core/namespaces/utxo';
|
|
6
3
|
|
|
7
4
|
function disconnectSubscriber(
|
|
8
5
|
instance: () => ProviderAPI
|
package/src/namespaces/utxo.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { UtxoActions } from '@
|
|
1
|
+
import type { UtxoActions } from '@hub3js/bip122';
|
|
2
2
|
|
|
3
|
+
import { builders } from '@hub3js/bip122';
|
|
3
4
|
import { NamespaceBuilder } from '@hub3js/core';
|
|
4
5
|
import * as commonBuilders from '@hub3js/std/builders';
|
|
5
6
|
import { standardizeAndThrowError } from '@hub3js/std/operators';
|
|
6
|
-
import { builders } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
7
7
|
|
|
8
8
|
import { utxoActions } from '../actions/utxo.js';
|
|
9
9
|
import { utxoBuilders } from '../builders/utxo.js';
|
|
@@ -32,7 +32,10 @@ const disconnect = commonBuilders
|
|
|
32
32
|
.after(disconnectSubscriberCleanup)
|
|
33
33
|
.build();
|
|
34
34
|
|
|
35
|
-
const canEagerConnect =
|
|
35
|
+
const canEagerConnect = builders
|
|
36
|
+
.canEagerConnect()
|
|
37
|
+
.action(utxoActions.canEagerConnect(utxoBitget))
|
|
38
|
+
.build();
|
|
36
39
|
|
|
37
40
|
const utxo = new NamespaceBuilder<UtxoActions>('UTXO', WALLET_ID)
|
|
38
41
|
.action(connect)
|
package/src/signers/utxo.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';
|
|
1
2
|
import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
2
3
|
import type {
|
|
3
4
|
EVM_NAMESPACE,
|
|
@@ -6,7 +7,6 @@ import type {
|
|
|
6
7
|
} from '@hub3js/namespaces';
|
|
7
8
|
import type { InstanceMap } from '@hub3js/std/types';
|
|
8
9
|
import type { ProviderAPI as TronProviderApi } from '@rango-dev/wallets-core/namespaces/tron';
|
|
9
|
-
import type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
10
10
|
|
|
11
11
|
export type ProviderObject = {
|
|
12
12
|
[EVM_NAMESPACE]: EvmProviderApi;
|
package/src/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Provider } from './types.js';
|
|
2
|
+
import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';
|
|
2
3
|
import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
3
4
|
import type { ProviderAPI as TronProviderApi } from '@rango-dev/wallets-core/namespaces/tron';
|
|
4
|
-
import type { ProviderAPI as UtxoProviderApi } from '@rango-dev/wallets-core/namespaces/utxo';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
EVM_NAMESPACE,
|