@rango-dev/provider-enkrypt 0.65.1-next.0 → 0.65.1
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 +1 -0
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +4 -4
- package/dist/namespaces/evm.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/constants.ts +0 -3
- package/src/namespaces/evm.ts +0 -2
- package/dist/hooks/evm.d.ts +0 -7
- package/dist/hooks/evm.d.ts.map +0 -1
- package/src/hooks/evm.ts +0 -16
package/CHANGELOG.md
CHANGED
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ProviderMetadata } from '@hub3js/core';
|
|
2
2
|
export declare const WALLET_ID = "enkrypt";
|
|
3
|
-
export declare const ENKRYPT_REJECTION = "User Rejected Request: The user rejected the request.";
|
|
4
3
|
export declare const metadata: ProviderMetadata;
|
|
5
4
|
//# sourceMappingURL=constants.d.ts.map
|
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;AAOrD,eAAO,MAAM,SAAS,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOrD,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,QAAQ,EAAE,gBAiCtB,CAAC"}
|
package/dist/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import{ProviderBuilder as N}from"@hub3js/core";import{isEvmNamespace as k}from"@hub3js/evm";import{EVM_NAMESPACE as v}from"@hub3js/namespaces";import{DefaultSignerFactory as y,TransactionType as w}from"rango-types";async function m(e){let t=e.get(v),c=new y,{DefaultEvmSigner:h}=await import("@rango-dev/signer-evm");return t&&c.registerSigner(w.EVM,new h(t)),c}o(m,"getSigners");import{EVM_NAMESPACE as p}from"@hub3js/namespaces";function s(){let{enkrypt:e}=window,t=e?.providers?.ethereum;if(!t)return null;let c=new Map;return c.set(p,t),c}o(s,"enkrypt");function d(){let e=s();if(!e)throw new Error("Enkrypt Wallet is not injected. Please check your wallet.");return e}o(d,"getInstanceOrThrow");function r(){let t=s()?.get(p);if(!t)throw new Error("Enkrypt Wallet not injected or EVM not enabled. Please check your wallet.");return t}o(r,"evmEnkrypt");var a="enkrypt",l={name:"Enkrypt",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/enkrypt/icon.svg",extensions:{chrome:"https://chrome.google.com/webstore/detail/enkrypt/kkpllkodjeloidieedojogacfhpaihoh",firefox:"https://addons.mozilla.org/en-US/firefox/addon/enkrypt/",brave:"https://chrome.google.com/webstore/detail/enkrypt/kkpllkodjeloidieedojogacfhpaihoh",edge:"https://microsoftedge.microsoft.com/addons/detail/enkrypt-ethereum-polkad/gfenajajnjjmmdojhdjmnngomkhlnfjl",homepage:"https://www.enkrypt.com/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",isChainSupported:k}]}},{name:"signers",value:{getSigners:async()=>m(d())}}]};import{NamespaceBuilder as b}from"@hub3js/core";import{actions as n,builders as i,hooks as P}from"@hub3js/evm";import*as u from"@hub3js/std/builders";import{standardizeAndThrowError as A}from"@hub3js/std/operators";var[S,g]=P.changeAccountSubscriber(r),j=i.connect().action(n.connect(r)).before(S).or(g).or(A).build(),x=u.disconnect().after(g).build(),T=i.canSwitchNetwork().action(n.canSwitchNetwork()).build(),M=i.canEagerConnect().action(n.canEagerConnect(r)).build(),C=i.getChainId().action(n.getChainId(r)).build(),I=i.getAllowance().action(n.getAllowance(r)).build(),L=i.getTransactionReceipt().action(n.getTransactionReceipt(r)).build(),f=new b("EVM",a).action(j).action(x).action(M).action(T).action(C).action(I).action(L).build();var V=o(()=>new N(a).init(function(e){let[,t]=e.state();s()&&(t("installed",!0),console.debug("[enkrypt] instance detected.",e))}).config("metadata",l).add("evm",f).build(),"buildProvider");export{a as WALLET_ID,V 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/provider.ts", "../src/constants.ts", "../src/signer.ts", "../src/utils.ts", "../src/namespaces/evm.ts"
|
|
4
|
-
"sourcesContent": ["import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { enkrypt } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (enkrypt()) {\n setState('installed', true);\n console.debug('[enkrypt] 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 { isEvmNamespace } from '@hub3js/evm';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const WALLET_ID = 'enkrypt';\
|
|
5
|
-
"mappings": "+EAAA,OAAS,mBAAAA,MAAuB,eCEhC,OAAS,kBAAAC,MAAsB,cCC/B,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,wBAAAC,EAAsB,mBAAAC,MAAuB,cAEtD,eAAOC,EACLC,EACwB,CACxB,IAAMC,EAAcD,EAAS,IAAIE,CAAa,EACxCC,EAAU,IAAIC,EACd,CAAE,iBAAAC,CAAiB,EAAI,KAAM,QAAO,uBAAuB,EACjE,OAAMJ,GACJE,EAAQ,eACNG,EAAgB,IAChB,IAAID,EAAiBJ,CAAW,CAClC,EAEKE,CACT,CAb8BI,EAAAR,EAAA,cCJ9B,OAAS,iBAAAS,MAAqB,qBAEvB,SAASC,GAA2B,CACzC,GAAM,CAAE,QAAAA,CAAQ,EAAI,OACdC,EAAWD,GAAS,WAAW,SACrC,GAAI,CAACC,EACH,OAAO,KAET,IAAMC,EAAsB,IAAI,IAChC,OAAAA,EAAU,IAAIC,EAAeF,CAAQ,EAE9BC,CACT,CAVgBE,EAAAJ,EAAA,WAYT,SAASK,GAA+B,CAC7C,IAAMH,EAAYF,EAAQ,EAE1B,GAAI,CAACE,EACH,MAAM,IAAI,MACR,2DACF,EAGF,OAAOA,CACT,CAVgBE,EAAAC,EAAA,sBAYT,SAASC,GAAiC,CAG/C,IAAMC,EAFYP,EAAQ,GAEK,IAAIG,CAAa,EAEhD,GAAI,CAACI,EACH,MAAM,IAAI,MACR,2EACF,EAGF,OAAOA,CACT,CAZgBH,EAAAE,EAAA,cFrBT,IAAME,EAAY,
|
|
6
|
-
"names": ["ProviderBuilder", "isEvmNamespace", "EVM_NAMESPACE", "DefaultSignerFactory", "TransactionType", "getSigners", "provider", "ethProvider", "EVM_NAMESPACE", "signers", "DefaultSignerFactory", "DefaultEvmSigner", "TransactionType", "__name", "EVM_NAMESPACE", "enkrypt", "ethereum", "instances", "EVM_NAMESPACE", "__name", "getInstanceOrThrow", "evmEnkrypt", "evmInstance", "WALLET_ID", "
|
|
3
|
+
"sources": ["../src/provider.ts", "../src/constants.ts", "../src/signer.ts", "../src/utils.ts", "../src/namespaces/evm.ts"],
|
|
4
|
+
"sourcesContent": ["import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { enkrypt } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (enkrypt()) {\n setState('installed', true);\n console.debug('[enkrypt] 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 { isEvmNamespace } from '@hub3js/evm';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const WALLET_ID = 'enkrypt';\nexport const metadata: ProviderMetadata = {\n name: 'Enkrypt',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/enkrypt/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/enkrypt/kkpllkodjeloidieedojogacfhpaihoh',\n firefox: 'https://addons.mozilla.org/en-US/firefox/addon/enkrypt/',\n brave:\n 'https://chrome.google.com/webstore/detail/enkrypt/kkpllkodjeloidieedojogacfhpaihoh',\n edge: 'https://microsoftedge.microsoft.com/addons/detail/enkrypt-ethereum-polkad/gfenajajnjjmmdojhdjmnngomkhlnfjl',\n\n homepage: 'https://www.enkrypt.com/',\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 },\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 { DefaultSignerFactory, TransactionType } from 'rango-types';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const ethProvider = provider.get(EVM_NAMESPACE);\n const signers = new DefaultSignerFactory();\n const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');\n if (!!ethProvider) {\n signers.registerSigner(\n TransactionType.EVM,\n new DefaultEvmSigner(ethProvider)\n );\n }\n return signers;\n}\n", "import type { EnkryptEvmProvider, Provider } from './types.js';\n\nimport { EVM_NAMESPACE } from '@hub3js/namespaces';\n\nexport function enkrypt(): Provider | null {\n const { enkrypt } = window;\n const ethereum = enkrypt?.providers?.ethereum;\n if (!ethereum) {\n return null;\n }\n const instances: Provider = new Map();\n instances.set(EVM_NAMESPACE, ethereum);\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = enkrypt();\n\n if (!instances) {\n throw new Error(\n 'Enkrypt Wallet is not injected. Please check your wallet.'\n );\n }\n\n return instances;\n}\n\nexport function evmEnkrypt(): EnkryptEvmProvider {\n const instances = enkrypt();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Enkrypt Wallet not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\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 { evmEnkrypt } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmEnkrypt);\nconst connect = builders\n .connect()\n .action(actions.connect(evmEnkrypt))\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(evmEnkrypt))\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmEnkrypt))\n .build();\n\nconst getAllowance = builders\n .getAllowance()\n .action(actions.getAllowance(evmEnkrypt))\n .build();\n\nconst getTransactionReceipt = builders\n .getTransactionReceipt()\n .action(actions.getTransactionReceipt(evmEnkrypt))\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"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,mBAAAA,MAAuB,eCEhC,OAAS,kBAAAC,MAAsB,cCC/B,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,wBAAAC,EAAsB,mBAAAC,MAAuB,cAEtD,eAAOC,EACLC,EACwB,CACxB,IAAMC,EAAcD,EAAS,IAAIE,CAAa,EACxCC,EAAU,IAAIC,EACd,CAAE,iBAAAC,CAAiB,EAAI,KAAM,QAAO,uBAAuB,EACjE,OAAMJ,GACJE,EAAQ,eACNG,EAAgB,IAChB,IAAID,EAAiBJ,CAAW,CAClC,EAEKE,CACT,CAb8BI,EAAAR,EAAA,cCJ9B,OAAS,iBAAAS,MAAqB,qBAEvB,SAASC,GAA2B,CACzC,GAAM,CAAE,QAAAA,CAAQ,EAAI,OACdC,EAAWD,GAAS,WAAW,SACrC,GAAI,CAACC,EACH,OAAO,KAET,IAAMC,EAAsB,IAAI,IAChC,OAAAA,EAAU,IAAIC,EAAeF,CAAQ,EAE9BC,CACT,CAVgBE,EAAAJ,EAAA,WAYT,SAASK,GAA+B,CAC7C,IAAMH,EAAYF,EAAQ,EAE1B,GAAI,CAACE,EACH,MAAM,IAAI,MACR,2DACF,EAGF,OAAOA,CACT,CAVgBE,EAAAC,EAAA,sBAYT,SAASC,GAAiC,CAG/C,IAAMC,EAFYP,EAAQ,GAEK,IAAIG,CAAa,EAEhD,GAAI,CAACI,EACH,MAAM,IAAI,MACR,2EACF,EAGF,OAAOA,CACT,CAZgBH,EAAAE,EAAA,cFrBT,IAAME,EAAY,UACZC,EAA6B,CACxC,KAAM,UACN,KAAM,wFACN,WAAY,CACV,OACE,qFACF,QAAS,0DACT,MACE,qFACF,KAAM,6GAEN,SAAU,0BACZ,EACA,WAAY,CACV,CACE,KAAM,aACN,MAAO,CACL,UAAW,WACX,KAAM,CACJ,CACE,MAAO,MACP,MAAO,MACP,GAAI,MACJ,iBAAkBC,CACpB,CACF,CACF,CACF,EACA,CACE,KAAM,UACN,MAAO,CAAE,WAAY,SAAYC,EAAWC,EAAmB,CAAC,CAAE,CACpE,CACF,CACF,EGvCA,OAAS,oBAAAC,MAAwB,eACjC,OAAS,WAAAC,EAAS,YAAAC,EAAU,SAAAC,MAAa,cACzC,UAAYC,MAAoB,uBAChC,OAAS,4BAAAC,MAAgC,wBAKzC,GAAM,CAACC,EAAyBC,CAAoB,EAClDC,EAAM,wBAAwBC,CAAU,EACpCC,EAAUC,EACb,QAAQ,EACR,OAAOC,EAAQ,QAAQH,CAAU,CAAC,EAClC,OAAOH,CAAuB,EAC9B,GAAGC,CAAoB,EACvB,GAAGM,CAAwB,EAC3B,MAAM,EAEHC,EACH,aAAuB,EACvB,MAAMP,CAAoB,EAC1B,MAAM,EAEHQ,EAAmBJ,EACtB,iBAAiB,EACjB,OAAOC,EAAQ,iBAAiB,CAAC,EACjC,MAAM,EAEHI,EAAkBL,EACrB,gBAAgB,EAChB,OAAOC,EAAQ,gBAAgBH,CAAU,CAAC,EAC1C,MAAM,EAEHQ,EAAaN,EAChB,WAAW,EACX,OAAOC,EAAQ,WAAWH,CAAU,CAAC,EACrC,MAAM,EAEHS,EAAeP,EAClB,aAAa,EACb,OAAOC,EAAQ,aAAaH,CAAU,CAAC,EACvC,MAAM,EAEHU,EAAwBR,EAC3B,sBAAsB,EACtB,OAAOC,EAAQ,sBAAsBH,CAAU,CAAC,EAChD,MAAM,EAEHW,EAAM,IAAIC,EAA6B,MAAOC,CAAS,EAC1D,OAAOZ,CAAO,EACd,OAAOI,CAAU,EACjB,OAAOE,CAAe,EACtB,OAAOD,CAAgB,EACvB,OAAOE,CAAU,EACjB,OAAOC,CAAY,EACnB,OAAOC,CAAqB,EAC5B,MAAM,EJpDT,IAAMI,EAAgBC,EAAA,IACpB,IAAIC,EAAgBC,CAAS,EAC1B,KAAK,SAAUC,EAAS,CACvB,GAAM,CAAC,CAAEC,CAAQ,EAAID,EAAQ,MAAM,EAE/BE,EAAQ,IACVD,EAAS,YAAa,EAAI,EAC1B,QAAQ,MAAM,+BAAgCD,CAAO,EAEzD,CAAC,EACA,OAAO,WAAYG,CAAQ,EAC3B,IAAI,MAAOC,CAAG,EACd,MAAM,EAZW",
|
|
6
|
+
"names": ["ProviderBuilder", "isEvmNamespace", "EVM_NAMESPACE", "DefaultSignerFactory", "TransactionType", "getSigners", "provider", "ethProvider", "EVM_NAMESPACE", "signers", "DefaultSignerFactory", "DefaultEvmSigner", "TransactionType", "__name", "EVM_NAMESPACE", "enkrypt", "ethereum", "instances", "EVM_NAMESPACE", "__name", "getInstanceOrThrow", "evmEnkrypt", "evmInstance", "WALLET_ID", "metadata", "isEvmNamespace", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "evmEnkrypt", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canSwitchNetwork", "canEagerConnect", "getChainId", "getAllowance", "getTransactionReceipt", "evm", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "enkrypt", "metadata", "evm"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src/namespaces/evm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src/namespaces/evm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAkD9C,QAAA,MAAM,GAAG,qDAQC,CAAC;AAEX,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-enkrypt",
|
|
3
|
-
"version": "0.65.1
|
|
3
|
+
"version": "0.65.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"lint": "eslint \"**/*.{ts,tsx}\""
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rango-dev/signer-evm": "^0.47.
|
|
25
|
+
"@rango-dev/signer-evm": "^0.47.1",
|
|
26
26
|
"rango-types": "^0.6.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@hub3js/core": "^0.
|
|
30
|
-
"@hub3js/evm": "^0.
|
|
31
|
-
"@hub3js/namespaces": "^0.
|
|
32
|
-
"@hub3js/std": "^0.
|
|
29
|
+
"@hub3js/core": "^0.63.0",
|
|
30
|
+
"@hub3js/evm": "^0.6.0",
|
|
31
|
+
"@hub3js/namespaces": "^0.7.0",
|
|
32
|
+
"@hub3js/std": "^0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@hub3js/core": "^0.
|
|
36
|
-
"@hub3js/evm": "^0.
|
|
37
|
-
"@hub3js/namespaces": "^0.
|
|
38
|
-
"@hub3js/std": "^0.
|
|
35
|
+
"@hub3js/core": "^0.63.0",
|
|
36
|
+
"@hub3js/evm": "^0.6.0",
|
|
37
|
+
"@hub3js/namespaces": "^0.7.0",
|
|
38
|
+
"@hub3js/std": "^0.5.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
package/src/constants.ts
CHANGED
|
@@ -6,9 +6,6 @@ import getSigners from './signer.js';
|
|
|
6
6
|
import { getInstanceOrThrow } from './utils.js';
|
|
7
7
|
|
|
8
8
|
export const WALLET_ID = 'enkrypt';
|
|
9
|
-
// Enkrypt rejects with a bare string, not an error object.
|
|
10
|
-
export const ENKRYPT_REJECTION =
|
|
11
|
-
'User Rejected Request: The user rejected the request.';
|
|
12
9
|
export const metadata: ProviderMetadata = {
|
|
13
10
|
name: 'Enkrypt',
|
|
14
11
|
icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/enkrypt/icon.svg',
|
package/src/namespaces/evm.ts
CHANGED
|
@@ -6,7 +6,6 @@ import * as commonBuilders from '@hub3js/std/builders';
|
|
|
6
6
|
import { standardizeAndThrowError } from '@hub3js/std/operators';
|
|
7
7
|
|
|
8
8
|
import { WALLET_ID } from '../constants.js';
|
|
9
|
-
import { evmHooks } from '../hooks/evm.js';
|
|
10
9
|
import { evmEnkrypt } from '../utils.js';
|
|
11
10
|
|
|
12
11
|
const [changeAccountSubscriber, changeAccountCleanup] =
|
|
@@ -16,7 +15,6 @@ const connect = builders
|
|
|
16
15
|
.action(actions.connect(evmEnkrypt))
|
|
17
16
|
.before(changeAccountSubscriber)
|
|
18
17
|
.or(changeAccountCleanup)
|
|
19
|
-
.or(evmHooks.convertRejectionError)
|
|
20
18
|
.or(standardizeAndThrowError)
|
|
21
19
|
.build();
|
|
22
20
|
|
package/dist/hooks/evm.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@hub3js/core';
|
|
2
|
-
declare function convertRejectionError(_context: Context, error: unknown): unknown;
|
|
3
|
-
export declare const evmHooks: {
|
|
4
|
-
convertRejectionError: typeof convertRejectionError;
|
|
5
|
-
};
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=evm.d.ts.map
|
package/dist/hooks/evm.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src/hooks/evm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAM5C,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAOzE;AAED,eAAO,MAAM,QAAQ;;CAA4B,CAAC"}
|
package/src/hooks/evm.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@hub3js/core';
|
|
2
|
-
|
|
3
|
-
import { Hub3Error } from '@hub3js/core';
|
|
4
|
-
|
|
5
|
-
import { ENKRYPT_REJECTION } from '../constants.js';
|
|
6
|
-
|
|
7
|
-
function convertRejectionError(_context: Context, error: unknown): unknown {
|
|
8
|
-
if (error === ENKRYPT_REJECTION) {
|
|
9
|
-
return new Hub3Error('PROVIDER_USER_REJECTED_REQUEST', error, {
|
|
10
|
-
cause: error,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
return error;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const evmHooks = { convertRejectionError };
|