New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@portal-hq/injected-provider

Package Overview
Dependencies
Maintainers
7
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@portal-hq/injected-provider - npm Package Compare versions

Comparing version 2.0.4 to 2.0.6

7

lib/commonjs/index.js

@@ -89,6 +89,4 @@ "use strict";

enable() {
return __awaiter(this, void 0, void 0, function* () {
this.emit('connect', { chainId: `0x${this.chainId.toString(16)}` });
return [this.address];
});
this.emit('connect', { chainId: `0x${this.chainId.toString(16)}` });
return [this.address];
}

@@ -200,2 +198,3 @@ /**

else if (typeof this.gatewayConfig === 'object' &&
// eslint-disable-next-line no-prototype-builtins
!this.gatewayConfig.hasOwnProperty(this.chainId)) {

@@ -202,0 +201,0 @@ // If there's no explicit mapping for the current chainId, error out

@@ -7,22 +7,3 @@ "use strict";

// Optional
autoApprove = false, enableMpc = false, }) => 'window.portalAddress = "' +
address +
'";' +
'window.portalApiKey = "' +
apiKey +
'";' +
'window.portalAutoApprove = ' +
autoApprove +
';' +
'window.portalChainId = "' +
chainId +
'";' +
'window.portalGatewayConfig = ' +
JSON.stringify(gatewayConfig) +
';' +
'window.portalMPCEnabled = ' +
enableMpc +
';' +
injection +
'true;';
autoApprove = false, enableMpc = false, }) => `window.portalAddress = "${address}";${window.portalApiKey} = "${apiKey}";window.portalAutoApprove = ${autoApprove};window.portalChainId = "${chainId}";window.portalGatewayConfig = ${JSON.stringify(gatewayConfig)};window.portalMPCEnabled = ${enableMpc};${injection}true;`;
const injection = `__INJECTION__`;

@@ -62,3 +62,5 @@ "use strict";

}
catch (err) { }
catch (err) {
// Noop
}
}

@@ -65,0 +67,0 @@ };

@@ -82,6 +82,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

enable() {
return __awaiter(this, void 0, void 0, function* () {
this.emit('connect', { chainId: `0x${this.chainId.toString(16)}` });
return [this.address];
});
this.emit('connect', { chainId: `0x${this.chainId.toString(16)}` });
return [this.address];
}

@@ -193,2 +191,3 @@ /**

else if (typeof this.gatewayConfig === 'object' &&
// eslint-disable-next-line no-prototype-builtins
!this.gatewayConfig.hasOwnProperty(this.chainId)) {

@@ -195,0 +194,0 @@ // If there's no explicit mapping for the current chainId, error out

@@ -5,22 +5,3 @@ export default ({

// Optional
autoApprove = false, enableMpc = false, }) => 'window.portalAddress = "' +
address +
'";' +
'window.portalApiKey = "' +
apiKey +
'";' +
'window.portalAutoApprove = ' +
autoApprove +
';' +
'window.portalChainId = "' +
chainId +
'";' +
'window.portalGatewayConfig = ' +
JSON.stringify(gatewayConfig) +
';' +
'window.portalMPCEnabled = ' +
enableMpc +
';' +
injection +
'true;';
autoApprove = false, enableMpc = false, }) => `window.portalAddress = "${address}";${window.portalApiKey} = "${apiKey}";window.portalAutoApprove = ${autoApprove};window.portalChainId = "${chainId}";window.portalGatewayConfig = ${JSON.stringify(gatewayConfig)};window.portalMPCEnabled = ${enableMpc};${injection}true;`;
const injection = `__INJECTION__`;

@@ -57,3 +57,5 @@ import Provider from '../index';

}
catch (err) { }
catch (err) {
// Noop
}
}

@@ -60,0 +62,0 @@ };

{
"name": "@portal-hq/injected-provider",
"version": "2.0.4",
"version": "2.0.6",
"license": "MIT",

@@ -23,3 +23,3 @@ "main": "lib/commonjs/index",

"dependencies": {
"@portal-hq/utils": "^2.0.4"
"@portal-hq/utils": "^2.0.6"
},

@@ -41,3 +41,3 @@ "devDependencies": {

},
"gitHead": "2d2f1ef628bc8788fa4a9cd32cc44795e547b3a7"
"gitHead": "d933407992d91fd46d22b003233626dcb06dbf5b"
}

@@ -21,2 +21,3 @@ import {

} from '../types'
import { RpcErrorOptions } from '@portal-hq/utils/types'

@@ -120,3 +121,3 @@ export { default as injectionScript } from './injection/script'

public async enable(): Promise<string[]> {
public enable(): string[] {
this.emit('connect', { chainId: `0x${this.chainId.toString(16)}` })

@@ -193,3 +194,3 @@

if (response.error) {
throw new ProviderRpcError(response.error)
throw new ProviderRpcError(response.error as RpcErrorOptions)
}

@@ -217,3 +218,3 @@

event: string,
listenerToRemove?: EventHandler,
listenerToRemove?: EventHandler
): void {

@@ -228,3 +229,3 @@ if (!this.events[event]) {

const filterEventHandlers = (
registeredEventHandler: RegisteredEventHandler,
registeredEventHandler: RegisteredEventHandler
) => {

@@ -249,2 +250,3 @@ return registeredEventHandler.handler !== listenerToRemove

typeof this.gatewayConfig === 'object' &&
// eslint-disable-next-line no-prototype-builtins
!this.gatewayConfig.hasOwnProperty(this.chainId)

@@ -254,3 +256,3 @@ ) {

throw new Error(
`[Portal] No RPC endpoint configured for chainId: ${this.chainId}`,
`[Portal] No RPC endpoint configured for chainId: ${this.chainId}`
)

@@ -268,3 +270,3 @@ }

throw new Error(
`[Portal] Could not find a valid gatewayConfig entry for chainId: ${this.chainId}`,
`[Portal] Could not find a valid gatewayConfig entry for chainId: ${this.chainId}`
)

@@ -271,0 +273,0 @@ }

@@ -14,23 +14,8 @@ import { type InjectionBrowserScriptOptions } from '../../types'

}: InjectionBrowserScriptOptions) =>
'window.portalAddress = "' +
address +
'";' +
'window.portalApiKey = "' +
apiKey +
'";' +
'window.portalAutoApprove = ' +
autoApprove +
';' +
'window.portalChainId = "' +
chainId +
'";' +
'window.portalGatewayConfig = ' +
JSON.stringify(gatewayConfig) +
';' +
'window.portalMPCEnabled = ' +
enableMpc +
';' +
injection +
'true;'
`window.portalAddress = "${address}";${
window.portalApiKey
} = "${apiKey}";window.portalAutoApprove = ${autoApprove};window.portalChainId = "${chainId}";window.portalGatewayConfig = ${JSON.stringify(
gatewayConfig
)};window.portalMPCEnabled = ${enableMpc};${injection}true;`
const injection = `__INJECTION__`

@@ -46,3 +46,3 @@ import { WebView } from 'react-native-webview'

'tokenplace:PRIMARY_CONNECTION',
JSON.stringify({ blockchain: 'ETHEREUM', provider: 'MobileWallet' }),
JSON.stringify({ blockchain: 'ETHEREUM', provider: 'MobileWallet' })
)

@@ -76,3 +76,3 @@ } else if (document.location.host.endsWith('aave.com')) {

console.log(
`[PortalInjectionScript] Attempting postMessage request for ${message}.`,
`[PortalInjectionScript] Attempting postMessage request for ${message}.`
)

@@ -83,3 +83,3 @@

}
},
}
)

@@ -91,8 +91,8 @@

try {
const { type, data } = JSON.parse(event.data)
const { type, data } = JSON.parse(event.data as string)
window.console.log(
`[PortalInjectionScript] Received event with '${type}' with data: ${JSON.stringify(
data,
)}.`,
data
)}.`
)

@@ -104,7 +104,7 @@

`[PortalInjectionScript] Sending ${type} with data: ${JSON.stringify(
data,
)}.`,
data
)}.`
)
// Handle provider cases
provider.emit(type, data)
provider.emit(type as string, data)
break

@@ -116,3 +116,3 @@ default:

window.console.log(
`[PortalInjectionScript] Passing event along because it's unparsable: ${event}, ${event.data}`,
`[PortalInjectionScript] Passing event along because it's unparsable: ${event}, ${event.data}`
)

@@ -125,3 +125,5 @@

window.dispatchEvent(event)
} catch (err) {}
} catch (err) {
// Noop
}
}

@@ -128,0 +130,0 @@ }

@@ -21,3 +21,3 @@ import { type SigningRequestArguments } from '@portal-hq/utils'

message: SigningRequestArguments,
provider: Provider,
provider: Provider
): Promise<any> {

@@ -50,3 +50,3 @@ const { method, params } = message

}
},
}
)

@@ -59,3 +59,3 @@

data: message,
}),
})
)

@@ -62,0 +62,0 @@ })

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc