@rango-dev/provider-binance 0.5.0 → 0.5.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +3 -3
- package/dist/provider-binance.build.json +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/signer.ts +2 -2
- package/src/types.ts +2 -2
- package/src/utils.ts +3 -3
package/CHANGELOG.md
CHANGED
package/dist/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=Object.defineProperty;var n=(e,t)=>v(e,"name",{value:t,configurable:!0});import{defineVersions as
|
|
1
|
+
var v=Object.defineProperty;var n=(e,t)=>v(e,"name",{value:t,configurable:!0});import{defineVersions as V}from"@hub3js/core/utils";import{ProviderBuilder as _}from"@hub3js/core";import{LegacyNetworks as o}from"@rango-dev/wallets-core/legacy";import"rango-types";import{EVM_NAMESPACE as A}from"@hub3js/namespaces";import{dynamicImportWithRefinedError as I,getNetworkInstance as S}from"@rango-dev/wallets-shared";import{DefaultSignerFactory as y,TransactionType as P}from"rango-types";async function m(e){let t=S(e,A),r=new y,{DefaultEvmSigner:E}=await I(async()=>await import("@rango-dev/signer-evm"));return r.registerSigner(P.EVM,new E(t)),r}n(m,"getSigners");import"@hub3js/evm";import{EVM_NAMESPACE as l}from"@hub3js/namespaces";function i(){let{binancew3w:e}=window;if(!e)return null;let t=new Map;return e.ethereum&&t.set(l,e.ethereum),t.size===0?null:t}n(i,"binance");function p(){let e=i();if(!e)throw new Error("Binance Wallet is not injected. Please check your wallet.");return e}n(p,"getInstanceOrThrow");function c(){let t=i()?.get(l);if(!t)throw new Error("Binance not injected or EVM not enabled. Please check your wallet.");return t}n(c,"evmBinance");async function u(e){let[t]=await e.request({method:"eth_requestAccounts"}),r=await e.request({method:"eth_chainId"});return{accounts:[t],chainId:r}}n(u,"getEvmAccounts");var a="binance",M=[o.OPTIMISM,o.ETHEREUM,o.LINEA,o.METIS,o.BLAST,o.CELO,o.FANTOM,o.MONAD,o.SONIC,o.BERACHAIN,o.BASE,o.ZETA_CHAIN,o.ARBITRUM,o.BSC,o.SCROLL,o.AVAX_CCHAIN],f={name:"Binance Wallet",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/binance/icon.svg",extensions:{chrome:"https://chromewebstore.google.com/detail/binance-wallet/cadiboklkpojfamcoggejbbdjcoiljjk",brave:"https://chromewebstore.google.com/detail/binance-wallet/cadiboklkpojfamcoggejbbdjcoiljjk",homepage:"https://www.binance.com/binancewallet"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",getSupportedChains:e=>e.filter(t=>M.includes(t.name))}]}},{name:"signers",value:{getSigners:async()=>m(p())}}]};import{NamespaceBuilder as T}from"@hub3js/core";import{actions as d,builders as s,utils as C}from"@hub3js/evm";import*as g from"@hub3js/std/builders";import{standardizeAndThrowError as N}from"@hub3js/std/operators";var[j,h]=s.changeAccountSubscriber(c).format(async(e,t)=>{let r=await e.request({method:"eth_chainId"});return C.formatAccountsToCAIP([t[0]],r)}).build(),k=s.connect().action(d.connect(c,{getAccounts:u})).before(j).or(h).or(N).build(),B=g.disconnect().after(h).build(),x=s.canSwitchNetwork().action(d.canSwitchNetwork()).build(),L=s.getChainId().action(d.getChainId(c)).build(),w=new T("EVM",a).action(k).action(B).action(x).action(L).build();var b=n(()=>new _(a).init(function(e){let[,t]=e.state();i()&&(t("installed",!0),console.debug("[binance-wallet] instance detected.",e))}).config("metadata",f).add("evm",w).build(),"buildProvider");var pe=n(()=>V().version("1.0.0",b()).build(),"versions");export{pe 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/utils.ts", "../src/namespaces/evm.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 };\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { binance as binanceInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n if (binanceInstance()) {\n setState('installed', true);\n console.debug('[binance-wallet] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('evm', evm)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport { LegacyNetworks } from '@rango-dev/wallets-core/legacy';\nimport { type BlockchainMeta } from 'rango-types';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const WALLET_ID = 'binance';\nexport const EVM_SUPPORTED_CHAINS = [\n LegacyNetworks.OPTIMISM,\n LegacyNetworks.ETHEREUM,\n LegacyNetworks.LINEA,\n LegacyNetworks.METIS,\n LegacyNetworks.BLAST,\n LegacyNetworks.CELO,\n LegacyNetworks.FANTOM,\n LegacyNetworks.MONAD,\n LegacyNetworks.SONIC,\n LegacyNetworks.BERACHAIN,\n LegacyNetworks.BASE,\n LegacyNetworks.ZETA_CHAIN,\n LegacyNetworks.ARBITRUM,\n LegacyNetworks.BSC,\n LegacyNetworks.SCROLL,\n LegacyNetworks.AVAX_CCHAIN,\n];\n\nexport const metadata: ProviderMetadata = {\n name: 'Binance Wallet',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/binance/icon.svg',\n extensions: {\n chrome:\n 'https://chromewebstore.google.com/detail/binance-wallet/cadiboklkpojfamcoggejbbdjcoiljjk',\n brave:\n 'https://chromewebstore.google.com/detail/binance-wallet/cadiboklkpojfamcoggejbbdjcoiljjk',\n homepage: 'https://www.binance.com/binancewallet',\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 getSupportedChains: (allBlockchains: BlockchainMeta[]) =>\n allBlockchains.filter((blockchainMeta) =>\n EVM_SUPPORTED_CHAINS.includes(\n blockchainMeta.name as LegacyNetworks\n )\n ),\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 {
|
|
5
|
-
"mappings": "+EAAA,OAAS,kBAAAA,MAAsB,qBCA/B,OAAS,mBAAAC,MAAuB,eCEhC,OAAS,kBAAAC,MAAsB,iCAC/B,MAAoC,cCApC,OAAS,
|
|
6
|
-
"names": ["defineVersions", "ProviderBuilder", "LegacyNetworks", "
|
|
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 };\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { binance as binanceInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n if (binanceInstance()) {\n setState('installed', true);\n console.debug('[binance-wallet] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('evm', evm)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport { LegacyNetworks } from '@rango-dev/wallets-core/legacy';\nimport { type BlockchainMeta } from 'rango-types';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const WALLET_ID = 'binance';\nexport const EVM_SUPPORTED_CHAINS = [\n LegacyNetworks.OPTIMISM,\n LegacyNetworks.ETHEREUM,\n LegacyNetworks.LINEA,\n LegacyNetworks.METIS,\n LegacyNetworks.BLAST,\n LegacyNetworks.CELO,\n LegacyNetworks.FANTOM,\n LegacyNetworks.MONAD,\n LegacyNetworks.SONIC,\n LegacyNetworks.BERACHAIN,\n LegacyNetworks.BASE,\n LegacyNetworks.ZETA_CHAIN,\n LegacyNetworks.ARBITRUM,\n LegacyNetworks.BSC,\n LegacyNetworks.SCROLL,\n LegacyNetworks.AVAX_CCHAIN,\n];\n\nexport const metadata: ProviderMetadata = {\n name: 'Binance Wallet',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/binance/icon.svg',\n extensions: {\n chrome:\n 'https://chromewebstore.google.com/detail/binance-wallet/cadiboklkpojfamcoggejbbdjcoiljjk',\n brave:\n 'https://chromewebstore.google.com/detail/binance-wallet/cadiboklkpojfamcoggejbbdjcoiljjk',\n homepage: 'https://www.binance.com/binancewallet',\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 getSupportedChains: (allBlockchains: BlockchainMeta[]) =>\n allBlockchains.filter((blockchainMeta) =>\n EVM_SUPPORTED_CHAINS.includes(\n blockchainMeta.name as LegacyNetworks\n )\n ),\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 { EVM_NAMESPACE } from '@hub3js/namespaces';\nimport {\n dynamicImportWithRefinedError,\n getNetworkInstance,\n} from '@rango-dev/wallets-shared';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const evmProvider = getNetworkInstance(provider, EVM_NAMESPACE);\n const signers = new DefaultSignerFactory();\n const { DefaultEvmSigner } = await dynamicImportWithRefinedError(\n async () => await import('@rango-dev/signer-evm')\n );\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));\n return signers;\n}\n", "import type { Provider } from './types.js';\n\nimport { type ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport { EVM_NAMESPACE } from '@hub3js/namespaces';\n\nexport function binance(): Provider | null {\n const { binancew3w } = window;\n\n if (!binancew3w) {\n return null;\n }\n\n const instances = new Map();\n if (binancew3w.ethereum) {\n instances.set(EVM_NAMESPACE, binancew3w.ethereum);\n }\n\n if (instances.size === 0) {\n return null;\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = binance();\n\n if (!instances) {\n throw new Error(\n 'Binance Wallet is not injected. Please check your wallet.'\n );\n }\n\n return instances;\n}\n\nexport function evmBinance(): EvmProviderApi {\n const instances = binance();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Binance not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\n}\n/**\n * * WORKAROUND 1: Binance Wallet Race Condition\n * Simultaneous calls to 'eth_chainId' and 'eth_requestAccounts' fail to return\n * a chainId. These must be executed sequentially to ensure both values resolve.\n */\nexport async function getEvmAccounts(provider: EvmProviderApi) {\n /**\n * * WORKAROUND 2: Account Indexing Consistency\n * Binance Wallet's `connect` returns a list where the currently selected account\n * is always the first item. We're directly taking this first item as the active account.\n *\n */\n const [account] = await provider.request({\n method: 'eth_requestAccounts',\n });\n const chainId = await provider.request({ method: 'eth_chainId' });\n\n return {\n accounts: [account],\n chainId,\n };\n}\n", "import type { EvmActions } from '@hub3js/evm';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, utils } from '@hub3js/evm';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { evmBinance, getEvmAccounts } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] = builders\n .changeAccountSubscriber(evmBinance)\n /*\n * Binance returns an array of connected accounts with the active one first.\n * Since we only need the active account, we take the first element as a workaround.\n */\n .format(async (instance, accounts) => {\n const chainId = await instance.request({ method: 'eth_chainId' });\n return utils.formatAccountsToCAIP([accounts[0]], chainId);\n })\n .build();\n\nconst connect = builders\n .connect()\n .action(\n actions.connect(evmBinance, {\n getAccounts: getEvmAccounts,\n })\n )\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 getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmBinance))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canSwitchNetwork)\n .action(getChainId)\n .build();\n\nexport { evm };\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,kBAAAA,MAAsB,qBCA/B,OAAS,mBAAAC,MAAuB,eCEhC,OAAS,kBAAAC,MAAsB,iCAC/B,MAAoC,cCApC,OAAS,iBAAAC,MAAqB,qBAC9B,OACE,iCAAAC,EACA,sBAAAC,MACK,4BACP,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAEhE,eAAOC,EACLC,EACwB,CACxB,IAAMC,EAAcC,EAAmBF,EAAUG,CAAa,EACxDC,EAAU,IAAIC,EACd,CAAE,iBAAAC,CAAiB,EAAI,MAAMC,EACjC,SAAY,KAAM,QAAO,uBAAuB,CAClD,EACA,OAAAH,EAAQ,eAAeI,EAAO,IAAK,IAAIF,EAAiBL,CAAW,CAAC,EAC7DG,CACT,CAV8BK,EAAAV,EAAA,cCR9B,MAAmD,cACnD,OAAS,iBAAAW,MAAqB,qBAEvB,SAASC,GAA2B,CACzC,GAAM,CAAE,WAAAC,CAAW,EAAI,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IAAI,MAAOC,CAAG,EACd,MAAM,EAXW,iBDFtB,IAAMC,GAAWC,EAAA,IACfC,EAAe,EAAE,QAAQ,QAASC,EAAc,CAAC,EAAE,MAAM,EAD1C",
|
|
6
|
+
"names": ["defineVersions", "ProviderBuilder", "LegacyNetworks", "EVM_NAMESPACE", "dynamicImportWithRefinedError", "getNetworkInstance", "DefaultSignerFactory", "TxType", "getSigners", "provider", "evmProvider", "getNetworkInstance", "EVM_NAMESPACE", "signers", "DefaultSignerFactory", "DefaultEvmSigner", "dynamicImportWithRefinedError", "TxType", "__name", "EVM_NAMESPACE", "binance", "binancew3w", "instances", "EVM_NAMESPACE", "__name", "getInstanceOrThrow", "evmBinance", "evmInstance", "getEvmAccounts", "provider", "account", "chainId", "WALLET_ID", "EVM_SUPPORTED_CHAINS", "LegacyNetworks", "metadata", "allBlockchains", "blockchainMeta", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "utils", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "builders", "evmBinance", "instance", "accounts", "chainId", "utils", "connect", "actions", "getEvmAccounts", "standardizeAndThrowError", "disconnect", "canSwitchNetwork", "getChainId", "evm", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "binance", "metadata", "evm", "versions", "__name", "defineVersions", "buildProvider"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/signer.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/signer.ts":{"bytes":751,"imports":[{"path":"@hub3js/namespaces","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/signer-evm","kind":"dynamic-import","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/utils.ts":{"bytes":1729,"imports":[{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@hub3js/namespaces","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":1826,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/namespaces/evm.ts":{"bytes":1587,"imports":[{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@hub3js/std/builders","kind":"import-statement","external":true},{"path":"@hub3js/std/operators","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"}],"format":"esm"},"src/provider.ts":{"bytes":590,"imports":[{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"src/namespaces/evm.ts","kind":"import-statement","original":"./namespaces/evm.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/mod.ts":{"bytes":209,"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"src/provider.ts","kind":"import-statement","original":"./provider.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/mod.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":11134},"dist/mod.js":{"imports":[{"path":"@hub3js/core/utils","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@hub3js/namespaces","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/signer-evm","kind":"dynamic-import","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@hub3js/namespaces","kind":"import-statement","external":true},{"path":"@hub3js/core","kind":"import-statement","external":true},{"path":"@hub3js/evm","kind":"import-statement","external":true},{"path":"@hub3js/std/builders","kind":"import-statement","external":true},{"path":"@hub3js/std/operators","kind":"import-statement","external":true}],"exports":["versions"],"entryPoint":"src/mod.ts","inputs":{"src/mod.ts":{"bytesInOutput":110},"src/provider.ts":{"bytesInOutput":244},"src/constants.ts":{"bytesInOutput":840},"src/signer.ts":{"bytesInOutput":399},"src/utils.ts":{"bytesInOutput":674},"src/namespaces/evm.ts":{"bytesInOutput":658}},"bytes":3060}}}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EVM_NAMESPACE } from '@hub3js/namespaces';
|
|
3
3
|
export type ProviderObject = {
|
|
4
|
-
[
|
|
4
|
+
[EVM_NAMESPACE]: EvmProviderApi;
|
|
5
5
|
};
|
|
6
6
|
export type Provider = Map<keyof ProviderObject, ProviderObject[keyof ProviderObject]>;
|
|
7
7
|
//# sourceMappingURL=types.d.ts.map
|
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,EAAE,
|
|
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,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,GAAG,CACxB,MAAM,cAAc,EACpB,cAAc,CAAC,MAAM,cAAc,CAAC,CACrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-binance",
|
|
3
|
-
"version": "0.5.0",
|
|
3
|
+
"version": "0.5.1-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
"lint": "eslint \"**/*.{ts,tsx}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@hub3js/core": "^0.
|
|
25
|
-
"@hub3js/evm": "^0.
|
|
26
|
-
"@hub3js/
|
|
24
|
+
"@hub3js/core": "^0.61.0",
|
|
25
|
+
"@hub3js/evm": "^0.3.0",
|
|
26
|
+
"@hub3js/namespaces": "^0.2.2",
|
|
27
|
+
"@hub3js/std": "^0.2.0",
|
|
27
28
|
"@rango-dev/signer-evm": "^0.44.0",
|
|
28
|
-
"@rango-dev/wallets-core": "^0.60.
|
|
29
|
-
"@rango-dev/wallets-shared": "^0.61.
|
|
29
|
+
"@rango-dev/wallets-core": "^0.60.1-next.2",
|
|
30
|
+
"@rango-dev/wallets-shared": "^0.61.1-next.3",
|
|
30
31
|
"rango-types": "^0.5.0"
|
|
31
32
|
},
|
|
32
33
|
"publishConfig": {
|
package/src/signer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Provider } from './types.js';
|
|
2
2
|
import type { SignerFactory } from 'rango-types';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { EVM_NAMESPACE } from '@hub3js/namespaces';
|
|
5
5
|
import {
|
|
6
6
|
dynamicImportWithRefinedError,
|
|
7
7
|
getNetworkInstance,
|
|
@@ -11,7 +11,7 @@ import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
|
|
|
11
11
|
export default async function getSigners(
|
|
12
12
|
provider: Provider
|
|
13
13
|
): Promise<SignerFactory> {
|
|
14
|
-
const evmProvider = getNetworkInstance(provider,
|
|
14
|
+
const evmProvider = getNetworkInstance(provider, EVM_NAMESPACE);
|
|
15
15
|
const signers = new DefaultSignerFactory();
|
|
16
16
|
const { DefaultEvmSigner } = await dynamicImportWithRefinedError(
|
|
17
17
|
async () => await import('@rango-dev/signer-evm')
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EVM_NAMESPACE } from '@hub3js/namespaces';
|
|
3
3
|
|
|
4
4
|
export type ProviderObject = {
|
|
5
|
-
[
|
|
5
|
+
[EVM_NAMESPACE]: EvmProviderApi;
|
|
6
6
|
};
|
|
7
7
|
export type Provider = Map<
|
|
8
8
|
keyof ProviderObject,
|
package/src/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Provider } from './types.js';
|
|
2
2
|
|
|
3
3
|
import { type ProviderAPI as EvmProviderApi } from '@hub3js/evm';
|
|
4
|
-
import {
|
|
4
|
+
import { EVM_NAMESPACE } from '@hub3js/namespaces';
|
|
5
5
|
|
|
6
6
|
export function binance(): Provider | null {
|
|
7
7
|
const { binancew3w } = window;
|
|
@@ -12,7 +12,7 @@ export function binance(): Provider | null {
|
|
|
12
12
|
|
|
13
13
|
const instances = new Map();
|
|
14
14
|
if (binancew3w.ethereum) {
|
|
15
|
-
instances.set(
|
|
15
|
+
instances.set(EVM_NAMESPACE, binancew3w.ethereum);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
if (instances.size === 0) {
|
|
@@ -37,7 +37,7 @@ export function getInstanceOrThrow(): Provider {
|
|
|
37
37
|
export function evmBinance(): EvmProviderApi {
|
|
38
38
|
const instances = binance();
|
|
39
39
|
|
|
40
|
-
const evmInstance = instances?.get(
|
|
40
|
+
const evmInstance = instances?.get(EVM_NAMESPACE);
|
|
41
41
|
|
|
42
42
|
if (!evmInstance) {
|
|
43
43
|
throw new Error(
|