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

@walletconnect/utils

Package Overview
Dependencies
Maintainers
1
Versions
661
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/utils - npm Package Compare versions

Comparing version 1.0.0-beta.25 to 1.0.0-beta.26

11

lib/index.d.ts
/// <reference types="node" />
import { ITxData, IClientMeta, IParseURIResult, IJsonRpcResponseSuccess, IJsonRpcResponseError, IJsonRpcErrorMessage } from '@walletconnect/types';
import { ITxData, IClientMeta, IParseURIResult, IJsonRpcSubscription, IJsonRpcRequest, IJsonRpcResponseSuccess, IJsonRpcResponseError, IJsonRpcErrorMessage, IInternalEvent, IWalletConnectSession } from '@walletconnect/types';
export declare function convertArrayBufferToBuffer(arrayBuffer: ArrayBuffer): Buffer;

@@ -44,2 +44,11 @@ export declare function convertArrayBufferToUtf8(arrayBuffer: ArrayBuffer): string;

};
export declare function isJsonRpcSubscription(object: any): object is IJsonRpcSubscription;
export declare function isJsonRpcRequest(object: any): object is IJsonRpcRequest;
export declare function isJsonRpcResponseSuccess(object: any): object is IJsonRpcResponseSuccess;
export declare function isJsonRpcResponseError(object: any): object is IJsonRpcResponseError;
export declare function isInternalEvent(object: any): object is IInternalEvent;
export declare function isWalletConnectSession(object: any): object is IWalletConnectSession;
export declare function isReservedEvent(event: string): boolean;
export declare const signingMethods: string[];
export declare function isSilentPayload(request: IJsonRpcRequest): boolean;
//# sourceMappingURL=index.d.ts.map

4

package.json
{
"name": "@walletconnect/utils",
"version": "1.0.0-beta.25",
"version": "1.0.0-beta.26",
"description": "Utility Library for WalletConnect",

@@ -61,3 +61,3 @@ "scripts": {

"@ethersproject/strings": "^5.0.0-beta.125",
"@walletconnect/types": "^1.0.0-beta.25",
"@walletconnect/types": "^1.0.0-beta.26",
"bignumber.js": "^8.1.1"

@@ -64,0 +64,0 @@ },

@@ -57,2 +57,10 @@ # WalletConnect Utils

function formatRpcError (error: Partial<IJsonRpcErrorMessage>): { code: number; message: string }
function isJsonRpcSubscription (object: any): boolean
function isJsonRpcRequest (object: any): boolean
function isJsonRpcResponseSuccess (object: any): boolean
function isJsonRpcResponseError (object: any): boolean
function isInternalEvent (object: any): boolean
function isWalletConnectSession (object: any): boolean
function isReservedEvent (event: string): boolean
```

@@ -16,5 +16,9 @@ import BigNumber from 'bignumber.js'

IQueryParamsResult,
IJsonRpcSubscription,
IJsonRpcRequest,
IJsonRpcResponseSuccess,
IJsonRpcResponseError,
IJsonRpcErrorMessage
IJsonRpcErrorMessage,
IInternalEvent,
IWalletConnectSession
} from '@walletconnect/types'

@@ -561,1 +565,66 @@

}
// -- typeGuards ----------------------------------------------------------- //
export function isJsonRpcSubscription (
object: any
): object is IJsonRpcSubscription {
return typeof object.params === 'object'
}
export function isJsonRpcRequest (object: any): object is IJsonRpcRequest {
return typeof object.method !== 'undefined'
}
export function isJsonRpcResponseSuccess (
object: any
): object is IJsonRpcResponseSuccess {
return typeof object.result !== 'undefined'
}
export function isJsonRpcResponseError (
object: any
): object is IJsonRpcResponseError {
return typeof object.error !== 'undefined'
}
export function isInternalEvent (object: any): object is IInternalEvent {
return typeof object.event !== 'undefined'
}
export function isWalletConnectSession (
object: any
): object is IWalletConnectSession {
return typeof object.bridge !== 'undefined'
}
export function isReservedEvent (event: string) {
const reservedEvents = [
'session_request',
'session_update',
'exchange_key',
'connect',
'disconnect'
]
return reservedEvents.includes(event) || event.startsWith('wc_')
}
export const signingMethods = [
'eth_sendTransaction',
'eth_signTransction',
'eth_sign',
'eth_signTypedData',
'eth_signTypedData_v1',
'eth_signTypedData_v3',
'personal_sign'
]
export function isSilentPayload (request: IJsonRpcRequest): boolean {
if (request.method.startsWith('wc_')) {
return true
}
if (signingMethods.includes(request.method)) {
return false
}
return true
}

Sorry, the diff of this file is not supported yet

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

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