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

@xlabs-libs/wallet-aggregator-near

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xlabs-libs/wallet-aggregator-near - npm Package Compare versions

Comparing version 0.0.1-alpha.1 to 0.0.1-alpha.2

27

dist/cjs/near.js

@@ -22,2 +22,6 @@ "use strict";

this.accounts = [];
this.onNetworkChange = ({ networkId }) => {
this.network = Object.assign(Object.assign({}, this.network), { networkId });
this.emit('networkChanged');
};
this.config = config;

@@ -45,2 +49,5 @@ this.modules = modules;

}
getNetworkInfo() {
return this.network;
}
getName() {

@@ -146,4 +153,7 @@ if (!this.metadata)

modal.show();
const onSignIn = ({ accounts }) => __awaiter(this, void 0, void 0, function* () {
yield onConnect(accounts);
});
const onConnect = (accounts) => __awaiter(this, void 0, void 0, function* () {
var _a;
var _a, _b;
modal.hide();

@@ -154,8 +164,8 @@ const wallet = yield this.selector.wallet();

this.metadata = wallet === null || wallet === void 0 ? void 0 : wallet.metadata;
(_a = this.selector) === null || _a === void 0 ? void 0 : _a.off('signedIn', () => { });
this.network = Object.assign({}, this.selector.options.network);
(_a = this.selector) === null || _a === void 0 ? void 0 : _a.on('networkChanged', this.onNetworkChange);
(_b = this.selector) === null || _b === void 0 ? void 0 : _b.off('signedIn', onSignIn);
resolve(this.getAddresses());
});
this.selector.on('signedIn', ({ accounts }) => __awaiter(this, void 0, void 0, function* () {
yield onConnect(accounts);
}));
this.selector.on('signedIn', onSignIn);
const accounts = this.selector.store.getState().accounts;

@@ -168,3 +178,8 @@ if (accounts.length > 0) {

}
isConnected() {
var _a;
return !!((_a = this.selector) === null || _a === void 0 ? void 0 : _a.isSignedIn());
}
disconnect() {
var _a;
return __awaiter(this, void 0, void 0, function* () {

@@ -179,2 +194,4 @@ const wallet = yield this.getWallet();

yield wallet.signOut();
(_a = this.selector) === null || _a === void 0 ? void 0 : _a.off('networkChanged', this.onNetworkChange);
this.selector = undefined;
});

@@ -181,0 +198,0 @@ }

@@ -10,2 +10,9 @@ import { setupWalletSelector } from "@near-wallet-selector/core";

this.accounts = [];
this.onNetworkChange = ({ networkId }) => {
this.network = {
...this.network,
networkId
};
this.emit('networkChanged');
};
this.config = config;

@@ -32,2 +39,5 @@ this.modules = modules;

}
getNetworkInfo() {
return this.network;
}
getName() {

@@ -126,2 +136,5 @@ if (!this.metadata)

modal.show();
const onSignIn = async ({ accounts }) => {
await onConnect(accounts);
};
const onConnect = async (accounts) => {

@@ -133,8 +146,10 @@ modal.hide();

this.metadata = wallet?.metadata;
this.selector?.off('signedIn', () => { });
this.network = {
...this.selector.options.network,
};
this.selector?.on('networkChanged', this.onNetworkChange);
this.selector?.off('signedIn', onSignIn);
resolve(this.getAddresses());
};
this.selector.on('signedIn', async ({ accounts }) => {
await onConnect(accounts);
});
this.selector.on('signedIn', onSignIn);
const accounts = this.selector.store.getState().accounts;

@@ -146,2 +161,5 @@ if (accounts.length > 0) {

}
isConnected() {
return !!this.selector?.isSignedIn();
}
async disconnect() {

@@ -156,2 +174,4 @@ const wallet = await this.getWallet();

await wallet.signOut();
this.selector?.off('networkChanged', this.onNetworkChange);
this.selector = undefined;
}

@@ -158,0 +178,0 @@ async getWallet() {

8

dist/types/near.d.ts

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

import { Action, FinalExecutionOutcome, Wallet as InternalWallet } from "@near-wallet-selector/core";
import { Action, FinalExecutionOutcome, Network, Wallet as InternalWallet } from "@near-wallet-selector/core";
import { Address, ChainId, SendTransactionResult, Wallet } from "@xlabs-libs/wallet-aggregator-core";

@@ -19,3 +19,3 @@ import { ConnectConfig as NearConfig } from "near-api-js";

type NearTransactionResult = FinalExecutionOutcome[];
export declare class NearWallet extends Wallet<NearTransactionParams, NearTransactionParams, NearTransactionResult> {
export declare class NearWallet extends Wallet<NearTransactionParams, NearTransactionParams, NearTransactionResult, Network> {
private readonly config;

@@ -29,2 +29,3 @@ private readonly modules;

private allowRedirect;
private network?;
constructor({ config, modules, contractId, allowRedirect }: NearWalletParams);

@@ -34,2 +35,3 @@ getAddress(): string | undefined;

setMainAddress(id: string): void;
getNetworkInfo(): Network | undefined;
getName(): string;

@@ -49,6 +51,8 @@ getUrl(): string;

connect(): Promise<Address[]>;
isConnected(): boolean;
disconnect(): Promise<void>;
getWallet(): Promise<InternalWallet | undefined>;
private onNetworkChange;
}
export {};
//# sourceMappingURL=near.d.ts.map
{
"name": "@xlabs-libs/wallet-aggregator-near",
"repository": "https://github.com/XLabs/wallet-aggregator-sdk/tree/master/packages/wallets/near",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"sideEffects": false,

@@ -26,3 +26,3 @@ "license": "MIT",

"rxjs": "^7.5.7",
"@xlabs-libs/wallet-aggregator-core": "^0.0.1-alpha.5"
"@xlabs-libs/wallet-aggregator-core": "^0.0.1-alpha.7"
},

@@ -29,0 +29,0 @@ "scripts": {

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

import { Account, Action, FinalExecutionOutcome, NetworkId, setupWalletSelector, Wallet as InternalWallet, WalletMetadata, WalletSelector } from "@near-wallet-selector/core";
import { Account, Action, FinalExecutionOutcome, Network, NetworkId, setupWalletSelector, Wallet as InternalWallet, WalletMetadata, WalletSelector } from "@near-wallet-selector/core";
import { setupModal } from "@near-wallet-selector/modal-ui";

@@ -30,3 +30,4 @@ import { Address, ChainId, CHAIN_ID_NEAR, SendTransactionResult, Wallet } from "@xlabs-libs/wallet-aggregator-core";

NearTransactionParams,
NearTransactionResult
NearTransactionResult,
Network
> {

@@ -41,2 +42,3 @@ private readonly config: NearConfig;

private allowRedirect: boolean;
private network?: Network;

@@ -70,2 +72,6 @@ constructor({ config, modules, contractId, allowRedirect }: NearWalletParams) {

getNetworkInfo(): Network | undefined {
return this.network;
}
getName(): string {

@@ -172,2 +178,6 @@ if (!this.metadata) return 'Near';

const onSignIn = async ({ accounts }: { accounts: Account[] }) => {
await onConnect(accounts);
}
const onConnect = async (accounts: Account[]) => {

@@ -181,10 +191,13 @@ modal.hide();

this.metadata = wallet?.metadata;
this.network = {
...this.selector!.options.network,
}
this.selector?.off('signedIn', () => {});
this.selector?.on('networkChanged', this.onNetworkChange);
this.selector?.off('signedIn', onSignIn);
resolve(this.getAddresses());
};
this.selector!.on('signedIn', async ({ accounts }) => {
await onConnect(accounts);
});
this.selector!.on('signedIn', onSignIn);

@@ -198,2 +211,6 @@ const accounts = this.selector!.store.getState().accounts;

isConnected(): boolean {
return !!this.selector?.isSignedIn();
}
async disconnect(): Promise<void> {

@@ -209,2 +226,5 @@ const wallet = await this.getWallet();

await wallet.signOut();
this.selector?.off('networkChanged', this.onNetworkChange);
this.selector = undefined;
}

@@ -215,2 +235,10 @@

}
private onNetworkChange = ({ networkId }: { networkId: string; }) => {
this.network = {
...this.network!,
networkId
}
this.emit('networkChanged');
};
}

Sorry, the diff of this file is not supported yet

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