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

get-starknet-core

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-starknet-core - npm Package Compare versions

Comparing version 4.0.0-next.3 to 4.0.0-next.4

122

dist/core.js
var Q = Object.defineProperty;
var Y = (I, M, e) => M in I ? Q(I, M, { enumerable: !0, configurable: !0, writable: !0, value: e }) : I[M] = e;
var w = (I, M, e) => (Y(I, typeof M != "symbol" ? M + "" : M, e), e), r = (I, M, e) => {
var w = (I, M, e) => (Y(I, typeof M != "symbol" ? M + "" : M, e), e), y = (I, M, e) => {
if (!M.has(I))
throw TypeError("Cannot " + e);
};
var c = (I, M, e) => (r(I, M, "read from private field"), e ? e.call(I) : M.get(I)), z = (I, M, e) => {
var j = (I, M, e) => (y(I, M, "read from private field"), e ? e.call(I) : M.get(I)), z = (I, M, e) => {
if (M.has(I))
throw TypeError("Cannot add the same private member more than once");
M instanceof WeakSet ? M.add(I) : M.set(I, e);
}, l = (I, M, e, N) => (r(I, M, "write to private field"), N ? N.call(I, e) : M.set(I, e), e);
var n = (I, M, e) => (r(I, M, "access private method"), e);
const U = [
}, l = (I, M, e, N) => (y(I, M, "write to private field"), N ? N.call(I, e) : M.set(I, e), e);
var n = (I, M, e) => (y(I, M, "access private method"), e);
const m = [
{

@@ -34,3 +34,3 @@ id: "argentX",

}
], m = () => `${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`, x = (I) => {
], U = () => `${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`, x = (I) => {
for (let M = I.length - 1; M > 0; M--) {

@@ -41,7 +41,7 @@ const e = Math.floor(Math.random() * (M + 1));

return I;
}, y = (...I) => (M) => I.reduce((e, N) => e.then(N), Promise.resolve(M));
var A, i, u, C, k, a, s;
class f {
}, r = (...I) => (M) => I.reduce((e, N) => e.then(N), Promise.resolve(M));
var A, i, u, o, h, a, s;
class b {
constructor(M) {
z(this, C);
z(this, o);
z(this, a);

@@ -55,25 +55,32 @@ z(this, A, !1);

set(M) {
return !c(this, A) && !n(this, a, s).call(this) ? !1 : (this.delete(), this.value = M, M && (l(this, i, `${c(this, u)}-${m()}`), localStorage.setItem(c(this, i), M)), !0);
return !j(this, A) && !n(this, a, s).call(this) ? !1 : (this.delete(), this.value = M, M && (l(this, i, `${j(this, u)}-${U()}`), localStorage.setItem(j(this, i), M)), !0);
}
get() {
return n(this, C, k).call(this), this.value;
return n(this, o, h).call(this), this.value;
}
delete() {
return !c(this, A) && !n(this, a, s).call(this) ? !1 : (this.value = null, c(this, i) && localStorage.removeItem(c(this, i)), !0);
return !j(this, A) && !n(this, a, s).call(this) ? !1 : (this.value = null, j(this, i) && localStorage.removeItem(j(this, i)), !0);
}
}
A = new WeakMap(), i = new WeakMap(), u = new WeakMap(), C = new WeakSet(), k = function() {
A = new WeakMap(), i = new WeakMap(), u = new WeakMap(), o = new WeakSet(), h = function() {
this.value && this.set(this.value);
}, a = new WeakSet(), s = function() {
try {
!c(this, A) && typeof window < "u" && (l(this, i, Object.keys(localStorage).find(
(M) => M.startsWith(c(this, u))
)), l(this, A, !0), c(this, i) && this.set(localStorage.getItem(c(this, i))));
!j(this, A) && typeof window < "u" && (l(this, i, Object.keys(localStorage).find(
(M) => M.startsWith(j(this, u))
)), l(this, A, !0), j(this, i) && this.set(localStorage.getItem(j(this, i))));
} catch (M) {
console.warn(M);
}
return c(this, A);
return j(this, A);
};
var L = /* @__PURE__ */ ((I) => (I.Accounts = "accounts", I))(L || {});
function o(I, M) {
var S;
(function(I) {
I.SN_MAIN = "0x534e5f4d41494e", I.SN_GOERLI = "0x534e5f474f45524c49", I.SN_SEPOLIA = "0x534e5f5345504f4c4941";
})(S || (S = {}));
var C;
(function(I) {
I.Accounts = "accounts";
})(C || (C = {}));
function O(I, M) {
var e, N;

@@ -90,10 +97,10 @@ if ((e = M == null ? void 0 : M.include) != null && e.length) {

}
const S = async (I) => {
const k = async (I) => {
const M = await Promise.all(
I.map(
(e) => e.request({ type: "wallet_getPermissions" }).then((N) => N.includes(L.Accounts)).catch(() => !1)
(e) => e.request({ type: "wallet_getPermissions" }).then((N) => N.includes(C.Accounts)).catch(() => !1)
)
);
return I.filter((e, N) => M[N]);
}, b = (I) => {
}, E = (I) => {
try {

@@ -113,3 +120,3 @@ return I && [

};
function O(I, M) {
function d(I, M) {
return Object.values(

@@ -125,3 +132,3 @@ Object.getOwnPropertyNames(I).reduce((e, N) => {

}
const d = (I, M) => {
const L = (I, M) => {
if (M && Array.isArray(M)) {

@@ -136,10 +143,10 @@ I.sort((N, D) => M.indexOf(N.id) - M.indexOf(D.id));

return x(I);
}, E = typeof window < "u" ? window : {}, W = {
windowObject: E,
isWalletObject: b,
storageFactoryImplementation: (I) => new f(I)
}, W = typeof window < "u" ? window : {}, v = {
windowObject: W,
isWalletObject: E,
storageFactoryImplementation: (I) => new b(I)
};
function v(I = {}) {
function G(I = {}) {
const { storageFactoryImplementation: M, windowObject: e, isWalletObject: N } = {
...W,
...v,
...I

@@ -149,30 +156,30 @@ }, D = M("gsw-last");

getAvailableWallets: async (g = {}) => {
const j = O(
const c = d(
e,
N
);
return y(
(t) => o(t, g),
(t) => d(t, g.sort)
)(j);
return r(
(t) => O(t, g),
(t) => L(t, g.sort)
)(c);
},
getAuthorizedWallets: async (g = {}) => {
const j = O(
const c = d(
e,
N
);
return y(
(t) => S(t),
(t) => o(t, g),
(t) => d(t, g.sort)
)(j);
return r(
(t) => k(t),
(t) => O(t, g),
(t) => L(t, g.sort)
)(c);
},
getDiscoveryWallets: async (g = {}) => y(
(j) => o(j, g),
(j) => d(j, g.sort)
)(U),
getDiscoveryWallets: async (g = {}) => r(
(c) => O(c, g),
(c) => L(c, g.sort)
)(m),
getLastConnectedWallet: async () => {
const g = D.get(), t = O(e, N).find(
(h) => h.id === g
), [T] = await S(
const g = D.get(), t = d(e, N).find(
(f) => f.id === g
), [T] = await k(
t ? [t] : []

@@ -182,7 +189,7 @@ );

},
enable: async (g, j) => {
enable: async (g, c) => {
await g.request({
type: "wallet_requestAccounts",
params: {
silentMode: j == null ? void 0 : j.silentMode
silentMode: c == null ? void 0 : c.silentMode
}

@@ -193,3 +200,3 @@ });

});
if (!(t != null && t.includes(L.Accounts)))
if (!(t != null && t.includes(C.Accounts)))
throw new Error("Failed to connect to wallet");

@@ -203,7 +210,10 @@ return D.set(g.id), g;

}
const G = v();
const P = G();
export {
L as Permission,
G as default,
v as getStarknet
C as Permission,
S as StarknetChainId,
P as default,
G as getStarknet,
E as isWalletObj,
d as scanObjectForWallets
};
import type { GetStarknetOptions, GetStarknetResult } from "./types";
export type { StarknetWindowObject } from "./StarknetWindowObject";
export type { AddDeclareTransactionParameters, AddDeclareTransactionResult, AddDeployAccountTransactionParameters, AddDeployAccountTransactionResult, AddInvokeTransactionParameters, AddInvokeTransactionResult, AddStarknetChainParameters, RequestAccountsParameters, StarknetChainId, SwitchStarknetChainParameters, GetDeploymentDataResult, WatchAssetParameters, TypedData, RequestFn, RpcMessage, IsParamsOptional, RpcTypeToMessageMap, RequestFnCall, } from "./rpcMessage";
export type { WalletEvents, AccountChangeEventHandler, NetworkChangeEventHandler, WalletEventHandlers, } from "./walletEvents";
export { Permission } from "./rpcMessage";
import { type StarknetWindowObject } from "starknet-types";
export type { StarknetWindowObject, AddDeclareTransactionParameters, AddDeclareTransactionResult, AddDeployAccountTransactionParameters, AddDeployAccountTransactionResult, AddInvokeTransactionParameters, AddInvokeTransactionResult, AddStarknetChainParameters, RequestAccountsParameters, SwitchStarknetChainParameters, GetDeploymentDataResult, WatchAssetParameters, TypedData, RequestFn, RpcMessage, IsParamsOptional, RpcTypeToMessageMap, RequestFnCall, AccountChangeEventHandler, NetworkChangeEventHandler, WalletEventHandlers, WalletEvents, } from "starknet-types";
export { StarknetChainId, Permission } from "starknet-types";
export { scanObjectForWallets } from "./wallet/scan";
export { isWalletObj } from "./wallet/isWalletObject";
export type { DisconnectOptions, GetStarknetOptions, GetStarknetResult, GetWalletOptions, WalletProvider, } from "./types";
declare global {
interface Window {
[key: `starknet_${string}`]: StarknetWindowObject | undefined;
}
}
export declare function getStarknet(options?: Partial<GetStarknetOptions>): GetStarknetResult;
declare const _default: GetStarknetResult;
export default _default;

@@ -1,7 +0,6 @@

import { StarknetWindowObject } from "./StarknetWindowObject";
import { WalletProvider } from "./discovery";
import { IStorageWrapper } from "./localStorageStore";
import { RequestAccountsParameters } from "./rpcMessage";
import { FilterList } from "./wallet/filter";
import { Sort } from "./wallet/sort";
import type { RequestAccountsParameters, StarknetWindowObject } from "starknet-types";
export type { WalletProvider } from "./discovery";

@@ -8,0 +7,0 @@ export interface GetStarknetOptions {

@@ -1,3 +0,3 @@

import { type StarknetWindowObject } from "../StarknetWindowObject";
import type { WalletProvider } from "../discovery";
import { type StarknetWindowObject } from "starknet-types";
export declare type FilterList = string[];

@@ -4,0 +4,0 @@ interface FilterByOptions {

@@ -1,2 +0,2 @@

import type { StarknetWindowObject } from "../StarknetWindowObject";
import type { StarknetWindowObject } from "starknet-types";
export declare function scanObjectForWallets(obj: Record<string, any>, isWalletObject: (wallet: any) => boolean): StarknetWindowObject[];

@@ -1,4 +0,4 @@

import { StarknetWindowObject } from "../StarknetWindowObject";
import { WalletProvider } from "../discovery";
import { type StarknetWindowObject } from "starknet-types";
export declare type Sort = string[] | "random" | null | undefined;
export declare const sortBy: <T extends WalletProvider | StarknetWindowObject>(wallets: T[], sort: Sort) => T[];
{
"name": "get-starknet-core",
"version": "4.0.0-next.3",
"version": "4.0.0-next.4",
"keywords": [

@@ -27,2 +27,5 @@ "starknet",

],
"dependencies": {
"starknet-types": "^0.0.4"
},
"devDependencies": {

@@ -29,0 +32,0 @@ "c8": "^7.12.0",

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