Socket
Socket
Sign inDemoInstall

@wormhole-foundation/sdk-connect

Package Overview
Dependencies
Maintainers
6
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wormhole-foundation/sdk-connect - npm Package Compare versions

Comparing version 0.6.6-beta.1 to 0.6.6

17

dist/cjs/config.d.ts

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

import type { Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainsConfig } from "@wormhole-foundation/sdk-definitions";
import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainConfig, ChainsConfig } from "@wormhole-foundation/sdk-definitions";
export declare const DEFAULT_TASK_TIMEOUT: number;

@@ -9,6 +9,2 @@ export type WormholeConfig<N extends Network = Network, P extends Platform = Platform> = {

};
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
};
export type ConfigOverrides<N extends Network> = RecursivePartial<WormholeConfig<N>>;
export declare const CONFIG: {

@@ -32,5 +28,12 @@ readonly Mainnet: {

export declare function networkPlatformConfigs<N extends Network, P extends Platform>(network: N, platform: P): ChainsConfig<N, P>;
export declare function applyOverrides<N extends Network>(network: N, overrides?: ConfigOverrides<N>): WormholeConfig;
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
};
export type WormholeConfigOverrides<N extends Network> = RecursivePartial<WormholeConfig<N>>;
export type ChainsConfigOverrides<N extends Network, P extends Platform> = RecursivePartial<ChainsConfig<N, P>>;
export type ChainConfigOverrides<N extends Network, C extends Chain> = RecursivePartial<ChainConfig<N, C>>;
export declare function applyWormholeConfigOverrides<N extends Network>(network: N, overrides?: WormholeConfigOverrides<N>): WormholeConfig;
export declare function applyChainsConfigConfigOverrides<N extends Network, P extends Platform>(network: N, platform: P, overrides?: ChainsConfigOverrides<N, P>): ChainsConfig<N, P>;
export declare const DEFAULT_NETWORK: Network;
export {};
//# sourceMappingURL=config.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_NETWORK = exports.applyOverrides = exports.networkPlatformConfigs = exports.CONFIG = exports.DEFAULT_TASK_TIMEOUT = void 0;
exports.DEFAULT_NETWORK = exports.applyChainsConfigConfigOverrides = exports.applyWormholeConfigOverrides = exports.networkPlatformConfigs = exports.CONFIG = exports.DEFAULT_TASK_TIMEOUT = void 0;
const sdk_base_1 = require("@wormhole-foundation/sdk-base");

@@ -31,25 +31,33 @@ const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");

// Apply any overrides to the base config
function applyOverrides(network, overrides) {
function applyWormholeConfigOverrides(network, overrides) {
let base = exports.CONFIG[network];
if (!overrides)
return base;
// recurse through the overrides and apply them to the base config
function override(base, overrides) {
if (!base)
base = {};
for (const [key, value] of Object.entries(overrides)) {
if (typeof value === "object" && !Array.isArray(value)) {
base[key] = override(base[key], value);
}
else {
base[key] = value;
}
}
return override(base, overrides);
}
exports.applyWormholeConfigOverrides = applyWormholeConfigOverrides;
// Apply any overrides to the base config
function applyChainsConfigConfigOverrides(network, platform, overrides) {
const base = networkPlatformConfigs(network, platform);
if (!overrides)
return base;
}
return override(base, overrides);
}
exports.applyOverrides = applyOverrides;
exports.applyChainsConfigConfigOverrides = applyChainsConfigConfigOverrides;
// recurse through the overrides and apply them to the base config
function override(base, overrides) {
if (!base)
base = {};
for (const [key, value] of Object.entries(overrides)) {
if (typeof value === "object" && !Array.isArray(value)) {
base[key] = override(base[key], value);
}
else {
base[key] = value;
}
}
return base;
}
const inNode = typeof process !== "undefined";
exports.DEFAULT_NETWORK = (inNode && process.env["NETWORK"]) || "Testnet";
//# sourceMappingURL=config.js.map
import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainAddress, ChainContext, Contracts, NativeAddress, PayloadDiscriminator, PayloadLiteral, PlatformContext, PlatformUtils, TokenAddress, TokenId, TxHash, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions";
import type { ConfigOverrides, WormholeConfig } from "./config.js";
import { WormholeConfig, WormholeConfigOverrides } from "./config.js";
import { CircleTransfer } from "./protocols/cctpTransfer.js";

@@ -16,3 +16,3 @@ import { TokenTransfer } from "./protocols/tokenTransfer.js";

readonly config: WormholeConfig<N>;
constructor(network: N, platforms: PlatformUtils<any>[], config?: ConfigOverrides<N>);
constructor(network: N, platforms: PlatformUtils<any>[], config?: WormholeConfigOverrides<N>);
get network(): N;

@@ -19,0 +19,0 @@ /**

@@ -8,2 +8,3 @@ "use strict";

const config_js_1 = require("./config.js");
const config_js_2 = require("./config.js");
const cctpTransfer_js_1 = require("./protocols/cctpTransfer.js");

@@ -21,3 +22,3 @@ const tokenTransfer_js_1 = require("./protocols/tokenTransfer.js");

this._network = network;
this.config = (0, config_js_1.applyOverrides)(network, config);
this.config = (0, config_js_1.applyWormholeConfigOverrides)(network, config);
this._chains = new Map();

@@ -201,3 +202,3 @@ this._platforms = new Map();

*/
async getVaaBytes(wormholeMessageId, timeout = config_js_1.DEFAULT_TASK_TIMEOUT) {
async getVaaBytes(wormholeMessageId, timeout = config_js_2.DEFAULT_TASK_TIMEOUT) {
return await (0, whscan_api_js_1.getVaaBytesWithRetry)(this.config.api, wormholeMessageId, timeout);

@@ -214,3 +215,3 @@ }

*/
async getVaa(id, decodeAs, timeout = config_js_1.DEFAULT_TASK_TIMEOUT) {
async getVaa(id, decodeAs, timeout = config_js_2.DEFAULT_TASK_TIMEOUT) {
if (typeof id === "string")

@@ -227,3 +228,3 @@ return await (0, whscan_api_js_1.getVaaByTxHashWithRetry)(this.config.api, id, decodeAs, timeout);

*/
async getCircleAttestation(msgHash, timeout = config_js_1.DEFAULT_TASK_TIMEOUT) {
async getCircleAttestation(msgHash, timeout = config_js_2.DEFAULT_TASK_TIMEOUT) {
return (0, circle_api_js_1.getCircleAttestationWithRetry)(this.config.circleAPI, msgHash, timeout);

@@ -237,3 +238,3 @@ }

*/
async getTransactionStatus(id, timeout = config_js_1.DEFAULT_TASK_TIMEOUT) {
async getTransactionStatus(id, timeout = config_js_2.DEFAULT_TASK_TIMEOUT) {
let msgid;

@@ -308,3 +309,3 @@ // No txid endpoint exists to get the status by txhash yet

*/
static async parseMessageFromTx(chain, txid, timeout = config_js_1.DEFAULT_TASK_TIMEOUT) {
static async parseMessageFromTx(chain, txid, timeout = config_js_2.DEFAULT_TASK_TIMEOUT) {
const task = async () => {

@@ -311,0 +312,0 @@ try {

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

import type { Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainsConfig } from "@wormhole-foundation/sdk-definitions";
import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainConfig, ChainsConfig } from "@wormhole-foundation/sdk-definitions";
export declare const DEFAULT_TASK_TIMEOUT: number;

@@ -9,6 +9,2 @@ export type WormholeConfig<N extends Network = Network, P extends Platform = Platform> = {

};
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
};
export type ConfigOverrides<N extends Network> = RecursivePartial<WormholeConfig<N>>;
export declare const CONFIG: {

@@ -32,5 +28,12 @@ readonly Mainnet: {

export declare function networkPlatformConfigs<N extends Network, P extends Platform>(network: N, platform: P): ChainsConfig<N, P>;
export declare function applyOverrides<N extends Network>(network: N, overrides?: ConfigOverrides<N>): WormholeConfig;
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
};
export type WormholeConfigOverrides<N extends Network> = RecursivePartial<WormholeConfig<N>>;
export type ChainsConfigOverrides<N extends Network, P extends Platform> = RecursivePartial<ChainsConfig<N, P>>;
export type ChainConfigOverrides<N extends Network, C extends Chain> = RecursivePartial<ChainConfig<N, C>>;
export declare function applyWormholeConfigOverrides<N extends Network>(network: N, overrides?: WormholeConfigOverrides<N>): WormholeConfig;
export declare function applyChainsConfigConfigOverrides<N extends Network, P extends Platform>(network: N, platform: P, overrides?: ChainsConfigOverrides<N, P>): ChainsConfig<N, P>;
export declare const DEFAULT_NETWORK: Network;
export {};
//# sourceMappingURL=config.d.ts.map

@@ -27,24 +27,31 @@ import { circle } from "@wormhole-foundation/sdk-base";

// Apply any overrides to the base config
export function applyOverrides(network, overrides) {
export function applyWormholeConfigOverrides(network, overrides) {
let base = CONFIG[network];
if (!overrides)
return base;
// recurse through the overrides and apply them to the base config
function override(base, overrides) {
if (!base)
base = {};
for (const [key, value] of Object.entries(overrides)) {
if (typeof value === "object" && !Array.isArray(value)) {
base[key] = override(base[key], value);
}
else {
base[key] = value;
}
}
return override(base, overrides);
}
// Apply any overrides to the base config
export function applyChainsConfigConfigOverrides(network, platform, overrides) {
const base = networkPlatformConfigs(network, platform);
if (!overrides)
return base;
}
return override(base, overrides);
}
// recurse through the overrides and apply them to the base config
function override(base, overrides) {
if (!base)
base = {};
for (const [key, value] of Object.entries(overrides)) {
if (typeof value === "object" && !Array.isArray(value)) {
base[key] = override(base[key], value);
}
else {
base[key] = value;
}
}
return base;
}
const inNode = typeof process !== "undefined";
export const DEFAULT_NETWORK = (inNode && process.env["NETWORK"]) || "Testnet";
//# sourceMappingURL=config.js.map
import type { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
import type { ChainAddress, ChainContext, Contracts, NativeAddress, PayloadDiscriminator, PayloadLiteral, PlatformContext, PlatformUtils, TokenAddress, TokenId, TxHash, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions";
import type { ConfigOverrides, WormholeConfig } from "./config.js";
import { WormholeConfig, WormholeConfigOverrides } from "./config.js";
import { CircleTransfer } from "./protocols/cctpTransfer.js";

@@ -16,3 +16,3 @@ import { TokenTransfer } from "./protocols/tokenTransfer.js";

readonly config: WormholeConfig<N>;
constructor(network: N, platforms: PlatformUtils<any>[], config?: ConfigOverrides<N>);
constructor(network: N, platforms: PlatformUtils<any>[], config?: WormholeConfigOverrides<N>);
get network(): N;

@@ -19,0 +19,0 @@ /**

import { chainToPlatform, circle } from "@wormhole-foundation/sdk-base";
import { canonicalAddress, isNative, nativeTokenId, toNative, } from "@wormhole-foundation/sdk-definitions";
import { getCircleAttestationWithRetry } from "./circle-api.js";
import { DEFAULT_TASK_TIMEOUT, applyOverrides } from "./config.js";
import { applyWormholeConfigOverrides } from "./config.js";
import { DEFAULT_TASK_TIMEOUT } from "./config.js";
import { CircleTransfer } from "./protocols/cctpTransfer.js";

@@ -17,3 +18,3 @@ import { TokenTransfer } from "./protocols/tokenTransfer.js";

this._network = network;
this.config = applyOverrides(network, config);
this.config = applyWormholeConfigOverrides(network, config);
this._chains = new Map();

@@ -20,0 +21,0 @@ this._platforms = new Map();

{
"name": "@wormhole-foundation/sdk-connect",
"version": "0.6.6-beta.1",
"version": "0.6.6",
"repository": {

@@ -78,6 +78,6 @@ "type": "git",

"axios": "^1.4.0",
"@wormhole-foundation/sdk-base": "0.6.6-beta.1",
"@wormhole-foundation/sdk-definitions": "0.6.6-beta.1"
"@wormhole-foundation/sdk-base": "0.6.6",
"@wormhole-foundation/sdk-definitions": "0.6.6"
},
"type": "module"
}

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