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

@airgap/beacon-sdk

Package Overview
Dependencies
Maintainers
1
Versions
286
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@airgap/beacon-sdk - npm Package Compare versions

Comparing version 0.3.0-beta.2 to 0.3.0

1

dist/beacon-message-events.d.ts

@@ -5,2 +5,3 @@ import { BeaconEvent } from './events';

[key in BeaconMessageType]: {
sent: BeaconEvent;
success: BeaconEvent;

@@ -7,0 +8,0 @@ error: BeaconEvent;

16

dist/beacon-message-events.js

@@ -7,6 +7,8 @@ "use strict";

[_1.BeaconMessageType.PermissionRequest]: {
success: events_1.BeaconEvent.PERMISSION_REQUEST_SENT,
sent: events_1.BeaconEvent.PERMISSION_REQUEST_SENT,
success: events_1.BeaconEvent.PERMISSION_REQUEST_SUCCESS,
error: events_1.BeaconEvent.PERMISSION_REQUEST_ERROR
},
[_1.BeaconMessageType.PermissionResponse]: {
sent: events_1.BeaconEvent.UNKNOWN,
success: events_1.BeaconEvent.UNKNOWN,

@@ -16,6 +18,8 @@ error: events_1.BeaconEvent.UNKNOWN

[_1.BeaconMessageType.OperationRequest]: {
success: events_1.BeaconEvent.OPERATION_REQUEST_SENT,
sent: events_1.BeaconEvent.OPERATION_REQUEST_SENT,
success: events_1.BeaconEvent.OPERATION_REQUEST_SUCCESS,
error: events_1.BeaconEvent.OPERATION_REQUEST_ERROR
},
[_1.BeaconMessageType.OperationResponse]: {
sent: events_1.BeaconEvent.UNKNOWN,
success: events_1.BeaconEvent.UNKNOWN,

@@ -25,6 +29,8 @@ error: events_1.BeaconEvent.UNKNOWN

[_1.BeaconMessageType.SignPayloadRequest]: {
success: events_1.BeaconEvent.SIGN_REQUEST_SENT,
sent: events_1.BeaconEvent.SIGN_REQUEST_SENT,
success: events_1.BeaconEvent.SIGN_REQUEST_SUCCESS,
error: events_1.BeaconEvent.SIGN_REQUEST_ERROR
},
[_1.BeaconMessageType.SignPayloadResponse]: {
sent: events_1.BeaconEvent.UNKNOWN,
success: events_1.BeaconEvent.UNKNOWN,

@@ -34,6 +40,8 @@ error: events_1.BeaconEvent.UNKNOWN

[_1.BeaconMessageType.BroadcastRequest]: {
success: events_1.BeaconEvent.BROADCAST_REQUEST_SENT,
sent: events_1.BeaconEvent.BROADCAST_REQUEST_SENT,
success: events_1.BeaconEvent.BROADCAST_REQUEST_SUCCESS,
error: events_1.BeaconEvent.BROADCAST_REQUEST_ERROR
},
[_1.BeaconMessageType.BroadcastResponse]: {
sent: events_1.BeaconEvent.UNKNOWN,
success: events_1.BeaconEvent.UNKNOWN,

@@ -40,0 +48,0 @@ error: events_1.BeaconEvent.UNKNOWN

@@ -28,4 +28,5 @@ import { ExposedPromise } from '../../utils/exposed-promise';

private handleRequestError;
private notifySuccess;
private handleBeaconError;
private makeRequest;
}

@@ -107,6 +107,5 @@ "use strict";

};
const response = await this.makeRequest(request).catch(async (requestError) => {
const { message, connectionInfo } = await this.makeRequest(request).catch(async (requestError) => {
throw this.handleRequestError(request, requestError);
});
const { message, connectionInfo } = response;
await this.handleBeaconError(message);

@@ -129,5 +128,7 @@ const address = await crypto_1.getAddressFromPublicKey(message.pubkey);

await this.setActiveAccount(accountInfo);
console.log('permissions interception', response);
console.log('permissions interception', { message, connectionInfo });
const { beaconId, network, scopes } = message;
return { beaconId, address, network, scopes };
const output = { beaconId, address, network, scopes };
await this.notifySuccess(request, { output, connectionContext: connectionInfo });
return output;
}

@@ -146,8 +147,10 @@ async requestSignPayload(input) {

};
const response = await this.makeRequest(request).catch(async (requestError) => {
const { message, connectionInfo } = await this.makeRequest(request).catch(async (requestError) => {
throw this.handleRequestError(request, requestError);
});
await this.handleBeaconError(response.message);
const { beaconId, signature } = response.message;
return { beaconId, signature };
await this.handleBeaconError(message);
const { beaconId, signature } = message;
const output = { beaconId, signature };
await this.notifySuccess(request, { output, connectionContext: connectionInfo });
return output;
}

@@ -167,7 +170,9 @@ async requestOperation(input) {

};
const response = await this.makeRequest(request).catch(async (requestError) => {
const { message, connectionInfo } = await this.makeRequest(request).catch(async (requestError) => {
throw this.handleRequestError(request, requestError);
});
await this.handleBeaconError(response.message);
const { beaconId, transactionHash } = response.message;
await this.handleBeaconError(message);
const { beaconId, transactionHash } = message;
const output = { beaconId, transactionHash };
await this.notifySuccess(request, { output, connectionContext: connectionInfo });
return { beaconId, transactionHash };

@@ -184,7 +189,9 @@ }

};
const response = await this.makeRequest(request).catch(async (requestError) => {
const { message, connectionInfo } = await this.makeRequest(request).catch(async (requestError) => {
throw this.handleRequestError(request, requestError);
});
await this.handleBeaconError(response.message);
const { beaconId, transactionHash } = response.message;
await this.handleBeaconError(message);
const { beaconId, transactionHash } = message;
const output = { beaconId, transactionHash };
await this.notifySuccess(request, { output, connectionContext: connectionInfo });
return { beaconId, transactionHash };

@@ -199,2 +206,7 @@ }

}
async notifySuccess(request, response) {
this.events
.emit(beacon_message_events_1.messageEvents[request.type].success, response)
.catch((emitError) => console.warn(emitError));
}
async handleBeaconError(message) {

@@ -223,3 +235,3 @@ const errorMessage = message;

this.events
.emit(beacon_message_events_1.messageEvents[requestInput.type].success)
.emit(beacon_message_events_1.messageEvents[requestInput.type].sent)
.catch((emitError) => console.warn(emitError));

@@ -239,9 +251,2 @@ if (!this.beaconId) {

await (await this.transport).send(payload);
exposed.promise
.then((promiseResult) => {
this.events
.emit(beacon_message_events_1.messageEvents[requestInput.type].success, promiseResult)
.catch((emitError) => console.warn(emitError));
})
.catch(() => undefined);
return exposed.promise; // TODO: fix type

@@ -248,0 +253,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SDK_VERSION = '0.3.0-beta.2';
exports.SDK_VERSION = '0.3.0';
exports.BEACON_VERSION = '1';
//# sourceMappingURL=constants.js.map
import { Transport } from './transports/Transport';
import { ConnectionContext } from './types/ConnectionContext';
import { P2PPairInfo, AccountInfo, BeaconErrorMessage, BeaconMessage } from '.';
import { P2PPairInfo, AccountInfo, BeaconErrorMessage, BeaconResponseOutputMessage } from '.';
export declare enum BeaconEvent {

@@ -28,4 +28,4 @@ PERMISSION_REQUEST_SENT = "PERMISSION_REQUEST_SENT",

[BeaconEvent.PERMISSION_REQUEST_SUCCESS]: {
message: BeaconMessage;
connectionInfo: ConnectionContext;
output: BeaconResponseOutputMessage;
connectionContext: ConnectionContext;
};

@@ -35,4 +35,4 @@ [BeaconEvent.PERMISSION_REQUEST_ERROR]: BeaconErrorMessage;

[BeaconEvent.OPERATION_REQUEST_SUCCESS]: {
message: BeaconMessage;
connectionInfo: ConnectionContext;
output: BeaconResponseOutputMessage;
connectionContext: ConnectionContext;
};

@@ -42,4 +42,4 @@ [BeaconEvent.OPERATION_REQUEST_ERROR]: BeaconErrorMessage;

[BeaconEvent.SIGN_REQUEST_SUCCESS]: {
message: BeaconMessage;
connectionInfo: ConnectionContext;
output: BeaconResponseOutputMessage;
connectionContext: ConnectionContext;
};

@@ -49,4 +49,4 @@ [BeaconEvent.SIGN_REQUEST_ERROR]: BeaconErrorMessage;

[BeaconEvent.BROADCAST_REQUEST_SUCCESS]: {
message: BeaconMessage;
connectionInfo: ConnectionContext;
output: BeaconResponseOutputMessage;
connectionContext: ConnectionContext;
};

@@ -53,0 +53,0 @@ [BeaconEvent.BROADCAST_REQUEST_ERROR]: BeaconErrorMessage;

@@ -75,8 +75,8 @@ "use strict";

const showPermissionSuccessAlert = async (data) => {
const message = data.message;
const output = data.output;
const alertConfig = {
title: 'Permission Response',
body: `We received permissions for the address ${message.address} on the network ${message.network.type} with the following permissions:
body: `We received permissions for the address ${output.address} on the network ${output.network.type} with the following permissions:
${message.scopes}`,
${output.scopes}`,
confirmButtonText: 'Ok!',

@@ -88,3 +88,3 @@ confirmCallback: () => {

actionCallback: () => {
window.open(`https://tezblock.io/account/${message.address}`);
window.open(`https://tezblock.io/account/${output.address}`);
}

@@ -95,6 +95,6 @@ };

const showOperationSuccessAlert = async (data) => {
const message = data.message;
const output = data.output;
const alertConfig = {
title: 'Operation Response',
body: `The transaction has successfully been broadcasted to the network with the following hash: ${message.transactionHash}`,
body: `The transaction has successfully been broadcasted to the network with the following hash: ${output.transactionHash}`,
confirmButtonText: 'Close',

@@ -106,3 +106,3 @@ confirmCallback: () => {

actionCallback: () => {
window.open(`https://tezblock.io/transaction/${message.transactionHash}`);
window.open(`https://tezblock.io/transaction/${output.transactionHash}`);
}

@@ -113,6 +113,6 @@ };

const showSignSuccessAlert = async (data) => {
const message = data.message;
const output = data.output;
const alertConfig = {
title: 'Operation Response',
body: `The transaction has successfully been signed. Signature: ${message.signature}`,
title: 'Sign Response',
body: `The transaction has successfully been signed. Signature: ${output.signature}`,
confirmButtonText: 'Close',

@@ -126,6 +126,6 @@ confirmCallback: () => {

const showBroadcastSuccessAlert = async (data) => {
const message = data.message;
const output = data.output;
const alertConfig = {
title: 'Operation Response',
body: `The transaction has successfully been broadcasted to the network with the following hash: ${message.transactionHash}`,
title: 'Broadcast Response',
body: `The transaction has successfully been broadcasted to the network with the following hash: ${output.transactionHash}`,
confirmButtonText: 'Close',

@@ -137,3 +137,3 @@ confirmCallback: () => {

actionCallback: () => {
window.open(`https://tezblock.io/transaction/${message.transactionHash}`);
window.open(`https://tezblock.io/transaction/${output.transactionHash}`);
}

@@ -140,0 +140,0 @@ };

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

};
chrome.runtime.sendMessage(message);
chrome.runtime.sendMessage(message, (data) => {
logger.log('send', 'got response', data);
});
}

@@ -26,0 +28,0 @@ async init() {

{
"name": "@airgap/beacon-sdk",
"version": "0.3.0-beta.2",
"version": "0.3.0",
"description": "The beacon-sdk is setup in a way to allow for p2p communication between wallets and dapps",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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

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