Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@particle-network/provider

Package Overview
Dependencies
Maintainers
4
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@particle-network/provider - npm Package Compare versions

Comparing version 0.6.3-alpha.0 to 0.7.0

49

lib/auth-adapter.js

@@ -41,4 +41,5 @@ "use strict";

var ethereumjs_util_1 = require("ethereumjs-util");
var auth_1 = require("@particle-network/auth");
var types_1 = require("./types");
var common_1 = require("@particle-network/common");
var utils_1 = require("./utils");
var AuthEVMAdapter = /** @class */ (function () {

@@ -51,3 +52,3 @@ function AuthEVMAdapter(auth) {

return __awaiter(this, void 0, void 0, function () {
var wallet, txData, chainId, keys, i, name_1, chainIds;
var wallet, txData, chainId, chain;
return __generator(this, function (_a) {

@@ -71,3 +72,3 @@ switch (_a.label) {

}
return [3 /*break*/, 14];
return [3 /*break*/, 12];
case 2:

@@ -80,3 +81,3 @@ if (!(request.method === "eth_chainId")) return [3 /*break*/, 3];

txData = request.params[0];
if (!txData.type) {
if ((0, utils_1.isNullish)(txData.type)) {
// set transaction default type "0x2", EIP1559.

@@ -93,3 +94,3 @@ txData.type = "0x2";

}
return [3 /*break*/, 14];
return [3 /*break*/, 12];
case 4:

@@ -103,3 +104,3 @@ if (!(request.method === "eth_signTypedData_v3" || request.method === "eth_signTypedData_v4")) return [3 /*break*/, 5];

}
return [3 /*break*/, 14];
return [3 /*break*/, 12];
case 5:

@@ -115,30 +116,18 @@ if (!(request.method === "personal_sign" ||

}
return [3 /*break*/, 14];
return [3 /*break*/, 12];
case 6:
if (!(request.method === "wallet_switchEthereumChain")) return [3 /*break*/, 13];
if (!(request.params && request.params instanceof Array && request.params[0] && request.params[0].chainId)) return [3 /*break*/, 11];
chainId = request.params[0].chainId;
keys = Object.keys(auth_1.supportChains);
i = 0;
_a.label = 7;
if (!(request.method === "wallet_switchEthereumChain")) return [3 /*break*/, 11];
if (!(request.params && request.params instanceof Array && request.params[0] && request.params[0].chainId)) return [3 /*break*/, 9];
chainId = Number(request.params[0].chainId);
chain = common_1.chains.getChainById(chainId);
if (!chain) return [3 /*break*/, 8];
return [4 /*yield*/, this.auth.setChainInfo(chain)];
case 7:
if (!(i < keys.length)) return [3 /*break*/, 10];
name_1 = keys[i];
chainIds = auth_1.supportChains[name_1];
if (!chainIds.includes(Number(chainId))) return [3 /*break*/, 9];
return [4 /*yield*/, this.auth.setChainInfo({
name: name_1,
id: Number(chainId),
})];
case 8:
_a.sent();
return [2 /*return*/, Promise.resolve(null)];
case 9:
i++;
return [3 /*break*/, 7];
case 10: return [2 /*return*/, Promise.reject(types_1.ProviderError.paramsError())];
case 11: return [2 /*return*/, Promise.reject(types_1.ProviderError.paramsError())];
case 12: return [3 /*break*/, 14];
case 13: return [2 /*return*/, Promise.reject(types_1.ProviderError.unsupportedMethod())];
case 14: return [2 /*return*/];
case 8: return [2 /*return*/, Promise.reject(types_1.ProviderError.paramsError())];
case 9: return [2 /*return*/, Promise.reject(types_1.ProviderError.paramsError())];
case 10: return [3 /*break*/, 12];
case 11: return [2 /*return*/, Promise.reject(types_1.ProviderError.unsupportedMethod())];
case 12: return [2 /*return*/];
}

@@ -145,0 +134,0 @@ });

@@ -73,3 +73,3 @@ "use strict";

_this.auth.on("chainChanged", function (chain) {
if (chain.name !== "solana") {
if (chain.name !== "Solana") {
_this.events.emit("chainChanged", (0, ethereumjs_util_1.bufferToHex)((0, utils_1.legacyToBuffer)(chain.id)));

@@ -76,0 +76,0 @@ }

{
"name": "@particle-network/provider",
"version": "0.6.3-alpha.0",
"version": "0.7.0",
"files": [

@@ -15,3 +15,3 @@ "lib",

"dependencies": {
"@particle-network/auth": "^0.6.3-alpha.0",
"@particle-network/auth": "^0.7.0",
"axios": "^0.27.2",

@@ -32,3 +32,3 @@ "buffer": "^6.0.3",

},
"gitHead": "21ac77a2d3621d0dec1377fdc7a0b189337b2723"
"gitHead": "ed67e3124ec04d25a2b243ef20b12aa43eb07caa"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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