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

@wormhole-foundation/sdk-definitions

Package Overview
Dependencies
Maintainers
5
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.3.0-beta.16 to 0.3.0

dist/cjs/payloads/portico.d.ts

7

dist/cjs/chain.d.ts

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

import { Chain, Network, Platform, PlatformToChains, ProtocolName } from "@wormhole-foundation/sdk-base";
import { ProtocolName, Chain, Network, Platform, PlatformToChains, tokens } from "@wormhole-foundation/sdk-base";
import { ChainAddress, TokenAddress, UniversalOrNative } from "./address";

@@ -6,2 +6,3 @@ import { WormholeMessageId } from "./attestation";

import { AutomaticCircleBridge, CircleBridge } from "./protocols/circleBridge";
import { WormholeCore } from "./protocols/core";
import { IbcBridge } from "./protocols/ibc";

@@ -11,4 +12,3 @@ import { AutomaticTokenBridge, TokenBridge } from "./protocols/tokenBridge";

import { ChainConfig, SignedTx, TokenId } from "./types";
import { WormholeCore } from "./protocols/core";
export declare abstract class ChainContext<N extends Network, P extends Platform, C extends Chain = PlatformToChains<P>> {
export declare abstract class ChainContext<N extends Network, P extends Platform = Platform, C extends Chain = PlatformToChains<P>> {
readonly network: N;

@@ -33,2 +33,3 @@ readonly platform: PlatformContext<N, P>;

sendWait(stxns: SignedTx): Promise<string[]>;
getToken(symbol: tokens.TokenSymbol): tokens.Token | undefined;
getNativeWrappedTokenId(): Promise<TokenId<C>>;

@@ -35,0 +36,0 @@ getTokenAccount(address: UniversalOrNative<C>, token: UniversalOrNative<C>): Promise<ChainAddress<C>>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChainContext = void 0;
const sdk_base_1 = require("@wormhole-foundation/sdk-base");
const address_1 = require("./address");
const protocol_1 = require("./protocol");

@@ -31,2 +33,8 @@ class ChainContext {

async getDecimals(token) {
// try to find it in the token cache first
if (this.config.tokenMap) {
const found = sdk_base_1.tokens.getTokenByAddress(this.network, this.chain, token.toString());
if (found)
return BigInt(found.decimals);
}
return this.platform.utils().getDecimals(this.chain, this.getRpc(), token);

@@ -52,3 +60,16 @@ }

}
getToken(symbol) {
if (!this.config.tokenMap)
return;
if (!(symbol in this.config.tokenMap))
return;
return this.config.tokenMap[symbol];
}
async getNativeWrappedTokenId() {
// see if we have it configured
if (this.config.wrappedNative) {
const { address } = this.config.wrappedNative;
return { chain: this.chain, address: (0, address_1.toNative)(this.chain, address) };
}
// otherwise grab it from the token bridge fn
const tb = await this.getTokenBridge();

@@ -55,0 +76,0 @@ return { chain: this.chain, address: await tb.getWrappedNative() };

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

import { Chain, ChainToPlatform, Network, Platform, PlatformToChains, explorer } from "@wormhole-foundation/sdk-base";
import { Chain, ChainToPlatform, Network, Platform, PlatformToChains, explorer, tokens } from "@wormhole-foundation/sdk-base";
import { ChainAddress } from "./address";

@@ -28,2 +28,4 @@ import { Contracts } from "./contracts";

rpc: string;
tokenMap?: tokens.ChainTokens;
wrappedNative?: tokens.Token;
explorer?: explorer.ExplorerSettings;

@@ -30,0 +32,0 @@ };

@@ -25,2 +25,7 @@ "use strict";

catch { }
const tokenMap = sdk_base_1.tokens.getTokenMap(n, c);
const nativeToken = tokenMap
? Object.values(tokenMap).find((token) => token.address === "native" && token.wrapped)
: undefined;
const wrappedNative = nativeToken ? tokenMap[nativeToken.wrapped.symbol] : undefined;
return {

@@ -36,2 +41,4 @@ key: c,

nativeChainId,
tokenMap,
wrappedNative,
explorer: sdk_base_1.explorer.explorerConfigs(n, c),

@@ -38,0 +45,0 @@ rpc: sdk_base_1.rpc.rpcAddress(n, c),

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

import { Chain, Network, Platform, PlatformToChains, ProtocolName } from "@wormhole-foundation/sdk-base";
import { ProtocolName, Chain, Network, Platform, PlatformToChains, tokens } from "@wormhole-foundation/sdk-base";
import { ChainAddress, TokenAddress, UniversalOrNative } from "./address";

@@ -6,2 +6,3 @@ import { WormholeMessageId } from "./attestation";

import { AutomaticCircleBridge, CircleBridge } from "./protocols/circleBridge";
import { WormholeCore } from "./protocols/core";
import { IbcBridge } from "./protocols/ibc";

@@ -11,4 +12,3 @@ import { AutomaticTokenBridge, TokenBridge } from "./protocols/tokenBridge";

import { ChainConfig, SignedTx, TokenId } from "./types";
import { WormholeCore } from "./protocols/core";
export declare abstract class ChainContext<N extends Network, P extends Platform, C extends Chain = PlatformToChains<P>> {
export declare abstract class ChainContext<N extends Network, P extends Platform = Platform, C extends Chain = PlatformToChains<P>> {
readonly network: N;

@@ -33,2 +33,3 @@ readonly platform: PlatformContext<N, P>;

sendWait(stxns: SignedTx): Promise<string[]>;
getToken(symbol: tokens.TokenSymbol): tokens.Token | undefined;
getNativeWrappedTokenId(): Promise<TokenId<C>>;

@@ -35,0 +36,0 @@ getTokenAccount(address: UniversalOrNative<C>, token: UniversalOrNative<C>): Promise<ChainAddress<C>>;

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

import { tokens, } from "@wormhole-foundation/sdk-base";
import { toNative } from "./address";
import { protocolIsRegistered } from "./protocol";

@@ -28,2 +30,8 @@ export class ChainContext {

async getDecimals(token) {
// try to find it in the token cache first
if (this.config.tokenMap) {
const found = tokens.getTokenByAddress(this.network, this.chain, token.toString());
if (found)
return BigInt(found.decimals);
}
return this.platform.utils().getDecimals(this.chain, this.getRpc(), token);

@@ -49,3 +57,16 @@ }

}
getToken(symbol) {
if (!this.config.tokenMap)
return;
if (!(symbol in this.config.tokenMap))
return;
return this.config.tokenMap[symbol];
}
async getNativeWrappedTokenId() {
// see if we have it configured
if (this.config.wrappedNative) {
const { address } = this.config.wrappedNative;
return { chain: this.chain, address: toNative(this.chain, address) };
}
// otherwise grab it from the token bridge fn
const tb = await this.getTokenBridge();

@@ -52,0 +73,0 @@ return { chain: this.chain, address: await tb.getWrappedNative() };

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

import { Chain, ChainToPlatform, Network, Platform, PlatformToChains, explorer } from "@wormhole-foundation/sdk-base";
import { Chain, ChainToPlatform, Network, Platform, PlatformToChains, explorer, tokens } from "@wormhole-foundation/sdk-base";
import { ChainAddress } from "./address";

@@ -28,2 +28,4 @@ import { Contracts } from "./contracts";

rpc: string;
tokenMap?: tokens.ChainTokens;
wrappedNative?: tokens.Token;
explorer?: explorer.ExplorerSettings;

@@ -30,0 +32,0 @@ };

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

import { chainToPlatform, chains, decimals, explorer, finality, isChain, nativeChainIds, rpc, toChainId, } from "@wormhole-foundation/sdk-base";
import { chainToPlatform, chains, decimals, explorer, finality, isChain, nativeChainIds, rpc, toChainId, tokens, } from "@wormhole-foundation/sdk-base";
import { getContracts } from "./contracts";

@@ -20,2 +20,7 @@ export function isTokenId(thing) {

catch { }
const tokenMap = tokens.getTokenMap(n, c);
const nativeToken = tokenMap
? Object.values(tokenMap).find((token) => token.address === "native" && token.wrapped)
: undefined;
const wrappedNative = nativeToken ? tokenMap[nativeToken.wrapped.symbol] : undefined;
return {

@@ -31,2 +36,4 @@ key: c,

nativeChainId,
tokenMap,
wrappedNative,
explorer: explorer.explorerConfigs(n, c),

@@ -33,0 +40,0 @@ rpc: rpc.rpcAddress(n, c),

{
"name": "@wormhole-foundation/sdk-definitions",
"version": "0.3.0-beta.16",
"version": "0.3.0",
"repository": {

@@ -33,4 +33,4 @@ "type": "git",

"@noble/hashes": "^1.3.1",
"@wormhole-foundation/sdk-base": "^0.3.0-beta.16"
"@wormhole-foundation/sdk-base": "^0.3.0"
}
}

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

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