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

@renegade-fi/core

Package Overview
Dependencies
Maintainers
0
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@renegade-fi/core - npm Package Compare versions

Comparing version 0.0.0-canary-20240821190005 to 0.0.0-canary-20240825031043

7

dist/esm/actions/waitForTaskCompletionWs.js

@@ -19,7 +19,8 @@ import { TASK_STATUS_ROUTE } from '../constants.js';

const messageHandler = (message) => {
if (message.topic === topic && message.event.type === 'TaskStatusUpdate') {
if (message.event.status?.state === 'Completed') {
const parsedMessage = JSON.parse(message);
if (parsedMessage.topic === topic && parsedMessage.event.type === 'TaskStatusUpdate') {
if (parsedMessage.event.status?.state === 'Completed') {
return null;
}
if (message.event.status?.state === 'Failed') {
if (parsedMessage.event.status?.state === 'Failed') {
throw new Error(`Task ${id} failed`);

@@ -26,0 +27,0 @@ }

@@ -64,3 +64,2 @@ ////////////////////////////////////////////////////////////////////////////////

export * from '../types/task.js';
export * from '../types/ws.js';
export {} from '../types/utils.js';

@@ -67,0 +66,0 @@ ////////////////////////////////////////////////////////////////////////////////

@@ -14,2 +14,5 @@ import { getSkRoot } from '../actions/getSkRoot.js';

*
* The message handler is also responsible for parsing the message, to give it control over e.g. how
* bigint values are parsed.
*
* Additionally, the method accepts an async `prefetch` function which can be used ahead of the websocket

@@ -32,5 +35,4 @@ * connection being opened to fetch a value which will be returned immediately if it is not undefined.

ws.onmessage = (event) => {
const message = JSON.parse(event.data);
try {
const result = messageHandler(message);
const result = messageHandler(event.data);
if (result !== undefined) {

@@ -37,0 +39,0 @@ promiseSettled = true;

@@ -43,3 +43,2 @@ export { type CancelOrderRequestErrorType, type CancelOrderRequestParameters, type CancelOrderRequestReturnType, cancelOrderRequest, } from '../actions/cancelOrderRequest.js';

export * from '../types/task.js';
export * from '../types/ws.js';
export { type Evaluate, type ExactPartial, type Mutable, type StrictOmit as Omit, type OneOf, type RemoveUndefined, type UnionCompute, type UnionStrictOmit, type UnionExactPartial, } from '../types/utils.js';

@@ -46,0 +45,0 @@ export { formatAmount, parseAmount } from '../utils/format.js';

@@ -10,3 +10,3 @@ import { type GetBackOfQueueWalletParameters, type GetBackOfQueueWalletReturnType } from '../actions/getBackOfQueueWallet.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -13,0 +13,0 @@ direction?: unknown;

@@ -12,3 +12,3 @@ import { type GetNetworkOrdersReturnType } from '../actions/getNetworkOrders.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -15,0 +15,0 @@ direction?: unknown;

@@ -14,3 +14,3 @@ import { type GetOpenOrdersReturnType, type GetOpenOrdersParams } from '../actions/getOpenOrders.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -17,0 +17,0 @@ direction?: unknown;

@@ -12,3 +12,3 @@ import { type GetOrderHistoryReturnType } from '../actions/getOrderHistory.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -15,0 +15,0 @@ direction?: unknown;

@@ -13,3 +13,3 @@ import { type GetOrderMetadataReturnType, type GetOrderMetadataParameters } from '../actions/getOrderMetadata.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -16,0 +16,0 @@ direction?: unknown;

@@ -12,3 +12,3 @@ import { type GetPingReturnType } from '../actions/ping.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -15,0 +15,0 @@ direction?: unknown;

@@ -12,3 +12,3 @@ import { type GetTaskHistoryReturnType } from '../actions/getTaskHistory.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -15,0 +15,0 @@ direction?: unknown;

@@ -13,3 +13,3 @@ import { type GetWalletFromRelayerParameters, type GetWalletFromRelayerReturnType } from '../actions/getWalletFromRelayer.js';

signal: AbortSignal;
meta: Record<string, unknown> | undefined;
meta: import("@tanstack/query-core").QueryMeta | undefined;
pageParam?: unknown;

@@ -16,0 +16,0 @@ direction?: unknown;

import type { Config } from '../createConfig.js';
import type { RelayerWebsocketMessage } from '../types/ws.js';
/**

@@ -14,2 +13,5 @@ * A lightweight method which resolves when a short-lived websocket connection is closed.

*
* The message handler is also responsible for parsing the message, to give it control over e.g. how
* bigint values are parsed.
*
* Additionally, the method accepts an async `prefetch` function which can be used ahead of the websocket

@@ -23,3 +25,3 @@ * connection being opened to fetch a value which will be returned immediately if it is not undefined.

*/
export declare function websocketWaiter<T>(config: Config, topic: string, messageHandler: (message: RelayerWebsocketMessage) => T | undefined, prefetch?: () => Promise<T | undefined>, timeout?: number): Promise<T>;
export declare function websocketWaiter<T>(config: Config, topic: string, messageHandler: (message: any) => T | undefined, prefetch?: () => Promise<T | undefined>, timeout?: number): Promise<T>;
//# sourceMappingURL=websocketWaiter.d.ts.map
{
"name": "@renegade-fi/core",
"description": "VanillaJS library for Renegade",
"version": "0.0.0-canary-20240821190005",
"version": "0.0.0-canary-20240825031043",
"files": [

@@ -6,0 +6,0 @@ "dist/**",

import type { Config } from '../createConfig.js'
import type { WaitForTaskCompletionParameters } from './waitForTaskCompletion.js'
import type { RelayerWebsocketMessage } from '../types/ws.js'
import { TASK_STATUS_ROUTE } from '../constants.js'

@@ -31,9 +30,10 @@ import { websocketWaiter } from '../utils/websocketWaiter.js'

const messageHandler = (message: RelayerWebsocketMessage) => {
if (message.topic === topic && message.event.type === 'TaskStatusUpdate') {
if (message.event.status?.state === 'Completed') {
const messageHandler = (message: any) => {
const parsedMessage = JSON.parse(message)
if (parsedMessage.topic === topic && parsedMessage.event.type === 'TaskStatusUpdate') {
if (parsedMessage.event.status?.state === 'Completed') {
return null
}
if (message.event.status?.state === 'Failed') {
if (parsedMessage.event.status?.state === 'Failed') {
throw new Error(`Task ${id} failed`)

@@ -40,0 +40,0 @@ }

@@ -248,3 +248,2 @@ ////////////////////////////////////////////////////////////////////////////////

export * from '../types/task.js'
export * from '../types/ws.js'

@@ -251,0 +250,0 @@ export {

@@ -7,3 +7,2 @@ import { getSkRoot } from '../actions/getSkRoot.js'

import type { Config } from '../createConfig.js'
import type { RelayerWebsocketMessage } from '../types/ws.js'

@@ -20,2 +19,5 @@ /**

* should return null.
*
* The message handler is also responsible for parsing the message, to give it control over e.g. how
* bigint values are parsed.
*

@@ -33,3 +35,3 @@ * Additionally, the method accepts an async `prefetch` function which can be used ahead of the websocket

topic: string,
messageHandler: (message: RelayerWebsocketMessage) => T | undefined,
messageHandler: (message: any) => T | undefined,
prefetch?: () => Promise<T | undefined>,

@@ -48,5 +50,4 @@ timeout?: number,

ws.onmessage = (event) => {
const message = JSON.parse(event.data)
try {
const result = messageHandler(message)
const result = messageHandler(event.data)
if (result !== undefined) {

@@ -53,0 +54,0 @@ promiseSettled = true

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

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